Reworked First-Run Wizard.

It was made more compact because it doesn't make sense to have a
full-blown two-page wizard for setting up two paths and showing a
checkbox.

Signed-off-by: Mavridis Philippe <mavridisf@gmail.com>
pull/24/head
Mavridis Philippe 4 years ago
parent 3a5d06908c
commit cbf067eac1
No known key found for this signature in database
GPG Key ID: F8D2D7E2F989A494

File diff suppressed because one or more lines are too long

@ -28,9 +28,10 @@ void
FirstRunWizard::init() FirstRunWizard::init()
{ {
//aesthetics // remove unwanted buttons
cancelButton()->setFixedSize( cancelButton()->sizeHint() ); cancelButton()->hide();
helpButton()->hide(); helpButton()->hide();
backButton()->hide();
TQString homepath = getenv("HOME"); TQString homepath = getenv("HOME");
databasepath = homepath + "/.klamav/database"; databasepath = homepath + "/.klamav/database";
@ -39,29 +40,10 @@ FirstRunWizard::init()
quarantinepath = homepath + "/.klamav/quarantine"; quarantinepath = homepath + "/.klamav/quarantine";
QuarantineLocation->setURL(quarantinepath); QuarantineLocation->setURL(quarantinepath);
preview->setPixmap( TQPixmap(locate("data", "klamav/about/klam.png")) ); setFinishEnabled ( WizardPage, true );
// picture1->setPixmap( getJPG( "amarok_rocks" ) );
// picture4->setPixmap( *picture1->pixmap() );
setFinishEnabled ( WizardPage_1, true );
} }
void
FirstRunWizard::showPage( TQWidget *w ) //virtual
{
TQWizard::showPage( w );
cancelButton()->setText( w == WizardPage ? i18n("&Skip") : i18n("&Cancel") );
}
// void // void
// FirstRunWizard::destroy() // FirstRunWizard::destroy()
// { // {

@ -346,51 +346,50 @@ void Klamav::firstRunWizard() {
TQString homepath = getenv("HOME"); TQString homepath = getenv("HOME");
TQString defaultdb = homepath + "/.klamav/database"; TQString defaultdb = homepath + "/.klamav/database";
TQString defaultquar = homepath + "/.klamav/quarantine"; TQString defaultquar = homepath + "/.klamav/quarantine";
if( wizard.exec() != TQDialog::Rejected ){
TDEConfig* config = TDEGlobal::config();
config->setGroup("Freshklam");
TQString wizardDBPath = wizard.databasePath().path(-1);
TQString wizardTQRPath = wizard.quarantinePath().path(-1);
/* kdDebug() << wizard.databasePath() << endl;
kdDebug() << wizard.defaultDatabasePath() << endl;*/
//Configure Database Path
TQStringList lastDownloadPaths;
if ((wizardDBPath != "") && (TQDir::cleanDirPath(wizardDBPath) != defaultdb)){
lastDownloadPaths.prepend( TQString("%1").arg(wizardDBPath));
checkDir(wizardDBPath);
}else{
lastDownloadPaths.prepend( TQString("%1").arg(wizard.defaultDatabasePath()));
createDefaultKlamAVDir("database");
}
config->writeEntry("lastDownloadPaths", lastDownloadPaths);
config->sync();
//Configure Quarantine Path
TQStringList lastQuarLocations;
config->setGroup("Kuarantine");
/* kdDebug() << wizard.quarantinePath() << endl;
kdDebug() << wizard.defaultQuarantinePath() << endl;
kdDebug() << defaultquar << endl;*/
if ((wizardTQRPath != "") && (TQDir::cleanDirPath(wizardTQRPath) != defaultquar)){
lastQuarLocations.prepend( TQString("%1").arg(wizardTQRPath));
checkDir(wizardTQRPath);
}else{
lastQuarLocations.prepend( TQString("%1").arg(wizard.defaultQuarantinePath()));
createDefaultKlamAVDir("quarantine");
}
config->writeEntry("KuarantineLocations", lastQuarLocations);
config->sync();
if (wizard.downloadDatabase()){
kdDebug() << "downloading database" << endl;
downloadDBForWizard = true;
}
// Execute wizard
wizard.exec();
// These are run after the wizard is finished
TDEConfig* config = TDEGlobal::config();
config->setGroup("Freshklam");
TQString wizardDBPath = wizard.databasePath().path(-1);
TQString wizardTQRPath = wizard.quarantinePath().path(-1);
//Configure Database Path
TQStringList lastDownloadPaths;
if ((wizardDBPath != "") && (TQDir::cleanDirPath(wizardDBPath) != defaultdb)){
lastDownloadPaths.prepend( TQString("%1").arg(wizardDBPath));
checkDir(wizardDBPath);
}else{
lastDownloadPaths.prepend( TQString("%1").arg(wizard.defaultDatabasePath()));
createDefaultKlamAVDir("database");
}
config->writeEntry("lastDownloadPaths", lastDownloadPaths);
config->sync();
//Configure Quarantine Path
TQStringList lastQuarLocations;
config->setGroup("Kuarantine");
if ((wizardTQRPath != "") && (TQDir::cleanDirPath(wizardTQRPath) != defaultquar)){
lastQuarLocations.prepend( TQString("%1").arg(wizardTQRPath));
checkDir(wizardTQRPath);
}else{
lastQuarLocations.prepend( TQString("%1").arg(wizard.defaultQuarantinePath()));
createDefaultKlamAVDir("quarantine");
} }
config->writeEntry("KuarantineLocations", lastQuarLocations);
config->sync();
if (wizard.downloadDatabase()){
kdDebug() << "downloading database" << endl;
downloadDBForWizard = true;
}
} }

Loading…
Cancel
Save