author | zautrix <zautrix> | 2004-08-01 16:27:04 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-08-01 16:27:04 (UTC) |
commit | f968c6f5541463caadee98e200c2ba035fa20959 (patch) (unidiff) | |
tree | e71549b7ba1312a55f0311ed74754943d22af22a /libkdepim/ksyncprefsdialog.cpp | |
parent | 3a4186926d078692ad3c2261b70406c391f27554 (diff) | |
download | kdepimpi-f968c6f5541463caadee98e200c2ba035fa20959.zip kdepimpi-f968c6f5541463caadee98e200c2ba035fa20959.tar.gz kdepimpi-f968c6f5541463caadee98e200c2ba035fa20959.tar.bz2 |
Extended the sync config dialog
Diffstat (limited to 'libkdepim/ksyncprefsdialog.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libkdepim/ksyncprefsdialog.cpp | 77 |
1 files changed, 65 insertions, 12 deletions
diff --git a/libkdepim/ksyncprefsdialog.cpp b/libkdepim/ksyncprefsdialog.cpp index 7c04f48..355c05d 100644 --- a/libkdepim/ksyncprefsdialog.cpp +++ b/libkdepim/ksyncprefsdialog.cpp | |||
@@ -1,476 +1,529 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2004 Lutz Rogowski <rogowski@kde.org> | 3 | Copyright (c) 2004 Lutz Rogowski <rogowski@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <qlayout.h> | 24 | #include <qlayout.h> |
25 | #include <qlabel.h> | 25 | #include <qlabel.h> |
26 | #include <qgroupbox.h> | 26 | #include <qgroupbox.h> |
27 | #include <qbuttongroup.h> | 27 | #include <qbuttongroup.h> |
28 | #include <qlineedit.h> | 28 | #include <qlineedit.h> |
29 | #include <qfont.h> | 29 | #include <qfont.h> |
30 | #include <qslider.h> | 30 | #include <qslider.h> |
31 | #include <qfile.h> | 31 | #include <qfile.h> |
32 | #include <qdir.h> | 32 | #include <qdir.h> |
33 | #include <qtextstream.h> | 33 | #include <qtextstream.h> |
34 | #include <qcombobox.h> | 34 | #include <qcombobox.h> |
35 | #include <qvbox.h> | 35 | #include <qvbox.h> |
36 | #include <qhbox.h> | 36 | #include <qhbox.h> |
37 | #include <qspinbox.h> | 37 | #include <qspinbox.h> |
38 | #include <qdatetime.h> | 38 | #include <qdatetime.h> |
39 | #include <qcheckbox.h> | 39 | #include <qcheckbox.h> |
40 | #include <qradiobutton.h> | 40 | #include <qradiobutton.h> |
41 | #include <qpushbutton.h> | 41 | #include <qpushbutton.h> |
42 | #include <qstrlist.h> | 42 | #include <qstrlist.h> |
43 | #include <qapplication.h> | 43 | #include <qapplication.h> |
44 | #include <qlayout.h> | 44 | #include <qlayout.h> |
45 | #include <qscrollview.h> | 45 | #include <qscrollview.h> |
46 | 46 | ||
47 | #include <kcolorbutton.h> | 47 | #include <kcolorbutton.h> |
48 | #include <kdebug.h> | 48 | #include <kdebug.h> |
49 | #include <klocale.h> | 49 | #include <klocale.h> |
50 | #include <kglobal.h> | 50 | #include <kglobal.h> |
51 | #include <kfontdialog.h> | 51 | #include <kfontdialog.h> |
52 | #include <kmessagebox.h> | 52 | #include <kmessagebox.h> |
53 | #include <kcolordialog.h> | 53 | #include <kcolordialog.h> |
54 | #include <kiconloader.h> | 54 | #include <kiconloader.h> |
55 | #include <kemailsettings.h> | 55 | #include <kemailsettings.h> |
56 | #include <kstandarddirs.h> | 56 | #include <kstandarddirs.h> |
57 | #include <kfiledialog.h> | 57 | #include <kfiledialog.h> |
58 | #include <kmessagebox.h> | 58 | #include <kmessagebox.h> |
59 | 59 | ||
60 | //#include <kurlrequester.h> | 60 | //#include <kurlrequester.h> |
61 | #include <klineedit.h> | 61 | #include <klineedit.h> |
62 | #include "ksyncprofile.h" | 62 | #include "ksyncprofile.h" |
63 | 63 | ||
64 | 64 | ||
65 | //#include "koprefs.h" | 65 | //#include "koprefs.h" |
66 | 66 | ||
67 | #include "ksyncprefsdialog.h" | 67 | #include "ksyncprefsdialog.h" |
68 | //#include "koglobals.h" | 68 | //#include "koglobals.h" |
69 | 69 | ||
70 | 70 | ||
71 | KSyncPrefsDialog::KSyncPrefsDialog(QWidget *parent, char *name, bool modal) : | 71 | KSyncPrefsDialog::KSyncPrefsDialog(QWidget *parent, char *name, bool modal) : |
72 | KDialog(parent,name,true) | 72 | KDialog(parent,name,true) |
73 | { | 73 | { |
74 | 74 | ||
75 | setCaption( i18n("Synchronization Preferences")); | 75 | setCaption( i18n("Synchronization Preferences")); |
76 | 76 | ||
77 | mSyncProfiles.setAutoDelete( true ); | 77 | mSyncProfiles.setAutoDelete( true ); |
78 | setupSyncAlgTab(); | 78 | setupSyncAlgTab(); |
79 | } | 79 | } |
80 | 80 | ||
81 | 81 | ||
82 | KSyncPrefsDialog::~KSyncPrefsDialog() | 82 | KSyncPrefsDialog::~KSyncPrefsDialog() |
83 | { | 83 | { |
84 | } | 84 | } |
85 | 85 | ||
86 | void KSyncPrefsDialog::setupSyncAlgTab() | 86 | void KSyncPrefsDialog::setupSyncAlgTab() |
87 | { | 87 | { |
88 | QLabel * lab; | 88 | QLabel * lab; |
89 | //QFrame *page = addPage(i18n("Sync Prefs"),0,0); | 89 | //QFrame *page = addPage(i18n("Sync Prefs"),0,0); |
90 | QVBox * mainbox = new QVBox( this ); | 90 | QVBox * mainbox = new QVBox( this ); |
91 | QScrollView* sv = new QScrollView( mainbox ); | 91 | QScrollView* sv = new QScrollView( mainbox ); |
92 | QHBoxLayout * lay = new QHBoxLayout( this ); | 92 | QHBoxLayout * lay = new QHBoxLayout( this ); |
93 | lay->addWidget( mainbox ); | 93 | lay->addWidget( mainbox ); |
94 | QHBox * b_box = new QHBox( mainbox ); | 94 | QHBox * b_box = new QHBox( mainbox ); |
95 | 95 | ||
96 | QPushButton* button = new QPushButton( i18n("Ok"), b_box ); | 96 | QPushButton* button = new QPushButton( i18n("Ok"), b_box ); |
97 | connect ( button, SIGNAL( clicked()), this, SLOT (slotOK() ) ); | 97 | connect ( button, SIGNAL( clicked()), this, SLOT (slotOK() ) ); |
98 | button = new QPushButton( i18n("Cancel"), b_box ); | 98 | button = new QPushButton( i18n("Cancel"), b_box ); |
99 | connect ( button, SIGNAL( clicked()), this, SLOT (reject() ) ); | 99 | connect ( button, SIGNAL( clicked()), this, SLOT (reject() ) ); |
100 | //QBoxLayout * sl = new QVBoxLayout(this ); | 100 | //QBoxLayout * sl = new QVBoxLayout(this ); |
101 | //sl->addWidget ( sv ); | 101 | //sl->addWidget ( sv ); |
102 | sv->setResizePolicy ( QScrollView::AutoOneFit ); | 102 | sv->setResizePolicy ( QScrollView::AutoOneFit ); |
103 | QFrame *topFrame = new QFrame ( sv ); | 103 | QFrame *topFrame = new QFrame ( sv ); |
104 | sv->addChild( topFrame ); | 104 | sv->addChild( topFrame ); |
105 | mSetupSyncAlgTab = topFrame; | 105 | mSetupSyncAlgTab = topFrame; |
106 | QGridLayout *topLayout = new QGridLayout(topFrame,6,2); | 106 | QGridLayout *topLayout = new QGridLayout(topFrame,6,2); |
107 | topLayout->setSpacing(spacingHint()); | 107 | topLayout->setSpacing(spacingHint()); |
108 | topLayout->setMargin(marginHint()); | 108 | topLayout->setMargin(marginHint()); |
109 | 109 | ||
110 | //lab = new QLabel(i18n("Sync settings not yet implemented. DO NOT USE!"), topFrame); | 110 | //lab = new QLabel(i18n("Sync settings not yet implemented. DO NOT USE!"), topFrame); |
111 | int iii = 0; | 111 | int iii = 0; |
112 | //topLayout->addMultiCellWidget(lab , iii,iii,0,1); | 112 | //topLayout->addMultiCellWidget(lab , iii,iii,0,1); |
113 | //++iii; | 113 | //++iii; |
114 | 114 | ||
115 | mMyMachineName = new QLineEdit(topFrame); | 115 | mMyMachineName = new QLineEdit(topFrame); |
116 | lab = new QLabel(mMyMachineName, i18n("Local device name:"), topFrame); | 116 | lab = new QLabel(mMyMachineName, i18n("Local device name:"), topFrame); |
117 | topLayout->addWidget(lab ,iii,0); | 117 | topLayout->addWidget(lab ,iii,0); |
118 | topLayout->addWidget(mMyMachineName,iii,1); | 118 | topLayout->addWidget(mMyMachineName,iii,1); |
119 | ++iii; | 119 | ++iii; |
120 | 120 | ||
121 | QHBox* buttonbox = new QHBox( topFrame); | 121 | QHBox* buttonbox = new QHBox( topFrame); |
122 | topLayout->addMultiCellWidget(buttonbox, iii,iii,0,1); | 122 | topLayout->addMultiCellWidget(buttonbox, iii,iii,0,1); |
123 | ++iii; | 123 | ++iii; |
124 | button = new QPushButton( i18n("New profile"), buttonbox ); | 124 | button = new QPushButton( i18n("New profile"), buttonbox ); |
125 | connect ( button, SIGNAL( clicked()), this, SLOT (newProfile() ) ); | 125 | connect ( button, SIGNAL( clicked()), this, SLOT (newProfile() ) ); |
126 | 126 | ||
127 | button = new QPushButton( i18n("Clone profile"), buttonbox ); | 127 | button = new QPushButton( i18n("Clone profile"), buttonbox ); |
128 | connect ( button, SIGNAL( clicked()), this, SLOT ( cloneProfile() ) ); | 128 | connect ( button, SIGNAL( clicked()), this, SLOT ( cloneProfile() ) ); |
129 | 129 | ||
130 | button = new QPushButton( i18n("Delete profile"), buttonbox ); | 130 | button = new QPushButton( i18n("Delete profile"), buttonbox ); |
131 | connect ( button, SIGNAL( clicked()), this, SLOT (deleteProfile() ) ); | 131 | connect ( button, SIGNAL( clicked()), this, SLOT (deleteProfile() ) ); |
132 | 132 | ||
133 | mProfileBox = new QComboBox(topFrame); | 133 | mProfileBox = new QComboBox(topFrame); |
134 | mProfileBox->setEditable ( true ); | 134 | mProfileBox->setEditable ( true ); |
135 | connect ( mProfileBox, SIGNAL(activated ( int ) ), this, SLOT (profileChanged( int ) ) ); | 135 | connect ( mProfileBox, SIGNAL(activated ( int ) ), this, SLOT (profileChanged( int ) ) ); |
136 | connect ( mProfileBox, SIGNAL( textChanged ( const QString & ) ), this, SLOT (textChanged( const QString & ) ) ); | 136 | connect ( mProfileBox, SIGNAL( textChanged ( const QString & ) ), this, SLOT (textChanged( const QString & ) ) ); |
137 | 137 | ||
138 | lab = new QLabel(mProfileBox, i18n("Profile:"), topFrame); | 138 | lab = new QLabel(mProfileBox, i18n("Profile:"), topFrame); |
139 | topLayout->addWidget(lab ,iii,0); | 139 | topLayout->addWidget(lab ,iii,0); |
140 | topLayout->addWidget(mProfileBox, iii,1); | 140 | topLayout->addWidget(mProfileBox, iii,1); |
141 | ++iii; | 141 | ++iii; |
142 | 142 | ||
143 | mIncludeInRing = new QCheckBox( i18n("Include in multiple calendar sync"), topFrame ); | 143 | mIncludeInRing = new QCheckBox( i18n("Include in multiple calendar sync"), topFrame ); |
144 | topLayout->addMultiCellWidget(mIncludeInRing, iii,iii,0,1); | 144 | topLayout->addMultiCellWidget(mIncludeInRing, iii,iii,0,1); |
145 | ++iii; | 145 | ++iii; |
146 | mIncludeInRingAB = new QCheckBox( i18n("Include in multiple addressbook sync"), topFrame ); | 146 | mIncludeInRingAB = new QCheckBox( i18n("Include in multiple addressbook sync"), topFrame ); |
147 | topLayout->addMultiCellWidget(mIncludeInRingAB, iii,iii,0,1); | 147 | topLayout->addMultiCellWidget(mIncludeInRingAB, iii,iii,0,1); |
148 | ++iii; | 148 | ++iii; |
149 | 149 | ||
150 | mAskForPreferences = new QCheckBox( i18n("Ask for preferences before sync"), topFrame ); | 150 | mAskForPreferences = new QCheckBox( i18n("Ask for preferences before sync"), topFrame ); |
151 | topLayout->addMultiCellWidget(mAskForPreferences, iii,iii,0,1); | 151 | topLayout->addMultiCellWidget(mAskForPreferences, iii,iii,0,1); |
152 | ++iii; | 152 | ++iii; |
153 | QButtonGroup* gr = new QButtonGroup ( 1, Qt::Horizontal, i18n("Sync preferences"), topFrame); | 153 | QButtonGroup* gr = new QButtonGroup ( 1, Qt::Horizontal, i18n("Sync preferences"), topFrame); |
154 | topLayout->addMultiCellWidget(gr, iii,iii,0,1); | 154 | topLayout->addMultiCellWidget(gr, iii,iii,0,1); |
155 | ++iii; | 155 | ++iii; |
156 | loc = new QRadioButton ( i18n("Take local entry on conflict"), gr ); | 156 | loc = new QRadioButton ( i18n("Take local entry on conflict"), gr ); |
157 | rem = new QRadioButton ( i18n("Take remote entry on conflict"), gr ); | 157 | rem = new QRadioButton ( i18n("Take remote entry on conflict"), gr ); |
158 | newest = new QRadioButton ( i18n("Take newest entry on conflict"), gr ); | 158 | newest = new QRadioButton ( i18n("Take newest entry on conflict"), gr ); |
159 | ask = new QRadioButton ( i18n("Ask for every entry on conflict"), gr ); | 159 | ask = new QRadioButton ( i18n("Ask for every entry on conflict"), gr ); |
160 | f_loc= new QRadioButton ( i18n("Force: Take local entry always"), gr ); | 160 | f_loc= new QRadioButton ( i18n("Force: Take local entry always"), gr ); |
161 | f_rem = new QRadioButton ( i18n("Force: Take remote entry always"), gr ); | 161 | f_rem = new QRadioButton ( i18n("Force: Take remote entry always"), gr ); |
162 | // both = new QRadioButton ( i18n("Take both on conflict"), gr ); | 162 | // both = new QRadioButton ( i18n("Take both on conflict"), gr ); |
163 | 163 | ||
164 | mShowSummaryAfterSync = new QCheckBox( i18n("Show summary after sync"), topFrame ); | 164 | mShowSummaryAfterSync = new QCheckBox( i18n("Show summary after sync"), topFrame ); |
165 | topLayout->addMultiCellWidget(mShowSummaryAfterSync, iii,iii,0,1); | 165 | topLayout->addMultiCellWidget(mShowSummaryAfterSync, iii,iii,0,1); |
166 | ++iii; | ||
167 | |||
168 | mWriteBackFile = new QCheckBox( i18n("Write back synced data"), topFrame ); | ||
169 | topLayout->addMultiCellWidget(mWriteBackFile, iii,iii,0,1); | ||
166 | ++iii; | 170 | ++iii; |
167 | 171 | ||
168 | mWriteBackExisting= new QCheckBox( i18n("Write back existing entries only"), topFrame ); | 172 | mWriteBackExisting= new QCheckBox( i18n("-- Write back (on remote) existing entries only"), topFrame ); |
169 | topLayout->addMultiCellWidget(mWriteBackExisting, iii,iii,0,1); | 173 | topLayout->addMultiCellWidget(mWriteBackExisting, iii,iii,0,1); |
170 | ++iii; | 174 | ++iii; |
171 | 175 | ||
172 | mWriteBackFile = new QCheckBox( i18n("Write back file"), topFrame ); | 176 | mWriteBackFuture= new QCheckBox( i18n("-- Write back (calendar) entries in future only"), topFrame ); |
173 | topLayout->addMultiCellWidget(mWriteBackFile, iii,iii,0,1); | 177 | topLayout->addMultiCellWidget(mWriteBackFuture, iii,iii,0,1); |
174 | ++iii; | 178 | ++iii; |
175 | 179 | topLayout->addMultiCellWidget(new QLabel( i18n("---- Max. weeks in future: ") , topFrame ), iii,iii,0,0); | |
180 | mWriteBackFutureWeeks= new QSpinBox(1,104, 1, topFrame); | ||
181 | topLayout->addMultiCellWidget(mWriteBackFutureWeeks, iii,iii,1,1); | ||
182 | ++iii; | ||
183 | |||
176 | proGr = new QButtonGroup ( 1, Qt::Horizontal, i18n("Profile kind"), topFrame); | 184 | proGr = new QButtonGroup ( 1, Qt::Horizontal, i18n("Profile kind"), topFrame); |
177 | gr = proGr; | 185 | gr = proGr; |
178 | topLayout->addMultiCellWidget(gr, iii,iii,0,1); | 186 | topLayout->addMultiCellWidget(gr, iii,iii,0,1); |
179 | ++iii; | 187 | ++iii; |
180 | mIsLocal = new QRadioButton ( i18n("Local file"), gr ); | 188 | mIsLocal = new QRadioButton ( i18n("Local file"), gr ); |
181 | mIsNotLocal = new QRadioButton ( i18n("Remote file (w down/upload command)"), gr ); | 189 | mIsNotLocal = new QRadioButton ( i18n("Remote file (w down/upload command)"), gr ); |
182 | connect (mIsLocal, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) ); | 190 | connect (mIsLocal, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) ); |
183 | 191 | // *** local | |
184 | localFileWidget = new QVBox( topFrame); | 192 | localFileWidget = new QVBox( topFrame); |
185 | topLayout->addMultiCellWidget(localFileWidget, iii,iii,0,1); | 193 | topLayout->addMultiCellWidget(localFileWidget, iii,iii,0,1); |
186 | ++iii; | 194 | ++iii; |
187 | QHBox* temphb = new QHBox( localFileWidget ); | 195 | QHBox* temphb = new QHBox( localFileWidget ); |
188 | lab = new QLabel( i18n("Local file:"), temphb); | ||
189 | mRemoteFile = new QLineEdit(localFileWidget); | ||
190 | 196 | ||
197 | lab = new QLabel( i18n("Local file Cal:"), temphb ); | ||
198 | lab = new QLabel( i18n("Local file ABook:"), temphb ); | ||
199 | temphb = new QHBox( localFileWidget ); | ||
191 | button = new QPushButton( i18n("Choose..."), temphb ); | 200 | button = new QPushButton( i18n("Choose..."), temphb ); |
192 | connect ( button, SIGNAL( clicked()), this, SLOT ( chooseFile() ) ); | 201 | connect ( button, SIGNAL( clicked()), this, SLOT ( chooseFile() ) ); |
202 | button = new QPushButton( i18n("Choose..."), temphb ); | ||
203 | connect ( button, SIGNAL( clicked()), this, SLOT ( chooseFileAB() ) ); | ||
204 | temphb = new QHBox( localFileWidget ); | ||
193 | 205 | ||
206 | mRemoteFile = new QLineEdit( temphb); | ||
207 | mRemoteFileAB = new QLineEdit( temphb); | ||
194 | 208 | ||
209 | // *** remote | ||
195 | remoteFileWidget = new QVBox( topFrame); | 210 | remoteFileWidget = new QVBox( topFrame); |
196 | topLayout->addMultiCellWidget(remoteFileWidget, iii,iii,0,1); | 211 | topLayout->addMultiCellWidget(remoteFileWidget, iii,iii,0,1); |
197 | ++iii; | 212 | ++iii; |
213 | temphb = new QHBox( remoteFileWidget ); | ||
214 | new QLabel( i18n("Calendar:"), temphb); | ||
215 | new QLabel( i18n("AddressBook:"), temphb); | ||
216 | |||
198 | lab = new QLabel( i18n("Pre sync (download) command:"), remoteFileWidget); | 217 | lab = new QLabel( i18n("Pre sync (download) command:"), remoteFileWidget); |
199 | mRemotePrecommand = new QLineEdit(remoteFileWidget); | 218 | temphb = new QHBox( remoteFileWidget ); |
219 | mRemotePrecommand = new QLineEdit(temphb); | ||
220 | mRemotePrecommandAB = new QLineEdit(temphb); | ||
200 | 221 | ||
201 | lab = new QLabel( i18n("Local temp file:"), remoteFileWidget); | 222 | lab = new QLabel( i18n("Local temp file:"), remoteFileWidget); |
202 | mLocalTempFile = new QLineEdit(remoteFileWidget); | 223 | temphb = new QHBox( remoteFileWidget ); |
224 | mLocalTempFile = new QLineEdit(temphb); | ||
225 | mLocalTempFileAB = new QLineEdit(temphb); | ||
203 | 226 | ||
204 | |||
205 | lab = new QLabel( i18n("Post sync (upload) command:"), remoteFileWidget); | 227 | lab = new QLabel( i18n("Post sync (upload) command:"), remoteFileWidget); |
206 | mRemotePostcommand = new QLineEdit(remoteFileWidget); | 228 | temphb = new QHBox( remoteFileWidget ); |
229 | mRemotePostcommand = new QLineEdit(temphb ); | ||
230 | mRemotePostcommandAB = new QLineEdit(temphb ); | ||
207 | 231 | ||
208 | lab = new QLabel( i18n("Fill in default values for:"), remoteFileWidget); | 232 | lab = new QLabel( i18n("Fill in default values for:"), remoteFileWidget); |
209 | temphb = new QHBox( remoteFileWidget ); | 233 | temphb = new QHBox( remoteFileWidget ); |
210 | button = new QPushButton( i18n("ssh/scp"), temphb ); | 234 | button = new QPushButton( i18n("ssh/scp"), temphb ); |
211 | connect ( button, SIGNAL( clicked()), this, SLOT (fillSSH() ) ); | 235 | connect ( button, SIGNAL( clicked()), this, SLOT (fillSSH() ) ); |
212 | button = new QPushButton( i18n("ftp"), temphb ); | 236 | button = new QPushButton( i18n("ftp"), temphb ); |
213 | connect ( button, SIGNAL( clicked()), this, SLOT (fillFTP() ) ); | 237 | connect ( button, SIGNAL( clicked()), this, SLOT (fillFTP() ) ); |
214 | lab = new QLabel( i18n("Hint: Use $PWD$ for placeholder of password!"), remoteFileWidget); | 238 | lab = new QLabel( i18n("Hint: Use $PWD$ for placeholder of password!"), remoteFileWidget); |
215 | 239 | ||
216 | 240 | ||
217 | } | 241 | } |
218 | void KSyncPrefsDialog::slotOK() | 242 | void KSyncPrefsDialog::slotOK() |
219 | { | 243 | { |
220 | if ( mMyMachineName->text() == "undefined" ) { | 244 | if ( mMyMachineName->text() == "undefined" ) { |
221 | KMessageBox::error(this,i18n("Local device name undefined!\nPlease define device name!"),i18n("KO/Pi config error")); | 245 | KMessageBox::error(this,i18n("Local device name undefined!\nPlease define device name!"),i18n("KO/Pi config error")); |
222 | return; | 246 | return; |
223 | } | 247 | } |
224 | int i; | 248 | int i; |
225 | for (i = 0; i < mSyncProfileNames.count(); ++ i) { | 249 | for (i = 0; i < mSyncProfileNames.count(); ++ i) { |
226 | if ( mSyncProfileNames.contains( mSyncProfileNames[i]) > 1 ) { | 250 | if ( mSyncProfileNames.contains( mSyncProfileNames[i]) > 1 ) { |
227 | KMessageBox::error(this,i18n("Multiple profiles with same name!\nPlease use unique profile names!"),i18n("KO/Pi config error")); | 251 | KMessageBox::error(this,i18n("Multiple profiles with same name!\nPlease use unique profile names!"),i18n("KO/Pi config error")); |
228 | return; | 252 | return; |
229 | } | 253 | } |
230 | } | 254 | } |
231 | usrWriteConfig(); | 255 | usrWriteConfig(); |
232 | QDialog::accept(); | 256 | QDialog::accept(); |
233 | } | 257 | } |
234 | void KSyncPrefsDialog::accept() | 258 | void KSyncPrefsDialog::accept() |
235 | { | 259 | { |
236 | slotOK(); | 260 | slotOK(); |
237 | } | 261 | } |
238 | void KSyncPrefsDialog::chooseFile() | 262 | void KSyncPrefsDialog::chooseFile() |
239 | { | 263 | { |
240 | QString fn = QDir::homeDirPath(); | 264 | QString fn = QDir::homeDirPath(); |
241 | 265 | ||
242 | fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.ics/*.vcs)"), this ); | 266 | fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.ics/*.vcs)"), this ); |
243 | if ( fn == "" ) | 267 | if ( fn == "" ) |
244 | return; | 268 | return; |
245 | mRemoteFile->setText( fn ); | 269 | mRemoteFile->setText( fn ); |
246 | } | 270 | } |
247 | 271 | ||
272 | void KSyncPrefsDialog::chooseFileAB() | ||
273 | { | ||
274 | QString fn = QDir::homeDirPath(); | ||
275 | |||
276 | fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.ics/*.vcs)"), this ); | ||
277 | if ( fn == "" ) | ||
278 | return; | ||
279 | mRemoteFileAB->setText( fn ); | ||
280 | } | ||
281 | |||
248 | void KSyncPrefsDialog::textChanged( const QString & s ) | 282 | void KSyncPrefsDialog::textChanged( const QString & s ) |
249 | { | 283 | { |
250 | if ( mProfileBox->count() == 0 ) | 284 | if ( mProfileBox->count() == 0 ) |
251 | return; | 285 | return; |
252 | if ( currentSelection < 3 ) { | 286 | if ( currentSelection < 3 ) { |
253 | //KMessageBox::error(this,i18n("This profil name\ncannot be edited!\n"),i18n("KO/Pi config error")); | 287 | //KMessageBox::error(this,i18n("This profil name\ncannot be edited!\n"),i18n("KO/Pi config error")); |
254 | mProfileBox->blockSignals( true ); | 288 | mProfileBox->blockSignals( true ); |
255 | mProfileBox->setCurrentItem(mProfileBox-> currentItem ()); | 289 | mProfileBox->setCurrentItem(mProfileBox-> currentItem ()); |
256 | mProfileBox->blockSignals( false ); | 290 | mProfileBox->blockSignals( false ); |
257 | return; | 291 | return; |
258 | } | 292 | } |
259 | //qDebug("cur i %d ",mProfileBox-> currentItem () ); | 293 | //qDebug("cur i %d ",mProfileBox-> currentItem () ); |
260 | mProfileBox->changeItem ( s, mProfileBox-> currentItem () ) ; | 294 | mProfileBox->changeItem ( s, mProfileBox-> currentItem () ) ; |
261 | KSyncProfile* prof = mSyncProfiles.at(mProfileBox-> currentItem ()) ; | 295 | KSyncProfile* prof = mSyncProfiles.at(mProfileBox-> currentItem ()) ; |
262 | prof->setName( s ); | 296 | prof->setName( s ); |
263 | mSyncProfileNames[mProfileBox-> currentItem ()] = s; | 297 | mSyncProfileNames[mProfileBox-> currentItem ()] = s; |
264 | } | 298 | } |
265 | void KSyncPrefsDialog::profileChanged( int item ) | 299 | void KSyncPrefsDialog::profileChanged( int item ) |
266 | { | 300 | { |
267 | //qDebug("KSyncPrefsDialog::profileChanged %d ", item ); | 301 | //qDebug("KSyncPrefsDialog::profileChanged %d ", item ); |
268 | KSyncProfile* prof; | 302 | KSyncProfile* prof; |
269 | saveProfile(); | 303 | saveProfile(); |
270 | currentSelection = item; | 304 | currentSelection = item; |
271 | prof = mSyncProfiles.at(item) ; | 305 | prof = mSyncProfiles.at(item) ; |
272 | mRemotePrecommand->setText(prof->getPreSyncCommand()); | 306 | mRemotePrecommand->setText(prof->getPreSyncCommand()); |
273 | mRemotePostcommand->setText(prof->getPostSyncCommand()); | 307 | mRemotePostcommand->setText(prof->getPostSyncCommand()); |
274 | mLocalTempFile->setText(prof->getLocalTempFile()); | 308 | mLocalTempFile->setText(prof->getLocalTempFile()); |
275 | mRemoteFile->setText(prof->getRemoteFileName()) ; | 309 | mRemoteFile->setText(prof->getRemoteFileName()) ; |
310 | |||
311 | mRemotePrecommandAB->setText(prof->getPreSyncCommandAB()); | ||
312 | mRemotePostcommandAB->setText(prof->getPostSyncCommandAB()); | ||
313 | mLocalTempFileAB->setText(prof->getLocalTempFileAB()); | ||
314 | mRemoteFileAB->setText(prof->getRemoteFileNameAB()) ; | ||
276 | mShowSummaryAfterSync->setChecked( prof->getShowSummaryAfterSync()); | 315 | mShowSummaryAfterSync->setChecked( prof->getShowSummaryAfterSync()); |
277 | mAskForPreferences->setChecked( prof->getAskForPreferences()); | 316 | mAskForPreferences->setChecked( prof->getAskForPreferences()); |
278 | mWriteBackExisting->setChecked( prof->getWriteBackExisting() ); | 317 | mWriteBackExisting->setChecked( prof->getWriteBackExisting() ); |
279 | mWriteBackFile->setChecked( prof->getWriteBackFile()); | 318 | mWriteBackFile->setChecked( prof->getWriteBackFile()); |
280 | mIncludeInRing->setChecked( prof->getIncludeInRingSync() ); | 319 | mIncludeInRing->setChecked( prof->getIncludeInRingSync() ); |
281 | mIncludeInRingAB->setChecked( prof->getIncludeInRingSyncAB() ); | 320 | mIncludeInRingAB->setChecked( prof->getIncludeInRingSyncAB() ); |
321 | mWriteBackFuture->setChecked( prof->getWriteBackFuture()); | ||
322 | mWriteBackFutureWeeks->setValue( prof->getWriteBackFutureWeeks() ); | ||
282 | 323 | ||
283 | switch ( prof->getSyncPrefs() ) { | 324 | switch ( prof->getSyncPrefs() ) { |
284 | case 0: | 325 | case 0: |
285 | loc->setChecked( true); | 326 | loc->setChecked( true); |
286 | break; | 327 | break; |
287 | case 1: | 328 | case 1: |
288 | rem->setChecked( true ); | 329 | rem->setChecked( true ); |
289 | break; | 330 | break; |
290 | case 2: | 331 | case 2: |
291 | newest->setChecked( true); | 332 | newest->setChecked( true); |
292 | break; | 333 | break; |
293 | case 3: | 334 | case 3: |
294 | ask->setChecked( true); | 335 | ask->setChecked( true); |
295 | break; | 336 | break; |
296 | case 4: | 337 | case 4: |
297 | f_loc->setChecked( true); | 338 | f_loc->setChecked( true); |
298 | break; | 339 | break; |
299 | case 5: | 340 | case 5: |
300 | f_rem->setChecked( true); | 341 | f_rem->setChecked( true); |
301 | break; | 342 | break; |
302 | case 6: | 343 | case 6: |
303 | //both->setChecked( true); | 344 | //both->setChecked( true); |
304 | break; | 345 | break; |
305 | default: | 346 | default: |
306 | break; | 347 | break; |
307 | } | 348 | } |
308 | mIsLocal->setChecked(prof->getIsLocalFileSync()) ; | 349 | mIsLocal->setChecked(prof->getIsLocalFileSync()) ; |
309 | mIsNotLocal->setChecked(!prof->getIsLocalFileSync()); | 350 | mIsNotLocal->setChecked(!prof->getIsLocalFileSync()); |
310 | proGr->setEnabled( item > 2 ); | 351 | proGr->setEnabled( item > 2 ); |
311 | if ( item < 3 ) { | 352 | if ( item < 3 ) { |
312 | localFileWidget->setEnabled(false); | 353 | localFileWidget->setEnabled(false); |
313 | remoteFileWidget->setEnabled(false); | 354 | remoteFileWidget->setEnabled(false); |
314 | 355 | ||
315 | } else | 356 | } else |
316 | kindChanged( prof->getIsLocalFileSync() ); | 357 | kindChanged( prof->getIsLocalFileSync() ); |
317 | } | 358 | } |
318 | 359 | ||
319 | void KSyncPrefsDialog::fillSSH() | 360 | void KSyncPrefsDialog::fillSSH() |
320 | { | 361 | { |
321 | mRemotePrecommand->setText("scp zaurus@192.168.0.65:/home/zaurus/kdepim/apps/korganizer/mycalendar.ics /tmp/mycalendar.ics" ); | 362 | mRemotePrecommand->setText("scp zaurus@192.168.0.65:/home/zaurus/kdepim/apps/korganizer/mycalendar.ics /tmp/mycalendar.ics" ); |
322 | mLocalTempFile->setText("/tmp/mycalendar.ics" ); | 363 | mLocalTempFile->setText("/tmp/mycalendar.ics" ); |
323 | mRemotePostcommand->setText("scp /tmp/mycalendar.ics zaurus@192.168.0.65:/home/zaurus/kdepim/apps/korganizer/mycalendar.ics" ); | 364 | mRemotePostcommand->setText("scp /tmp/mycalendar.ics zaurus@192.168.0.65:/home/zaurus/kdepim/apps/korganizer/mycalendar.ics" ); |
365 | mRemotePrecommandAB->setText("scp zaurus@192.168.0.65:/home/zaurus/kdepim/apps/kabc/std.vcf /tmp/std.vcf" ); | ||
366 | mLocalTempFileAB->setText("/tmp/std.vcf" ); | ||
367 | mRemotePostcommandAB->setText("scp /tmp/std.vcf zaurus@192.168.0.65:/home/zaurus/kdepim/apps/kabc/std.vcf" ); | ||
324 | } | 368 | } |
325 | void KSyncPrefsDialog::fillFTP() | 369 | void KSyncPrefsDialog::fillFTP() |
326 | { | 370 | { |
327 | mRemotePrecommand->setText("cd /tmp;ftp ftp://zaurus:a@192.168.0.65/kdepim/apps/korganizer/mycalendar.ics" ); | 371 | mRemotePrecommand->setText("cd /tmp;ftp ftp://zaurus:a@192.168.0.65/kdepim/apps/korganizer/mycalendar.ics" ); |
328 | mLocalTempFile->setText("/tmp/mycalendar.ics" ); | 372 | mLocalTempFile->setText("/tmp/mycalendar.ics" ); |
329 | mRemotePostcommand->setText("ftp -u ftp://zaurus:a@192.168.0.65/kdepim/apps/korganizer/mycalendar.ics /tmp/mycalendar.ics" ); | 373 | mRemotePostcommand->setText("ftp -u ftp://zaurus:a@192.168.0.65/kdepim/apps/korganizer/mycalendar.ics /tmp/mycalendar.ics" ); |
374 | mRemotePrecommandAB->setText("cd /tmp;ftp ftp://zaurus:a@192.168.0.65/kdepim/apps/kabc/std.vcf" ); | ||
375 | mLocalTempFileAB->setText("/tmp/std.vcf" ); | ||
376 | mRemotePostcommandAB->setText("ftp -u ftp://zaurus:a@192.168.0.65/kdepim/apps/kabc/std.vcf /tmp/std.vcf" ); | ||
330 | 377 | ||
331 | } | 378 | } |
332 | void KSyncPrefsDialog::kindChanged( bool b ) | 379 | void KSyncPrefsDialog::kindChanged( bool b ) |
333 | { | 380 | { |
334 | 381 | ||
335 | localFileWidget->setEnabled(b); | 382 | localFileWidget->setEnabled(b); |
336 | remoteFileWidget->setEnabled(!b); | 383 | remoteFileWidget->setEnabled(!b); |
337 | 384 | ||
338 | } | 385 | } |
339 | void KSyncPrefsDialog::deleteProfile() | 386 | void KSyncPrefsDialog::deleteProfile() |
340 | { | 387 | { |
341 | //qDebug("KSyncPrefsDialog::deleteProfile() "); | 388 | //qDebug("KSyncPrefsDialog::deleteProfile() "); |
342 | if ( currentSelection >= 0 ) { | 389 | if ( currentSelection >= 0 ) { |
343 | if ( currentSelection < 3 ) { | 390 | if ( currentSelection < 3 ) { |
344 | KMessageBox::error(this,i18n("This profil cannot be deleted!\n"),i18n("KO/Pi config error")); | 391 | KMessageBox::error(this,i18n("This profil cannot be deleted!\n"),i18n("KO/Pi config error")); |
345 | return; | 392 | return; |
346 | } | 393 | } |
347 | KSyncProfile* temp = mSyncProfiles.at(currentSelection); | 394 | KSyncProfile* temp = mSyncProfiles.at(currentSelection); |
348 | mSyncProfiles.remove( temp ); | 395 | mSyncProfiles.remove( temp ); |
349 | mSyncProfileNames.remove( mSyncProfileNames.at( currentSelection )); | 396 | mSyncProfileNames.remove( mSyncProfileNames.at( currentSelection )); |
350 | insertProfiles(); | 397 | insertProfiles(); |
351 | } | 398 | } |
352 | } | 399 | } |
353 | 400 | ||
354 | void KSyncPrefsDialog::saveProfile() | 401 | void KSyncPrefsDialog::saveProfile() |
355 | { | 402 | { |
356 | KSyncProfile* prof; | 403 | KSyncProfile* prof; |
357 | if ( currentSelection >= 0 ) { | 404 | if ( currentSelection >= 0 ) { |
358 | prof = mSyncProfiles.at(currentSelection) ; | 405 | prof = mSyncProfiles.at(currentSelection) ; |
359 | prof->setPreSyncCommand( mRemotePrecommand->text()); | 406 | prof->setPreSyncCommand( mRemotePrecommand->text()); |
360 | prof->setPostSyncCommand( mRemotePostcommand->text() ); | 407 | prof->setPostSyncCommand( mRemotePostcommand->text() ); |
361 | prof->setLocalTempFile( mLocalTempFile->text()); | 408 | prof->setLocalTempFile( mLocalTempFile->text()); |
362 | prof->setRemoteFileName( mRemoteFile->text() ); | 409 | prof->setRemoteFileName( mRemoteFile->text() ); |
410 | prof->setPreSyncCommandAB( mRemotePrecommandAB->text()); | ||
411 | prof->setPostSyncCommandAB( mRemotePostcommandAB->text() ); | ||
412 | prof->setLocalTempFileAB( mLocalTempFileAB->text()); | ||
413 | prof->setRemoteFileNameAB( mRemoteFileAB->text() ); | ||
363 | prof->setShowSummaryAfterSync( mShowSummaryAfterSync->isChecked() ); | 414 | prof->setShowSummaryAfterSync( mShowSummaryAfterSync->isChecked() ); |
364 | prof->setAskForPreferences( mAskForPreferences->isChecked()); | 415 | prof->setAskForPreferences( mAskForPreferences->isChecked()); |
365 | prof->setWriteBackExisting(mWriteBackExisting->isChecked() ); | 416 | prof->setWriteBackExisting(mWriteBackExisting->isChecked() ); |
366 | prof->setWriteBackFile( mWriteBackFile->isChecked()); | 417 | prof->setWriteBackFile( mWriteBackFile->isChecked()); |
367 | prof->setIncludeInRingSync( mIncludeInRing->isChecked() ); | 418 | prof->setIncludeInRingSync( mIncludeInRing->isChecked() ); |
368 | prof->setIncludeInRingSyncAB( mIncludeInRingAB->isChecked() ); | 419 | prof->setIncludeInRingSyncAB( mIncludeInRingAB->isChecked() ); |
369 | int syncprefs = rem->isChecked()*1+newest->isChecked()*2+ ask->isChecked()*3+ f_loc->isChecked()*4+ f_rem->isChecked()*5 ;//+ both->isChecked()*6 ; | 420 | int syncprefs = rem->isChecked()*1+newest->isChecked()*2+ ask->isChecked()*3+ f_loc->isChecked()*4+ f_rem->isChecked()*5 ;//+ both->isChecked()*6 ; |
370 | prof->setSyncPrefs( syncprefs); | 421 | prof->setSyncPrefs( syncprefs); |
371 | prof->setIsLocalFileSync( mIsLocal->isChecked() ); | 422 | prof->setIsLocalFileSync( mIsLocal->isChecked() ); |
423 | prof->setWriteBackFuture(mWriteBackFuture->isChecked()); | ||
424 | prof->setWriteBackFutureWeeks(mWriteBackFutureWeeks->value()); | ||
372 | } | 425 | } |
373 | 426 | ||
374 | } | 427 | } |
375 | 428 | ||
376 | void KSyncPrefsDialog::insertProfiles() | 429 | void KSyncPrefsDialog::insertProfiles() |
377 | { | 430 | { |
378 | int curItem = mProfileBox->currentItem(); | 431 | int curItem = mProfileBox->currentItem(); |
379 | mProfileBox->blockSignals( true ); | 432 | mProfileBox->blockSignals( true ); |
380 | mProfileBox->clear(); | 433 | mProfileBox->clear(); |
381 | mProfileBox->insertStringList (mSyncProfileNames ); | 434 | mProfileBox->insertStringList (mSyncProfileNames ); |
382 | int item = mSyncProfileNames.count() -1; | 435 | int item = mSyncProfileNames.count() -1; |
383 | if ( curItem >= 0 && mSyncProfileNames.count() > 0 && curItem < mSyncProfileNames.count() ) | 436 | if ( curItem >= 0 && mSyncProfileNames.count() > 0 && curItem < mSyncProfileNames.count() ) |
384 | mProfileBox->setCurrentItem( curItem ); | 437 | mProfileBox->setCurrentItem( curItem ); |
385 | else if ( item >= 0 ) { | 438 | else if ( item >= 0 ) { |
386 | mProfileBox->setCurrentItem( item ); | 439 | mProfileBox->setCurrentItem( item ); |
387 | } | 440 | } |
388 | currentSelection = -1; | 441 | currentSelection = -1; |
389 | if ( mSyncProfileNames.count() > 0 ) { | 442 | if ( mSyncProfileNames.count() > 0 ) { |
390 | //qDebug(" profileChanged( mProfileBox->currentItem() "); | 443 | //qDebug(" profileChanged( mProfileBox->currentItem() "); |
391 | profileChanged( mProfileBox->currentItem() ); | 444 | profileChanged( mProfileBox->currentItem() ); |
392 | currentSelection = mProfileBox->currentItem(); | 445 | currentSelection = mProfileBox->currentItem(); |
393 | } | 446 | } |
394 | mProfileBox->blockSignals( false ); | 447 | mProfileBox->blockSignals( false ); |
395 | } | 448 | } |
396 | 449 | ||
397 | void KSyncPrefsDialog::addProfile ( KSyncProfile* temp ) | 450 | void KSyncPrefsDialog::addProfile ( KSyncProfile* temp ) |
398 | { | 451 | { |
399 | saveProfile(); | 452 | saveProfile(); |
400 | mSyncProfiles.append( temp ); | 453 | mSyncProfiles.append( temp ); |
401 | mSyncProfileNames << temp->getName(); | 454 | mSyncProfileNames << temp->getName(); |
402 | insertProfiles(); | 455 | insertProfiles(); |
403 | int last = mProfileBox->count() -1; | 456 | int last = mProfileBox->count() -1; |
404 | mProfileBox->blockSignals( true ); | 457 | mProfileBox->blockSignals( true ); |
405 | mProfileBox->setCurrentItem( last ); | 458 | mProfileBox->setCurrentItem( last ); |
406 | mProfileBox->blockSignals( false ); | 459 | mProfileBox->blockSignals( false ); |
407 | profileChanged(last); | 460 | profileChanged(last); |
408 | } | 461 | } |
409 | void KSyncPrefsDialog::newProfile() | 462 | void KSyncPrefsDialog::newProfile() |
410 | { | 463 | { |
411 | addProfile ( new KSyncProfile () ); | 464 | addProfile ( new KSyncProfile () ); |
412 | } | 465 | } |
413 | 466 | ||
414 | void KSyncPrefsDialog::cloneProfile() | 467 | void KSyncPrefsDialog::cloneProfile() |
415 | { | 468 | { |
416 | if ( currentSelection >= 0 ) | 469 | if ( currentSelection >= 0 ) |
417 | addProfile (mSyncProfiles.at(currentSelection)->clone()) ; | 470 | addProfile (mSyncProfiles.at(currentSelection)->clone()) ; |
418 | else | 471 | else |
419 | newProfile(); | 472 | newProfile(); |
420 | } | 473 | } |
421 | 474 | ||
422 | void KSyncPrefsDialog::setLocalMachineName ( const QString& name ) | 475 | void KSyncPrefsDialog::setLocalMachineName ( const QString& name ) |
423 | { | 476 | { |
424 | mMyMachineName->setText( name ); | 477 | mMyMachineName->setText( name ); |
425 | 478 | ||
426 | } | 479 | } |
427 | QString KSyncPrefsDialog::getLocalMachineName ( ) | 480 | QString KSyncPrefsDialog::getLocalMachineName ( ) |
428 | { | 481 | { |
429 | return mMyMachineName->text(); | 482 | return mMyMachineName->text(); |
430 | } | 483 | } |
431 | 484 | ||
432 | QStringList KSyncPrefsDialog::getSyncProfileNames() | 485 | QStringList KSyncPrefsDialog::getSyncProfileNames() |
433 | { | 486 | { |
434 | return mSyncProfileNames; | 487 | return mSyncProfileNames; |
435 | } | 488 | } |
436 | void KSyncPrefsDialog::usrReadConfig() | 489 | void KSyncPrefsDialog::usrReadConfig() |
437 | { | 490 | { |
438 | //KConfig *config = KOGlobals::config(); | 491 | //KConfig *config = KOGlobals::config(); |
439 | KConfig config ( locateLocal( "config","syncprofilesrc" ) ); | 492 | KConfig config ( locateLocal( "config","syncprofilesrc" ) ); |
440 | config.setGroup("SyncProfiles"); | 493 | config.setGroup("SyncProfiles"); |
441 | mSyncProfileNames =config.readListEntry("SyncProfileNames"); | 494 | mSyncProfileNames =config.readListEntry("SyncProfileNames"); |
442 | mMyMachineName->setText(config.readEntry("LocalMachineName","undefined")); | 495 | mMyMachineName->setText(config.readEntry("LocalMachineName","undefined")); |
443 | int i; | 496 | int i; |
444 | KSyncProfile* temp ; | 497 | KSyncProfile* temp ; |
445 | mSyncProfiles.clear(); | 498 | mSyncProfiles.clear(); |
446 | for ( i = 0; i < mSyncProfileNames.count();++i ) { | 499 | for ( i = 0; i < mSyncProfileNames.count();++i ) { |
447 | temp = new KSyncProfile (); | 500 | temp = new KSyncProfile (); |
448 | temp->setName( mSyncProfileNames[i] ); | 501 | temp->setName( mSyncProfileNames[i] ); |
449 | temp->readConfig( &config ); | 502 | temp->readConfig( &config ); |
450 | mSyncProfiles.append( temp ); | 503 | mSyncProfiles.append( temp ); |
451 | } | 504 | } |
452 | insertProfiles(); | 505 | insertProfiles(); |
453 | //mMyMachineName->setText(KOPrefs::instance()->mLocalMachineName ); | 506 | //mMyMachineName->setText(KOPrefs::instance()->mLocalMachineName ); |
454 | } | 507 | } |
455 | 508 | ||
456 | 509 | ||
457 | void KSyncPrefsDialog::usrWriteConfig() | 510 | void KSyncPrefsDialog::usrWriteConfig() |
458 | { | 511 | { |
459 | saveProfile(); | 512 | saveProfile(); |
460 | if ( currentSelection >= 0 ) | 513 | if ( currentSelection >= 0 ) |
461 | profileChanged(currentSelection); | 514 | profileChanged(currentSelection); |
462 | //KConfig *config = KOGlobals::config(); | 515 | //KConfig *config = KOGlobals::config(); |
463 | KConfig config ( locateLocal( "config","syncprofilesrc" ) ); | 516 | KConfig config ( locateLocal( "config","syncprofilesrc" ) ); |
464 | config.setGroup("SyncProfiles"); | 517 | config.setGroup("SyncProfiles"); |
465 | KSyncProfile* prof = mSyncProfiles.first(); | 518 | KSyncProfile* prof = mSyncProfiles.first(); |
466 | while ( prof ) { | 519 | while ( prof ) { |
467 | prof->writeConfig(&config); | 520 | prof->writeConfig(&config); |
468 | prof = mSyncProfiles.next(); | 521 | prof = mSyncProfiles.next(); |
469 | } | 522 | } |
470 | //KOPrefs::instance()->mSyncProfileNames = mSyncProfileNames; | 523 | //KOPrefs::instance()->mSyncProfileNames = mSyncProfileNames; |
471 | //KOPrefs::instance()->mLocalMachineName = mMyMachineName->text(); | 524 | //KOPrefs::instance()->mLocalMachineName = mMyMachineName->text(); |
472 | config.writeEntry("SyncProfileNames",mSyncProfileNames); | 525 | config.writeEntry("SyncProfileNames",mSyncProfileNames); |
473 | QString name = mMyMachineName->text(); | 526 | QString name = mMyMachineName->text(); |
474 | config.writeEntry("LocalMachineName",name); | 527 | config.writeEntry("LocalMachineName",name); |
475 | } | 528 | } |
476 | 529 | ||