-rw-r--r-- | libkdepim/kcmconfigs/kdepimconfigwidget.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/libkdepim/kcmconfigs/kdepimconfigwidget.cpp b/libkdepim/kcmconfigs/kdepimconfigwidget.cpp index bbed38d..5cd845e 100644 --- a/libkdepim/kcmconfigs/kdepimconfigwidget.cpp +++ b/libkdepim/kcmconfigs/kdepimconfigwidget.cpp | |||
@@ -98,100 +98,107 @@ KDEPIMConfigWidget::KDEPIMConfigWidget(KPimGlobalPrefs *prefs, QWidget *parent, | |||
98 | 98 | ||
99 | QVBoxLayout *topLayout = new QVBoxLayout( this, 0, | 99 | QVBoxLayout *topLayout = new QVBoxLayout( this, 0, |
100 | KDialog::spacingHint() ); | 100 | KDialog::spacingHint() ); |
101 | 101 | ||
102 | tabWidget = new QTabWidget( this ); | 102 | tabWidget = new QTabWidget( this ); |
103 | topLayout->addWidget( tabWidget ); | 103 | topLayout->addWidget( tabWidget ); |
104 | 104 | ||
105 | 105 | ||
106 | setupLocaleTab(); | 106 | setupLocaleTab(); |
107 | setupLocaleDateTab(); | 107 | setupLocaleDateTab(); |
108 | setupTimeZoneTab(); | 108 | setupTimeZoneTab(); |
109 | setupExternalAppTab(); | 109 | setupExternalAppTab(); |
110 | setupStoreTab(); | 110 | setupStoreTab(); |
111 | 111 | ||
112 | } | 112 | } |
113 | void KDEPIMConfigWidget::showTimeZoneTab() | 113 | void KDEPIMConfigWidget::showTimeZoneTab() |
114 | { | 114 | { |
115 | tabWidget->setCurrentPage ( 3 ) ; | 115 | tabWidget->setCurrentPage ( 3 ) ; |
116 | } | 116 | } |
117 | void KDEPIMConfigWidget::setupStoreTab() | 117 | void KDEPIMConfigWidget::setupStoreTab() |
118 | { | 118 | { |
119 | QVBox *storePage = new QVBox( this ); | 119 | QVBox *storePage = new QVBox( this ); |
120 | new QLabel( i18n("Your current storage dir is:\n%1\nYour mail is stored in:\n(storagedir)/apps/kopiemail/localmail").arg(KGlobal::dirs()->localkdedir()), storePage ); | 120 | new QLabel( i18n("Your current storage dir is:\n%1\nYour mail is stored in:\n(storagedir)/apps/kopiemail/localmail").arg(KGlobal::dirs()->localkdedir()), storePage ); |
121 | new QLabel( i18n("<b>New data storage dir:</b>"), storePage ); | 121 | new QLabel( i18n("<b>New data storage dir:</b>"), storePage ); |
122 | mStoreUrl = new KURLRequester( storePage ); | 122 | mStoreUrl = new KURLRequester( storePage ); |
123 | mStoreUrl->setURL( KGlobal::dirs()->localkdedir() ); | 123 | mStoreUrl->setURL( KGlobal::dirs()->localkdedir() ); |
124 | new QLabel( i18n("New dirs are created automatically"), storePage ); | 124 | new QLabel( i18n("New dirs are created automatically"), storePage ); |
125 | QHBox *bb = new QHBox( storePage ); | 125 | QHBox *bb = new QHBox( storePage ); |
126 | QPushButton * pb; | 126 | QPushButton * pb; |
127 | if ( QApplication::desktop()->width() < 640 ) | 127 | if ( QApplication::desktop()->width() < 640 ) |
128 | pb = new QPushButton ( i18n("Save"), bb ); | 128 | pb = new QPushButton ( i18n("Save"), bb ); |
129 | else | 129 | else |
130 | pb = new QPushButton ( i18n("Save settings"), bb ); | 130 | pb = new QPushButton ( i18n("Save settings"), bb ); |
131 | connect(pb, SIGNAL( clicked() ), this, SLOT ( saveStoreSettings() ) ); | 131 | connect(pb, SIGNAL( clicked() ), this, SLOT ( saveStoreSettings() ) ); |
132 | pb = new QPushButton ( i18n("Save standard"), bb ); | 132 | pb = new QPushButton ( i18n("Save standard"), bb ); |
133 | connect(pb, SIGNAL( clicked() ), this, SLOT ( setStandardStore() ) ); | 133 | connect(pb, SIGNAL( clicked() ), this, SLOT ( setStandardStore() ) ); |
134 | new QLabel( i18n("<b>New settings are used\nafter a restart</b>"), storePage ); | 134 | new QLabel( i18n("<b>New settings are used\nafter a restart</b>"), storePage ); |
135 | new QLabel( i18n("Settings are stored in\n%1").arg(QDir::homeDirPath() + "/.microkdehome" ), storePage ); | 135 | new QLabel( i18n("Settings are stored in\n%1").arg(QDir::homeDirPath() + "/.microkdehome" ), storePage ); |
136 | tabWidget->addTab( storePage, i18n( "Data storage path" ) ); | 136 | tabWidget->addTab( storePage, i18n( "Data storage path" ) ); |
137 | } | 137 | } |
138 | void KDEPIMConfigWidget::setStandardStore() | 138 | void KDEPIMConfigWidget::setStandardStore() |
139 | { | 139 | { |
140 | mStoreUrl->setURL( QDir::homeDirPath() + "/kdepim" ); | 140 | mStoreUrl->setURL( QDir::homeDirPath() + "/kdepim" ); |
141 | saveStoreSettings(); | 141 | saveStoreSettings(); |
142 | } | 142 | } |
143 | void KDEPIMConfigWidget::saveStoreSettings() | 143 | void KDEPIMConfigWidget::saveStoreSettings() |
144 | { | 144 | { |
145 | if ( !mStoreUrl->url().isEmpty() ) { | 145 | if ( !mStoreUrl->url().isEmpty() ) { |
146 | KConfig cfg ( QDir::homeDirPath() + "/.microkdehome" ); | 146 | QString path = QDir::homeDirPath(); |
147 | QString url = mStoreUrl->url(); | ||
148 | #ifdef DESKTOP_VERSION | ||
149 | if ( url.startsWith( "LOCAL:" ) ) { | ||
150 | path = qApp->applicationDirPath () ; | ||
151 | } | ||
152 | #endif | ||
153 | KConfig cfg ( path + "/.microkdehome" ); | ||
147 | cfg.setGroup("Global"); | 154 | cfg.setGroup("Global"); |
148 | cfg.writeEntry( "MICROKDEHOME", mStoreUrl->url() ); | 155 | cfg.writeEntry( "MICROKDEHOME", url ); |
149 | qDebug("cfg.writeEntry( MICROKDEHOME, mStoreUrl->url() ); "); | 156 | qDebug("cfg.writeEntry( MICROKDEHOME, %s ", url.latin1()); |
150 | cfg.sync(); | 157 | cfg.sync(); |
151 | } else { | 158 | } else { |
152 | mStoreUrl->setURL( QDir::homeDirPath() + "/kdepim" ); | 159 | mStoreUrl->setURL( QDir::homeDirPath() + "/kdepim" ); |
153 | saveStoreSettings(); | 160 | saveStoreSettings(); |
154 | } | 161 | } |
155 | } | 162 | } |
156 | void KDEPIMConfigWidget::setupExternalAppTab() | 163 | void KDEPIMConfigWidget::setupExternalAppTab() |
157 | { | 164 | { |
158 | QWidget *externalAppsPage = new QWidget( this ); | 165 | QWidget *externalAppsPage = new QWidget( this ); |
159 | QVBoxLayout* layout = new QVBoxLayout( externalAppsPage, KDialog::marginHintSmall(), | 166 | QVBoxLayout* layout = new QVBoxLayout( externalAppsPage, KDialog::marginHintSmall(), |
160 | KDialog::spacingHintSmall() ); | 167 | KDialog::spacingHintSmall() ); |
161 | 168 | ||
162 | mExternalApps = new QComboBox( externalAppsPage ); | 169 | mExternalApps = new QComboBox( externalAppsPage ); |
163 | 170 | ||
164 | QMap<ExternalAppHandler::Types, QString>::Iterator it; | 171 | QMap<ExternalAppHandler::Types, QString>::Iterator it; |
165 | for( it = mExternalAppsMap.begin(); it != mExternalAppsMap.end(); ++it ) | 172 | for( it = mExternalAppsMap.begin(); it != mExternalAppsMap.end(); ++it ) |
166 | mExternalApps->insertItem( it.data(), it.key() ); | 173 | mExternalApps->insertItem( it.data(), it.key() ); |
167 | 174 | ||
168 | layout->addWidget( mExternalApps ); | 175 | layout->addWidget( mExternalApps ); |
169 | 176 | ||
170 | connect( mExternalApps, SIGNAL( activated( int ) ), | 177 | connect( mExternalApps, SIGNAL( activated( int ) ), |
171 | this, SLOT (externalapp_changed( int ) ) ); | 178 | this, SLOT (externalapp_changed( int ) ) ); |
172 | 179 | ||
173 | 180 | ||
174 | mExternalAppGroupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Used Mail Client" ), externalAppsPage ); | 181 | mExternalAppGroupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Used Mail Client" ), externalAppsPage ); |
175 | QGridLayout *boxLayout = new QGridLayout( mExternalAppGroupBox->layout(), 4, 2, -1, "gridlayout" ); | 182 | QGridLayout *boxLayout = new QGridLayout( mExternalAppGroupBox->layout(), 4, 2, -1, "gridlayout" ); |
176 | mExternalAppGroupBox->layout()->setMargin(5); | 183 | mExternalAppGroupBox->layout()->setMargin(5); |
177 | 184 | ||
178 | mClient = new QComboBox( mExternalAppGroupBox ); | 185 | mClient = new QComboBox( mExternalAppGroupBox ); |
179 | boxLayout->addMultiCellWidget( mClient, 0, 0, 0, 1 ); | 186 | boxLayout->addMultiCellWidget( mClient, 0, 0, 0, 1 ); |
180 | 187 | ||
181 | connect( mClient, SIGNAL( activated( int ) ), | 188 | connect( mClient, SIGNAL( activated( int ) ), |
182 | this, SLOT (client_changed( int ) ) ); | 189 | this, SLOT (client_changed( int ) ) ); |
183 | 190 | ||
184 | QLabel* lab = new QLabel( i18n("Channel:"), mExternalAppGroupBox); | 191 | QLabel* lab = new QLabel( i18n("Channel:"), mExternalAppGroupBox); |
185 | boxLayout->addWidget( lab, 1, 0 ); | 192 | boxLayout->addWidget( lab, 1, 0 ); |
186 | mChannel = new QLineEdit(mExternalAppGroupBox); | 193 | mChannel = new QLineEdit(mExternalAppGroupBox); |
187 | mChannel->setReadOnly(true); | 194 | mChannel->setReadOnly(true); |
188 | boxLayout->addMultiCellWidget( mChannel, 2 , 2, 0, 1 ); | 195 | boxLayout->addMultiCellWidget( mChannel, 2 , 2, 0, 1 ); |
189 | 196 | ||
190 | lab = new QLabel( i18n("Message:"), mExternalAppGroupBox); | 197 | lab = new QLabel( i18n("Message:"), mExternalAppGroupBox); |
191 | boxLayout->addWidget( lab, 3, 0 ); | 198 | boxLayout->addWidget( lab, 3, 0 ); |
192 | mMessage = new QLineEdit(mExternalAppGroupBox); | 199 | mMessage = new QLineEdit(mExternalAppGroupBox); |
193 | mMessage->setReadOnly(true); | 200 | mMessage->setReadOnly(true); |
194 | boxLayout->addWidget( mMessage , 4, 0); | 201 | boxLayout->addWidget( mMessage , 4, 0); |
195 | 202 | ||
196 | lab = new QLabel( i18n("Parameters:"), mExternalAppGroupBox); | 203 | lab = new QLabel( i18n("Parameters:"), mExternalAppGroupBox); |
197 | boxLayout->addWidget( lab, 3, 1 ); | 204 | boxLayout->addWidget( lab, 3, 1 ); |