@ -28,17 +28,17 @@
# include "mtip.h"
# include "systemconfig.h"
# include < qcheckbox.h>
# include < qfile.h>
# include < qhbox.h>
# include < qhbuttongroup.h>
# include < qheader.h>
# include < qlabel.h>
# include < qlayout.h>
# include < qradiobutton.h>
# include < qtooltip.h>
# include < qvgroupbox.h>
# include < qwhatsthis.h>
# include < nt qcheckbox.h>
# include < nt qfile.h>
# include < nt qhbox.h>
# include < nt qhbuttongroup.h>
# include < nt qheader.h>
# include < nt qlabel.h>
# include < nt qlayout.h>
# include < nt qradiobutton.h>
# include < nt qtooltip.h>
# include < nt qvgroupbox.h>
# include < nt qwhatsthis.h>
# include <kconfigdialogmanager.h>
# include <kiconloader.h>
@ -58,7 +58,7 @@ MSettingsDialog *MSettingsDialog::_instance = 0;
// public
MSettingsDialog : : MSettingsDialog ( QWidget * parent )
MSettingsDialog : : MSettingsDialog ( T QWidget * parent )
: KDialogBase (
IconList ,
i18n ( " Settings " ) ,
@ -85,7 +85,7 @@ MSettingsDialog::MSettingsDialog(QWidget *parent)
connect ( this , SIGNAL ( okClicked ( ) ) , SLOT ( slotOKClicked ( ) ) ) ;
// lock after login
c_autoLock - > setChecked ( QFile: : exists ( KGlobalSettings : : autostartPath ( ) + " /kshutdown-autolock.desktop " ) ) ;
c_autoLock - > setChecked ( T QFile: : exists ( KGlobalSettings : : autostartPath ( ) + " /kshutdown-autolock.desktop " ) ) ;
setInitialSize ( configDialogSize ( " Settings Dialog " ) ) ;
showPage ( _lastPage ) ; // restore last page
@ -100,13 +100,13 @@ MSettingsDialog::~MSettingsDialog()
// private
QFrame * MSettingsDialog : : addPage ( const QString & itemName , const QString & iconName )
T QFrame * MSettingsDialog : : addPage ( const T QString & itemName , const T QString & iconName )
{
return KDialogBase : : addPage ( itemName , QString: : null , MainBarIcon ( iconName , 32 ) ) ;
return KDialogBase : : addPage ( itemName , T QString: : null , MainBarIcon ( iconName , 32 ) ) ;
}
bool MSettingsDialog : : disabledByAdmin ( const QString & key , QFrame * page ,
QBoxLayout * pageLayout ) const
bool MSettingsDialog : : disabledByAdmin ( const T QString & key , T QFrame * page ,
T QBoxLayout * pageLayout ) const
{
if ( MiscUtils : : isRestricted ( " settings_ " + key ) )
{
@ -127,12 +127,12 @@ bool MSettingsDialog::disabledByAdmin(const QString &key, QFrame *page,
void MSettingsDialog : : initActionsPage ( )
{
_actionsPage = addPage ( i18n ( " Actions " ) , " kshutdown " ) ;
QVBoxLayout * l = new QVBoxLayout( _actionsPage , 5 ) ;
T QVBoxLayout * l = new T QVBoxLayout( _actionsPage , 5 ) ;
if ( disabledByAdmin ( " actions " , _actionsPage , l ) )
return ;
QVGroupBox * gb_general = new QVGroupBox( i18n ( " Actions " ) , _actionsPage ) ;
T QVGroupBox * gb_general = new T QVGroupBox( i18n ( " Actions " ) , _actionsPage ) ;
_actions = new KListView ( gb_general , " KListView::_actions " ) ;
_actions - > setAllColumnsShowFocus ( true ) ;
@ -156,8 +156,8 @@ void MSettingsDialog::initActionsPage()
_shutDownItem = new KListViewItem ( _actions , ks_actions - > getName ( Action : : ShutDown ) ) ;
_shutDownItem - > setPixmap ( 0 , ks_actions - > getIcon ( Action : : ShutDown ) ) ;
connect ( _actions , SIGNAL ( doubleClicked ( QListViewItem * , const QPoint & , int ) ) , SLOT ( slotEditAction ( ) ) ) ;
connect ( _actions , SIGNAL ( spacePressed ( QListViewItem * ) ) , SLOT ( slotEditAction ( ) ) ) ;
connect ( _actions , SIGNAL ( doubleClicked ( T QListViewItem * , const T QPoint & , int ) ) , SLOT ( slotEditAction ( ) ) ) ;
connect ( _actions , SIGNAL ( spacePressed ( T QListViewItem * ) ) , SLOT ( slotEditAction ( ) ) ) ;
// edit action
KPushButton * b_editAction = new KPushButton ( SmallIcon ( " edit " ) , i18n ( " Edit... " ) , gb_general , " KPushButton::b_editAction " ) ;
connect ( b_editAction , SIGNAL ( clicked ( ) ) , SLOT ( slotEditAction ( ) ) ) ;
@ -165,7 +165,7 @@ void MSettingsDialog::initActionsPage()
KPushButton * b_checkSystemConfig = new KPushButton ( SmallIcon ( " button_ok " ) , i18n ( " Check System Configuration " ) , gb_general , " KPushButton::b_checkSystemConfig " ) ;
connect ( b_checkSystemConfig , SIGNAL ( clicked ( ) ) , SLOT ( slotCheckSystemConfig ( ) ) ) ;
QVGroupBox * gb_extras = new QVGroupBox( i18n ( " Extras Menu " ) , _actionsPage ) ;
T QVGroupBox * gb_extras = new T QVGroupBox( i18n ( " Extras Menu " ) , _actionsPage ) ;
KPushButton * b_modifyExtras = new KPushButton ( SmallIcon ( " edit " ) , i18n ( " Modify... " ) , gb_extras , " KPushButton::b_modifyExtras " ) ;
if ( ! ks_actions - > isEnabled ( Action : : Extras ) )
gb_extras - > hide ( ) ;
@ -184,18 +184,18 @@ void MSettingsDialog::initActionsPage()
void MSettingsDialog : : initAdvancedPage ( )
{
_advancedPage = addPage ( i18n ( " Advanced " ) , " misc " ) ;
QVBoxLayout * l = new QVBoxLayout( _advancedPage , 5 ) ;
T QVBoxLayout * l = new T QVBoxLayout( _advancedPage , 5 ) ;
// after login
QVGroupBox * gb_afterLogin = new QVGroupBox( i18n ( " After Login " ) , _advancedPage ) ;
c_autoLock = new QCheckBox( i18n ( " Lock screen " ) , gb_afterLogin ) ;
T QVGroupBox * gb_afterLogin = new T QVGroupBox( i18n ( " After Login " ) , _advancedPage ) ;
c_autoLock = new T QCheckBox( i18n ( " Lock screen " ) , gb_afterLogin ) ;
connect ( c_autoLock , SIGNAL ( clicked ( ) ) , SLOT ( slotConfigChanged ( ) ) ) ;
// cd tray close
QVGroupBox * gb_cdTrayClose = new QVGroupBox( i18n ( " Before Logout " ) , _advancedPage ) ;
QCheckBox * c_cdTrayClose = new QCheckBox( i18n ( " Close CD-ROM Tray " ) , gb_cdTrayClose , " kcfg_cd_tray_close " ) ;
QHBox * cdTrayCloseBox = new QHBox( gb_cdTrayClose ) ;
QLabel * l_cdTrayCloseCommand = new QLabel( i18n ( " Command: " ) , cdTrayCloseBox ) ;
T QVGroupBox * gb_cdTrayClose = new T QVGroupBox( i18n ( " Before Logout " ) , _advancedPage ) ;
T QCheckBox * c_cdTrayClose = new T QCheckBox( i18n ( " Close CD-ROM Tray " ) , gb_cdTrayClose , " kcfg_cd_tray_close " ) ;
T QHBox * cdTrayCloseBox = new T QHBox( gb_cdTrayClose ) ;
T QLabel * l_cdTrayCloseCommand = new T QLabel( i18n ( " Command: " ) , cdTrayCloseBox ) ;
// FIXME: 2.0: disable "in_cdTrayCloseCommand" if "c_cdTrayClose" is not checked
// TODO: 2.0: "Test" button
KLineEdit * in_cdTrayCloseCommand = new KLineEdit ( cdTrayCloseBox , " kcfg_cd_tray_close_command " ) ;
@ -217,10 +217,10 @@ void MSettingsDialog::initAdvancedPage()
void MSettingsDialog : : initGeneralPage ( )
{
_generalPage = addPage ( i18n ( " General " ) , " misc " ) ;
QVBoxLayout * l = new QVBoxLayout( _generalPage , 5 ) ;
T QVBoxLayout * l = new T QVBoxLayout( _generalPage , 5 ) ;
// problems
QVGroupBox * gb_problems = new QVGroupBox( i18n ( " Common Problems " ) , _generalPage ) ;
T QVGroupBox * gb_problems = new T QVGroupBox( i18n ( " Common Problems " ) , _generalPage ) ;
KURLLabel * ul_shutDownProblem = new KURLLabel ( gb_problems ) ;
ul_shutDownProblem - > setText ( i18n ( " \" Turn Off Computer \" does not work " ) ) ;
@ -231,17 +231,17 @@ void MSettingsDialog::initGeneralPage()
connect ( ul_trayMessageProblem , SIGNAL ( leftClickedURL ( ) ) , SLOT ( slotTrayMessageProblem ( ) ) ) ;
// links
QVGroupBox * gb_links = new QVGroupBox( i18n ( " Add/Remove Links " ) , _generalPage ) ;
T QVGroupBox * gb_links = new T QVGroupBox( i18n ( " Add/Remove Links " ) , _generalPage ) ;
new Links ( gb_links ) ;
// system tray
gb_systemTray = new QHButtonGroup( i18n ( " Show System Tray Icon " ) , _generalPage , " kcfg_system_tray " ) ;
QRadioButton * rb_systemTray ;
rb_systemTray = new QRadioButton( i18n ( " Always " ) , gb_systemTray ) ;
gb_systemTray = new T QHButtonGroup( i18n ( " Show System Tray Icon " ) , _generalPage , " kcfg_system_tray " ) ;
T QRadioButton * rb_systemTray ;
rb_systemTray = new T QRadioButton( i18n ( " Always " ) , gb_systemTray ) ;
MiscUtils : : setHint ( rb_systemTray , i18n ( " Tray icon will be always visible. " ) ) ;
rb_systemTray = new QRadioButton( i18n ( " If Active " ) , gb_systemTray ) ;
rb_systemTray = new T QRadioButton( i18n ( " If Active " ) , gb_systemTray ) ;
MiscUtils : : setHint ( rb_systemTray , i18n ( " Tray icon will be visible only if KShutDown is active. " ) ) ;
rb_systemTray = new QRadioButton( i18n ( " Never " ) , gb_systemTray ) ;
rb_systemTray = new T QRadioButton( i18n ( " Never " ) , gb_systemTray ) ;
MiscUtils : : setHint ( rb_systemTray , i18n ( " Tray icon will be always hidden. " ) ) ;
l - > addWidget ( gb_problems ) ;
@ -249,7 +249,7 @@ void MSettingsDialog::initGeneralPage()
l - > addWidget ( gb_systemTray ) ;
// karamba info
QString karambaThemes = locate ( " appdata " , " karamba/kshutdown-48x48.png " ) ;
T QString karambaThemes = locate ( " appdata " , " karamba/kshutdown-48x48.png " ) ;
if ( ! karambaThemes . isNull ( ) )
{
int i = karambaThemes . findRev ( " / " ) ;
@ -258,12 +258,12 @@ void MSettingsDialog::initGeneralPage()
MTip * t_karamba = new MTip ( MTip : : Info , _generalPage ) ;
/* TODO: 2.0: superkaramba integration
t_karamba - > disconnect (
t_karamba , SIGNAL ( linkClicked ( const QString & ) ) ,
t_karamba , SLOT ( openLink ( const QString & ) )
t_karamba , SIGNAL ( linkClicked ( const T QString & ) ) ,
t_karamba , SLOT ( openLink ( const T QString & ) )
) ;
t_karamba - > connect (
t_karamba , SIGNAL ( linkClicked ( const QString & ) ) ,
this , SLOT ( slotOpenKarambaLink ( const QString & ) )
t_karamba , SIGNAL ( linkClicked ( const T QString & ) ) ,
this , SLOT ( slotOpenKarambaLink ( const T QString & ) )
) ;
*/
karambaThemes = karambaThemes . left ( i ) ;
@ -283,16 +283,16 @@ void MSettingsDialog::initGeneralPage()
void MSettingsDialog : : initMessagesPage ( )
{
_messagesPage = addPage ( i18n ( " Messages " ) , " messagebox_warning " ) ;
QVBoxLayout * l = new QVBoxLayout( _messagesPage , 5 ) ;
T QVBoxLayout * l = new T QVBoxLayout( _messagesPage , 5 ) ;
KTabWidget * t_messages = new KTabWidget ( _messagesPage ) ;
t_messages - > setFocusPolicy ( StrongFocus ) ;
// warning message:
QWidget * w_warning = new QWidget( _messagesPage ) ;
QVBoxLayout * l_warning = new QVBoxLayout( w_warning , 5 ) ;
T QWidget * w_warning = new T QWidget( _messagesPage ) ;
T QVBoxLayout * l_warning = new T QVBoxLayout( w_warning , 5 ) ;
// enabled/info
QCheckBox * c_warningMessageEnabled = new QCheckBox( i18n ( " Display a warning message before action " ) , w_warning , " kcfg_warning_message_enabled " ) ;
T QCheckBox * c_warningMessageEnabled = new T QCheckBox( i18n ( " Display a warning message before action " ) , w_warning , " kcfg_warning_message_enabled " ) ;
// slider
in_warningMessageDelay = new KIntNumInput ( w_warning , " kcfg_warning_message_delay " ) ;
in_warningMessageDelay - > setSuffix ( " " + i18n ( " minute(s) " ) ) ;
@ -300,8 +300,8 @@ void MSettingsDialog::initMessagesPage()
KPushButton * b_warningMessageTest = new KPushButton ( KStdGuiItem : : test ( ) , w_warning , " KPushButton::b_warningMessageTest " ) ;
connect ( b_warningMessageTest , SIGNAL ( clicked ( ) ) , SLOT ( slotWarningMessageTest ( ) ) ) ;
QLabel * l_warningText = new QLabel( i18n ( " Recommended " ) , w_warning ) ;
l_warningText - > setFont ( QFont( l_warningText - > font ( ) . family ( ) , l_warningText - > font ( ) . pointSize ( ) , QFont: : Bold ) ) ;
T QLabel * l_warningText = new T QLabel( i18n ( " Recommended " ) , w_warning ) ;
l_warningText - > setFont ( T QFont( l_warningText - > font ( ) . family ( ) , l_warningText - > font ( ) . pointSize ( ) , T QFont: : Bold ) ) ;
l_warning - > addWidget ( l_warningText ) ;
l_warning - > addWidget ( c_warningMessageEnabled ) ;
@ -312,10 +312,10 @@ void MSettingsDialog::initMessagesPage()
t_messages - > addTab ( w_warning , i18n ( " Warning Message " ) ) ;
// custom message:
QWidget * w_customMessage = new QWidget( _messagesPage ) ;
QVBoxLayout * l_customMessage = new QVBoxLayout( w_customMessage , 5 ) ;
QCheckBox * c_customMessageEnabled = new QCheckBox( i18n ( " Enabled " ) , w_customMessage , " kcfg_custom_message_enabled " ) ;
QLabel * l_customMessageCommand = new QLabel( i18n ( " A shell command to execute: " ) , w_customMessage ) ;
T QWidget * w_customMessage = new T QWidget( _messagesPage ) ;
T QVBoxLayout * l_customMessage = new T QVBoxLayout( w_customMessage , 5 ) ;
T QCheckBox * c_customMessageEnabled = new T QCheckBox( i18n ( " Enabled " ) , w_customMessage , " kcfg_custom_message_enabled " ) ;
T QLabel * l_customMessageCommand = new T QLabel( i18n ( " A shell command to execute: " ) , w_customMessage ) ;
in_customMessageCommand = new KLineEdit ( w_customMessage , " kcfg_custom_message_command " ) ;
MiscUtils : : setHint (
in_customMessageCommand ,
@ -347,8 +347,8 @@ void MSettingsDialog::initMessagesPage()
t_messages - > addTab ( w_customMessage , i18n ( " Custom Message " ) ) ;
// progress bar
QVGroupBox * w_progressBar = new QVGroupBox( i18n ( " Progress Bar " ) , _messagesPage ) ;
new QCheckBox( i18n ( " Enabled " ) , w_progressBar , " kcfg_progress_bar_enabled " ) ;
T QVGroupBox * w_progressBar = new T QVGroupBox( i18n ( " Progress Bar " ) , _messagesPage ) ;
new T QCheckBox( i18n ( " Enabled " ) , w_progressBar , " kcfg_progress_bar_enabled " ) ;
// re-enable messages
b_enableAllMessages = new KPushButton ( i18n ( " Re-enable All Message Boxes " ) , _messagesPage , " KPushButton::b_enableAllMessages " ) ;
@ -420,7 +420,7 @@ void MSettingsDialog::updateItem(KListViewItem *item)
return ;
Action : : Method method = Action : : Method_KDE ;
QString
T QString
command ,
group = ks_actions - > actionToConfigGroup ( action ) ;
@ -439,12 +439,12 @@ void MSettingsDialog::updateItem(KListViewItem *item)
conf - > setGroup ( group ) ;
if ( conf - > readBoolEntry ( " RunCommandBeforeAction " , false ) )
{
QString cmd = conf - > readEntry ( " CommandBeforeAction " , " " ) ;
T QString cmd = conf - > readEntry ( " CommandBeforeAction " , " " ) ;
int pause = conf - > readNumEntry ( " CommandBeforeActionPause " , 10 ) ;
if ( pause = = 0 )
cmd + = " [ " + i18n ( " No pause " ) + " ] " ;
else
cmd + = " [ " + i18n ( " Pause: %1 " ) . arg ( QString: : number ( pause ) + " s " ) + " ] " ;
cmd + = " [ " + i18n ( " Pause: %1 " ) . arg ( T QString: : number ( pause ) + " s " ) + " ] " ;
item - > setText ( 2 , cmd ) ;
}
else
@ -479,7 +479,7 @@ void MSettingsDialog::slotEditAction()
return ;
MActionEditDialog * dialog = new MActionEditDialog ( this , itemToActionType ( item ) ) ;
if ( dialog - > exec ( ) = = QDialog: : Accepted )
if ( dialog - > exec ( ) = = T QDialog: : Accepted )
{
updateItem ( item ) ;
slotConfigChanged ( ) ;