00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #include "configdisplay.h"
00019
00020 K_PLUGIN_FACTORY( ConfigDisplayFactory, registerPlugin<ConfigDisplay>(); )
00021 K_EXPORT_PLUGIN( ConfigDisplayFactory( "kcm_kshowmailconfigdisplay" ) )
00022
00023 ConfigDisplay::ConfigDisplay( QWidget * parent, const QVariantList & args )
00024 : KCModule( ConfigDisplayFactory::componentData(), parent, args )
00025 {
00026
00027
00028
00029
00030 QVBoxLayout* layMain = new QVBoxLayout( this );
00031
00032
00033 QGroupBox* gboxAccountlist = new QGroupBox( i18nc( "@title:group appearance options of the account view", "Account list" ), this );
00034 layMain->addWidget( gboxAccountlist );
00035 QGroupBox* gboxMessagelist = new QGroupBox( i18nc( "@title:group appearance options of the mail view", "Mail list" ), this );
00036 layMain->addWidget( gboxMessagelist );
00037 QGroupBox* gboxMessageContent = new QGroupBox( i18nc( "@title:group appearance options of the mail content view", "Mail content" ), this );
00038 layMain->addWidget( gboxMessageContent );
00039
00040
00041 QGridLayout* layAccountlist = new QGridLayout();
00042 QGridLayout* layMessagelist = new QGridLayout();
00043 QGridLayout* layMessageContent = new QGridLayout();
00044 gboxAccountlist->setLayout( layAccountlist );
00045 gboxMessagelist->setLayout( layMessagelist );
00046 gboxMessageContent->setLayout( layMessageContent );
00047
00048
00049 chkAccountlistActive = new QCheckBox( i18nc( "@option:check show column 'active' in the account view", "Active" ), gboxAccountlist );
00050 chkAccountlistActive->setToolTip( i18nc( "@info:tooltip", "To switch on/off the 'Active' column in the account list" ) );
00051 layAccountlist->addWidget( chkAccountlistActive, 0, 0 );
00052
00053 chkAccountlistAccount = new QCheckBox( i18nc( "@option:check show account column in the account view", "Account" ), gboxAccountlist );
00054 chkAccountlistAccount->setToolTip( i18nc( "@info:tooltip", "To switch on/off the 'Account' column in the account list" ) );
00055 layAccountlist->addWidget( chkAccountlistAccount, 0, 1 );
00056
00057 chkAccountlistServer = new QCheckBox( i18nc( "@option:check show server column in the account view", "Server" ), gboxAccountlist );
00058 chkAccountlistServer->setToolTip( i18nc( "@info:tooltip", "To switch on/off the 'Server' column in the account list" ) );
00059 layAccountlist->addWidget( chkAccountlistServer, 1, 0 );
00060
00061 chkAccountlistUser = new QCheckBox( i18nc( "@option:check show user column in the account view", "User" ), gboxAccountlist );
00062 chkAccountlistUser->setToolTip( i18nc( "@info:tooltip", "To switch on/off the 'User' column in the account list" ) );
00063 layAccountlist->addWidget( chkAccountlistUser, 1, 1 );
00064
00065 chkAccountlistMessages = new QCheckBox( i18nc( "@option:check show number of messages column in the account view", "Messages" ), gboxAccountlist );
00066 chkAccountlistMessages->setToolTip( i18nc( "@info:tooltip", "To switch on/off the 'Messages' column in the account list" ) );
00067 layAccountlist->addWidget( chkAccountlistMessages, 2, 0 );
00068
00069 chkAccountlistSize = new QCheckBox( i18nc( "@option:check show column about the entire size of mails in the account view", "Size" ), gboxAccountlist );
00070 chkAccountlistSize->setToolTip( i18nc( "@info:tooltip", "To switch on/off the 'Size' column in the account list" ) );
00071 layAccountlist->addWidget( chkAccountlistSize, 2, 1 );
00072
00073 chkMessagelistNumber = new QCheckBox( i18nc( "@option:check show mail number column in the mail view", "Number" ), gboxMessagelist );
00074 chkMessagelistNumber->setToolTip( i18nc( "@info:tooltip", "To switch on/off the 'Number' column in the message list" ) );
00075 layMessagelist->addWidget( chkMessagelistNumber, 0, 0 );
00076
00077 chkMessagelistAccount = new QCheckBox( i18nc( "@option:check show account name column in the mail view", "Account" ), gboxMessagelist );
00078 chkMessagelistAccount->setToolTip( i18nc( "@info:tooltip", "To switch on/off the 'Account' column in the message list" ) );
00079 layMessagelist->addWidget( chkMessagelistAccount, 0, 1 );
00080
00081 chkMessagelistFrom = new QCheckBox( i18nc( "@option:check show sender column in the mail view", "From" ), gboxMessagelist );
00082 chkMessagelistFrom->setToolTip( i18nc( "@info:tooltip", "To switch on/off the 'From' column in the message list" ) );
00083 layMessagelist->addWidget( chkMessagelistFrom, 1, 0 );
00084
00085 chkMessagelistTo = new QCheckBox( i18nc( "@option:check show addressee column in mail view", "To" ), gboxMessagelist );
00086 chkMessagelistTo->setToolTip( i18nc( "@info:tooltip", "To switch on/off the 'To' column in the message list" ) );
00087 layMessagelist->addWidget( chkMessagelistTo, 1, 1 );
00088
00089 chkMessagelistSubject = new QCheckBox( i18nc( "@option:check show subject column in mail view", "Subject" ), gboxMessagelist );
00090 chkMessagelistSubject->setToolTip( i18nc( "@info:tooltip", "To switch on/off the 'Subject' column in the message list" ) );
00091 layMessagelist->addWidget( chkMessagelistSubject, 2, 0 );
00092
00093 chkMessagelistDate = new QCheckBox( i18nc( "@option:check show send date column in the mail view", "Date" ), gboxMessagelist );
00094 chkMessagelistDate->setToolTip( i18nc( "@info:tooltip", "To switch on/off the 'Date' column in the message list" ) );
00095 layMessagelist->addWidget( chkMessagelistDate, 2, 1 );
00096
00097 chkMessagelistSize = new QCheckBox( i18nc( "@option:check show mail size column in the mail view", "Size" ), gboxMessagelist );
00098 chkMessagelistSize->setToolTip( i18nc( "@info:tooltip", "To switch on/off the 'Size' column in the message list" ) );
00099 layMessagelist->addWidget( chkMessagelistSize, 3, 0 );
00100
00101 chkMessagelistContent = new QCheckBox( i18nc( "@option:check show content type column in mail view", "Content" ), gboxMessagelist );
00102 chkMessagelistContent->setToolTip( i18nc( "@info:tooltip", "To switch on/off the 'Content' column in the message list" ) );
00103 layMessagelist->addWidget( chkMessagelistContent, 3, 1 );
00104
00105 chkMessagelistState = new QCheckBox( i18nc( "@option:check show state column in mail view", "State" ), gboxMessagelist );
00106 chkMessagelistState->setToolTip( i18nc( "@info:tooltip", "To switch on/off the 'State' column in the message list" ) );
00107 layMessagelist->addWidget( chkMessagelistState, 4, 0 );
00108
00109 chkAllowHTML = new QCheckBox( i18nc( "@option:check allow the mail content view to process HTML", "Allow HTML" ), gboxMessageContent );
00110 chkAllowHTML->setToolTip( i18nc( "@info:tooltip", "To switch on/off HTML in the message view") );
00111 layMessageContent->addWidget( chkAllowHTML, 0, 0 );
00112
00113
00114 connect( chkAccountlistActive, SIGNAL( toggled( bool ) ), this, SLOT( slotChanged() ) );
00115 connect( chkAccountlistAccount, SIGNAL( toggled( bool ) ), this, SLOT( slotChanged() ) );
00116 connect( chkAccountlistServer, SIGNAL( toggled( bool ) ), this, SLOT( slotChanged() ) );
00117 connect( chkAccountlistUser, SIGNAL( toggled( bool ) ), this, SLOT( slotChanged() ) );
00118 connect( chkAccountlistMessages, SIGNAL( toggled( bool ) ), this, SLOT( slotChanged() ) );
00119 connect( chkAccountlistSize, SIGNAL( toggled( bool ) ), this, SLOT( slotChanged() ) );
00120 connect( chkMessagelistNumber, SIGNAL( toggled( bool ) ), this, SLOT( slotChanged() ) );
00121 connect( chkMessagelistAccount, SIGNAL( toggled( bool ) ), this, SLOT( slotChanged() ) );
00122 connect( chkMessagelistFrom, SIGNAL( toggled( bool ) ), this, SLOT( slotChanged() ) );
00123 connect( chkMessagelistTo, SIGNAL( toggled( bool ) ), this, SLOT( slotChanged() ) );
00124 connect( chkMessagelistSubject, SIGNAL( toggled( bool ) ), this, SLOT( slotChanged() ) );
00125 connect( chkMessagelistDate, SIGNAL( toggled( bool ) ), this, SLOT( slotChanged() ) );
00126 connect( chkMessagelistSize, SIGNAL( toggled( bool ) ), this, SLOT( slotChanged() ) );
00127 connect( chkMessagelistContent, SIGNAL( toggled( bool ) ), this, SLOT( slotChanged() ) );
00128 connect( chkMessagelistState, SIGNAL( toggled( bool ) ), this, SLOT( slotChanged() ) );
00129 connect( chkAllowHTML, SIGNAL( toggled( bool ) ), this, SLOT( slotChanged() ) );
00130
00131
00132
00133 config = KGlobal::config();
00134
00135
00136 load();
00137 }
00138
00139 ConfigDisplay::~ConfigDisplay()
00140 {
00141 }
00142
00143 void ConfigDisplay::slotChanged( )
00144 {
00145 KCModule::changed();
00146 }
00147
00148 void ConfigDisplay::load( )
00149 {
00150 KConfigGroup* configAccList = new KConfigGroup( config, CONFIG_GROUP_ACCOUNT_LIST );
00151
00152 chkAccountlistActive->setChecked( configAccList->readEntry( CONFIG_ENTRY_DISPLAY_ACCOUNT_ACTIVE, DEFAULT_DISPLAY_ACCOUNT_ACTIVE ) );
00153 chkAccountlistAccount->setChecked( configAccList->readEntry( CONFIG_ENTRY_DISPLAY_ACCOUNT_ACCOUNT, DEFAULT_DISPLAY_ACCOUNT_ACCOUNT ) );
00154 chkAccountlistServer->setChecked( configAccList->readEntry( CONFIG_ENTRY_DISPLAY_ACCOUNT_SERVER, DEFAULT_DISPLAY_ACCOUNT_SERVER ) );
00155 chkAccountlistUser->setChecked( configAccList->readEntry( CONFIG_ENTRY_DISPLAY_ACCOUNT_USER, DEFAULT_DISPLAY_ACCOUNT_USER ) );
00156 chkAccountlistMessages->setChecked( configAccList->readEntry( CONFIG_ENTRY_DISPLAY_ACCOUNT_MESSAGES, DEFAULT_DISPLAY_ACCOUNT_MESSAGES ) );
00157 chkAccountlistSize->setChecked( configAccList->readEntry( CONFIG_ENTRY_DISPLAY_ACCOUNT_SIZE, DEFAULT_DISPLAY_ACCOUNT_SIZE ) );
00158
00159 KConfigGroup* configMessList = new KConfigGroup( config, CONFIG_GROUP_MESSAGE_LIST );
00160
00161 chkMessagelistNumber->setChecked( configMessList->readEntry( CONFIG_ENTRY_DISPLAY_MESSAGE_NUMBER, DEFAULT_DISPLAY_MESSAGE_NUMBER ) );
00162 chkMessagelistAccount->setChecked( configMessList->readEntry( CONFIG_ENTRY_DISPLAY_MESSAGE_ACCOUNT, DEFAULT_DISPLAY_MESSAGE_ACCOUNT ) );
00163 chkMessagelistFrom->setChecked( configMessList->readEntry( CONFIG_ENTRY_DISPLAY_MESSAGE_FROM, DEFAULT_DISPLAY_MESSAGE_FROM ) );
00164 chkMessagelistTo->setChecked( configMessList->readEntry( CONFIG_ENTRY_DISPLAY_MESSAGE_TO, DEFAULT_DISPLAY_MESSAGE_TO ) );
00165 chkMessagelistSubject->setChecked( configMessList->readEntry( CONFIG_ENTRY_DISPLAY_MESSAGE_SUBJECT, DEFAULT_DISPLAY_MESSAGE_SUBJECT ) );
00166 chkMessagelistDate->setChecked( configMessList->readEntry( CONFIG_ENTRY_DISPLAY_MESSAGE_DATE, DEFAULT_DISPLAY_MESSAGE_DATE ) );
00167 chkMessagelistSize->setChecked( configMessList->readEntry( CONFIG_ENTRY_DISPLAY_MESSAGE_SIZE, DEFAULT_DISPLAY_MESSAGE_SIZE ) );
00168 chkMessagelistContent->setChecked( configMessList->readEntry( CONFIG_ENTRY_DISPLAY_MESSAGE_CONTENT, DEFAULT_DISPLAY_MESSAGE_CONTENT ) );
00169 chkMessagelistState->setChecked( configMessList->readEntry( CONFIG_ENTRY_DISPLAY_MESSAGE_STATE, DEFAULT_DISPLAY_MESSAGE_STATE ) );
00170
00171 KConfigGroup* configView = new KConfigGroup( config, CONFIG_GROUP_VIEW );
00172
00173 chkAllowHTML->setChecked( configView->readEntry( CONFIG_ENTRY_VIEW_USE_HTML, DEFAULT_VIEW_USE_HTML ) );
00174
00175 delete configAccList;
00176 delete configMessList;
00177 delete configView;
00178
00179 }
00180
00181 void ConfigDisplay::save()
00182 {
00183 KConfigGroup* configAccList = new KConfigGroup( config, CONFIG_GROUP_ACCOUNT_LIST );
00184
00185 configAccList->writeEntry( CONFIG_ENTRY_DISPLAY_ACCOUNT_ACTIVE, chkAccountlistActive->isChecked() );
00186 configAccList->writeEntry( CONFIG_ENTRY_DISPLAY_ACCOUNT_ACCOUNT, chkAccountlistAccount->isChecked() );
00187 configAccList->writeEntry( CONFIG_ENTRY_DISPLAY_ACCOUNT_SERVER, chkAccountlistServer->isChecked() );
00188 configAccList->writeEntry( CONFIG_ENTRY_DISPLAY_ACCOUNT_USER, chkAccountlistUser->isChecked() );
00189 configAccList->writeEntry( CONFIG_ENTRY_DISPLAY_ACCOUNT_MESSAGES, chkAccountlistMessages->isChecked() );
00190 configAccList->writeEntry( CONFIG_ENTRY_DISPLAY_ACCOUNT_SIZE, chkAccountlistSize->isChecked() );
00191
00192 KConfigGroup* configMessList = new KConfigGroup( config, CONFIG_GROUP_MESSAGE_LIST );
00193
00194 configMessList->writeEntry( CONFIG_ENTRY_DISPLAY_MESSAGE_NUMBER, chkMessagelistNumber->isChecked() );
00195 configMessList->writeEntry( CONFIG_ENTRY_DISPLAY_MESSAGE_ACCOUNT, chkMessagelistAccount->isChecked() );
00196 configMessList->writeEntry( CONFIG_ENTRY_DISPLAY_MESSAGE_FROM, chkMessagelistFrom->isChecked() );
00197 configMessList->writeEntry( CONFIG_ENTRY_DISPLAY_MESSAGE_TO, chkMessagelistTo->isChecked() );
00198 configMessList->writeEntry( CONFIG_ENTRY_DISPLAY_MESSAGE_SUBJECT, chkMessagelistSubject->isChecked() );
00199 configMessList->writeEntry( CONFIG_ENTRY_DISPLAY_MESSAGE_DATE, chkMessagelistDate->isChecked() );
00200 configMessList->writeEntry( CONFIG_ENTRY_DISPLAY_MESSAGE_SIZE, chkMessagelistSize->isChecked() );
00201 configMessList->writeEntry( CONFIG_ENTRY_DISPLAY_MESSAGE_CONTENT, chkMessagelistContent->isChecked() );
00202 configMessList->writeEntry( CONFIG_ENTRY_DISPLAY_MESSAGE_STATE, chkMessagelistState->isChecked() );
00203
00204 KConfigGroup* configView = new KConfigGroup( config, CONFIG_GROUP_VIEW );
00205
00206 configView->writeEntry( CONFIG_ENTRY_VIEW_USE_HTML, chkAllowHTML->isChecked() );
00207
00208
00209 config->sync();
00210
00211 delete configAccList;
00212 delete configMessList;
00213 delete configView;
00214 }
00215
00216 void ConfigDisplay::defaults()
00217 {
00218 chkAccountlistActive->setChecked( DEFAULT_DISPLAY_ACCOUNT_ACTIVE );
00219 chkAccountlistAccount->setChecked( DEFAULT_DISPLAY_ACCOUNT_ACCOUNT );
00220 chkAccountlistServer->setChecked( DEFAULT_DISPLAY_ACCOUNT_SERVER );
00221 chkAccountlistUser->setChecked( DEFAULT_DISPLAY_ACCOUNT_USER );
00222 chkAccountlistMessages->setChecked( DEFAULT_DISPLAY_ACCOUNT_MESSAGES );
00223 chkAccountlistSize->setChecked( DEFAULT_DISPLAY_ACCOUNT_SIZE );
00224
00225 chkMessagelistNumber->setChecked( DEFAULT_DISPLAY_MESSAGE_NUMBER );
00226 chkMessagelistAccount->setChecked( DEFAULT_DISPLAY_MESSAGE_ACCOUNT );
00227 chkMessagelistFrom->setChecked( DEFAULT_DISPLAY_MESSAGE_FROM );
00228 chkMessagelistTo->setChecked( DEFAULT_DISPLAY_MESSAGE_TO );
00229 chkMessagelistSubject->setChecked( DEFAULT_DISPLAY_MESSAGE_SUBJECT );
00230 chkMessagelistDate->setChecked( DEFAULT_DISPLAY_MESSAGE_DATE );
00231 chkMessagelistSize->setChecked( DEFAULT_DISPLAY_MESSAGE_SIZE );
00232 chkMessagelistContent->setChecked( DEFAULT_DISPLAY_MESSAGE_CONTENT );
00233 chkMessagelistState->setChecked( DEFAULT_DISPLAY_MESSAGE_STATE );
00234
00235 chkAllowHTML->setChecked( DEFAULT_VIEW_USE_HTML );
00236
00237 }
00238 #include "configdisplay.moc"