@ -85,12 +85,12 @@ Klamav::Klamav()
scanner_menu - > insertItem ( i18n ( " &Schedule scan... " ) , this , SLOT ( slotScheduleScan ( ) ) ) ;
scanner_menu - > insertItem ( i18n ( " &Options... " ) , this , SLOT ( slotOptions ( ) ) ) ;
TDEPopupMenu * tabs_menu = new TDEPopupMenu ( this ) ;
tabs_menu = new TDEPopupMenu ( this ) ;
tabs_menu - > setCheckable ( true ) ;
tabs_menu- > insertItem ( i18n ( " Show &Welcome tab " ) , this , SLOT ( slotToggleWelcome ( ) ) ) ;
tabs_menu- > insertItem ( i18n ( " Show &Quarantine tab " ) , this , SLOT ( slotToggle Welcom e( ) ) ) ;
tabs_menu- > insertItem ( i18n ( " Show &Virus Browser tab " ) , this , SLOT ( slotToggleDBViewer ( ) ) ) ;
tabs_menu- > insertItem ( i18n ( " Show &Events tab " ) , this , SLOT ( slotToggleEvents ( ) ) ) ;
showWelcomeTab = tabs_menu- > insertItem ( i18n ( " Show &Welcome tab " ) , this , SLOT ( slotToggleWelcome ( ) ) ) ;
showQuarantineTab = tabs_menu- > insertItem ( i18n ( " Show &Quarantine tab " ) , this , SLOT ( slotToggle Quarantin e( ) ) ) ;
showDBViewerTab = tabs_menu- > insertItem ( i18n ( " Show &Virus Browser tab " ) , this , SLOT ( slotToggleDBViewer ( ) ) ) ;
showEventsTab = tabs_menu- > insertItem ( i18n ( " Show &Events tab " ) , this , SLOT ( slotToggleEvents ( ) ) ) ;
// Menu bar
@ -104,7 +104,7 @@ Klamav::Klamav()
activityviewer = new Activityviewer ( this ) ;
aboutklamav = new Aboutklamav ( this ) ;
tab- > addTab ( aboutklamav , i18n ( " Welcome " ) ) ;
updateTabState( 0 , true ) ; // Welcome tab
klamscan = new Klamscan ( this ) ;
tab - > addTab ( klamscan , i18n ( " &Scan " ) ) ;
@ -120,14 +120,12 @@ Klamav::Klamav()
kuarantine = new Kuarantine ( this ) ;
tab- > addTab ( kuarantine , i18n ( " &Quarantine " ) ) ;
updateTabState( 1 , true ) ; // Quarantine tab
klamdb = new KlamDB ( this ) ;
tab - > addTab ( klamdb , i18n ( " Virus Browser " ) ) ;
tab - > addTab ( activityviewer , i18n ( " Events " ) ) ;
updateTabState ( 2 , true ) ; // Virus Browser tab
updateTabState ( 3 , true ) ; // Events tab
top - > addWidget ( tab ) ;
@ -189,6 +187,62 @@ void Klamav::clamdStopped() {
_tray - > setPixmap ( KSystemTray : : loadIcon ( " klamav_on_acc_disabled " ) ) ;
}
void Klamav : : updateTabState ( int tabId , bool init ) {
if ( config - > group ( ) ! = " Tabs " )
config - > setGroup ( " Tabs " ) ;
TQString optionName , tabName ;
TQWidget * tabWidget ;
int itemId ;
switch ( tabId ) {
case 0 : // Welcome tab
optionName = " ShowWelcomeTab " ;
tabName = " Welcome " ;
tabWidget = aboutklamav ;
itemId = showWelcomeTab ;
break ;
case 1 : // Quarantine tab
optionName = " ShowQuarantineTab " ;
tabName = " Quarantine " ;
tabWidget = kuarantine ;
itemId = showQuarantineTab ;
break ;
case 2 : // DBViewer tab
optionName = " ShowDBViewerTab " ;
tabName = " Virus Browser " ;
tabWidget = klamdb ;
itemId = showDBViewerTab ;
break ;
case 3 : // Events tab
optionName = " ShowEventsTab " ;
tabName = " Events " ;
tabWidget = activityviewer ;
itemId = showEventsTab ;
break ;
}
if ( config - > readBoolEntry ( optionName , true ) ) {
tab - > insertTab ( tabWidget , i18n ( tabName ) ) ;
tabWidget - > show ( ) ;
if ( ! init ) tab - > setCurrentPage ( tab - > indexOf ( tabWidget ) ) ;
} else {
if ( tab - > currentPageIndex ( ) = = tabId )
tab - > setCurrentPage ( 0 ) ;
if ( tab - > indexOf ( tabWidget ) ! = - 1 ) {
tab - > removePage ( tabWidget ) ;
}
tabWidget - > hide ( ) ;
}
tabs_menu - > setItemChecked ( itemId , config - > readBoolEntry ( optionName , true ) ) ;
}
// Menu slots
void Klamav : : slotScanFile ( ) { }
void Klamav : : slotScanDir ( ) { }
@ -197,10 +251,34 @@ void Klamav::slotOptions() {
slotConfigKlamav ( " Archive Limits " ) ;
}
void Klamav : : slotToggleWelcome ( ) { }
void Klamav : : slotToggleQuarantine ( ) { }
void Klamav : : slotToggleDBViewer ( ) { }
void Klamav : : slotToggleEvents ( ) { }
void Klamav : : slotToggleWelcome ( ) {
bool newState = ! config - > readBoolEntry ( " ShowWelcomeTab " , true ) ;
config - > writeEntry ( " ShowWelcomeTab " , newState ) ;
config - > sync ( ) ;
updateTabState ( 0 , false ) ;
}
void Klamav : : slotToggleQuarantine ( ) {
bool newState = ! config - > readBoolEntry ( " ShowQuarantineTab " , true ) ;
config - > writeEntry ( " ShowQuarantineTab " , newState ) ;
config - > sync ( ) ;
updateTabState ( 1 , false ) ;
}
void Klamav : : slotToggleDBViewer ( ) {
bool newState = ! config - > readBoolEntry ( " ShowDBViewerTab " , true ) ;
config - > writeEntry ( " ShowDBViewerTab " , newState ) ;
config - > sync ( ) ;
updateTabState ( 2 , false ) ;
}
void Klamav : : slotToggleEvents ( ) {
bool newState = ! config - > readBoolEntry ( " ShowEventsTab " , true ) ;
config - > writeEntry ( " ShowEventsTab " , newState ) ;
config - > sync ( ) ;
updateTabState ( 3 , false ) ;
}
void Klamav : : contextUpdateFK ( ) {