author | ulf69 <ulf69> | 2004-10-02 00:19:45 (UTC) |
---|---|---|
committer | ulf69 <ulf69> | 2004-10-02 00:19:45 (UTC) |
commit | ba1176743a536e19bb8b9d68b1c0c0023a0f3101 (patch) (unidiff) | |
tree | 352e97763d1b90eca9884651ab5533ef8ae8affc | |
parent | 7810fe355bd75c83bcdaed646cd1dde8d3c94fcb (diff) | |
download | kdepimpi-ba1176743a536e19bb8b9d68b1c0c0023a0f3101.zip kdepimpi-ba1176743a536e19bb8b9d68b1c0c0023a0f3101.tar.gz kdepimpi-ba1176743a536e19bb8b9d68b1c0c0023a0f3101.tar.bz2 |
fixed a crash when pressing return(enter) in the syncprofilenames combobox
-rw-r--r-- | libkdepim/ksyncprefsdialog.cpp | 3 | ||||
-rw-r--r-- | libkdepim/ksyncprofile.cpp | 2 |
2 files changed, 3 insertions, 2 deletions
diff --git a/libkdepim/ksyncprefsdialog.cpp b/libkdepim/ksyncprefsdialog.cpp index 6e6e631..28aac45 100644 --- a/libkdepim/ksyncprefsdialog.cpp +++ b/libkdepim/ksyncprefsdialog.cpp | |||
@@ -1,663 +1,664 @@ | |||
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 | mProfileBox->setInsertionPolicy(QComboBox::NoInsertion); | ||
135 | connect ( mProfileBox, SIGNAL(activated ( int ) ), this, SLOT (profileChanged( int ) ) ); | 136 | connect ( mProfileBox, SIGNAL(activated ( int ) ), this, SLOT (profileChanged( int ) ) ); |
136 | connect ( mProfileBox, SIGNAL( textChanged ( const QString & ) ), this, SLOT (textChanged( const QString & ) ) ); | 137 | connect ( mProfileBox, SIGNAL( textChanged ( const QString & ) ), this, SLOT (textChanged( const QString & ) ) ); |
137 | 138 | ||
138 | lab = new QLabel(mProfileBox, i18n("Profile:"), topFrame); | 139 | lab = new QLabel(mProfileBox, i18n("Profile:"), topFrame); |
139 | topLayout->addWidget(lab ,iii,0); | 140 | topLayout->addWidget(lab ,iii,0); |
140 | topLayout->addWidget(mProfileBox, iii,1); | 141 | topLayout->addWidget(mProfileBox, iii,1); |
141 | ++iii; | 142 | ++iii; |
142 | 143 | ||
143 | mIncludeInRing = new QCheckBox( i18n("Include in multiple calendar sync"), topFrame ); | 144 | mIncludeInRing = new QCheckBox( i18n("Include in multiple calendar sync"), topFrame ); |
144 | topLayout->addMultiCellWidget(mIncludeInRing, iii,iii,0,1); | 145 | topLayout->addMultiCellWidget(mIncludeInRing, iii,iii,0,1); |
145 | ++iii; | 146 | ++iii; |
146 | mIncludeInRingAB = new QCheckBox( i18n("Include in multiple addressbook sync"), topFrame ); | 147 | mIncludeInRingAB = new QCheckBox( i18n("Include in multiple addressbook sync"), topFrame ); |
147 | topLayout->addMultiCellWidget(mIncludeInRingAB, iii,iii,0,1); | 148 | topLayout->addMultiCellWidget(mIncludeInRingAB, iii,iii,0,1); |
148 | ++iii; | 149 | ++iii; |
149 | mIncludeInRingPWM = new QCheckBox( i18n("Include in multiple pwmanager sync"), topFrame ); | 150 | mIncludeInRingPWM = new QCheckBox( i18n("Include in multiple pwmanager sync"), topFrame ); |
150 | topLayout->addMultiCellWidget(mIncludeInRingPWM, iii,iii,0,1); | 151 | topLayout->addMultiCellWidget(mIncludeInRingPWM, iii,iii,0,1); |
151 | ++iii; | 152 | ++iii; |
152 | 153 | ||
153 | mAskForPreferences = new QCheckBox( i18n("Ask for preferences before sync"), topFrame ); | 154 | mAskForPreferences = new QCheckBox( i18n("Ask for preferences before sync"), topFrame ); |
154 | topLayout->addMultiCellWidget(mAskForPreferences, iii,iii,0,1); | 155 | topLayout->addMultiCellWidget(mAskForPreferences, iii,iii,0,1); |
155 | ++iii; | 156 | ++iii; |
156 | QButtonGroup* gr = new QButtonGroup ( 1, Qt::Horizontal, i18n("Sync preferences"), topFrame); | 157 | QButtonGroup* gr = new QButtonGroup ( 1, Qt::Horizontal, i18n("Sync preferences"), topFrame); |
157 | topLayout->addMultiCellWidget(gr, iii,iii,0,1); | 158 | topLayout->addMultiCellWidget(gr, iii,iii,0,1); |
158 | ++iii; | 159 | ++iii; |
159 | loc = new QRadioButton ( i18n("Take local entry on conflict"), gr ); | 160 | loc = new QRadioButton ( i18n("Take local entry on conflict"), gr ); |
160 | rem = new QRadioButton ( i18n("Take remote entry on conflict"), gr ); | 161 | rem = new QRadioButton ( i18n("Take remote entry on conflict"), gr ); |
161 | newest = new QRadioButton ( i18n("Take newest entry on conflict"), gr ); | 162 | newest = new QRadioButton ( i18n("Take newest entry on conflict"), gr ); |
162 | ask = new QRadioButton ( i18n("Ask for every entry on conflict"), gr ); | 163 | ask = new QRadioButton ( i18n("Ask for every entry on conflict"), gr ); |
163 | f_loc= new QRadioButton ( i18n("Force: Take local entry always"), gr ); | 164 | f_loc= new QRadioButton ( i18n("Force: Take local entry always"), gr ); |
164 | f_rem = new QRadioButton ( i18n("Force: Take remote entry always"), gr ); | 165 | f_rem = new QRadioButton ( i18n("Force: Take remote entry always"), gr ); |
165 | // both = new QRadioButton ( i18n("Take both on conflict"), gr ); | 166 | // both = new QRadioButton ( i18n("Take both on conflict"), gr ); |
166 | 167 | ||
167 | mShowSummaryAfterSync = new QCheckBox( i18n("Show summary after sync"), topFrame ); | 168 | mShowSummaryAfterSync = new QCheckBox( i18n("Show summary after sync"), topFrame ); |
168 | topLayout->addMultiCellWidget(mShowSummaryAfterSync, iii,iii,0,1); | 169 | topLayout->addMultiCellWidget(mShowSummaryAfterSync, iii,iii,0,1); |
169 | ++iii; | 170 | ++iii; |
170 | 171 | ||
171 | mWriteBackFile = new QCheckBox( i18n("Write back synced data"), topFrame ); | 172 | mWriteBackFile = new QCheckBox( i18n("Write back synced data"), topFrame ); |
172 | topLayout->addMultiCellWidget(mWriteBackFile, iii,iii,0,1); | 173 | topLayout->addMultiCellWidget(mWriteBackFile, iii,iii,0,1); |
173 | ++iii; | 174 | ++iii; |
174 | 175 | ||
175 | mWriteBackExisting= new QCheckBox( i18n("-- Write back (on remote) existing entries only"), topFrame ); | 176 | mWriteBackExisting= new QCheckBox( i18n("-- Write back (on remote) existing entries only"), topFrame ); |
176 | topLayout->addMultiCellWidget(mWriteBackExisting, iii,iii,0,1); | 177 | topLayout->addMultiCellWidget(mWriteBackExisting, iii,iii,0,1); |
177 | ++iii; | 178 | ++iii; |
178 | 179 | ||
179 | mWriteBackFuture= new QCheckBox( i18n("-- Write back (calendar) entries in future only"), topFrame ); | 180 | mWriteBackFuture= new QCheckBox( i18n("-- Write back (calendar) entries in future only"), topFrame ); |
180 | topLayout->addMultiCellWidget(mWriteBackFuture, iii,iii,0,1); | 181 | topLayout->addMultiCellWidget(mWriteBackFuture, iii,iii,0,1); |
181 | ++iii; | 182 | ++iii; |
182 | topLayout->addMultiCellWidget(new QLabel( i18n("---- Max. weeks in future: ") , topFrame ), iii,iii,0,0); | 183 | topLayout->addMultiCellWidget(new QLabel( i18n("---- Max. weeks in future: ") , topFrame ), iii,iii,0,0); |
183 | mWriteBackFutureWeeks= new QSpinBox(1,104, 1, topFrame); | 184 | mWriteBackFutureWeeks= new QSpinBox(1,104, 1, topFrame); |
184 | topLayout->addMultiCellWidget(mWriteBackFutureWeeks, iii,iii,1,1); | 185 | topLayout->addMultiCellWidget(mWriteBackFutureWeeks, iii,iii,1,1); |
185 | ++iii; | 186 | ++iii; |
186 | 187 | ||
187 | proGr = new QButtonGroup ( 1, Qt::Horizontal, i18n("Profile kind"), topFrame); | 188 | proGr = new QButtonGroup ( 1, Qt::Horizontal, i18n("Profile kind"), topFrame); |
188 | gr = proGr; | 189 | gr = proGr; |
189 | topLayout->addMultiCellWidget(gr, iii,iii,0,1); | 190 | topLayout->addMultiCellWidget(gr, iii,iii,0,1); |
190 | ++iii; | 191 | ++iii; |
191 | mIsLocal = new QRadioButton ( i18n("Local file"), gr ); | 192 | mIsLocal = new QRadioButton ( i18n("Local file"), gr ); |
192 | mIsNotLocal = new QRadioButton ( i18n("Remote file (w down/upload command)"), gr ); | 193 | mIsNotLocal = new QRadioButton ( i18n("Remote file (w down/upload command)"), gr ); |
193 | connect (mIsLocal, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) ); | 194 | connect (mIsLocal, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) ); |
194 | mIsPhone = new QRadioButton ( i18n("Mobile device (cell phone)"), gr ); | 195 | mIsPhone = new QRadioButton ( i18n("Mobile device (cell phone)"), gr ); |
195 | connect (mIsPhone, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) ); | 196 | connect (mIsPhone, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) ); |
196 | 197 | ||
197 | 198 | ||
198 | phoneWidget = new QVBox( topFrame); | 199 | phoneWidget = new QVBox( topFrame); |
199 | topLayout->addMultiCellWidget(phoneWidget, iii,iii,0,1); | 200 | topLayout->addMultiCellWidget(phoneWidget, iii,iii,0,1); |
200 | ++iii; | 201 | ++iii; |
201 | mWriteContactToSIM= new QCheckBox( i18n("Sync contacts with phone SIM card (If not, sync with phone memory)"), phoneWidget ); | 202 | mWriteContactToSIM= new QCheckBox( i18n("Sync contacts with phone SIM card (If not, sync with phone memory)"), phoneWidget ); |
202 | QHBox* temphb = new QHBox( phoneWidget ); | 203 | QHBox* temphb = new QHBox( phoneWidget ); |
203 | new QLabel( i18n("I/O device: "), temphb ); | 204 | new QLabel( i18n("I/O device: "), temphb ); |
204 | mPhoneDevice = new QLineEdit( temphb); | 205 | mPhoneDevice = new QLineEdit( temphb); |
205 | button = new QPushButton( i18n("Help..."), temphb ); | 206 | button = new QPushButton( i18n("Help..."), temphb ); |
206 | connect ( button, SIGNAL( clicked()), this, SLOT ( helpDevice() ) ); | 207 | connect ( button, SIGNAL( clicked()), this, SLOT ( helpDevice() ) ); |
207 | 208 | ||
208 | 209 | ||
209 | temphb = new QHBox( phoneWidget ); | 210 | temphb = new QHBox( phoneWidget ); |
210 | new QLabel( i18n("Connection: "), temphb ); | 211 | new QLabel( i18n("Connection: "), temphb ); |
211 | mPhoneConnection = new QLineEdit( temphb); | 212 | mPhoneConnection = new QLineEdit( temphb); |
212 | button = new QPushButton( i18n("Help..."), temphb ); | 213 | button = new QPushButton( i18n("Help..."), temphb ); |
213 | connect ( button, SIGNAL( clicked()), this, SLOT ( helpConnection() ) ); | 214 | connect ( button, SIGNAL( clicked()), this, SLOT ( helpConnection() ) ); |
214 | 215 | ||
215 | 216 | ||
216 | temphb = new QHBox( phoneWidget ); | 217 | temphb = new QHBox( phoneWidget ); |
217 | new QLabel( i18n("Model(opt.): "), temphb ); | 218 | new QLabel( i18n("Model(opt.): "), temphb ); |
218 | mPhoneModel = new QLineEdit( temphb); | 219 | mPhoneModel = new QLineEdit( temphb); |
219 | button = new QPushButton( i18n("Help..."), temphb ); | 220 | button = new QPushButton( i18n("Help..."), temphb ); |
220 | connect ( button, SIGNAL( clicked()), this, SLOT ( helpModel() ) ); | 221 | connect ( button, SIGNAL( clicked()), this, SLOT ( helpModel() ) ); |
221 | 222 | ||
222 | // *** local | 223 | // *** local |
223 | localFileWidget = new QVBox( topFrame); | 224 | localFileWidget = new QVBox( topFrame); |
224 | topLayout->addMultiCellWidget(localFileWidget, iii,iii,0,1); | 225 | topLayout->addMultiCellWidget(localFileWidget, iii,iii,0,1); |
225 | ++iii; | 226 | ++iii; |
226 | temphb = new QHBox( localFileWidget ); | 227 | temphb = new QHBox( localFileWidget ); |
227 | 228 | ||
228 | lab = new QLabel( i18n("Local file Cal:"), temphb ); | 229 | lab = new QLabel( i18n("Local file Cal:"), temphb ); |
229 | lab = new QLabel( i18n("Local file ABook:"), temphb ); | 230 | lab = new QLabel( i18n("Local file ABook:"), temphb ); |
230 | lab = new QLabel( i18n("Local file PWMgr:"), temphb ); | 231 | lab = new QLabel( i18n("Local file PWMgr:"), temphb ); |
231 | temphb = new QHBox( localFileWidget ); | 232 | temphb = new QHBox( localFileWidget ); |
232 | button = new QPushButton( i18n("Choose..."), temphb ); | 233 | button = new QPushButton( i18n("Choose..."), temphb ); |
233 | connect ( button, SIGNAL( clicked()), this, SLOT ( chooseFile() ) ); | 234 | connect ( button, SIGNAL( clicked()), this, SLOT ( chooseFile() ) ); |
234 | button = new QPushButton( i18n("Choose..."), temphb ); | 235 | button = new QPushButton( i18n("Choose..."), temphb ); |
235 | connect ( button, SIGNAL( clicked()), this, SLOT ( chooseFileAB() ) ); | 236 | connect ( button, SIGNAL( clicked()), this, SLOT ( chooseFileAB() ) ); |
236 | button = new QPushButton( i18n("Choose..."), temphb ); | 237 | button = new QPushButton( i18n("Choose..."), temphb ); |
237 | connect ( button, SIGNAL( clicked()), this, SLOT ( chooseFilePWM() ) ); | 238 | connect ( button, SIGNAL( clicked()), this, SLOT ( chooseFilePWM() ) ); |
238 | temphb = new QHBox( localFileWidget ); | 239 | temphb = new QHBox( localFileWidget ); |
239 | 240 | ||
240 | mRemoteFile = new QLineEdit( temphb); | 241 | mRemoteFile = new QLineEdit( temphb); |
241 | mRemoteFileAB = new QLineEdit( temphb); | 242 | mRemoteFileAB = new QLineEdit( temphb); |
242 | mRemoteFilePWM = new QLineEdit( temphb); | 243 | mRemoteFilePWM = new QLineEdit( temphb); |
243 | 244 | ||
244 | // *** remote | 245 | // *** remote |
245 | remoteFileWidget = new QVBox( topFrame); | 246 | remoteFileWidget = new QVBox( topFrame); |
246 | topLayout->addMultiCellWidget(remoteFileWidget, iii,iii,0,1); | 247 | topLayout->addMultiCellWidget(remoteFileWidget, iii,iii,0,1); |
247 | ++iii; | 248 | ++iii; |
248 | temphb = new QHBox( remoteFileWidget ); | 249 | temphb = new QHBox( remoteFileWidget ); |
249 | new QLabel( i18n("Calendar:"), temphb); | 250 | new QLabel( i18n("Calendar:"), temphb); |
250 | new QLabel( i18n("AddressBook:"), temphb); | 251 | new QLabel( i18n("AddressBook:"), temphb); |
251 | new QLabel( i18n("PWManager:"), temphb); | 252 | new QLabel( i18n("PWManager:"), temphb); |
252 | 253 | ||
253 | lab = new QLabel( i18n("Pre sync (download) command:"), remoteFileWidget); | 254 | lab = new QLabel( i18n("Pre sync (download) command:"), remoteFileWidget); |
254 | temphb = new QHBox( remoteFileWidget ); | 255 | temphb = new QHBox( remoteFileWidget ); |
255 | mRemotePrecommand = new QLineEdit(temphb); | 256 | mRemotePrecommand = new QLineEdit(temphb); |
256 | mRemotePrecommandAB = new QLineEdit(temphb); | 257 | mRemotePrecommandAB = new QLineEdit(temphb); |
257 | mRemotePrecommandPWM = new QLineEdit(temphb); | 258 | mRemotePrecommandPWM = new QLineEdit(temphb); |
258 | 259 | ||
259 | lab = new QLabel( i18n("Local temp file:"), remoteFileWidget); | 260 | lab = new QLabel( i18n("Local temp file:"), remoteFileWidget); |
260 | temphb = new QHBox( remoteFileWidget ); | 261 | temphb = new QHBox( remoteFileWidget ); |
261 | mLocalTempFile = new QLineEdit(temphb); | 262 | mLocalTempFile = new QLineEdit(temphb); |
262 | mLocalTempFileAB = new QLineEdit(temphb); | 263 | mLocalTempFileAB = new QLineEdit(temphb); |
263 | mLocalTempFilePWM = new QLineEdit(temphb); | 264 | mLocalTempFilePWM = new QLineEdit(temphb); |
264 | 265 | ||
265 | lab = new QLabel( i18n("Post sync (upload) command:"), remoteFileWidget); | 266 | lab = new QLabel( i18n("Post sync (upload) command:"), remoteFileWidget); |
266 | temphb = new QHBox( remoteFileWidget ); | 267 | temphb = new QHBox( remoteFileWidget ); |
267 | mRemotePostcommand = new QLineEdit(temphb ); | 268 | mRemotePostcommand = new QLineEdit(temphb ); |
268 | mRemotePostcommandAB = new QLineEdit(temphb ); | 269 | mRemotePostcommandAB = new QLineEdit(temphb ); |
269 | mRemotePostcommandPWM = new QLineEdit(temphb ); | 270 | mRemotePostcommandPWM = new QLineEdit(temphb ); |
270 | 271 | ||
271 | lab = new QLabel( i18n("Fill in default values for:"), remoteFileWidget); | 272 | lab = new QLabel( i18n("Fill in default values for:"), remoteFileWidget); |
272 | temphb = new QHBox( remoteFileWidget ); | 273 | temphb = new QHBox( remoteFileWidget ); |
273 | button = new QPushButton( i18n("ssh/scp"), temphb ); | 274 | button = new QPushButton( i18n("ssh/scp"), temphb ); |
274 | connect ( button, SIGNAL( clicked()), this, SLOT (fillSSH() ) ); | 275 | connect ( button, SIGNAL( clicked()), this, SLOT (fillSSH() ) ); |
275 | button = new QPushButton( i18n("ftp"), temphb ); | 276 | button = new QPushButton( i18n("ftp"), temphb ); |
276 | connect ( button, SIGNAL( clicked()), this, SLOT (fillFTP() ) ); | 277 | connect ( button, SIGNAL( clicked()), this, SLOT (fillFTP() ) ); |
277 | lab = new QLabel( i18n("Hint: Use $PWD$ for placeholder of password!"), remoteFileWidget); | 278 | lab = new QLabel( i18n("Hint: Use $PWD$ for placeholder of password!"), remoteFileWidget); |
278 | 279 | ||
279 | 280 | ||
280 | } | 281 | } |
281 | void KSyncPrefsDialog::slotOK() | 282 | void KSyncPrefsDialog::slotOK() |
282 | { | 283 | { |
283 | if ( mMyMachineName->text() == "undefined" ) { | 284 | if ( mMyMachineName->text() == "undefined" ) { |
284 | KMessageBox::error(this,i18n("Local device name undefined!\nPlease define device name!"),i18n("KO/Pi config error")); | 285 | KMessageBox::error(this,i18n("Local device name undefined!\nPlease define device name!"),i18n("KO/Pi config error")); |
285 | return; | 286 | return; |
286 | } | 287 | } |
287 | int i; | 288 | int i; |
288 | for (i = 0; i < mSyncProfileNames.count(); ++ i) { | 289 | for (i = 0; i < mSyncProfileNames.count(); ++ i) { |
289 | if ( mSyncProfileNames.contains( mSyncProfileNames[i]) > 1 ) { | 290 | if ( mSyncProfileNames.contains( mSyncProfileNames[i]) > 1 ) { |
290 | KMessageBox::error(this,i18n("Multiple profiles with same name!\nPlease use unique profile names!"),i18n("KO/Pi config error")); | 291 | KMessageBox::error(this,i18n("Multiple profiles with same name!\nPlease use unique profile names!"),i18n("KO/Pi config error")); |
291 | return; | 292 | return; |
292 | } | 293 | } |
293 | } | 294 | } |
294 | usrWriteConfig(); | 295 | usrWriteConfig(); |
295 | QDialog::accept(); | 296 | QDialog::accept(); |
296 | } | 297 | } |
297 | void KSyncPrefsDialog::accept() | 298 | void KSyncPrefsDialog::accept() |
298 | { | 299 | { |
299 | slotOK(); | 300 | slotOK(); |
300 | } | 301 | } |
301 | void KSyncPrefsDialog::chooseFile() | 302 | void KSyncPrefsDialog::chooseFile() |
302 | { | 303 | { |
303 | QString fn = QDir::homeDirPath(); | 304 | QString fn = QDir::homeDirPath(); |
304 | 305 | ||
305 | fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.ics/*.vcs)"), this ); | 306 | fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.ics/*.vcs)"), this ); |
306 | if ( fn == "" ) | 307 | if ( fn == "" ) |
307 | return; | 308 | return; |
308 | mRemoteFile->setText( fn ); | 309 | mRemoteFile->setText( fn ); |
309 | } | 310 | } |
310 | 311 | ||
311 | void KSyncPrefsDialog::chooseFileAB() | 312 | void KSyncPrefsDialog::chooseFileAB() |
312 | { | 313 | { |
313 | QString fn = QDir::homeDirPath(); | 314 | QString fn = QDir::homeDirPath(); |
314 | 315 | ||
315 | fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.vcf)"), this ); | 316 | fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.vcf)"), this ); |
316 | if ( fn == "" ) | 317 | if ( fn == "" ) |
317 | return; | 318 | return; |
318 | mRemoteFileAB->setText( fn ); | 319 | mRemoteFileAB->setText( fn ); |
319 | } | 320 | } |
320 | 321 | ||
321 | void KSyncPrefsDialog::chooseFilePWM() | 322 | void KSyncPrefsDialog::chooseFilePWM() |
322 | { | 323 | { |
323 | QString fn = QDir::homeDirPath(); | 324 | QString fn = QDir::homeDirPath(); |
324 | 325 | ||
325 | fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.pwm)"), this ); | 326 | fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.pwm)"), this ); |
326 | if ( fn == "" ) | 327 | if ( fn == "" ) |
327 | return; | 328 | return; |
328 | mRemoteFilePWM->setText( fn ); | 329 | mRemoteFilePWM->setText( fn ); |
329 | } | 330 | } |
330 | 331 | ||
331 | void KSyncPrefsDialog::textChanged( const QString & s ) | 332 | void KSyncPrefsDialog::textChanged( const QString & s ) |
332 | { | 333 | { |
333 | if ( mProfileBox->count() == 0 ) | 334 | if ( mProfileBox->count() == 0 ) |
334 | return; | 335 | return; |
335 | if ( currentSelection < 3 ) { | 336 | if ( currentSelection < 3 ) { |
336 | //KMessageBox::error(this,i18n("This profil name\ncannot be edited!\n"),i18n("KO/Pi config error")); | 337 | //KMessageBox::error(this,i18n("This profil name\ncannot be edited!\n"),i18n("KO/Pi config error")); |
337 | mProfileBox->blockSignals( true ); | 338 | mProfileBox->blockSignals( true ); |
338 | mProfileBox->setCurrentItem(mProfileBox-> currentItem ()); | 339 | mProfileBox->setCurrentItem(mProfileBox-> currentItem ()); |
339 | mProfileBox->blockSignals( false ); | 340 | mProfileBox->blockSignals( false ); |
340 | return; | 341 | return; |
341 | } | 342 | } |
342 | //qDebug("cur i %d ",mProfileBox-> currentItem () ); | 343 | //qDebug("cur i %d ",mProfileBox-> currentItem () ); |
343 | mProfileBox->changeItem ( s, mProfileBox-> currentItem () ) ; | 344 | mProfileBox->changeItem ( s, mProfileBox-> currentItem () ) ; |
344 | KSyncProfile* prof = mSyncProfiles.at(mProfileBox-> currentItem ()) ; | 345 | KSyncProfile* prof = mSyncProfiles.at(mProfileBox-> currentItem ()) ; |
345 | prof->setName( s ); | 346 | prof->setName( s ); |
346 | mSyncProfileNames[mProfileBox-> currentItem ()] = s; | 347 | mSyncProfileNames[mProfileBox-> currentItem ()] = s; |
347 | } | 348 | } |
348 | void KSyncPrefsDialog::profileChanged( int item ) | 349 | void KSyncPrefsDialog::profileChanged( int item ) |
349 | { | 350 | { |
350 | //qDebug("KSyncPrefsDialog::profileChanged %d ", item ); | 351 | //qDebug("KSyncPrefsDialog::profileChanged before %d, count %d ", item, mProfileBox->count() ); |
351 | KSyncProfile* prof; | 352 | KSyncProfile* prof; |
352 | saveProfile(); | 353 | saveProfile(); |
353 | currentSelection = item; | 354 | currentSelection = item; |
354 | prof = mSyncProfiles.at(item) ; | 355 | prof = mSyncProfiles.at(item) ; |
355 | mRemotePrecommand->setText(prof->getPreSyncCommand()); | 356 | mRemotePrecommand->setText(prof->getPreSyncCommand()); |
356 | mRemotePostcommand->setText(prof->getPostSyncCommand()); | 357 | mRemotePostcommand->setText(prof->getPostSyncCommand()); |
357 | mLocalTempFile->setText(prof->getLocalTempFile()); | 358 | mLocalTempFile->setText(prof->getLocalTempFile()); |
358 | mRemoteFile->setText(prof->getRemoteFileName()) ; | 359 | mRemoteFile->setText(prof->getRemoteFileName()) ; |
359 | 360 | ||
360 | mRemotePrecommandAB->setText(prof->getPreSyncCommandAB()); | 361 | mRemotePrecommandAB->setText(prof->getPreSyncCommandAB()); |
361 | mRemotePostcommandAB->setText(prof->getPostSyncCommandAB()); | 362 | mRemotePostcommandAB->setText(prof->getPostSyncCommandAB()); |
362 | mLocalTempFileAB->setText(prof->getLocalTempFileAB()); | 363 | mLocalTempFileAB->setText(prof->getLocalTempFileAB()); |
363 | mRemoteFileAB->setText(prof->getRemoteFileNameAB()) ; | 364 | mRemoteFileAB->setText(prof->getRemoteFileNameAB()) ; |
364 | 365 | ||
365 | mRemotePrecommandPWM->setText(prof->getPreSyncCommandPWM()); | 366 | mRemotePrecommandPWM->setText(prof->getPreSyncCommandPWM()); |
366 | mRemotePostcommandPWM->setText(prof->getPostSyncCommandPWM()); | 367 | mRemotePostcommandPWM->setText(prof->getPostSyncCommandPWM()); |
367 | mLocalTempFilePWM->setText(prof->getLocalTempFilePWM()); | 368 | mLocalTempFilePWM->setText(prof->getLocalTempFilePWM()); |
368 | mRemoteFilePWM->setText(prof->getRemoteFileNamePWM()) ; | 369 | mRemoteFilePWM->setText(prof->getRemoteFileNamePWM()) ; |
369 | 370 | ||
370 | mWriteContactToSIM->setChecked( prof->getWriteContactToSIM()); | 371 | mWriteContactToSIM->setChecked( prof->getWriteContactToSIM()); |
371 | mPhoneDevice->setText(prof->getPhoneDevice()); | 372 | mPhoneDevice->setText(prof->getPhoneDevice()); |
372 | mPhoneConnection->setText(prof->getPhoneConnection()); | 373 | mPhoneConnection->setText(prof->getPhoneConnection()); |
373 | mPhoneModel->setText(prof->getPhoneModel()); | 374 | mPhoneModel->setText(prof->getPhoneModel()); |
374 | 375 | ||
375 | mShowSummaryAfterSync->setChecked( prof->getShowSummaryAfterSync()); | 376 | mShowSummaryAfterSync->setChecked( prof->getShowSummaryAfterSync()); |
376 | mAskForPreferences->setChecked( prof->getAskForPreferences()); | 377 | mAskForPreferences->setChecked( prof->getAskForPreferences()); |
377 | mWriteBackExisting->setChecked( prof->getWriteBackExisting() ); | 378 | mWriteBackExisting->setChecked( prof->getWriteBackExisting() ); |
378 | mWriteBackFile->setChecked( prof->getWriteBackFile()); | 379 | mWriteBackFile->setChecked( prof->getWriteBackFile()); |
379 | mIncludeInRing->setChecked( prof->getIncludeInRingSync() ); | 380 | mIncludeInRing->setChecked( prof->getIncludeInRingSync() ); |
380 | mIncludeInRingAB->setChecked( prof->getIncludeInRingSyncAB() ); | 381 | mIncludeInRingAB->setChecked( prof->getIncludeInRingSyncAB() ); |
381 | mIncludeInRingPWM->setChecked( prof->getIncludeInRingSyncPWM() ); | 382 | mIncludeInRingPWM->setChecked( prof->getIncludeInRingSyncPWM() ); |
382 | mWriteBackFuture->setChecked( prof->getWriteBackFuture()); | 383 | mWriteBackFuture->setChecked( prof->getWriteBackFuture()); |
383 | mWriteBackFutureWeeks->setValue( prof->getWriteBackFutureWeeks() ); | 384 | mWriteBackFutureWeeks->setValue( prof->getWriteBackFutureWeeks() ); |
384 | 385 | ||
385 | switch ( prof->getSyncPrefs() ) { | 386 | switch ( prof->getSyncPrefs() ) { |
386 | case 0: | 387 | case 0: |
387 | loc->setChecked( true); | 388 | loc->setChecked( true); |
388 | break; | 389 | break; |
389 | case 1: | 390 | case 1: |
390 | rem->setChecked( true ); | 391 | rem->setChecked( true ); |
391 | break; | 392 | break; |
392 | case 2: | 393 | case 2: |
393 | newest->setChecked( true); | 394 | newest->setChecked( true); |
394 | break; | 395 | break; |
395 | case 3: | 396 | case 3: |
396 | ask->setChecked( true); | 397 | ask->setChecked( true); |
397 | break; | 398 | break; |
398 | case 4: | 399 | case 4: |
399 | f_loc->setChecked( true); | 400 | f_loc->setChecked( true); |
400 | break; | 401 | break; |
401 | case 5: | 402 | case 5: |
402 | f_rem->setChecked( true); | 403 | f_rem->setChecked( true); |
403 | break; | 404 | break; |
404 | case 6: | 405 | case 6: |
405 | //both->setChecked( true); | 406 | //both->setChecked( true); |
406 | break; | 407 | break; |
407 | default: | 408 | default: |
408 | break; | 409 | break; |
409 | } | 410 | } |
410 | mIsLocal->setChecked(prof->getIsLocalFileSync()) ; | 411 | mIsLocal->setChecked(prof->getIsLocalFileSync()) ; |
411 | mIsPhone->setChecked(prof->getIsPhoneSync()) ; | 412 | mIsPhone->setChecked(prof->getIsPhoneSync()) ; |
412 | mIsNotLocal->setChecked(!prof->getIsLocalFileSync() && !prof->getIsPhoneSync() ); | 413 | mIsNotLocal->setChecked(!prof->getIsLocalFileSync() && !prof->getIsPhoneSync() ); |
413 | proGr->setEnabled( item > 2 ); | 414 | proGr->setEnabled( item > 2 ); |
414 | if ( item < 3 ) { | 415 | if ( item < 3 ) { |
415 | localFileWidget->hide(); | 416 | localFileWidget->hide(); |
416 | remoteFileWidget->hide(); | 417 | remoteFileWidget->hide(); |
417 | phoneWidget->hide(); | 418 | phoneWidget->hide(); |
418 | 419 | ||
419 | } else | 420 | } else |
420 | kindChanged( prof->getIsLocalFileSync() ); | 421 | kindChanged( prof->getIsLocalFileSync() ); |
421 | } | 422 | } |
422 | 423 | ||
423 | void KSyncPrefsDialog::fillSSH() | 424 | void KSyncPrefsDialog::fillSSH() |
424 | { | 425 | { |
425 | mRemotePrecommand->setText("scp zaurus@192.168.0.65:/home/zaurus/kdepim/apps/korganizer/mycalendar.ics /tmp/mycalendar.ics" ); | 426 | mRemotePrecommand->setText("scp zaurus@192.168.0.65:/home/zaurus/kdepim/apps/korganizer/mycalendar.ics /tmp/mycalendar.ics" ); |
426 | mLocalTempFile->setText("/tmp/mycalendar.ics" ); | 427 | mLocalTempFile->setText("/tmp/mycalendar.ics" ); |
427 | mRemotePostcommand->setText("scp /tmp/mycalendar.ics zaurus@192.168.0.65:/home/zaurus/kdepim/apps/korganizer/mycalendar.ics" ); | 428 | mRemotePostcommand->setText("scp /tmp/mycalendar.ics zaurus@192.168.0.65:/home/zaurus/kdepim/apps/korganizer/mycalendar.ics" ); |
428 | mRemotePrecommandAB->setText("scp zaurus@192.168.0.65:/home/zaurus/kdepim/apps/kabc/std.vcf /tmp/std.vcf" ); | 429 | mRemotePrecommandAB->setText("scp zaurus@192.168.0.65:/home/zaurus/kdepim/apps/kabc/std.vcf /tmp/std.vcf" ); |
429 | mLocalTempFileAB->setText("/tmp/std.vcf" ); | 430 | mLocalTempFileAB->setText("/tmp/std.vcf" ); |
430 | mRemotePostcommandAB->setText("scp /tmp/std.vcf zaurus@192.168.0.65:/home/zaurus/kdepim/apps/kabc/std.vcf" ); | 431 | mRemotePostcommandAB->setText("scp /tmp/std.vcf zaurus@192.168.0.65:/home/zaurus/kdepim/apps/kabc/std.vcf" ); |
431 | mRemotePrecommandPWM->setText("scp zaurus@192.168.0.65:/home/zaurus/kdepim/apps/pwmanager/passwords.pwm /tmp/passwords.pwm" ); | 432 | mRemotePrecommandPWM->setText("scp zaurus@192.168.0.65:/home/zaurus/kdepim/apps/pwmanager/passwords.pwm /tmp/passwords.pwm" ); |
432 | mLocalTempFilePWM->setText("/tmp/passwords.pwm" ); | 433 | mLocalTempFilePWM->setText("/tmp/passwords.pwm" ); |
433 | mRemotePostcommandPWM->setText("scp /tmp/passwords.pwm zaurus@192.168.0.65:/home/zaurus/kdepim/apps/pwmanager/pwmanager.pwm" ); | 434 | mRemotePostcommandPWM->setText("scp /tmp/passwords.pwm zaurus@192.168.0.65:/home/zaurus/kdepim/apps/pwmanager/pwmanager.pwm" ); |
434 | } | 435 | } |
435 | void KSyncPrefsDialog::fillFTP() | 436 | void KSyncPrefsDialog::fillFTP() |
436 | { | 437 | { |
437 | mRemotePrecommand->setText("cd /tmp;ftp ftp://zaurus:a@192.168.0.65/kdepim/apps/korganizer/mycalendar.ics" ); | 438 | mRemotePrecommand->setText("cd /tmp;ftp ftp://zaurus:a@192.168.0.65/kdepim/apps/korganizer/mycalendar.ics" ); |
438 | mLocalTempFile->setText("/tmp/mycalendar.ics" ); | 439 | mLocalTempFile->setText("/tmp/mycalendar.ics" ); |
439 | mRemotePostcommand->setText("ftp -u ftp://zaurus:a@192.168.0.65/kdepim/apps/korganizer/mycalendar.ics /tmp/mycalendar.ics" ); | 440 | mRemotePostcommand->setText("ftp -u ftp://zaurus:a@192.168.0.65/kdepim/apps/korganizer/mycalendar.ics /tmp/mycalendar.ics" ); |
440 | mRemotePrecommandAB->setText("cd /tmp;ftp ftp://zaurus:a@192.168.0.65/kdepim/apps/kabc/std.vcf" ); | 441 | mRemotePrecommandAB->setText("cd /tmp;ftp ftp://zaurus:a@192.168.0.65/kdepim/apps/kabc/std.vcf" ); |
441 | mLocalTempFileAB->setText("/tmp/std.vcf" ); | 442 | mLocalTempFileAB->setText("/tmp/std.vcf" ); |
442 | mRemotePostcommandAB->setText("ftp -u ftp://zaurus:a@192.168.0.65/kdepim/apps/kabc/std.vcf /tmp/std.vcf" ); | 443 | mRemotePostcommandAB->setText("ftp -u ftp://zaurus:a@192.168.0.65/kdepim/apps/kabc/std.vcf /tmp/std.vcf" ); |
443 | 444 | ||
444 | mRemotePrecommandPWM->setText("cd /tmp;ftp ftp://zaurus:a@192.168.0.65/kdepim/apps/pwmanager/passwords.pwm" ); | 445 | mRemotePrecommandPWM->setText("cd /tmp;ftp ftp://zaurus:a@192.168.0.65/kdepim/apps/pwmanager/passwords.pwm" ); |
445 | mLocalTempFilePWM->setText("/tmp/passwords.pwm" ); | 446 | mLocalTempFilePWM->setText("/tmp/passwords.pwm" ); |
446 | mRemotePostcommandPWM->setText("ftp -u ftp://zaurus:a@192.168.0.65/kdepim/apps/pwmanager/passwords.pwm /tmp/passwords.pwm" ); | 447 | mRemotePostcommandPWM->setText("ftp -u ftp://zaurus:a@192.168.0.65/kdepim/apps/pwmanager/passwords.pwm /tmp/passwords.pwm" ); |
447 | 448 | ||
448 | } | 449 | } |
449 | void KSyncPrefsDialog::kindChanged( bool b ) | 450 | void KSyncPrefsDialog::kindChanged( bool b ) |
450 | { | 451 | { |
451 | 452 | ||
452 | if ( mIsLocal->isChecked () ) | 453 | if ( mIsLocal->isChecked () ) |
453 | localFileWidget->show(); | 454 | localFileWidget->show(); |
454 | else | 455 | else |
455 | localFileWidget->hide(); | 456 | localFileWidget->hide(); |
456 | 457 | ||
457 | if ( mIsNotLocal->isChecked () ) | 458 | if ( mIsNotLocal->isChecked () ) |
458 | remoteFileWidget->show(); | 459 | remoteFileWidget->show(); |
459 | else | 460 | else |
460 | remoteFileWidget->hide(); | 461 | remoteFileWidget->hide(); |
461 | 462 | ||
462 | if ( mIsPhone->isChecked () ) { | 463 | if ( mIsPhone->isChecked () ) { |
463 | phoneWidget->show(); | 464 | phoneWidget->show(); |
464 | } | 465 | } |
465 | else { | 466 | else { |
466 | phoneWidget->hide(); | 467 | phoneWidget->hide(); |
467 | } | 468 | } |
468 | 469 | ||
469 | } | 470 | } |
470 | void KSyncPrefsDialog::deleteProfile() | 471 | void KSyncPrefsDialog::deleteProfile() |
471 | { | 472 | { |
472 | //qDebug("KSyncPrefsDialog::deleteProfile() "); | 473 | //qDebug("KSyncPrefsDialog::deleteProfile() "); |
473 | if ( currentSelection >= 0 ) { | 474 | if ( currentSelection >= 0 ) { |
474 | if ( currentSelection < 3 ) { | 475 | if ( currentSelection < 3 ) { |
475 | KMessageBox::error(this,i18n("This profil cannot be deleted!\n"),i18n("KO/Pi config error")); | 476 | KMessageBox::error(this,i18n("This profil cannot be deleted!\n"),i18n("KO/Pi config error")); |
476 | return; | 477 | return; |
477 | } | 478 | } |
478 | KSyncProfile* temp = mSyncProfiles.at(currentSelection); | 479 | KSyncProfile* temp = mSyncProfiles.at(currentSelection); |
479 | mSyncProfiles.remove( temp ); | 480 | mSyncProfiles.remove( temp ); |
480 | mSyncProfileNames.remove( mSyncProfileNames.at( currentSelection )); | 481 | mSyncProfileNames.remove( mSyncProfileNames.at( currentSelection )); |
481 | insertProfiles(); | 482 | insertProfiles(); |
482 | } | 483 | } |
483 | } | 484 | } |
484 | 485 | ||
485 | void KSyncPrefsDialog::saveProfile() | 486 | void KSyncPrefsDialog::saveProfile() |
486 | { | 487 | { |
487 | KSyncProfile* prof; | 488 | KSyncProfile* prof; |
488 | if ( currentSelection >= 0 ) { | 489 | if ( currentSelection >= 0 ) { |
489 | prof = mSyncProfiles.at(currentSelection) ; | 490 | prof = mSyncProfiles.at(currentSelection) ; |
490 | prof->setPreSyncCommand( mRemotePrecommand->text()); | 491 | prof->setPreSyncCommand( mRemotePrecommand->text()); |
491 | prof->setPostSyncCommand( mRemotePostcommand->text() ); | 492 | prof->setPostSyncCommand( mRemotePostcommand->text() ); |
492 | prof->setLocalTempFile( mLocalTempFile->text()); | 493 | prof->setLocalTempFile( mLocalTempFile->text()); |
493 | prof->setRemoteFileName( mRemoteFile->text() ); | 494 | prof->setRemoteFileName( mRemoteFile->text() ); |
494 | prof->setPreSyncCommandAB( mRemotePrecommandAB->text()); | 495 | prof->setPreSyncCommandAB( mRemotePrecommandAB->text()); |
495 | prof->setPostSyncCommandAB( mRemotePostcommandAB->text() ); | 496 | prof->setPostSyncCommandAB( mRemotePostcommandAB->text() ); |
496 | prof->setLocalTempFileAB( mLocalTempFileAB->text()); | 497 | prof->setLocalTempFileAB( mLocalTempFileAB->text()); |
497 | prof->setRemoteFileNameAB( mRemoteFileAB->text() ); | 498 | prof->setRemoteFileNameAB( mRemoteFileAB->text() ); |
498 | prof->setPreSyncCommandPWM( mRemotePrecommandPWM->text()); | 499 | prof->setPreSyncCommandPWM( mRemotePrecommandPWM->text()); |
499 | prof->setPostSyncCommandPWM( mRemotePostcommandPWM->text() ); | 500 | prof->setPostSyncCommandPWM( mRemotePostcommandPWM->text() ); |
500 | prof->setLocalTempFilePWM( mLocalTempFilePWM->text()); | 501 | prof->setLocalTempFilePWM( mLocalTempFilePWM->text()); |
501 | prof->setRemoteFileNamePWM( mRemoteFilePWM->text() ); | 502 | prof->setRemoteFileNamePWM( mRemoteFilePWM->text() ); |
502 | prof->setShowSummaryAfterSync( mShowSummaryAfterSync->isChecked() ); | 503 | prof->setShowSummaryAfterSync( mShowSummaryAfterSync->isChecked() ); |
503 | prof->setAskForPreferences( mAskForPreferences->isChecked()); | 504 | prof->setAskForPreferences( mAskForPreferences->isChecked()); |
504 | prof->setWriteBackExisting(mWriteBackExisting->isChecked() ); | 505 | prof->setWriteBackExisting(mWriteBackExisting->isChecked() ); |
505 | prof->setWriteBackFile( mWriteBackFile->isChecked()); | 506 | prof->setWriteBackFile( mWriteBackFile->isChecked()); |
506 | prof->setIncludeInRingSync( mIncludeInRing->isChecked() ); | 507 | prof->setIncludeInRingSync( mIncludeInRing->isChecked() ); |
507 | prof->setIncludeInRingSyncAB( mIncludeInRingAB->isChecked() ); | 508 | prof->setIncludeInRingSyncAB( mIncludeInRingAB->isChecked() ); |
508 | prof->setIncludeInRingSyncPWM( mIncludeInRingPWM->isChecked() ); | 509 | prof->setIncludeInRingSyncPWM( mIncludeInRingPWM->isChecked() ); |
509 | int syncprefs = rem->isChecked()*1+newest->isChecked()*2+ ask->isChecked()*3+ f_loc->isChecked()*4+ f_rem->isChecked()*5 ;//+ both->isChecked()*6 ; | 510 | int syncprefs = rem->isChecked()*1+newest->isChecked()*2+ ask->isChecked()*3+ f_loc->isChecked()*4+ f_rem->isChecked()*5 ;//+ both->isChecked()*6 ; |
510 | prof->setSyncPrefs( syncprefs); | 511 | prof->setSyncPrefs( syncprefs); |
511 | prof->setIsLocalFileSync( mIsLocal->isChecked() ); | 512 | prof->setIsLocalFileSync( mIsLocal->isChecked() ); |
512 | prof->setIsPhoneSync( mIsPhone->isChecked() ); | 513 | prof->setIsPhoneSync( mIsPhone->isChecked() ); |
513 | prof->setWriteBackFuture(mWriteBackFuture->isChecked()); | 514 | prof->setWriteBackFuture(mWriteBackFuture->isChecked()); |
514 | prof->setWriteBackFutureWeeks(mWriteBackFutureWeeks->value()); | 515 | prof->setWriteBackFutureWeeks(mWriteBackFutureWeeks->value()); |
515 | 516 | ||
516 | prof->setWriteContactToSIM(mWriteContactToSIM->isChecked()); | 517 | prof->setWriteContactToSIM(mWriteContactToSIM->isChecked()); |
517 | prof->setPhoneDevice( mPhoneDevice->text() ); | 518 | prof->setPhoneDevice( mPhoneDevice->text() ); |
518 | prof->setPhoneConnection( mPhoneConnection->text() ); | 519 | prof->setPhoneConnection( mPhoneConnection->text() ); |
519 | prof->setPhoneModel( mPhoneModel->text() ); | 520 | prof->setPhoneModel( mPhoneModel->text() ); |
520 | 521 | ||
521 | } | 522 | } |
522 | 523 | ||
523 | } | 524 | } |
524 | 525 | ||
525 | void KSyncPrefsDialog::insertProfiles() | 526 | void KSyncPrefsDialog::insertProfiles() |
526 | { | 527 | { |
527 | int curItem = mProfileBox->currentItem(); | 528 | int curItem = mProfileBox->currentItem(); |
528 | mProfileBox->blockSignals( true ); | 529 | mProfileBox->blockSignals( true ); |
529 | mProfileBox->clear(); | 530 | mProfileBox->clear(); |
530 | mProfileBox->insertStringList (mSyncProfileNames ); | 531 | mProfileBox->insertStringList (mSyncProfileNames ); |
531 | int item = mSyncProfileNames.count() -1; | 532 | int item = mSyncProfileNames.count() -1; |
532 | if ( curItem >= 0 && mSyncProfileNames.count() > 0 && curItem < mSyncProfileNames.count() ) | 533 | if ( curItem >= 0 && mSyncProfileNames.count() > 0 && curItem < mSyncProfileNames.count() ) |
533 | mProfileBox->setCurrentItem( curItem ); | 534 | mProfileBox->setCurrentItem( curItem ); |
534 | else if ( item >= 0 ) { | 535 | else if ( item >= 0 ) { |
535 | mProfileBox->setCurrentItem( item ); | 536 | mProfileBox->setCurrentItem( item ); |
536 | } | 537 | } |
537 | currentSelection = -1; | 538 | currentSelection = -1; |
538 | if ( mSyncProfileNames.count() > 0 ) { | 539 | if ( mSyncProfileNames.count() > 0 ) { |
539 | //qDebug(" profileChanged( mProfileBox->currentItem() "); | 540 | //qDebug(" profileChanged( mProfileBox->currentItem() "); |
540 | profileChanged( mProfileBox->currentItem() ); | 541 | profileChanged( mProfileBox->currentItem() ); |
541 | currentSelection = mProfileBox->currentItem(); | 542 | currentSelection = mProfileBox->currentItem(); |
542 | } | 543 | } |
543 | mProfileBox->blockSignals( false ); | 544 | mProfileBox->blockSignals( false ); |
544 | } | 545 | } |
545 | 546 | ||
546 | void KSyncPrefsDialog::addProfile ( KSyncProfile* temp ) | 547 | void KSyncPrefsDialog::addProfile ( KSyncProfile* temp ) |
547 | { | 548 | { |
548 | saveProfile(); | 549 | saveProfile(); |
549 | mSyncProfiles.append( temp ); | 550 | mSyncProfiles.append( temp ); |
550 | mSyncProfileNames << temp->getName(); | 551 | mSyncProfileNames << temp->getName(); |
551 | insertProfiles(); | 552 | insertProfiles(); |
552 | int last = mProfileBox->count() -1; | 553 | int last = mProfileBox->count() -1; |
553 | mProfileBox->blockSignals( true ); | 554 | mProfileBox->blockSignals( true ); |
554 | mProfileBox->setCurrentItem( last ); | 555 | mProfileBox->setCurrentItem( last ); |
555 | mProfileBox->blockSignals( false ); | 556 | mProfileBox->blockSignals( false ); |
556 | profileChanged(last); | 557 | profileChanged(last); |
557 | } | 558 | } |
558 | void KSyncPrefsDialog::newProfile() | 559 | void KSyncPrefsDialog::newProfile() |
559 | { | 560 | { |
560 | addProfile ( new KSyncProfile () ); | 561 | addProfile ( new KSyncProfile () ); |
561 | } | 562 | } |
562 | 563 | ||
563 | void KSyncPrefsDialog::cloneProfile() | 564 | void KSyncPrefsDialog::cloneProfile() |
564 | { | 565 | { |
565 | if ( currentSelection >= 0 ) | 566 | if ( currentSelection >= 0 ) |
566 | addProfile (mSyncProfiles.at(currentSelection)->clone()) ; | 567 | addProfile (mSyncProfiles.at(currentSelection)->clone()) ; |
567 | else | 568 | else |
568 | newProfile(); | 569 | newProfile(); |
569 | } | 570 | } |
570 | 571 | ||
571 | void KSyncPrefsDialog::setLocalMachineName ( const QString& name ) | 572 | void KSyncPrefsDialog::setLocalMachineName ( const QString& name ) |
572 | { | 573 | { |
573 | mMyMachineName->setText( name ); | 574 | mMyMachineName->setText( name ); |
574 | 575 | ||
575 | } | 576 | } |
576 | QString KSyncPrefsDialog::getLocalMachineName ( ) | 577 | QString KSyncPrefsDialog::getLocalMachineName ( ) |
577 | { | 578 | { |
578 | return mMyMachineName->text(); | 579 | return mMyMachineName->text(); |
579 | } | 580 | } |
580 | 581 | ||
581 | QStringList KSyncPrefsDialog::getSyncProfileNames() | 582 | QStringList KSyncPrefsDialog::getSyncProfileNames() |
582 | { | 583 | { |
583 | return mSyncProfileNames; | 584 | return mSyncProfileNames; |
584 | } | 585 | } |
585 | void KSyncPrefsDialog::usrReadConfig() | 586 | void KSyncPrefsDialog::usrReadConfig() |
586 | { | 587 | { |
587 | //KConfig *config = KOGlobals::config(); | 588 | //KConfig *config = KOGlobals::config(); |
588 | KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); | 589 | KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); |
589 | config.setGroup("General"); | 590 | config.setGroup("General"); |
590 | mSyncProfileNames =config.readListEntry("SyncProfileNames"); | 591 | mSyncProfileNames =config.readListEntry("SyncProfileNames"); |
591 | mMyMachineName->setText(config.readEntry("LocalMachineName","undefined")); | 592 | mMyMachineName->setText(config.readEntry("LocalMachineName","undefined")); |
592 | int i; | 593 | int i; |
593 | KSyncProfile* temp ; | 594 | KSyncProfile* temp ; |
594 | mSyncProfiles.clear(); | 595 | mSyncProfiles.clear(); |
595 | for ( i = 0; i < mSyncProfileNames.count();++i ) { | 596 | for ( i = 0; i < mSyncProfileNames.count();++i ) { |
596 | temp = new KSyncProfile (); | 597 | temp = new KSyncProfile (); |
597 | temp->setName( mSyncProfileNames[i] ); | 598 | temp->setName( mSyncProfileNames[i] ); |
598 | temp->readConfig( &config ); | 599 | temp->readConfig( &config ); |
599 | mSyncProfiles.append( temp ); | 600 | mSyncProfiles.append( temp ); |
600 | } | 601 | } |
601 | insertProfiles(); | 602 | insertProfiles(); |
602 | //mMyMachineName->setText(KOPrefs::instance()->mLocalMachineName ); | 603 | //mMyMachineName->setText(KOPrefs::instance()->mLocalMachineName ); |
603 | } | 604 | } |
604 | 605 | ||
605 | 606 | ||
606 | void KSyncPrefsDialog::usrWriteConfig() | 607 | void KSyncPrefsDialog::usrWriteConfig() |
607 | { | 608 | { |
608 | saveProfile(); | 609 | saveProfile(); |
609 | if ( currentSelection >= 0 ) | 610 | if ( currentSelection >= 0 ) |
610 | profileChanged(currentSelection); | 611 | profileChanged(currentSelection); |
611 | //KConfig *config = KOGlobals::config(); | 612 | //KConfig *config = KOGlobals::config(); |
612 | KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); | 613 | KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); |
613 | KSyncProfile* prof = mSyncProfiles.first(); | 614 | KSyncProfile* prof = mSyncProfiles.first(); |
614 | QStringList externalSyncProfileNames; | 615 | QStringList externalSyncProfileNames; |
615 | externalSyncProfileNames.append("Sharp_DTM");; | 616 | externalSyncProfileNames.append("Sharp_DTM");; |
616 | while ( prof ) { | 617 | while ( prof ) { |
617 | prof->writeConfig(&config); | 618 | prof->writeConfig(&config); |
618 | if ( prof->getIsPhoneSync( ) ) | 619 | if ( prof->getIsPhoneSync( ) ) |
619 | externalSyncProfileNames.append(prof->getName( ) ); | 620 | externalSyncProfileNames.append(prof->getName( ) ); |
620 | prof = mSyncProfiles.next(); | 621 | prof = mSyncProfiles.next(); |
621 | } | 622 | } |
622 | //KOPrefs::instance()->mSyncProfileNames = mSyncProfileNames; | 623 | //KOPrefs::instance()->mSyncProfileNames = mSyncProfileNames; |
623 | //KOPrefs::instance()->mLocalMachineName = mMyMachineName->text(); | 624 | //KOPrefs::instance()->mLocalMachineName = mMyMachineName->text(); |
624 | config.setGroup("General"); | 625 | config.setGroup("General"); |
625 | config.writeEntry("SyncProfileNames",mSyncProfileNames); | 626 | config.writeEntry("SyncProfileNames",mSyncProfileNames); |
626 | config.writeEntry("ExternSyncProfiles",externalSyncProfileNames); | 627 | config.writeEntry("ExternSyncProfiles",externalSyncProfileNames); |
627 | config.writeEntry("LocalMachineName",mMyMachineName->text()); | 628 | config.writeEntry("LocalMachineName",mMyMachineName->text()); |
628 | config.sync(); | 629 | config.sync(); |
629 | } | 630 | } |
630 | 631 | ||
631 | void KSyncPrefsDialog::helpDevice() | 632 | void KSyncPrefsDialog::helpDevice() |
632 | { | 633 | { |
633 | QString hint = i18n("Insert device where\nphone is connected. E.g.:\n"); | 634 | QString hint = i18n("Insert device where\nphone is connected. E.g.:\n"); |
634 | #ifdef _WIN32_ | 635 | #ifdef _WIN32_ |
635 | hint += "Leave empty for Irda.\n" | 636 | hint += "Leave empty for Irda.\n" |
636 | "com1:\n(first serial port)\n" | 637 | "com1:\n(first serial port)\n" |
637 | "usb not supported\n" | 638 | "usb not supported\n" |
638 | "???\n(bluetooth device address)\n"; | 639 | "???\n(bluetooth device address)\n"; |
639 | 640 | ||
640 | #else | 641 | #else |
641 | hint += "/dev/ircomm\n(Irda)\n" | 642 | hint += "/dev/ircomm\n(Irda)\n" |
642 | "/dev/ttyS0\n(first serial port)\n" | 643 | "/dev/ttyS0\n(first serial port)\n" |
643 | "/dev/ttyUSB0\n(first device usb port)\n" | 644 | "/dev/ttyUSB0\n(first device usb port)\n" |
644 | "???\n(bluetooth device address)\n"; | 645 | "???\n(bluetooth device address)\n"; |
645 | #endif | 646 | #endif |
646 | KMessageBox::information(this,hint,i18n("KDE-Pim sync config")); | 647 | KMessageBox::information(this,hint,i18n("KDE-Pim sync config")); |
647 | } | 648 | } |
648 | void KSyncPrefsDialog::helpModel() | 649 | void KSyncPrefsDialog::helpModel() |
649 | { | 650 | { |
650 | QString hint = i18n("Leave empty or\ninsert name of phone model:\n"); | 651 | QString hint = i18n("Leave empty or\ninsert name of phone model:\n"); |
651 | hint += "E.g. for Nokia 6310i:\n6310i\nAlso possible:\nobex\nfor Obex connection"; | 652 | hint += "E.g. for Nokia 6310i:\n6310i\nAlso possible:\nobex\nfor Obex connection"; |
652 | KMessageBox::information(this,hint,i18n("KDE-Pim sync config")); | 653 | KMessageBox::information(this,hint,i18n("KDE-Pim sync config")); |
653 | 654 | ||
654 | } | 655 | } |
655 | void KSyncPrefsDialog::helpConnection() | 656 | void KSyncPrefsDialog::helpConnection() |
656 | { | 657 | { |
657 | QString hint = i18n("Insert kind of connection,e.g.:\n"); | 658 | QString hint = i18n("Insert kind of connection,e.g.:\n"); |
658 | hint += "irda | Nokia FBUS over infrared\n" | 659 | hint += "irda | Nokia FBUS over infrared\n" |
659 | "irdaat | AT commands infrared\n(for Siemens/Sony-Erricsson)\n" | 660 | "irdaat | AT commands infrared\n(for Siemens/Sony-Erricsson)\n" |
660 | "irdaobex | set also model as obex\n" | 661 | "irdaobex | set also model as obex\n" |
661 | "fbus | Nokia FBUS2 serial\n"; | 662 | "fbus | Nokia FBUS2 serial\n"; |
662 | KMessageBox::information(this,hint,i18n("KDE-Pim sync config")); | 663 | KMessageBox::information(this,hint,i18n("KDE-Pim sync config")); |
663 | } | 664 | } |
diff --git a/libkdepim/ksyncprofile.cpp b/libkdepim/ksyncprofile.cpp index a43ebe2..2bf4e6c 100644 --- a/libkdepim/ksyncprofile.cpp +++ b/libkdepim/ksyncprofile.cpp | |||
@@ -1,199 +1,199 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KDE-Pim/Pi. | 2 | This file is part of KDE-Pim/Pi. |
3 | Copyright (c) 2004 Lutz Rogowski <rogowski@kde.org> | 3 | Copyright (c) 2004 Lutz Rogowski <rogowski@kde.org> |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library 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 GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | // $Id$ | 21 | // $Id$ |
22 | 22 | ||
23 | #include <qcolor.h> | 23 | #include <qcolor.h> |
24 | 24 | ||
25 | #include <kconfig.h> | 25 | #include <kconfig.h> |
26 | #include <kstandarddirs.h> | 26 | #include <kstandarddirs.h> |
27 | #include <kglobal.h> | 27 | #include <kglobal.h> |
28 | #include <kdebug.h> | 28 | #include <kdebug.h> |
29 | 29 | ||
30 | #include "ksyncprofile.h" | 30 | #include "ksyncprofile.h" |
31 | 31 | ||
32 | 32 | ||
33 | KSyncProfile::KSyncProfile(): QObject () | 33 | KSyncProfile::KSyncProfile(): QObject () |
34 | { | 34 | { |
35 | setDefault(); | 35 | setDefault(); |
36 | } | 36 | } |
37 | KSyncProfile::~KSyncProfile() | 37 | KSyncProfile::~KSyncProfile() |
38 | { | 38 | { |
39 | 39 | ||
40 | } | 40 | } |
41 | 41 | ||
42 | 42 | ||
43 | KSyncProfile* KSyncProfile::clone() | 43 | KSyncProfile* KSyncProfile::clone() |
44 | { | 44 | { |
45 | KSyncProfile* myClone = new KSyncProfile(); | 45 | KSyncProfile* myClone = new KSyncProfile(); |
46 | myClone->setPreSyncCommand( mPreSyncCommand ); | 46 | myClone->setPreSyncCommand( mPreSyncCommand ); |
47 | myClone->setPostSyncCommand( mPostSyncCommand ); | 47 | myClone->setPostSyncCommand( mPostSyncCommand ); |
48 | myClone->setLocalTempFile( mLocalTempFile); | 48 | myClone->setLocalTempFile( mLocalTempFile); |
49 | myClone->setRemoteFileName( mRemoteFileName ); | 49 | myClone->setRemoteFileName( mRemoteFileName ); |
50 | myClone->setPreSyncCommandAB( mPreSyncCommandAB ); | 50 | myClone->setPreSyncCommandAB( mPreSyncCommandAB ); |
51 | myClone->setPostSyncCommandAB( mPostSyncCommandAB ); | 51 | myClone->setPostSyncCommandAB( mPostSyncCommandAB ); |
52 | myClone->setLocalTempFileAB( mLocalTempFileAB); | 52 | myClone->setLocalTempFileAB( mLocalTempFileAB); |
53 | myClone->setRemoteFileNameAB( mRemoteFileNameAB ); | 53 | myClone->setRemoteFileNameAB( mRemoteFileNameAB ); |
54 | myClone->setPreSyncCommandPWM( mPreSyncCommandPWM ); | 54 | myClone->setPreSyncCommandPWM( mPreSyncCommandPWM ); |
55 | myClone->setPostSyncCommandPWM( mPostSyncCommandPWM ); | 55 | myClone->setPostSyncCommandPWM( mPostSyncCommandPWM ); |
56 | myClone->setLocalTempFilePWM( mLocalTempFilePWM); | 56 | myClone->setLocalTempFilePWM( mLocalTempFilePWM); |
57 | myClone->setRemoteFileNamePWM( mRemoteFileNamePWM ); | 57 | myClone->setRemoteFileNamePWM( mRemoteFileNamePWM ); |
58 | myClone->setShowSummaryAfterSync( mShowSummaryAfterSync ); | 58 | myClone->setShowSummaryAfterSync( mShowSummaryAfterSync ); |
59 | myClone->setAskForPreferences( mAskForPreferences); | 59 | myClone->setAskForPreferences( mAskForPreferences); |
60 | myClone->setWriteBackExisting(mWriteBackExisting ); | 60 | myClone->setWriteBackExisting(mWriteBackExisting ); |
61 | myClone->setWriteBackFile( mWriteBackFile); | 61 | myClone->setWriteBackFile( mWriteBackFile); |
62 | myClone->setWriteBackFuture( mWriteBackFuture ); | 62 | myClone->setWriteBackFuture( mWriteBackFuture ); |
63 | myClone->setWriteBackFutureWeeks( mWriteBackFutureWeeks ); | 63 | myClone->setWriteBackFutureWeeks( mWriteBackFutureWeeks ); |
64 | myClone->setIncludeInRingSync( mIncludeInRingSync ); | 64 | myClone->setIncludeInRingSync( mIncludeInRingSync ); |
65 | myClone->setIncludeInRingSyncAB( mIncludeInRingSyncAB ); | 65 | myClone->setIncludeInRingSyncAB( mIncludeInRingSyncAB ); |
66 | myClone->setIncludeInRingSyncPWM( mIncludeInRingSyncPWM ); | 66 | myClone->setIncludeInRingSyncPWM( mIncludeInRingSyncPWM ); |
67 | myClone->setSyncPrefs( mSyncPrefs); | 67 | myClone->setSyncPrefs( mSyncPrefs); |
68 | myClone->setIsLocalFileSync( mIsLocalFileSync ); | 68 | myClone->setIsLocalFileSync( mIsLocalFileSync ); |
69 | myClone->setIsPhoneSync( mIsPhoneSync ); | 69 | myClone->setIsPhoneSync( mIsPhoneSync ); |
70 | myClone->setWriteContactToSIM( mWriteContactToSIM ); | 70 | myClone->setWriteContactToSIM( mWriteContactToSIM ); |
71 | myClone->setName( "noName" ); | 71 | myClone->setName( "noName" ); |
72 | //myClone->setIdentifier( "noID" ); | 72 | //myClone->setIdentifier( "noID" ); |
73 | return myClone; | 73 | return myClone; |
74 | } | 74 | } |
75 | 75 | ||
76 | 76 | ||
77 | void KSyncProfile::setDefault() | 77 | void KSyncProfile::setDefault() |
78 | { | 78 | { |
79 | mPreSyncCommand = i18n("command for downloading remote file to local device"); | 79 | mPreSyncCommand = i18n("command for downloading remote file to local device"); |
80 | mPostSyncCommand = i18n("command for uploading local temp file to remote device"); | 80 | mPostSyncCommand = i18n("command for uploading local temp file to remote device"); |
81 | mLocalTempFile = "/tmp/mycalendar.ics"; | 81 | mLocalTempFile = "/tmp/mycalendar.ics"; |
82 | mRemoteFileName = "/home/polo/kdepim/apps/korganizer/localfile.ics"; | 82 | mRemoteFileName = "/home/polo/kdepim/apps/korganizer/localfile.ics"; |
83 | mPreSyncCommandAB = i18n("command for downloading remote file to local device"); | 83 | mPreSyncCommandAB = i18n("command for downloading remote file to local device"); |
84 | mPostSyncCommandAB = i18n("command for uploading local temp file to remote device"); | 84 | mPostSyncCommandAB = i18n("command for uploading local temp file to remote device"); |
85 | mLocalTempFileAB = "/tmp/std.vcf"; | 85 | mLocalTempFileAB = "/tmp/std.vcf"; |
86 | mRemoteFileNamePWM = "/home/polo/kdepim/apps/kabc/localfile.vcf"; | 86 | mRemoteFileNameAB = "/home/polo/kdepim/apps/kabc/localfile.vcf"; |
87 | mPreSyncCommandPWM = i18n("command for downloading remote file to local device"); | 87 | mPreSyncCommandPWM = i18n("command for downloading remote file to local device"); |
88 | mPostSyncCommandPWM = i18n("command for uploading local temp file to remote device"); | 88 | mPostSyncCommandPWM = i18n("command for uploading local temp file to remote device"); |
89 | mLocalTempFilePWM = "/tmp/passwords.pwm"; | 89 | mLocalTempFilePWM = "/tmp/passwords.pwm"; |
90 | mRemoteFileNamePWM = "/home/polo/kdepim/apps/pwmanager/localfile.pwm"; | 90 | mRemoteFileNamePWM = "/home/polo/kdepim/apps/pwmanager/localfile.pwm"; |
91 | mShowSummaryAfterSync = true; | 91 | mShowSummaryAfterSync = true; |
92 | mAskForPreferences = true; | 92 | mAskForPreferences = true; |
93 | mWriteBackExisting = false; | 93 | mWriteBackExisting = false; |
94 | mWriteBackFuture = false; | 94 | mWriteBackFuture = false; |
95 | mWriteBackFutureWeeks = 12; | 95 | mWriteBackFutureWeeks = 12; |
96 | mWriteBackFile = true; | 96 | mWriteBackFile = true; |
97 | mIncludeInRingSync = false; | 97 | mIncludeInRingSync = false; |
98 | mIncludeInRingSyncAB = false; | 98 | mIncludeInRingSyncAB = false; |
99 | mIncludeInRingSyncPWM = false; | 99 | mIncludeInRingSyncPWM = false; |
100 | mSyncPrefs = SYNC_PREF_ASK; | 100 | mSyncPrefs = SYNC_PREF_ASK; |
101 | mIsLocalFileSync = true; | 101 | mIsLocalFileSync = true; |
102 | mName = "noName"; | 102 | mName = "noName"; |
103 | mIsPhoneSync = false; | 103 | mIsPhoneSync = false; |
104 | mWriteContactToSIM = false; | 104 | mWriteContactToSIM = false; |
105 | mPhoneDevice = "/dev/ircomm"; | 105 | mPhoneDevice = "/dev/ircomm"; |
106 | mPhoneConnection = "irda"; | 106 | mPhoneConnection = "irda"; |
107 | mPhoneModel = "6310i"; | 107 | mPhoneModel = "6310i"; |
108 | } | 108 | } |
109 | void KSyncProfile::readConfig(KConfig *config ) | 109 | void KSyncProfile::readConfig(KConfig *config ) |
110 | { | 110 | { |
111 | if (config) | 111 | if (config) |
112 | { | 112 | { |
113 | 113 | ||
114 | config->setGroup( mName ); | 114 | config->setGroup( mName ); |
115 | 115 | ||
116 | mName = config->readEntry( "Name", mName ); | 116 | mName = config->readEntry( "Name", mName ); |
117 | mPreSyncCommand = config->readEntry( "PreSyncCommand",mPreSyncCommand ); | 117 | mPreSyncCommand = config->readEntry( "PreSyncCommand",mPreSyncCommand ); |
118 | mPostSyncCommand = config->readEntry( "PostSyncCommand", mPostSyncCommand ); | 118 | mPostSyncCommand = config->readEntry( "PostSyncCommand", mPostSyncCommand ); |
119 | mLocalTempFile = config->readEntry( "LocalTempFile", mLocalTempFile ); | 119 | mLocalTempFile = config->readEntry( "LocalTempFile", mLocalTempFile ); |
120 | mRemoteFileName = config->readEntry( "RemoteFileName", mRemoteFileName ); | 120 | mRemoteFileName = config->readEntry( "RemoteFileName", mRemoteFileName ); |
121 | 121 | ||
122 | mPreSyncCommandAB = config->readEntry( "PreSyncCommandAB",mPreSyncCommandAB ); | 122 | mPreSyncCommandAB = config->readEntry( "PreSyncCommandAB",mPreSyncCommandAB ); |
123 | mPostSyncCommandAB = config->readEntry( "PostSyncCommandAB", mPostSyncCommandAB ); | 123 | mPostSyncCommandAB = config->readEntry( "PostSyncCommandAB", mPostSyncCommandAB ); |
124 | mLocalTempFileAB = config->readEntry( "LocalTempFileAB", mLocalTempFileAB ); | 124 | mLocalTempFileAB = config->readEntry( "LocalTempFileAB", mLocalTempFileAB ); |
125 | mRemoteFileNameAB = config->readEntry( "RemoteFileNameAB", mRemoteFileNameAB ); | 125 | mRemoteFileNameAB = config->readEntry( "RemoteFileNameAB", mRemoteFileNameAB ); |
126 | 126 | ||
127 | mPreSyncCommandPWM = config->readEntry( "PreSyncCommandPWM",mPreSyncCommandPWM ); | 127 | mPreSyncCommandPWM = config->readEntry( "PreSyncCommandPWM",mPreSyncCommandPWM ); |
128 | mPostSyncCommandPWM = config->readEntry( "PostSyncCommandPWM", mPostSyncCommandPWM ); | 128 | mPostSyncCommandPWM = config->readEntry( "PostSyncCommandPWM", mPostSyncCommandPWM ); |
129 | mLocalTempFilePWM = config->readEntry( "LocalTempFilePWM", mLocalTempFilePWM ); | 129 | mLocalTempFilePWM = config->readEntry( "LocalTempFilePWM", mLocalTempFilePWM ); |
130 | mRemoteFileNamePWM = config->readEntry( "RemoteFileNamePWM", mRemoteFileNamePWM ); | 130 | mRemoteFileNamePWM = config->readEntry( "RemoteFileNamePWM", mRemoteFileNamePWM ); |
131 | 131 | ||
132 | mPhoneDevice = config->readEntry( "PhoneDevice", mPhoneDevice ); | 132 | mPhoneDevice = config->readEntry( "PhoneDevice", mPhoneDevice ); |
133 | mPhoneConnection = config->readEntry( "PhoneConnection", mPhoneConnection ); | 133 | mPhoneConnection = config->readEntry( "PhoneConnection", mPhoneConnection ); |
134 | mPhoneModel = config->readEntry( "PhoneModel", mPhoneModel ); | 134 | mPhoneModel = config->readEntry( "PhoneModel", mPhoneModel ); |
135 | 135 | ||
136 | mIncludeInRingSync = config->readBoolEntry( "IncludeInRingSync",mIncludeInRingSync ); | 136 | mIncludeInRingSync = config->readBoolEntry( "IncludeInRingSync",mIncludeInRingSync ); |
137 | mIncludeInRingSyncAB = config->readBoolEntry( "IncludeInRingSyncAB",mIncludeInRingSyncAB ); | 137 | mIncludeInRingSyncAB = config->readBoolEntry( "IncludeInRingSyncAB",mIncludeInRingSyncAB ); |
138 | mIncludeInRingSyncPWM = config->readBoolEntry( "IncludeInRingSyncPWM",mIncludeInRingSyncPWM ); | 138 | mIncludeInRingSyncPWM = config->readBoolEntry( "IncludeInRingSyncPWM",mIncludeInRingSyncPWM ); |
139 | mShowSummaryAfterSync = config->readBoolEntry( "ShowSummaryAfterSync", mShowSummaryAfterSync ); | 139 | mShowSummaryAfterSync = config->readBoolEntry( "ShowSummaryAfterSync", mShowSummaryAfterSync ); |
140 | mAskForPreferences = config->readBoolEntry( "AskForPreferences",mAskForPreferences ); | 140 | mAskForPreferences = config->readBoolEntry( "AskForPreferences",mAskForPreferences ); |
141 | mWriteBackExisting = config->readBoolEntry( "WriteBackExisting",mWriteBackExisting ); | 141 | mWriteBackExisting = config->readBoolEntry( "WriteBackExisting",mWriteBackExisting ); |
142 | mWriteBackFuture = config->readBoolEntry( "WriteBackFuture",mWriteBackFuture ); | 142 | mWriteBackFuture = config->readBoolEntry( "WriteBackFuture",mWriteBackFuture ); |
143 | mWriteBackFile = config->readBoolEntry( "WriteBackFile",mWriteBackFile ); | 143 | mWriteBackFile = config->readBoolEntry( "WriteBackFile",mWriteBackFile ); |
144 | mWriteContactToSIM = config->readBoolEntry( "WriteContactToSIM",mWriteContactToSIM ); | 144 | mWriteContactToSIM = config->readBoolEntry( "WriteContactToSIM",mWriteContactToSIM ); |
145 | mSyncPrefs = config->readNumEntry( "SyncPrefs", mSyncPrefs ); | 145 | mSyncPrefs = config->readNumEntry( "SyncPrefs", mSyncPrefs ); |
146 | mWriteBackFutureWeeks = config->readNumEntry( "WriteBackFutureWeeks", mWriteBackFutureWeeks ); | 146 | mWriteBackFutureWeeks = config->readNumEntry( "WriteBackFutureWeeks", mWriteBackFutureWeeks ); |
147 | mIsLocalFileSync= config->readBoolEntry( "IsLocalFileSync", mIsLocalFileSync ); | 147 | mIsLocalFileSync= config->readBoolEntry( "IsLocalFileSync", mIsLocalFileSync ); |
148 | mIsPhoneSync= config->readBoolEntry( "IsPhoneSync", mIsPhoneSync ); | 148 | mIsPhoneSync= config->readBoolEntry( "IsPhoneSync", mIsPhoneSync ); |
149 | } | 149 | } |
150 | else | 150 | else |
151 | { | 151 | { |
152 | setDefault(); | 152 | setDefault(); |
153 | } | 153 | } |
154 | } | 154 | } |
155 | 155 | ||
156 | void KSyncProfile::deleteConfig(KConfig *config ) | 156 | void KSyncProfile::deleteConfig(KConfig *config ) |
157 | { | 157 | { |
158 | config->deleteGroup( mName ); | 158 | config->deleteGroup( mName ); |
159 | } | 159 | } |
160 | 160 | ||
161 | void KSyncProfile::writeConfig( KConfig * config ) | 161 | void KSyncProfile::writeConfig( KConfig * config ) |
162 | { | 162 | { |
163 | config->setGroup(mName); | 163 | config->setGroup(mName); |
164 | 164 | ||
165 | config->writeEntry( "Name", mName ); | 165 | config->writeEntry( "Name", mName ); |
166 | config->writeEntry( "PreSyncCommand",mPreSyncCommand ); | 166 | config->writeEntry( "PreSyncCommand",mPreSyncCommand ); |
167 | config->writeEntry( "PostSyncCommand", mPostSyncCommand ); | 167 | config->writeEntry( "PostSyncCommand", mPostSyncCommand ); |
168 | config->writeEntry( "LocalTempFile", mLocalTempFile ); | 168 | config->writeEntry( "LocalTempFile", mLocalTempFile ); |
169 | config->writeEntry( "RemoteFileName", mRemoteFileName ); | 169 | config->writeEntry( "RemoteFileName", mRemoteFileName ); |
170 | 170 | ||
171 | config->writeEntry( "PreSyncCommandAB",mPreSyncCommandAB ); | 171 | config->writeEntry( "PreSyncCommandAB",mPreSyncCommandAB ); |
172 | config->writeEntry( "PostSyncCommandAB", mPostSyncCommandAB ); | 172 | config->writeEntry( "PostSyncCommandAB", mPostSyncCommandAB ); |
173 | config->writeEntry( "LocalTempFileAB", mLocalTempFileAB ); | 173 | config->writeEntry( "LocalTempFileAB", mLocalTempFileAB ); |
174 | config->writeEntry( "RemoteFileNameAB", mRemoteFileNameAB ); | 174 | config->writeEntry( "RemoteFileNameAB", mRemoteFileNameAB ); |
175 | 175 | ||
176 | config->writeEntry( "PreSyncCommandPWM",mPreSyncCommandPWM ); | 176 | config->writeEntry( "PreSyncCommandPWM",mPreSyncCommandPWM ); |
177 | config->writeEntry( "PostSyncCommandPWM", mPostSyncCommandPWM ); | 177 | config->writeEntry( "PostSyncCommandPWM", mPostSyncCommandPWM ); |
178 | config->writeEntry( "LocalTempFilePWM", mLocalTempFilePWM ); | 178 | config->writeEntry( "LocalTempFilePWM", mLocalTempFilePWM ); |
179 | config->writeEntry( "RemoteFileNamePWM", mRemoteFileNamePWM ); | 179 | config->writeEntry( "RemoteFileNamePWM", mRemoteFileNamePWM ); |
180 | 180 | ||
181 | config->writeEntry( "PhoneDevice", mPhoneDevice ); | 181 | config->writeEntry( "PhoneDevice", mPhoneDevice ); |
182 | config->writeEntry( "PhoneConnection", mPhoneConnection ); | 182 | config->writeEntry( "PhoneConnection", mPhoneConnection ); |
183 | config->writeEntry( "PhoneModel", mPhoneModel ); | 183 | config->writeEntry( "PhoneModel", mPhoneModel ); |
184 | 184 | ||
185 | config->writeEntry( "IncludeInRingSync",mIncludeInRingSync ); | 185 | config->writeEntry( "IncludeInRingSync",mIncludeInRingSync ); |
186 | config->writeEntry( "IncludeInRingSyncAB",mIncludeInRingSyncAB ); | 186 | config->writeEntry( "IncludeInRingSyncAB",mIncludeInRingSyncAB ); |
187 | config->writeEntry( "IncludeInRingSyncPWM",mIncludeInRingSyncPWM ); | 187 | config->writeEntry( "IncludeInRingSyncPWM",mIncludeInRingSyncPWM ); |
188 | config->writeEntry( "ShowSummaryAfterSync", mShowSummaryAfterSync ); | 188 | config->writeEntry( "ShowSummaryAfterSync", mShowSummaryAfterSync ); |
189 | config->writeEntry( "AskForPreferences",mAskForPreferences ); | 189 | config->writeEntry( "AskForPreferences",mAskForPreferences ); |
190 | config->writeEntry( "WriteBackExisting",mWriteBackExisting ); | 190 | config->writeEntry( "WriteBackExisting",mWriteBackExisting ); |
191 | config->writeEntry( "WriteBackFuture",mWriteBackFuture ); | 191 | config->writeEntry( "WriteBackFuture",mWriteBackFuture ); |
192 | config->writeEntry( "WriteBackFile",mWriteBackFile ); | 192 | config->writeEntry( "WriteBackFile",mWriteBackFile ); |
193 | config->writeEntry( "WriteContactToSIM",mWriteContactToSIM ); | 193 | config->writeEntry( "WriteContactToSIM",mWriteContactToSIM ); |
194 | config->writeEntry( "SyncPrefs", mSyncPrefs ); | 194 | config->writeEntry( "SyncPrefs", mSyncPrefs ); |
195 | config->writeEntry( "WriteBackFutureWeeks", mWriteBackFutureWeeks); | 195 | config->writeEntry( "WriteBackFutureWeeks", mWriteBackFutureWeeks); |
196 | config->writeEntry( "IsLocalFileSync", mIsLocalFileSync ); | 196 | config->writeEntry( "IsLocalFileSync", mIsLocalFileSync ); |
197 | config->writeEntry( "IsPhoneSync", mIsPhoneSync ); | 197 | config->writeEntry( "IsPhoneSync", mIsPhoneSync ); |
198 | } | 198 | } |
199 | 199 | ||