summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2004-08-01 19:29:37 (UTC)
committer zautrix <zautrix>2004-08-01 19:29:37 (UTC)
commit062113379f93ed645d2f246183c89eb8b6814834 (patch) (unidiff)
tree34e3a96d06b40d24c19c4e6814a65f290734563d
parent3bdbe8154381abc3fca2aaf5c055b59c2f8637a2 (diff)
downloadkdepimpi-062113379f93ed645d2f246183c89eb8b6814834.zip
kdepimpi-062113379f93ed645d2f246183c89eb8b6814834.tar.gz
kdepimpi-062113379f93ed645d2f246183c89eb8b6814834.tar.bz2
sync dialog fixes
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/mainwindow.cpp10
-rw-r--r--libkdepim/ksyncprefsdialog.cpp9
-rw-r--r--libkdepim/ksyncprofile.cpp8
3 files changed, 13 insertions, 14 deletions
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 298fa82..44b1264 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -1,1995 +1,1995 @@
1#include <stdlib.h> 1#include <stdlib.h>
2 2
3#include <qaction.h> 3#include <qaction.h>
4#include <qpopupmenu.h> 4#include <qpopupmenu.h>
5#include <qpainter.h> 5#include <qpainter.h>
6#include <qwhatsthis.h> 6#include <qwhatsthis.h>
7#include <qmessagebox.h> 7#include <qmessagebox.h>
8#include <qlineedit.h> 8#include <qlineedit.h>
9#include <qfile.h> 9#include <qfile.h>
10#include <qdir.h> 10#include <qdir.h>
11#include <qapp.h> 11#include <qapp.h>
12#include <qfileinfo.h> 12#include <qfileinfo.h>
13#include <qlabel.h> 13#include <qlabel.h>
14#include <qwmatrix.h> 14#include <qwmatrix.h>
15#include <qtextbrowser.h> 15#include <qtextbrowser.h>
16#include <qtextstream.h> 16#include <qtextstream.h>
17#ifndef DESKTOP_VERSION 17#ifndef DESKTOP_VERSION
18#include <qpe/global.h> 18#include <qpe/global.h>
19#include <qpe/qpemenubar.h> 19#include <qpe/qpemenubar.h>
20#include <qpe/qpetoolbar.h> 20#include <qpe/qpetoolbar.h>
21#include <qpe/resource.h> 21#include <qpe/resource.h>
22#include <qpe/qpeapplication.h> 22#include <qpe/qpeapplication.h>
23#include <qtopia/alarmserver.h> 23#include <qtopia/alarmserver.h>
24#include <qtopia/qcopenvelope_qws.h> 24#include <qtopia/qcopenvelope_qws.h>
25#else 25#else
26#include <qmenubar.h> 26#include <qmenubar.h>
27#include <qtoolbar.h> 27#include <qtoolbar.h>
28#include <qapplication.h> 28#include <qapplication.h>
29//#include <resource.h> 29//#include <resource.h>
30 30
31#endif 31#endif
32#include <libkcal/calendarlocal.h> 32#include <libkcal/calendarlocal.h>
33#include <libkcal/todo.h> 33#include <libkcal/todo.h>
34#include <libkdepim/ksyncprofile.h> 34#include <libkdepim/ksyncprofile.h>
35#include <libkdepim/kincidenceformatter.h> 35#include <libkdepim/kincidenceformatter.h>
36 36
37#include "calendarview.h" 37#include "calendarview.h"
38#include "koviewmanager.h" 38#include "koviewmanager.h"
39#include "datenavigator.h" 39#include "datenavigator.h"
40#include "koagendaview.h" 40#include "koagendaview.h"
41#include "koagenda.h" 41#include "koagenda.h"
42#include "kodialogmanager.h" 42#include "kodialogmanager.h"
43#include "kdialogbase.h" 43#include "kdialogbase.h"
44#include "kstandarddirs.h" 44#include "kstandarddirs.h"
45#include "koprefs.h" 45#include "koprefs.h"
46#include "kfiledialog.h" 46#include "kfiledialog.h"
47#include "koglobals.h" 47#include "koglobals.h"
48#include "kglobal.h" 48#include "kglobal.h"
49#include "klocale.h" 49#include "klocale.h"
50#include "kconfig.h" 50#include "kconfig.h"
51#include "simplealarmclient.h" 51#include "simplealarmclient.h"
52using namespace KCal; 52using namespace KCal;
53#ifndef _WIN32_ 53#ifndef _WIN32_
54#include <unistd.h> 54#include <unistd.h>
55#else 55#else
56#include "koimportoldialog.h" 56#include "koimportoldialog.h"
57#endif 57#endif
58#include "mainwindow.h" 58#include "mainwindow.h"
59 59
60int globalFlagBlockStartup; 60int globalFlagBlockStartup;
61MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : 61MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) :
62 QMainWindow( parent, name ) 62 QMainWindow( parent, name )
63{ 63{
64 64
65#ifdef DESKTOP_VERSION 65#ifdef DESKTOP_VERSION
66 setFont( QFont("Arial"), 14 ); 66 setFont( QFont("Arial"), 14 );
67#endif 67#endif
68 68
69 //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; 69 //QString confFile = KStandardDirs::appDir() + "config/korganizerrc";
70 QString confFile = locateLocal("config","korganizerrc"); 70 QString confFile = locateLocal("config","korganizerrc");
71 QFileInfo finf ( confFile ); 71 QFileInfo finf ( confFile );
72 bool showWarning = !finf.exists(); 72 bool showWarning = !finf.exists();
73 setIcon(SmallIcon( "ko24" ) ); 73 setIcon(SmallIcon( "ko24" ) );
74 mBlockAtStartup = true; 74 mBlockAtStartup = true;
75 mFlagKeyPressed = false; 75 mFlagKeyPressed = false;
76 setCaption("KOrganizer/Pi"); 76 setCaption("KOrganizer/Pi");
77 KOPrefs *p = KOPrefs::instance(); 77 KOPrefs *p = KOPrefs::instance();
78 // if ( QApplication::desktop()->height() > 480 ) { 78 // if ( QApplication::desktop()->height() > 480 ) {
79// if ( p->mHourSize == 4 ) 79// if ( p->mHourSize == 4 )
80// p->mHourSize = 6; 80// p->mHourSize = 6;
81// } 81// }
82 if ( p->mHourSize > 18 ) 82 if ( p->mHourSize > 18 )
83 p->mHourSize = 18; 83 p->mHourSize = 18;
84 QMainWindow::ToolBarDock tbd; 84 QMainWindow::ToolBarDock tbd;
85 if ( p->mToolBarHor ) { 85 if ( p->mToolBarHor ) {
86 if ( p->mToolBarUp ) 86 if ( p->mToolBarUp )
87 tbd = Bottom; 87 tbd = Bottom;
88 else 88 else
89 tbd = Top; 89 tbd = Top;
90 } 90 }
91 else { 91 else {
92 if ( p->mToolBarUp ) 92 if ( p->mToolBarUp )
93 tbd = Right; 93 tbd = Right;
94 else 94 else
95 tbd = Left; 95 tbd = Left;
96 } 96 }
97 if ( KOPrefs::instance()->mUseAppColors ) 97 if ( KOPrefs::instance()->mUseAppColors )
98 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); 98 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true );
99 globalFlagBlockStartup = 1; 99 globalFlagBlockStartup = 1;
100 iconToolBar = new QPEToolBar( this ); 100 iconToolBar = new QPEToolBar( this );
101 addToolBar (iconToolBar , tbd ); 101 addToolBar (iconToolBar , tbd );
102 mBlockSaveFlag = false; 102 mBlockSaveFlag = false;
103 mCalendarModifiedFlag = false; 103 mCalendarModifiedFlag = false;
104 104
105 QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); 105 QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this );
106 splash->setAlignment ( AlignCenter ); 106 splash->setAlignment ( AlignCenter );
107 setCentralWidget( splash ); 107 setCentralWidget( splash );
108#ifndef DESKTOP_VERSION 108#ifndef DESKTOP_VERSION
109 showMaximized(); 109 showMaximized();
110#endif 110#endif
111 //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); 111 //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ());
112 setDefaultPreferences(); 112 setDefaultPreferences();
113 mCalendar = new CalendarLocal(); 113 mCalendar = new CalendarLocal();
114 mView = new CalendarView( mCalendar, this,"mCalendar " ); 114 mView = new CalendarView( mCalendar, this,"mCalendar " );
115 mView->hide(); 115 mView->hide();
116 //mView->resize(splash->size() ); 116 //mView->resize(splash->size() );
117 initActions(); 117 initActions();
118#ifndef DESKTOP_VERSION 118#ifndef DESKTOP_VERSION
119 iconToolBar->show(); 119 iconToolBar->show();
120 qApp->processEvents(); 120 qApp->processEvents();
121#endif 121#endif
122 //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); 122 //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ());
123 int vh = height() ; 123 int vh = height() ;
124 int vw = width(); 124 int vw = width();
125 //qDebug("Toolbar hei %d ",iconToolBar->height() ); 125 //qDebug("Toolbar hei %d ",iconToolBar->height() );
126 if ( iconToolBar->orientation () == Qt:: Horizontal ) { 126 if ( iconToolBar->orientation () == Qt:: Horizontal ) {
127 vh -= iconToolBar->height(); 127 vh -= iconToolBar->height();
128 } else { 128 } else {
129 vw -= iconToolBar->height(); 129 vw -= iconToolBar->height();
130 } 130 }
131 //mView->setMaximumSize( splash->size() ); 131 //mView->setMaximumSize( splash->size() );
132 //mView->resize( splash->size() ); 132 //mView->resize( splash->size() );
133 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); 133 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ());
134 mView->readSettings(); 134 mView->readSettings();
135 bool oldOpened = false; 135 bool oldOpened = false;
136 bool newFile = false; 136 bool newFile = false;
137 if( !QFile::exists( defaultFileName() ) ) { 137 if( !QFile::exists( defaultFileName() ) ) {
138 QFileInfo finfo ( defaultFileName() ); 138 QFileInfo finfo ( defaultFileName() );
139 QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); 139 QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics");
140 qDebug("oldfile %s ", oldFile.latin1()); 140 qDebug("oldfile %s ", oldFile.latin1());
141 QString message = "You are starting KO/Pi for the\nfirst time after updating to a\nversion >= 1.9.1. The location of the\ndefault calendar file has changed.\nA mycalendar.ics file was detected\nat the old location.\nThis file will be loaded now\nand stored at the new location!\n(Config file location has changed, too!)\nPlease read menu Help-What's New!\n"; 141 QString message = "You are starting KO/Pi for the\nfirst time after updating to a\nversion >= 1.9.1. The location of the\ndefault calendar file has changed.\nA mycalendar.ics file was detected\nat the old location.\nThis file will be loaded now\nand stored at the new location!\n(Config file location has changed, too!)\nPlease read menu Help-What's New!\n";
142 finfo.setFile( oldFile ); 142 finfo.setFile( oldFile );
143 if (finfo.exists() ) { 143 if (finfo.exists() ) {
144 KMessageBox::information( this, message); 144 KMessageBox::information( this, message);
145 mView->openCalendar( oldFile ); 145 mView->openCalendar( oldFile );
146 qApp->processEvents(); 146 qApp->processEvents();
147 } else { 147 } else {
148 oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); 148 oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics");
149 finfo.setFile( oldFile ); 149 finfo.setFile( oldFile );
150 if (finfo.exists() ) { 150 if (finfo.exists() ) {
151 KMessageBox::information( this, message); 151 KMessageBox::information( this, message);
152 mView->openCalendar( oldFile ); 152 mView->openCalendar( oldFile );
153 qApp->processEvents(); 153 qApp->processEvents();
154 } 154 }
155 } 155 }
156 mView->saveCalendar( defaultFileName() ); 156 mView->saveCalendar( defaultFileName() );
157 newFile = true; 157 newFile = true;
158 } 158 }
159 159
160 QTime neededSaveTime = QDateTime::currentDateTime().time(); 160 QTime neededSaveTime = QDateTime::currentDateTime().time();
161 if ( ! oldOpened ) 161 if ( ! oldOpened )
162 mView->openCalendar( defaultFileName() ); 162 mView->openCalendar( defaultFileName() );
163 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); 163 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
164 qDebug("KO: Calendar loading time: %d ms",msNeeded ); 164 qDebug("KO: Calendar loading time: %d ms",msNeeded );
165 165
166 if ( KOPrefs::instance()->mLanguageChanged ) { 166 if ( KOPrefs::instance()->mLanguageChanged ) {
167 KOPrefs::instance()->setCategoryDefaults(); 167 KOPrefs::instance()->setCategoryDefaults();
168 int count = mView->addCategories(); 168 int count = mView->addCategories();
169 KOPrefs::instance()->mLanguageChanged = false; 169 KOPrefs::instance()->mLanguageChanged = false;
170 } 170 }
171 processIncidenceSelection( 0 ); 171 processIncidenceSelection( 0 );
172 connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), 172 connect( mView, SIGNAL( incidenceSelected( Incidence * ) ),
173 SLOT( processIncidenceSelection( Incidence * ) ) ); 173 SLOT( processIncidenceSelection( Incidence * ) ) );
174 connect( mView, SIGNAL( modifiedChanged( bool ) ), 174 connect( mView, SIGNAL( modifiedChanged( bool ) ),
175 SLOT( slotModifiedChanged( bool ) ) ); 175 SLOT( slotModifiedChanged( bool ) ) );
176 176
177 177
178 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); 178 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) );
179 mView->setModified( false ); 179 mView->setModified( false );
180 mBlockAtStartup = false; 180 mBlockAtStartup = false;
181 mView->setModified( false ); 181 mView->setModified( false );
182 setCentralWidget( mView ); 182 setCentralWidget( mView );
183 globalFlagBlockStartup = 0; 183 globalFlagBlockStartup = 0;
184 mView->show(); 184 mView->show();
185 delete splash; 185 delete splash;
186 if ( newFile ) 186 if ( newFile )
187 mView->updateConfig(); 187 mView->updateConfig();
188 // qApp->processEvents(); 188 // qApp->processEvents();
189 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); 189 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ());
190 fillSyncMenu(); 190 fillSyncMenu();
191 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); 191 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins );
192 if ( showWarning ) { 192 if ( showWarning ) {
193 KMessageBox::information( this, 193 KMessageBox::information( this,
194 "You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information"); 194 "You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information");
195 qApp->processEvents(); 195 qApp->processEvents();
196 mView->dialogManager()->showSyncOptions(); 196 mView->dialogManager()->showSyncOptions();
197 } 197 }
198} 198}
199MainWindow::~MainWindow() 199MainWindow::~MainWindow()
200{ 200{
201 //qDebug("MainWindow::~MainWindow() "); 201 //qDebug("MainWindow::~MainWindow() ");
202 //save toolbar location 202 //save toolbar location
203 203
204 delete mCalendar; 204 delete mCalendar;
205 delete KOPrefs::instance(); 205 delete KOPrefs::instance();
206 delete KIncidenceFormatter::instance(); 206 delete KIncidenceFormatter::instance();
207 207
208 208
209} 209}
210void MainWindow::closeEvent( QCloseEvent* ce ) 210void MainWindow::closeEvent( QCloseEvent* ce )
211{ 211{
212 212
213 213
214 214
215 if ( ! KOPrefs::instance()->mAskForQuit ) { 215 if ( ! KOPrefs::instance()->mAskForQuit ) {
216 saveOnClose(); 216 saveOnClose();
217 ce->accept(); 217 ce->accept();
218 return; 218 return;
219 219
220 } 220 }
221 221
222 switch( QMessageBox::information( this, "KO/Pi", 222 switch( QMessageBox::information( this, "KO/Pi",
223 i18n("Do you really want\nto close KO/Pi?"), 223 i18n("Do you really want\nto close KO/Pi?"),
224 i18n("Close"), i18n("No"), 224 i18n("Close"), i18n("No"),
225 0, 0 ) ) { 225 0, 0 ) ) {
226 case 0: 226 case 0:
227 saveOnClose(); 227 saveOnClose();
228 ce->accept(); 228 ce->accept();
229 break; 229 break;
230 case 1: 230 case 1:
231 ce->ignore(); 231 ce->ignore();
232 break; 232 break;
233 case 2: 233 case 2:
234 234
235 default: 235 default:
236 break; 236 break;
237 } 237 }
238 238
239 239
240} 240}
241 241
242void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) 242void MainWindow::recieve( const QCString& cmsg, const QByteArray& data )
243{ 243{
244 QDataStream stream( data, IO_ReadOnly ); 244 QDataStream stream( data, IO_ReadOnly );
245 // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); 245 // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" );
246 //QString datamess; 246 //QString datamess;
247 //qDebug("message "); 247 //qDebug("message ");
248 qDebug("KO: QCOP message received: %s ", cmsg.data() ); 248 qDebug("KO: QCOP message received: %s ", cmsg.data() );
249 if ( cmsg == "-writeFile" ) { 249 if ( cmsg == "-writeFile" ) {
250 // I made from the "-writeFile" an "-writeAlarm" 250 // I made from the "-writeFile" an "-writeAlarm"
251 mView->viewManager()->showWhatsNextView(); 251 mView->viewManager()->showWhatsNextView();
252 mCalendar->checkAlarmForIncidence( 0, true); 252 mCalendar->checkAlarmForIncidence( 0, true);
253 showMaximized(); 253 showMaximized();
254 raise(); 254 raise();
255 return; 255 return;
256 256
257 } 257 }
258 if ( cmsg == "-writeFileSilent" ) { 258 if ( cmsg == "-writeFileSilent" ) {
259 // I made from the "-writeFile" an "-writeAlarm" 259 // I made from the "-writeFile" an "-writeAlarm"
260 // mView->viewManager()->showWhatsNextView(); 260 // mView->viewManager()->showWhatsNextView();
261 mCalendar->checkAlarmForIncidence( 0, true); 261 mCalendar->checkAlarmForIncidence( 0, true);
262 //showMaximized(); 262 //showMaximized();
263 //raise(); 263 //raise();
264 hide(); 264 hide();
265 return; 265 return;
266 } 266 }
267 if ( cmsg == "-newCountdown" ) { 267 if ( cmsg == "-newCountdown" ) {
268 qDebug("newCountdown "); 268 qDebug("newCountdown ");
269 269
270 } 270 }
271 QString msg ; 271 QString msg ;
272 QString allmsg = cmsg; 272 QString allmsg = cmsg;
273 while ( allmsg.length() > 0 ) { 273 while ( allmsg.length() > 0 ) {
274 int nextC = allmsg.find( "-", 1 ); 274 int nextC = allmsg.find( "-", 1 );
275 if ( nextC == -1 ) { 275 if ( nextC == -1 ) {
276 msg = allmsg; 276 msg = allmsg;
277 allmsg = ""; 277 allmsg = "";
278 } else{ 278 } else{
279 msg = allmsg.left( nextC ); 279 msg = allmsg.left( nextC );
280 allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); 280 allmsg = allmsg.mid( nextC, allmsg.length()-nextC );
281 } 281 }
282 //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); 282 //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() );
283 if ( msg == "-newEvent" ) { 283 if ( msg == "-newEvent" ) {
284 mView->newEvent(); 284 mView->newEvent();
285 } 285 }
286 if ( msg == "-newTodo" ) { 286 if ( msg == "-newTodo" ) {
287 mView->newTodo(); 287 mView->newTodo();
288 288
289 } 289 }
290 if ( msg == "-showWN" ) { 290 if ( msg == "-showWN" ) {
291 mView->viewManager()->showWhatsNextView(); 291 mView->viewManager()->showWhatsNextView();
292 } 292 }
293 if ( msg == "-showTodo" ) { 293 if ( msg == "-showTodo" ) {
294 mView->viewManager()->showTodoView(); 294 mView->viewManager()->showTodoView();
295 } 295 }
296 if ( msg == "-showList" ) { 296 if ( msg == "-showList" ) {
297 mView->viewManager()->showListView(); 297 mView->viewManager()->showListView();
298 } 298 }
299 else if ( msg == "-showDay" ) { 299 else if ( msg == "-showDay" ) {
300 mView->viewManager()->showDayView(); 300 mView->viewManager()->showDayView();
301 } 301 }
302 else if ( msg == "-showWWeek" ) { 302 else if ( msg == "-showWWeek" ) {
303 mView->viewManager()->showWorkWeekView(); 303 mView->viewManager()->showWorkWeekView();
304 } 304 }
305 else if ( msg == "-ringSync" ) { 305 else if ( msg == "-ringSync" ) {
306 multiSync( false ); 306 multiSync( false );
307 } 307 }
308 else if ( msg == "-showWeek" ) { 308 else if ( msg == "-showWeek" ) {
309 mView->viewManager()->showWeekView(); 309 mView->viewManager()->showWeekView();
310 } 310 }
311 else if ( msg == "-showTodo" ) { 311 else if ( msg == "-showTodo" ) {
312 mView->viewManager()->showTodoView(); 312 mView->viewManager()->showTodoView();
313 } 313 }
314 else if ( msg == "-showJournal" ) { 314 else if ( msg == "-showJournal" ) {
315 mView->dateNavigator()->selectDates( 1 ); 315 mView->dateNavigator()->selectDates( 1 );
316 mView->dateNavigator()->selectToday(); 316 mView->dateNavigator()->selectToday();
317 mView->viewManager()->showJournalView(); 317 mView->viewManager()->showJournalView();
318 } 318 }
319 else if ( msg == "-showKO" ) { 319 else if ( msg == "-showKO" ) {
320 mView->viewManager()->showNextXView(); 320 mView->viewManager()->showNextXView();
321 } 321 }
322 else if ( msg == "-showWNext" || msg == "nextView()" ) { 322 else if ( msg == "-showWNext" || msg == "nextView()" ) {
323 mView->viewManager()->showWhatsNextView(); 323 mView->viewManager()->showWhatsNextView();
324 } 324 }
325 else if ( msg == "-showNextXView" ) { 325 else if ( msg == "-showNextXView" ) {
326 mView->viewManager()->showNextXView(); 326 mView->viewManager()->showNextXView();
327 } 327 }
328 328
329 329
330 } 330 }
331 331
332 showMaximized(); 332 showMaximized();
333 raise(); 333 raise();
334} 334}
335 335
336QPixmap MainWindow::loadPixmap( QString name ) 336QPixmap MainWindow::loadPixmap( QString name )
337{ 337{
338 return SmallIcon( name ); 338 return SmallIcon( name );
339 339
340} 340}
341void MainWindow::initActions() 341void MainWindow::initActions()
342{ 342{
343 //KOPrefs::instance()->mShowFullMenu 343 //KOPrefs::instance()->mShowFullMenu
344 iconToolBar->clear(); 344 iconToolBar->clear();
345 KOPrefs *p = KOPrefs::instance(); 345 KOPrefs *p = KOPrefs::instance();
346 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); 346 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar );
347 347
348 QPopupMenu *viewMenu = new QPopupMenu( this ); 348 QPopupMenu *viewMenu = new QPopupMenu( this );
349 QPopupMenu *actionMenu = new QPopupMenu( this ); 349 QPopupMenu *actionMenu = new QPopupMenu( this );
350 QPopupMenu *importMenu = new QPopupMenu( this ); 350 QPopupMenu *importMenu = new QPopupMenu( this );
351 351
352 syncMenu = new QPopupMenu( this ); 352 syncMenu = new QPopupMenu( this );
353 configureAgendaMenu = new QPopupMenu( this ); 353 configureAgendaMenu = new QPopupMenu( this );
354 configureToolBarMenu = new QPopupMenu( this ); 354 configureToolBarMenu = new QPopupMenu( this );
355 QPopupMenu *helpMenu = new QPopupMenu( this ); 355 QPopupMenu *helpMenu = new QPopupMenu( this );
356 if ( KOPrefs::instance()->mShowFullMenu ) { 356 if ( KOPrefs::instance()->mShowFullMenu ) {
357 QMenuBar *menuBar1; 357 QMenuBar *menuBar1;
358 menuBar1 = menuBar(); 358 menuBar1 = menuBar();
359 menuBar1->insertItem( i18n("File"), importMenu ); 359 menuBar1->insertItem( i18n("File"), importMenu );
360 menuBar1->insertItem( i18n("View"), viewMenu ); 360 menuBar1->insertItem( i18n("View"), viewMenu );
361 menuBar1->insertItem( i18n("Actions"), actionMenu ); 361 menuBar1->insertItem( i18n("Actions"), actionMenu );
362 menuBar1->insertItem( i18n("Synchronize"), syncMenu ); 362 menuBar1->insertItem( i18n("Synchronize"), syncMenu );
363 menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); 363 menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu );
364 //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); 364 //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu );
365 menuBar1->insertItem( i18n("Help"), helpMenu ); 365 menuBar1->insertItem( i18n("Help"), helpMenu );
366 } else { 366 } else {
367 QPEMenuBar *menuBar1; 367 QPEMenuBar *menuBar1;
368 menuBar1 = new QPEMenuBar( iconToolBar ); 368 menuBar1 = new QPEMenuBar( iconToolBar );
369 QPopupMenu *menuBar = new QPopupMenu( this ); 369 QPopupMenu *menuBar = new QPopupMenu( this );
370 menuBar1->insertItem( i18n("ME"), menuBar); 370 menuBar1->insertItem( i18n("ME"), menuBar);
371 menuBar->insertItem( i18n("File"), importMenu ); 371 menuBar->insertItem( i18n("File"), importMenu );
372 menuBar->insertItem( i18n("View"), viewMenu ); 372 menuBar->insertItem( i18n("View"), viewMenu );
373 menuBar->insertItem( i18n("Actions"), actionMenu ); 373 menuBar->insertItem( i18n("Actions"), actionMenu );
374 menuBar->insertItem( i18n("Synchronize"), syncMenu ); 374 menuBar->insertItem( i18n("Synchronize"), syncMenu );
375 menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); 375 menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu );
376 menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); 376 menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu );
377 menuBar->insertItem( i18n("Help"), helpMenu ); 377 menuBar->insertItem( i18n("Help"), helpMenu );
378 //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); 378 //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() );
379 menuBar1->setMaximumSize( menuBar1->sizeHint( )); 379 menuBar1->setMaximumSize( menuBar1->sizeHint( ));
380 } 380 }
381 connect ( syncMenu, SIGNAL( activated ( int ) ), this, SLOT (slotSyncMenu( int ) ) ); 381 connect ( syncMenu, SIGNAL( activated ( int ) ), this, SLOT (slotSyncMenu( int ) ) );
382 // ****************** 382 // ******************
383 QAction *action; 383 QAction *action;
384 QIconSet icon; 384 QIconSet icon;
385 // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); 385 // QPopupMenu *configureMenu= new QPopupMenu( menuBar );
386 configureToolBarMenu->setCheckable( true ); 386 configureToolBarMenu->setCheckable( true );
387 387
388 QString pathString = ""; 388 QString pathString = "";
389 if ( !p->mToolBarMiniIcons ) { 389 if ( !p->mToolBarMiniIcons ) {
390 if ( QApplication::desktop()->width() < 480 ) 390 if ( QApplication::desktop()->width() < 480 )
391 pathString += "icons16/"; 391 pathString += "icons16/";
392 } else 392 } else
393 pathString += "iconsmini/"; 393 pathString += "iconsmini/";
394 configureAgendaMenu->setCheckable( true ); 394 configureAgendaMenu->setCheckable( true );
395 configureAgendaMenu->insertItem(i18n("Toggle Allday"), 1 ); 395 configureAgendaMenu->insertItem(i18n("Toggle Allday"), 1 );
396 configureAgendaMenu->insertSeparator(); 396 configureAgendaMenu->insertSeparator();
397 configureAgendaMenu->insertItem(i18n("Tiny"), 4 ); 397 configureAgendaMenu->insertItem(i18n("Tiny"), 4 );
398 configureAgendaMenu->insertItem(i18n("Small"), 6 ); 398 configureAgendaMenu->insertItem(i18n("Small"), 6 );
399 configureAgendaMenu->insertItem(i18n("Medium"), 8 ); 399 configureAgendaMenu->insertItem(i18n("Medium"), 8 );
400 configureAgendaMenu->insertItem(i18n("Normal"), 10 ); 400 configureAgendaMenu->insertItem(i18n("Normal"), 10 );
401 configureAgendaMenu->insertItem(i18n("Large"), 12 ); 401 configureAgendaMenu->insertItem(i18n("Large"), 12 );
402 configureAgendaMenu->insertItem(i18n("Big"), 14 ); 402 configureAgendaMenu->insertItem(i18n("Big"), 14 );
403 configureAgendaMenu->insertItem(i18n("Bigger"), 16 ); 403 configureAgendaMenu->insertItem(i18n("Bigger"), 16 );
404 configureAgendaMenu->insertItem(i18n("Biggest"), 18 ); 404 configureAgendaMenu->insertItem(i18n("Biggest"), 18 );
405 //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); 405 //configureMenu->insertItem( "AgendaSize",configureAgendaMenu );
406 406
407 icon = loadPixmap( pathString + "configure" ); 407 icon = loadPixmap( pathString + "configure" );
408 action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this ); 408 action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this );
409 action->addTo( actionMenu ); 409 action->addTo( actionMenu );
410 connect( action, SIGNAL( activated() ), 410 connect( action, SIGNAL( activated() ),
411 mView, SLOT( edit_options() ) ); 411 mView, SLOT( edit_options() ) );
412 actionMenu->insertSeparator(); 412 actionMenu->insertSeparator();
413 icon = loadPixmap( pathString + "newevent" ); 413 icon = loadPixmap( pathString + "newevent" );
414 configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); 414 configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 );
415 configureToolBarMenu->insertSeparator(); 415 configureToolBarMenu->insertSeparator();
416 configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); 416 configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 );
417 QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); 417 QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this );
418 ne_action->addTo( actionMenu ); 418 ne_action->addTo( actionMenu );
419 connect( ne_action, SIGNAL( activated() ), 419 connect( ne_action, SIGNAL( activated() ),
420 mView, SLOT( newEvent() ) ); 420 mView, SLOT( newEvent() ) );
421 icon = loadPixmap( pathString + "newtodo" ); 421 icon = loadPixmap( pathString + "newtodo" );
422 configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); 422 configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 );
423 QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); 423 QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this );
424 nt_action->addTo( actionMenu ); 424 nt_action->addTo( actionMenu );
425 connect( nt_action, SIGNAL( activated() ), 425 connect( nt_action, SIGNAL( activated() ),
426 mView, SLOT( newTodo() ) ); 426 mView, SLOT( newTodo() ) );
427 icon = loadPixmap( pathString + "navi" ); 427 icon = loadPixmap( pathString + "navi" );
428 action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); 428 action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this );
429 action->addTo( viewMenu ); 429 action->addTo( viewMenu );
430 connect( action, SIGNAL( activated() ), 430 connect( action, SIGNAL( activated() ),
431 mView, SLOT( toggleDateNavigatorWidget() ) ); 431 mView, SLOT( toggleDateNavigatorWidget() ) );
432 icon = loadPixmap( pathString + "filter" ); 432 icon = loadPixmap( pathString + "filter" );
433 action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this ); 433 action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this );
434 action->addTo( viewMenu ); 434 action->addTo( viewMenu );
435 connect( action, SIGNAL( activated() ), 435 connect( action, SIGNAL( activated() ),
436 mView, SLOT( toggleFilter() ) ); 436 mView, SLOT( toggleFilter() ) );
437 437
438 438
439 viewMenu->insertSeparator(); 439 viewMenu->insertSeparator();
440 icon = loadPixmap( pathString + "picker" ); 440 icon = loadPixmap( pathString + "picker" );
441 action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this ); 441 action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this );
442 action->addTo( viewMenu ); 442 action->addTo( viewMenu );
443 connect( action, SIGNAL( activated() ), 443 connect( action, SIGNAL( activated() ),
444 mView, SLOT( showDatePicker() ) ); 444 mView, SLOT( showDatePicker() ) );
445 action->addTo( iconToolBar ); 445 action->addTo( iconToolBar );
446 viewMenu->insertSeparator(); 446 viewMenu->insertSeparator();
447 icon = loadPixmap( pathString + "list" ); 447 icon = loadPixmap( pathString + "list" );
448 configureToolBarMenu->insertItem(icon, i18n("List View"), 30 ); 448 configureToolBarMenu->insertItem(icon, i18n("List View"), 30 );
449 QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this ); 449 QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this );
450 showlist_action->addTo( viewMenu ); 450 showlist_action->addTo( viewMenu );
451 connect( showlist_action, SIGNAL( activated() ), 451 connect( showlist_action, SIGNAL( activated() ),
452 mView->viewManager(), SLOT( showListView() ) ); 452 mView->viewManager(), SLOT( showListView() ) );
453 453
454 454
455 icon = loadPixmap( pathString + "day" ); 455 icon = loadPixmap( pathString + "day" );
456 configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 ); 456 configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 );
457 QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this ); 457 QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this );
458 day1_action->addTo( viewMenu ); 458 day1_action->addTo( viewMenu );
459 // action->addTo( toolBar ); 459 // action->addTo( toolBar );
460 connect( day1_action, SIGNAL( activated() ), 460 connect( day1_action, SIGNAL( activated() ),
461 mView->viewManager(), SLOT( showDayView() ) ); 461 mView->viewManager(), SLOT( showDayView() ) );
462 462
463 icon = loadPixmap( pathString + "workweek" ); 463 icon = loadPixmap( pathString + "workweek" );
464 configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 ); 464 configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 );
465 QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this ); 465 QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this );
466 day5_action->addTo( viewMenu ); 466 day5_action->addTo( viewMenu );
467 connect( day5_action, SIGNAL( activated() ), 467 connect( day5_action, SIGNAL( activated() ),
468 mView->viewManager(), SLOT( showWorkWeekView() ) ); 468 mView->viewManager(), SLOT( showWorkWeekView() ) );
469 469
470 icon = loadPixmap( pathString + "week" ); 470 icon = loadPixmap( pathString + "week" );
471 configureToolBarMenu->insertItem(icon, i18n("Week"), 60 ); 471 configureToolBarMenu->insertItem(icon, i18n("Week"), 60 );
472 QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this ); 472 QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this );
473 day7_action->addTo( viewMenu ); 473 day7_action->addTo( viewMenu );
474 connect( day7_action, SIGNAL( activated() ), 474 connect( day7_action, SIGNAL( activated() ),
475 mView->viewManager(), SLOT( showWeekView() ) ); 475 mView->viewManager(), SLOT( showWeekView() ) );
476 476
477 icon = loadPixmap( pathString + "month" ); 477 icon = loadPixmap( pathString + "month" );
478 configureToolBarMenu->insertItem(icon, i18n("Month"), 70 ); 478 configureToolBarMenu->insertItem(icon, i18n("Month"), 70 );
479 QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this ); 479 QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this );
480 month_action->addTo( viewMenu ); 480 month_action->addTo( viewMenu );
481 connect( month_action, SIGNAL( activated() ), 481 connect( month_action, SIGNAL( activated() ),
482 mView->viewManager(), SLOT( showMonthView() ) ); 482 mView->viewManager(), SLOT( showMonthView() ) );
483 483
484 icon = loadPixmap( pathString + "todo" ); 484 icon = loadPixmap( pathString + "todo" );
485 configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 ); 485 configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 );
486 QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this ); 486 QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this );
487 todoview_action->addTo( viewMenu ); 487 todoview_action->addTo( viewMenu );
488 connect( todoview_action, SIGNAL( activated() ), 488 connect( todoview_action, SIGNAL( activated() ),
489 mView->viewManager(), SLOT( showTodoView() ) ); 489 mView->viewManager(), SLOT( showTodoView() ) );
490 490
491 icon = loadPixmap( pathString + "journal" ); 491 icon = loadPixmap( pathString + "journal" );
492 configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 ); 492 configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 );
493 QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this ); 493 QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this );
494 viewjournal_action->addTo( viewMenu ); 494 viewjournal_action->addTo( viewMenu );
495 connect( viewjournal_action, SIGNAL( activated() ), 495 connect( viewjournal_action, SIGNAL( activated() ),
496 mView->viewManager(), SLOT( showJournalView() ) ); 496 mView->viewManager(), SLOT( showJournalView() ) );
497 497
498 icon = loadPixmap( pathString + "xdays" ); 498 icon = loadPixmap( pathString + "xdays" );
499 configureToolBarMenu->insertItem(icon, i18n("Next days"), 100,4 ); 499 configureToolBarMenu->insertItem(icon, i18n("Next days"), 100,4 );
500 QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this ); 500 QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this );
501 xdays_action->addTo( viewMenu ); 501 xdays_action->addTo( viewMenu );
502 connect( xdays_action, SIGNAL( activated() ), 502 connect( xdays_action, SIGNAL( activated() ),
503 mView->viewManager(), SLOT( showNextXView() ) ); 503 mView->viewManager(), SLOT( showNextXView() ) );
504 504
505 icon = loadPixmap( pathString + "whatsnext" ); 505 icon = loadPixmap( pathString + "whatsnext" );
506 configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110, 4 ); 506 configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110, 4 );
507 QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this ); 507 QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this );
508 whatsnext_action->addTo( viewMenu ); 508 whatsnext_action->addTo( viewMenu );
509 connect( whatsnext_action, SIGNAL( activated() ), 509 connect( whatsnext_action, SIGNAL( activated() ),
510 mView->viewManager(), SLOT( showWhatsNextView() ) ); 510 mView->viewManager(), SLOT( showWhatsNextView() ) );
511 511
512#if 0 512#if 0
513 action = new QAction( "view_timespan", "Time Span", 0, this ); 513 action = new QAction( "view_timespan", "Time Span", 0, this );
514 action->addTo( viewMenu ); 514 action->addTo( viewMenu );
515 connect( action, SIGNAL( activated() ), 515 connect( action, SIGNAL( activated() ),
516 mView->viewManager(), SLOT( showTimeSpanView() ) ); 516 mView->viewManager(), SLOT( showTimeSpanView() ) );
517#endif 517#endif
518 518
519 mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0, 519 mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0,
520 this ); 520 this );
521 mNewSubTodoAction->addTo( actionMenu ); 521 mNewSubTodoAction->addTo( actionMenu );
522 connect( mNewSubTodoAction, SIGNAL( activated() ), 522 connect( mNewSubTodoAction, SIGNAL( activated() ),
523 mView, SLOT( newSubTodo() ) ); 523 mView, SLOT( newSubTodo() ) );
524 524
525 actionMenu->insertSeparator(); 525 actionMenu->insertSeparator();
526 526
527 mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this ); 527 mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this );
528 mShowAction->addTo( actionMenu ); 528 mShowAction->addTo( actionMenu );
529 connect( mShowAction, SIGNAL( activated() ), 529 connect( mShowAction, SIGNAL( activated() ),
530 mView, SLOT( showIncidence() ) ); 530 mView, SLOT( showIncidence() ) );
531 531
532 mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); 532 mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this );
533 mEditAction->addTo( actionMenu ); 533 mEditAction->addTo( actionMenu );
534 connect( mEditAction, SIGNAL( activated() ), 534 connect( mEditAction, SIGNAL( activated() ),
535 mView, SLOT( editIncidence() ) ); 535 mView, SLOT( editIncidence() ) );
536 536
537 mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); 537 mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this );
538 mDeleteAction->addTo( actionMenu ); 538 mDeleteAction->addTo( actionMenu );
539 connect( mDeleteAction, SIGNAL( activated() ), 539 connect( mDeleteAction, SIGNAL( activated() ),
540 mView, SLOT( deleteIncidence() ) ); 540 mView, SLOT( deleteIncidence() ) );
541 541
542 actionMenu->insertSeparator(); 542 actionMenu->insertSeparator();
543 543
544 action = new QAction( "purge_completed", i18n("Purge Completed"), 0, 544 action = new QAction( "purge_completed", i18n("Purge Completed"), 0,
545 this ); 545 this );
546 action->addTo( actionMenu ); 546 action->addTo( actionMenu );
547 connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); 547 connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) );
548 548
549 icon = loadPixmap( pathString + "search" ); 549 icon = loadPixmap( pathString + "search" );
550 QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); 550 QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this );
551 configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 4); 551 configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 4);
552 search_action->addTo( actionMenu ); 552 search_action->addTo( actionMenu );
553 connect( search_action, SIGNAL( activated() ), 553 connect( search_action, SIGNAL( activated() ),
554 mView->dialogManager(), SLOT( showSearchDialog() ) ); 554 mView->dialogManager(), SLOT( showSearchDialog() ) );
555 555
556 icon = loadPixmap( pathString + "today" ); 556 icon = loadPixmap( pathString + "today" );
557 configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130); 557 configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130);
558 QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); 558 QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this );
559 today_action->addTo( actionMenu ); 559 today_action->addTo( actionMenu );
560 connect( today_action, SIGNAL( activated() ), 560 connect( today_action, SIGNAL( activated() ),
561 mView, SLOT( goToday() ) ); 561 mView, SLOT( goToday() ) );
562 562
563 if ( KOPrefs::instance()->mShowFullMenu ) { 563 if ( KOPrefs::instance()->mShowFullMenu ) {
564 actionMenu->insertSeparator(); 564 actionMenu->insertSeparator();
565 actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu ); 565 actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu );
566 566
567 } 567 }
568 // actionMenu->insertSeparator(); 568 // actionMenu->insertSeparator();
569 action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0, 569 action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0,
570 this ); 570 this );
571 action->addTo( importMenu ); 571 action->addTo( importMenu );
572 connect( action, SIGNAL( activated() ), SLOT( importIcal() ) ); 572 connect( action, SIGNAL( activated() ), SLOT( importIcal() ) );
573 action = new QAction( "import_quick", i18n("Import last file"), 0, 573 action = new QAction( "import_quick", i18n("Import last file"), 0,
574 this ); 574 this );
575 action->addTo( importMenu ); 575 action->addTo( importMenu );
576 connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) ); 576 connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) );
577 importMenu->insertSeparator(); 577 importMenu->insertSeparator();
578 action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0, 578 action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0,
579 this ); 579 this );
580 action->addTo( importMenu ); 580 action->addTo( importMenu );
581 connect( action, SIGNAL( activated() ), SLOT( importBday() ) ); 581 connect( action, SIGNAL( activated() ), SLOT( importBday() ) );
582#ifndef DESKTOP_VERSION 582#ifndef DESKTOP_VERSION
583 importMenu->insertSeparator(); 583 importMenu->insertSeparator();
584 action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0, 584 action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0,
585 this ); 585 this );
586 action->addTo( importMenu ); 586 action->addTo( importMenu );
587 connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) ); 587 connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) );
588#else 588#else
589#ifdef _WIN32_ 589#ifdef _WIN32_
590 importMenu->insertSeparator(); 590 importMenu->insertSeparator();
591 action = new QAction( "import_ol", i18n("Import from OL"), 0, 591 action = new QAction( "import_ol", i18n("Import from OL"), 0,
592 this ); 592 this );
593 action->addTo( importMenu ); 593 action->addTo( importMenu );
594 connect( action, SIGNAL( activated() ), SLOT( importOL() ) ); 594 connect( action, SIGNAL( activated() ), SLOT( importOL() ) );
595#endif 595#endif
596#endif 596#endif
597 597
598 importMenu->insertSeparator(); 598 importMenu->insertSeparator();
599 action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0, 599 action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0,
600 this ); 600 this );
601 action->addTo( importMenu ); 601 action->addTo( importMenu );
602 connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) ); 602 connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) );
603 603
604 action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0, 604 action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0,
605 this ); 605 this );
606 action->addTo( importMenu ); 606 action->addTo( importMenu );
607 connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) ); 607 connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) );
608 608
609 importMenu->insertSeparator(); 609 importMenu->insertSeparator();
610 action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0, 610 action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0,
611 this ); 611 this );
612 action->addTo( importMenu ); connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) ); 612 action->addTo( importMenu ); connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) );
613 importMenu->insertSeparator(); 613 importMenu->insertSeparator();
614 action = new QAction( "manage cat", i18n("Manage new categories..."), 0, 614 action = new QAction( "manage cat", i18n("Manage new categories..."), 0,
615 this ); 615 this );
616 action->addTo( importMenu ); 616 action->addTo( importMenu );
617 connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) ); 617 connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) );
618#ifndef DESKTOP_VERSION 618#ifndef DESKTOP_VERSION
619 importMenu->insertSeparator(); 619 importMenu->insertSeparator();
620 action = new QAction( "beam all", i18n("Beam complete calendar..."), 0, 620 action = new QAction( "beam all", i18n("Beam complete calendar..."), 0,
621 this ); 621 this );
622 action->addTo( importMenu ); 622 action->addTo( importMenu );
623 connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) ); 623 connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) );
624 624
625 action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0, 625 action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0,
626 this ); 626 this );
627 action->addTo( importMenu ); 627 action->addTo( importMenu );
628 connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) ); 628 connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) );
629#else 629#else
630 importMenu->insertSeparator(); 630 importMenu->insertSeparator();
631 icon = loadPixmap( pathString + "print" ); 631 icon = loadPixmap( pathString + "print" );
632 action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this ); 632 action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this );
633 action->addTo( importMenu ); 633 action->addTo( importMenu );
634 connect( action, SIGNAL( activated() ), 634 connect( action, SIGNAL( activated() ),
635 this, SLOT( printCal() ) ); 635 this, SLOT( printCal() ) );
636 636
637 icon = loadPixmap( pathString + "print" ); 637 icon = loadPixmap( pathString + "print" );
638 action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this ); 638 action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this );
639 action->addTo( importMenu ); 639 action->addTo( importMenu );
640 connect( action, SIGNAL( activated() ), 640 connect( action, SIGNAL( activated() ),
641 this, SLOT( printSel() ) ); 641 this, SLOT( printSel() ) );
642#endif 642#endif
643 importMenu->insertSeparator(); 643 importMenu->insertSeparator();
644 action = new QAction( "beam all", i18n("Save"), 0, 644 action = new QAction( "beam all", i18n("Save"), 0,
645 this ); 645 this );
646 action->addTo( importMenu ); 646 action->addTo( importMenu );
647 connect( action, SIGNAL( activated() ), this, SLOT( save() ) ); 647 connect( action, SIGNAL( activated() ), this, SLOT( save() ) );
648 action = new QAction( "beam all", i18n("Exit (+save)"), 0, 648 action = new QAction( "beam all", i18n("Exit (+save)"), 0,
649 this ); 649 this );
650 action->addTo( importMenu ); 650 action->addTo( importMenu );
651 connect( action, SIGNAL( activated() ), this, SLOT( close() ) ); 651 connect( action, SIGNAL( activated() ), this, SLOT( close() ) );
652 652
653 //menuBar->insertItem( "Configure",configureMenu ); 653 //menuBar->insertItem( "Configure",configureMenu );
654 //configureMenu->insertItem( "Toolbar",configureToolBarMenu ); 654 //configureMenu->insertItem( "Toolbar",configureToolBarMenu );
655 icon = loadPixmap( "korganizer/korganizer" ); 655 icon = loadPixmap( "korganizer/korganizer" );
656 action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this ); 656 action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this );
657 action->addTo( helpMenu ); 657 action->addTo( helpMenu );
658 connect( action, SIGNAL( activated() ), 658 connect( action, SIGNAL( activated() ),
659 SLOT( keyBindings() ) ); 659 SLOT( keyBindings() ) );
660 action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this ); 660 action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this );
661 action->addTo( helpMenu ); 661 action->addTo( helpMenu );
662 connect( action, SIGNAL( activated() ), 662 connect( action, SIGNAL( activated() ),
663 SLOT( features() ) ); 663 SLOT( features() ) );
664 action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this ); 664 action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this );
665 action->addTo( helpMenu ); 665 action->addTo( helpMenu );
666 connect( action, SIGNAL( activated() ), 666 connect( action, SIGNAL( activated() ),
667 SLOT( aboutAutoSaving() ) ); 667 SLOT( aboutAutoSaving() ) );
668 action = new QAction( "Problemd", i18n("Known Problems..."), 0,this ); 668 action = new QAction( "Problemd", i18n("Known Problems..."), 0,this );
669 action->addTo( helpMenu ); 669 action->addTo( helpMenu );
670 connect( action, SIGNAL( activated() ), 670 connect( action, SIGNAL( activated() ),
671 SLOT( aboutKnownBugs() ) ); 671 SLOT( aboutKnownBugs() ) );
672 action = new QAction( "Translate Howto", i18n("User translation..."), 0,this ); 672 action = new QAction( "Translate Howto", i18n("User translation..."), 0,this );
673 action->addTo( helpMenu ); 673 action->addTo( helpMenu );
674 connect( action, SIGNAL( activated() ), 674 connect( action, SIGNAL( activated() ),
675 SLOT( usertrans() ) ); 675 SLOT( usertrans() ) );
676 action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this ); 676 action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this );
677 action->addTo( helpMenu ); 677 action->addTo( helpMenu );
678 connect( action, SIGNAL( activated() ), 678 connect( action, SIGNAL( activated() ),
679 SLOT( synchowto() ) ); 679 SLOT( synchowto() ) );
680 action = new QAction( "Whats New", i18n("What's new?"), 0,this ); 680 action = new QAction( "Whats New", i18n("What's new?"), 0,this );
681 action->addTo( helpMenu ); 681 action->addTo( helpMenu );
682 connect( action, SIGNAL( activated() ), 682 connect( action, SIGNAL( activated() ),
683 SLOT( whatsNew() ) ); 683 SLOT( whatsNew() ) );
684 action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this ); 684 action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this );
685 action->addTo( helpMenu ); 685 action->addTo( helpMenu );
686 connect( action, SIGNAL( activated() ), 686 connect( action, SIGNAL( activated() ),
687 SLOT( faq() ) ); 687 SLOT( faq() ) );
688 688
689 689
690 action = new QAction( "about", i18n("About..."), 0, this ); 690 action = new QAction( "about", i18n("About..."), 0, this );
691 action->addTo( helpMenu ); 691 action->addTo( helpMenu );
692 connect( action, SIGNAL( activated() ), 692 connect( action, SIGNAL( activated() ),
693 SLOT( about() ) ); 693 SLOT( about() ) );
694 //menuBar->insertSeparator(); 694 //menuBar->insertSeparator();
695 695
696 // ****************************************************** 696 // ******************************************************
697 // menubar icons 697 // menubar icons
698 698
699 699
700 iconToolBar->setHorizontalStretchable (true ); 700 iconToolBar->setHorizontalStretchable (true );
701 //menuBar->insertItem( iconToolBar ); 701 //menuBar->insertItem( iconToolBar );
702 //xdays_action 702 //xdays_action
703 if (p-> mShowIconNewEvent) 703 if (p-> mShowIconNewEvent)
704 ne_action->addTo( iconToolBar ); 704 ne_action->addTo( iconToolBar );
705 if (p->mShowIconNewTodo ) 705 if (p->mShowIconNewTodo )
706 nt_action->addTo( iconToolBar ); 706 nt_action->addTo( iconToolBar );
707 if (p-> mShowIconSearch) 707 if (p-> mShowIconSearch)
708 search_action->addTo( iconToolBar ); 708 search_action->addTo( iconToolBar );
709 if (p-> mShowIconNext) 709 if (p-> mShowIconNext)
710 whatsnext_action->addTo( iconToolBar ); 710 whatsnext_action->addTo( iconToolBar );
711 if (p-> mShowIconNextDays) 711 if (p-> mShowIconNextDays)
712 xdays_action->addTo( iconToolBar ); 712 xdays_action->addTo( iconToolBar );
713 if (p-> mShowIconList) 713 if (p-> mShowIconList)
714 showlist_action->addTo( iconToolBar ); 714 showlist_action->addTo( iconToolBar );
715 if (p-> mShowIconDay1) 715 if (p-> mShowIconDay1)
716 day1_action->addTo( iconToolBar ); 716 day1_action->addTo( iconToolBar );
717 if (p-> mShowIconDay5) 717 if (p-> mShowIconDay5)
718 day5_action->addTo( iconToolBar ); 718 day5_action->addTo( iconToolBar );
719 if (p-> mShowIconDay7) 719 if (p-> mShowIconDay7)
720 day7_action->addTo( iconToolBar ); 720 day7_action->addTo( iconToolBar );
721 if (p-> mShowIconMonth) 721 if (p-> mShowIconMonth)
722 month_action->addTo( iconToolBar ); 722 month_action->addTo( iconToolBar );
723 if (p-> mShowIconTodoview) 723 if (p-> mShowIconTodoview)
724 todoview_action->addTo( iconToolBar ); 724 todoview_action->addTo( iconToolBar );
725 if (p-> mShowIconJournal) 725 if (p-> mShowIconJournal)
726 viewjournal_action->addTo( iconToolBar ); 726 viewjournal_action->addTo( iconToolBar );
727 icon = loadPixmap( pathString + "2leftarrowB" ); 727 icon = loadPixmap( pathString + "2leftarrowB" );
728 configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200, 14); 728 configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200, 14);
729 if (p-> mShowIconBackFast) { 729 if (p-> mShowIconBackFast) {
730 action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this ); 730 action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this );
731 connect( action, SIGNAL( activated() ), 731 connect( action, SIGNAL( activated() ),
732 mView, SLOT( goPreviousMonth() ) ); 732 mView, SLOT( goPreviousMonth() ) );
733 action->addTo( iconToolBar ); 733 action->addTo( iconToolBar );
734 } 734 }
735 icon = loadPixmap( pathString + "1leftarrowB" ); 735 icon = loadPixmap( pathString + "1leftarrowB" );
736 configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210,15); 736 configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210,15);
737 if (p-> mShowIconBack) { 737 if (p-> mShowIconBack) {
738 action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this ); 738 action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this );
739 connect( action, SIGNAL( activated() ), 739 connect( action, SIGNAL( activated() ),
740 mView, SLOT( goPrevious() ) ); 740 mView, SLOT( goPrevious() ) );
741 action->addTo( iconToolBar ); 741 action->addTo( iconToolBar );
742 } 742 }
743 if (p-> mShowIconToday) 743 if (p-> mShowIconToday)
744 today_action->addTo( iconToolBar ); 744 today_action->addTo( iconToolBar );
745 icon = loadPixmap( pathString + "1rightarrowB" ); 745 icon = loadPixmap( pathString + "1rightarrowB" );
746 configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220); 746 configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220);
747 if (p-> mShowIconForward) { 747 if (p-> mShowIconForward) {
748 action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this ); 748 action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this );
749 connect( action, SIGNAL( activated() ), 749 connect( action, SIGNAL( activated() ),
750 mView, SLOT( goNext() ) ); 750 mView, SLOT( goNext() ) );
751 action->addTo( iconToolBar ); 751 action->addTo( iconToolBar );
752 } 752 }
753 icon = loadPixmap( pathString + "2rightarrowB" ); 753 icon = loadPixmap( pathString + "2rightarrowB" );
754 configureToolBarMenu->insertItem(icon, i18n("Next month"), 230); 754 configureToolBarMenu->insertItem(icon, i18n("Next month"), 230);
755 if (p-> mShowIconForwardFast) { 755 if (p-> mShowIconForwardFast) {
756 action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this ); 756 action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this );
757 connect( action, SIGNAL( activated() ), 757 connect( action, SIGNAL( activated() ),
758 mView, SLOT( goNextMonth() ) ); 758 mView, SLOT( goNextMonth() ) );
759 action->addTo( iconToolBar ); 759 action->addTo( iconToolBar );
760 } 760 }
761 761
762 762
763 configureToolBarMenu->insertItem(i18n("What's This?"), 300); 763 configureToolBarMenu->insertItem(i18n("What's This?"), 300);
764 764
765 if (p-> mShowIconNewEvent) 765 if (p-> mShowIconNewEvent)
766 configureToolBarMenu->setItemChecked( 10, true ); 766 configureToolBarMenu->setItemChecked( 10, true );
767 if (p->mShowIconNewTodo ) 767 if (p->mShowIconNewTodo )
768 configureToolBarMenu->setItemChecked( 20, true ); 768 configureToolBarMenu->setItemChecked( 20, true );
769 if (p-> mShowIconSearch) 769 if (p-> mShowIconSearch)
770 configureToolBarMenu->setItemChecked( 120, true ); 770 configureToolBarMenu->setItemChecked( 120, true );
771 if (p-> mShowIconList) 771 if (p-> mShowIconList)
772 configureToolBarMenu->setItemChecked( 30, true ); 772 configureToolBarMenu->setItemChecked( 30, true );
773 if (p-> mShowIconDay1) 773 if (p-> mShowIconDay1)
774 configureToolBarMenu->setItemChecked( 40, true ); 774 configureToolBarMenu->setItemChecked( 40, true );
775 if (p-> mShowIconDay5) 775 if (p-> mShowIconDay5)
776 configureToolBarMenu->setItemChecked( 50, true ); 776 configureToolBarMenu->setItemChecked( 50, true );
777 if (p-> mShowIconDay7) 777 if (p-> mShowIconDay7)
778 configureToolBarMenu->setItemChecked( 60, true ); 778 configureToolBarMenu->setItemChecked( 60, true );
779 if (p-> mShowIconMonth) 779 if (p-> mShowIconMonth)
780 configureToolBarMenu->setItemChecked( 70, true ); 780 configureToolBarMenu->setItemChecked( 70, true );
781 if (p-> mShowIconTodoview) 781 if (p-> mShowIconTodoview)
782 configureToolBarMenu->setItemChecked( 80, true ); 782 configureToolBarMenu->setItemChecked( 80, true );
783 if (p-> mShowIconBackFast) 783 if (p-> mShowIconBackFast)
784 configureToolBarMenu->setItemChecked( 200, true ); 784 configureToolBarMenu->setItemChecked( 200, true );
785 if (p-> mShowIconBack) 785 if (p-> mShowIconBack)
786 configureToolBarMenu->setItemChecked( 210, true ); 786 configureToolBarMenu->setItemChecked( 210, true );
787 if (p-> mShowIconToday) 787 if (p-> mShowIconToday)
788 configureToolBarMenu->setItemChecked( 130, true ); 788 configureToolBarMenu->setItemChecked( 130, true );
789 if (p-> mShowIconForward) 789 if (p-> mShowIconForward)
790 configureToolBarMenu->setItemChecked( 220, true ); 790 configureToolBarMenu->setItemChecked( 220, true );
791 if (p-> mShowIconForwardFast) 791 if (p-> mShowIconForwardFast)
792 configureToolBarMenu->setItemChecked( 230, true ); 792 configureToolBarMenu->setItemChecked( 230, true );
793 if (p-> mShowIconNextDays) 793 if (p-> mShowIconNextDays)
794 configureToolBarMenu->setItemChecked( 100, true ); 794 configureToolBarMenu->setItemChecked( 100, true );
795 if (p-> mShowIconNext) 795 if (p-> mShowIconNext)
796 configureToolBarMenu->setItemChecked( 110, true ); 796 configureToolBarMenu->setItemChecked( 110, true );
797 if (p-> mShowIconJournal) 797 if (p-> mShowIconJournal)
798 configureToolBarMenu->setItemChecked( 90, true ); 798 configureToolBarMenu->setItemChecked( 90, true );
799 if (p-> mShowIconWhatsThis) 799 if (p-> mShowIconWhatsThis)
800 configureToolBarMenu->setItemChecked( 300, true ); 800 configureToolBarMenu->setItemChecked( 300, true );
801 801
802 QLabel* dummy = new QLabel( iconToolBar ); 802 QLabel* dummy = new QLabel( iconToolBar );
803 dummy->setBackgroundColor( iconToolBar->backgroundColor() ); 803 dummy->setBackgroundColor( iconToolBar->backgroundColor() );
804 if (!p-> mShowIconStretch) 804 if (!p-> mShowIconStretch)
805 iconToolBar->setStretchableWidget ( dummy ) ; 805 iconToolBar->setStretchableWidget ( dummy ) ;
806 else 806 else
807 configureToolBarMenu->setItemChecked( 5, true ); 807 configureToolBarMenu->setItemChecked( 5, true );
808 if (p-> mShowIconWhatsThis) 808 if (p-> mShowIconWhatsThis)
809 QWhatsThis::whatsThisButton ( iconToolBar ); 809 QWhatsThis::whatsThisButton ( iconToolBar );
810 connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) ); 810 connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) );
811 configureAgenda( p->mHourSize ); 811 configureAgenda( p->mHourSize );
812 connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) ); 812 connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) );
813} 813}
814void MainWindow::fillSyncMenu() 814void MainWindow::fillSyncMenu()
815{ 815{
816 syncMenu->clear(); 816 syncMenu->clear();
817 syncMenu->insertItem( i18n("Configure..."), 0 ); 817 syncMenu->insertItem( i18n("Configure..."), 0 );
818 syncMenu->insertSeparator(); 818 syncMenu->insertSeparator();
819 syncMenu->insertItem( i18n("Multiple sync"), 1 ); 819 syncMenu->insertItem( i18n("Multiple sync"), 1 );
820 syncMenu->insertSeparator(); 820 syncMenu->insertSeparator();
821 KConfig config ( locateLocal( "config","syncprofilesrc" ) ); 821 KConfig config ( locateLocal( "config","syncprofilesrc" ) );
822 config.setGroup("SyncProfiles"); 822 config.setGroup("General");
823 QStringList prof = config.readListEntry("SyncProfileNames"); 823 QStringList prof = config.readListEntry("SyncProfileNames");
824 KOPrefs::instance()->mLocalMachineName = config.readEntry("LocalMachineName","undefined"); 824 KOPrefs::instance()->mLocalMachineName = config.readEntry("LocalMachineName","undefined");
825 if ( prof.count() < 3 ) { 825 if ( prof.count() < 3 ) {
826 prof.clear(); 826 prof.clear();
827 prof << i18n("Sharp-DTM"); 827 prof << i18n("Sharp_DTM");
828 prof << i18n("Local file"); 828 prof << i18n("Local_file");
829 prof << i18n("Last file"); 829 prof << i18n("Last_file");
830 KSyncProfile* temp = new KSyncProfile (); 830 KSyncProfile* temp = new KSyncProfile ();
831 temp->setName( prof[0] ); 831 temp->setName( prof[0] );
832 temp->writeConfig(&config); 832 temp->writeConfig(&config);
833 temp->setName( prof[1] ); 833 temp->setName( prof[1] );
834 temp->writeConfig(&config); 834 temp->writeConfig(&config);
835 temp->setName( prof[2] ); 835 temp->setName( prof[2] );
836 temp->writeConfig(&config); 836 temp->writeConfig(&config);
837 config.setGroup("SyncProfiles"); 837 config.setGroup("General");
838 config.writeEntry("SyncProfileNames",prof); 838 config.writeEntry("SyncProfileNames",prof);
839 config.sync(); 839 config.sync();
840 delete temp; 840 delete temp;
841 } 841 }
842 KOPrefs::instance()->mSyncProfileNames = prof; 842 KOPrefs::instance()->mSyncProfileNames = prof;
843 int i; 843 int i;
844 for ( i = 0; i < prof.count(); ++i ) { 844 for ( i = 0; i < prof.count(); ++i ) {
845 845
846 syncMenu->insertItem( prof[i], 1000+i ); 846 syncMenu->insertItem( prof[i], 1000+i );
847 if ( i == 2 ) 847 if ( i == 2 )
848 syncMenu->insertSeparator(); 848 syncMenu->insertSeparator();
849 } 849 }
850 QDir app_dir; 850 QDir app_dir;
851 if ( !app_dir.exists(QDir::homeDirPath()+"/Applications/dtm" ) ) { 851 if ( !app_dir.exists(QDir::homeDirPath()+"/Applications/dtm" ) ) {
852 syncMenu->setItemEnabled( false , 1000 ); 852 syncMenu->setItemEnabled( false , 1000 );
853 } 853 }
854} 854}
855 855
856int MainWindow::ringSync() 856int MainWindow::ringSync()
857{ 857{
858 int syncedProfiles = 0; 858 int syncedProfiles = 0;
859 int i; 859 int i;
860 QTime timer; 860 QTime timer;
861 KConfig config ( locateLocal( "config","syncprofilesrc" ) ); 861 KConfig config ( locateLocal( "config","syncprofilesrc" ) );
862 QStringList syncProfileNames = KOPrefs::instance()->mSyncProfileNames; 862 QStringList syncProfileNames = KOPrefs::instance()->mSyncProfileNames;
863 KSyncProfile* temp = new KSyncProfile (); 863 KSyncProfile* temp = new KSyncProfile ();
864 KOPrefs::instance()->mAskForPreferences = false; 864 KOPrefs::instance()->mAskForPreferences = false;
865 for ( i = 0; i < syncProfileNames.count(); ++i ) { 865 for ( i = 0; i < syncProfileNames.count(); ++i ) {
866 mCurrentSyncProfile = i; 866 mCurrentSyncProfile = i;
867 temp->setName(syncProfileNames[mCurrentSyncProfile]); 867 temp->setName(syncProfileNames[mCurrentSyncProfile]);
868 temp->readConfig(&config); 868 temp->readConfig(&config);
869 if ( temp->getIncludeInRingSync() && ( i < 1 || i > 2 )) { 869 if ( temp->getIncludeInRingSync() && ( i < 1 || i > 2 )) {
870 setCaption(i18n("Profile ")+syncProfileNames[mCurrentSyncProfile]+ i18n(" is synced ... ")); 870 setCaption(i18n("Profile ")+syncProfileNames[mCurrentSyncProfile]+ i18n(" is synced ... "));
871 ++syncedProfiles; 871 ++syncedProfiles;
872 // KOPrefs::instance()->mAskForPreferences = temp->getAskForPreferences(); 872 // KOPrefs::instance()->mAskForPreferences = temp->getAskForPreferences();
873 KOPrefs::instance()->mWriteBackFile = temp->getWriteBackFile(); 873 KOPrefs::instance()->mWriteBackFile = temp->getWriteBackFile();
874 KOPrefs::instance()->mWriteBackExistingOnly = temp->getWriteBackExisting(); 874 KOPrefs::instance()->mWriteBackExistingOnly = temp->getWriteBackExisting();
875 KOPrefs::instance()->mShowSyncSummary = false; 875 KOPrefs::instance()->mShowSyncSummary = false;
876 mView->setSyncDevice(syncProfileNames[i] ); 876 mView->setSyncDevice(syncProfileNames[i] );
877 mView->setSyncName( KOPrefs::instance()->mLocalMachineName ); 877 mView->setSyncName( KOPrefs::instance()->mLocalMachineName );
878 if ( i == 0 ) { 878 if ( i == 0 ) {
879 syncSharp(); 879 syncSharp();
880 } else { 880 } else {
881 if ( temp->getIsLocalFileSync() ) { 881 if ( temp->getIsLocalFileSync() ) {
882 if ( syncWithFile( temp->getRemoteFileName( ), true ) ) 882 if ( syncWithFile( temp->getRemoteFileName( ), true ) )
883 KOPrefs::instance()->mLastSyncedLocalFile = temp->getRemoteFileName(); 883 KOPrefs::instance()->mLastSyncedLocalFile = temp->getRemoteFileName();
884 } else { 884 } else {
885 syncRemote( temp, false ); 885 syncRemote( temp, false );
886 886
887 } 887 }
888 } 888 }
889 timer.start(); 889 timer.start();
890 setCaption(i18n("Multiple sync in progress ... please wait!") ); 890 setCaption(i18n("Multiple sync in progress ... please wait!") );
891 while ( timer.elapsed () < 2000 ) { 891 while ( timer.elapsed () < 2000 ) {
892 qApp->processEvents(); 892 qApp->processEvents();
893#ifndef _WIN32_ 893#ifndef _WIN32_
894 sleep (1); 894 sleep (1);
895#endif 895#endif
896 } 896 }
897 897
898 } 898 }
899 899
900 } 900 }
901 delete temp; 901 delete temp;
902 return syncedProfiles; 902 return syncedProfiles;
903} 903}
904 904
905void MainWindow::multiSync( bool askforPrefs ) 905void MainWindow::multiSync( bool askforPrefs )
906{ 906{
907 if (mBlockSaveFlag) 907 if (mBlockSaveFlag)
908 return; 908 return;
909 mBlockSaveFlag = true; 909 mBlockSaveFlag = true;
910 QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!"); 910 QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!");
911 if ( QMessageBox::information( this, i18n("KO/Pi Sync"), 911 if ( QMessageBox::information( this, i18n("KO/Pi Sync"),
912 question, 912 question,
913 i18n("Yes"), i18n("No"), 913 i18n("Yes"), i18n("No"),
914 0, 0 ) != 0 ) { 914 0, 0 ) != 0 ) {
915 mBlockSaveFlag = false; 915 mBlockSaveFlag = false;
916 setCaption(i18n("Aborted! Nothing synced!")); 916 setCaption(i18n("Aborted! Nothing synced!"));
917 return; 917 return;
918 } 918 }
919 mView->setSyncDevice(i18n("Multiple profiles") ); 919 mView->setSyncDevice(i18n("Multiple profiles") );
920 KOPrefs::instance()->mSyncAlgoPrefs = KOPrefs::instance()->mRingSyncAlgoPrefs; 920 KOPrefs::instance()->mSyncAlgoPrefs = KOPrefs::instance()->mRingSyncAlgoPrefs;
921 if ( askforPrefs ) { 921 if ( askforPrefs ) {
922 mView->edit_sync_options(); 922 mView->edit_sync_options();
923 KOPrefs::instance()->mRingSyncAlgoPrefs = KOPrefs::instance()->mSyncAlgoPrefs; 923 KOPrefs::instance()->mRingSyncAlgoPrefs = KOPrefs::instance()->mSyncAlgoPrefs;
924 } 924 }
925 setCaption(i18n("Multiple sync started.") ); 925 setCaption(i18n("Multiple sync started.") );
926 qApp->processEvents(); 926 qApp->processEvents();
927 int num = ringSync() ; 927 int num = ringSync() ;
928 if ( num > 1 ) 928 if ( num > 1 )
929 ringSync(); 929 ringSync();
930 mBlockSaveFlag = false; 930 mBlockSaveFlag = false;
931 if ( num ) 931 if ( num )
932 save(); 932 save();
933 if ( num ) 933 if ( num )
934 setCaption(i18n("%1 profiles synced. Multiple sync completed!").arg(num) ); 934 setCaption(i18n("%1 profiles synced. Multiple sync completed!").arg(num) );
935 else 935 else
936 setCaption(i18n("Nothing synced! No profiles defined for multisync!")); 936 setCaption(i18n("Nothing synced! No profiles defined for multisync!"));
937 return; 937 return;
938} 938}
939void MainWindow::slotSyncMenu( int action ) 939void MainWindow::slotSyncMenu( int action )
940{ 940{
941 //qDebug("syncaction %d ", action); 941 //qDebug("syncaction %d ", action);
942 if ( action == 0 ) { 942 if ( action == 0 ) {
943 943
944 confSync(); 944 confSync();
945 945
946 return; 946 return;
947 } 947 }
948 if ( action == 1 ) { 948 if ( action == 1 ) {
949 multiSync( true ); 949 multiSync( true );
950 return; 950 return;
951 } 951 }
952 952
953 if (mBlockSaveFlag) 953 if (mBlockSaveFlag)
954 return; 954 return;
955 mBlockSaveFlag = true; 955 mBlockSaveFlag = true;
956 mCurrentSyncProfile = action - 1000 ; 956 mCurrentSyncProfile = action - 1000 ;
957 mView->setSyncDevice(KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile] ); 957 mView->setSyncDevice(KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile] );
958 mView->setSyncName( KOPrefs::instance()->mLocalMachineName ); 958 mView->setSyncName( KOPrefs::instance()->mLocalMachineName );
959 KConfig config ( locateLocal( "config","syncprofilesrc" ) ); 959 KConfig config ( locateLocal( "config","syncprofilesrc" ) );
960 KSyncProfile* temp = new KSyncProfile (); 960 KSyncProfile* temp = new KSyncProfile ();
961 temp->setName(KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile]); 961 temp->setName(KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile]);
962 temp->readConfig(&config); 962 temp->readConfig(&config);
963 KOPrefs::instance()->mAskForPreferences = temp->getAskForPreferences(); 963 KOPrefs::instance()->mAskForPreferences = temp->getAskForPreferences();
964 KOPrefs::instance()->mSyncAlgoPrefs = temp->getSyncPrefs(); 964 KOPrefs::instance()->mSyncAlgoPrefs = temp->getSyncPrefs();
965 KOPrefs::instance()->mWriteBackFile = temp->getWriteBackFile(); 965 KOPrefs::instance()->mWriteBackFile = temp->getWriteBackFile();
966 KOPrefs::instance()->mWriteBackExistingOnly = temp->getWriteBackExisting(); 966 KOPrefs::instance()->mWriteBackExistingOnly = temp->getWriteBackExisting();
967 KOPrefs::instance()->mShowSyncSummary = temp->getShowSummaryAfterSync(); 967 KOPrefs::instance()->mShowSyncSummary = temp->getShowSummaryAfterSync();
968 if ( action == 1000 ) { 968 if ( action == 1000 ) {
969 syncSharp(); 969 syncSharp();
970 970
971 } else if ( action == 1001 ) { 971 } else if ( action == 1001 ) {
972 syncLocalFile(); 972 syncLocalFile();
973 973
974 } else if ( action == 1002 ) { 974 } else if ( action == 1002 ) {
975 quickSyncLocalFile(); 975 quickSyncLocalFile();
976 976
977 } else if ( action >= 1003 ) { 977 } else if ( action >= 1003 ) {
978 if ( temp->getIsLocalFileSync() ) { 978 if ( temp->getIsLocalFileSync() ) {
979 if ( syncWithFile( temp->getRemoteFileName( ), false ) ) 979 if ( syncWithFile( temp->getRemoteFileName( ), false ) )
980 KOPrefs::instance()->mLastSyncedLocalFile = temp->getRemoteFileName(); 980 KOPrefs::instance()->mLastSyncedLocalFile = temp->getRemoteFileName();
981 } else { 981 } else {
982 syncRemote( temp ); 982 syncRemote( temp );
983 983
984 } 984 }
985 } 985 }
986 delete temp; 986 delete temp;
987 mBlockSaveFlag = false; 987 mBlockSaveFlag = false;
988} 988}
989void MainWindow::setDefaultPreferences() 989void MainWindow::setDefaultPreferences()
990{ 990{
991 KOPrefs *p = KOPrefs::instance(); 991 KOPrefs *p = KOPrefs::instance();
992 992
993 p->mCompactDialogs = true; 993 p->mCompactDialogs = true;
994 p->mConfirm = true; 994 p->mConfirm = true;
995 // p->mEnableQuickTodo = false; 995 // p->mEnableQuickTodo = false;
996} 996}
997 997
998QString MainWindow::resourcePath() 998QString MainWindow::resourcePath()
999{ 999{
1000 return KGlobal::iconLoader()->iconPath(); 1000 return KGlobal::iconLoader()->iconPath();
1001} 1001}
1002 1002
1003void MainWindow::displayText( QString text ,QString cap ) 1003void MainWindow::displayText( QString text ,QString cap )
1004{ 1004{
1005 QDialog dia( this, "name", true ); ; 1005 QDialog dia( this, "name", true ); ;
1006 dia.setCaption( cap ); 1006 dia.setCaption( cap );
1007 QVBoxLayout* lay = new QVBoxLayout( &dia ); 1007 QVBoxLayout* lay = new QVBoxLayout( &dia );
1008 lay->setSpacing( 3 ); 1008 lay->setSpacing( 3 );
1009 lay->setMargin( 3 ); 1009 lay->setMargin( 3 );
1010 QTextBrowser tb ( &dia ); 1010 QTextBrowser tb ( &dia );
1011 lay->addWidget( &tb ); 1011 lay->addWidget( &tb );
1012 tb.setText( text ); 1012 tb.setText( text );
1013#ifdef DESKTOP_VERSION 1013#ifdef DESKTOP_VERSION
1014 dia.resize( 640, 480); 1014 dia.resize( 640, 480);
1015#else 1015#else
1016 dia.showMaximized(); 1016 dia.showMaximized();
1017#endif 1017#endif
1018 dia.exec(); 1018 dia.exec();
1019} 1019}
1020void MainWindow::displayFile( QString fn, QString cap ) 1020void MainWindow::displayFile( QString fn, QString cap )
1021{ 1021{
1022 QString fileName = resourcePath() + fn; 1022 QString fileName = resourcePath() + fn;
1023 QString text; 1023 QString text;
1024 QFile file( fileName ); 1024 QFile file( fileName );
1025 if (!file.open( IO_ReadOnly ) ) { 1025 if (!file.open( IO_ReadOnly ) ) {
1026 return ; 1026 return ;
1027 1027
1028 } 1028 }
1029 QTextStream ts( &file ); 1029 QTextStream ts( &file );
1030 text = ts.read(); 1030 text = ts.read();
1031 file.close(); 1031 file.close();
1032 displayText( text, cap); 1032 displayText( text, cap);
1033} 1033}
1034void MainWindow::features() 1034void MainWindow::features()
1035{ 1035{
1036 1036
1037 displayFile( "featuresKOPI.txt",i18n("KO/Pi Features and hints") ); 1037 displayFile( "featuresKOPI.txt",i18n("KO/Pi Features and hints") );
1038} 1038}
1039 1039
1040void MainWindow::usertrans() 1040void MainWindow::usertrans()
1041{ 1041{
1042 1042
1043 displayFile( "usertranslationHOWTO.txt",i18n("KO/Pi User translation HowTo") ); 1043 displayFile( "usertranslationHOWTO.txt",i18n("KO/Pi User translation HowTo") );
1044} 1044}
1045void MainWindow::synchowto() 1045void MainWindow::synchowto()
1046{ 1046{
1047 1047
1048 displayFile( "howtoSYNC.txt",i18n("KO/Pi Synchronization HowTo") ); 1048 displayFile( "howtoSYNC.txt",i18n("KO/Pi Synchronization HowTo") );
1049} 1049}
1050void MainWindow::faq() 1050void MainWindow::faq()
1051{ 1051{
1052 displayFile( "kopiFAQ.txt",i18n("KO/Pi FAQ") ); 1052 displayFile( "kopiFAQ.txt",i18n("KO/Pi FAQ") );
1053 1053
1054} 1054}
1055void MainWindow::whatsNew() 1055void MainWindow::whatsNew()
1056{ 1056{
1057 displayFile( "kopiWhatsNew.txt",i18n("KO/Pi Version Info") ); 1057 displayFile( "kopiWhatsNew.txt",i18n("KO/Pi Version Info") );
1058 1058
1059} 1059}
1060void MainWindow::about() 1060void MainWindow::about()
1061{ 1061{
1062 QString version; 1062 QString version;
1063#include <../version> 1063#include <../version>
1064 QMessageBox::about( this, i18n("About KOrganizer/Pi"), 1064 QMessageBox::about( this, i18n("About KOrganizer/Pi"),
1065 i18n("KOrganizer/Platform-independent\n") + 1065 i18n("KOrganizer/Platform-independent\n") +
1066 "(KO/Pi) " + version + " - " + 1066 "(KO/Pi) " + version + " - " +
1067 1067
1068#ifdef DESKTOP_VERSION 1068#ifdef DESKTOP_VERSION
1069 i18n("Desktop Edition\n") + 1069 i18n("Desktop Edition\n") +
1070#else 1070#else
1071 i18n("PDA-Edition\nfor: Zaurus 5x00 / 7x0 / 8x0\n") + 1071 i18n("PDA-Edition\nfor: Zaurus 5x00 / 7x0 / 8x0\n") +
1072#endif 1072#endif
1073 i18n("(c) 2004 Lutz Rogowski\nEmail:lutz@pi-sync.net\nKO/Pi is based on KOrganizer\n(c) 2002,2003 Cornelius Schumacher\nEmail: schumacher@kde.org\nKOrganizer/Pi is licensed\nunder the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.korganizer.org\nwww.pi-sync.net\n") ); 1073 i18n("(c) 2004 Lutz Rogowski\nEmail:lutz@pi-sync.net\nKO/Pi is based on KOrganizer\n(c) 2002,2003 Cornelius Schumacher\nEmail: schumacher@kde.org\nKOrganizer/Pi is licensed\nunder the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.korganizer.org\nwww.pi-sync.net\n") );
1074} 1074}
1075void MainWindow::keyBindings() 1075void MainWindow::keyBindings()
1076{ 1076{
1077 QString cap = i18n("Key bindings KOrganizer/Pi"); 1077 QString cap = i18n("Key bindings KOrganizer/Pi");
1078 QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") + 1078 QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") +
1079 i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+ 1079 i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+
1080 i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") + 1080 i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") +
1081 i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+ 1081 i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+
1082 i18n("<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n")+ 1082 i18n("<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n")+
1083 i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+ 1083 i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+
1084 i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+ 1084 i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+
1085 i18n("<p><b>N</b>: Next days view| <b>W</b>: What's next view\n ")+ 1085 i18n("<p><b>N</b>: Next days view| <b>W</b>: What's next view\n ")+
1086 i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+ 1086 i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+
1087 i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+ 1087 i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+
1088 i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+ 1088 i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+
1089 i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+ 1089 i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+
1090 i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+ 1090 i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+
1091 i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X</b>: Toggle datenavigator</p>\n")+ 1091 i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X</b>: Toggle datenavigator</p>\n")+
1092 i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+ 1092 i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+
1093 i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+ 1093 i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+
1094 i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+ 1094 i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+
1095 i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+ 1095 i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+
1096 i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+ 1096 i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+
1097 i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+ 1097 i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+
1098 i18n("<p><h3>In agenda view:</h3></p>\n") + 1098 i18n("<p><h3>In agenda view:</h3></p>\n") +
1099 i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+ 1099 i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+
1100 i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+ 1100 i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+
1101 i18n("<p><h3>In todo view:</h3></p>\n") + 1101 i18n("<p><h3>In todo view:</h3></p>\n") +
1102 i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+ 1102 i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+
1103 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ 1103 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+
1104 i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+ 1104 i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+
1105 i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+ 1105 i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+
1106 i18n("<p><h3>In list view:</h3></p>\n") + 1106 i18n("<p><h3>In list view:</h3></p>\n") +
1107 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ 1107 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+
1108 i18n("<p><b>return</b>: Select item+one step down</p>\n")+ 1108 i18n("<p><b>return</b>: Select item+one step down</p>\n")+
1109 i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+ 1109 i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+
1110 i18n("<p><b>up/down</b>: Next/prev item</p>\n")+ 1110 i18n("<p><b>up/down</b>: Next/prev item</p>\n")+
1111 i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+ 1111 i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+
1112 i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+ 1112 i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+
1113 i18n("<p><h3>In event/todo viewer:</h3></p>\n") + 1113 i18n("<p><h3>In event/todo viewer:</h3></p>\n") +
1114 i18n("<p><b>I,C</b>: Close dialog.</p>\n")+ 1114 i18n("<p><b>I,C</b>: Close dialog.</p>\n")+
1115 i18n("<p><b>A</b>: Show agenda view.</p>\n")+ 1115 i18n("<p><b>A</b>: Show agenda view.</p>\n")+
1116 i18n("<p><b>E</b>: Edit item</p>\n") + 1116 i18n("<p><b>E</b>: Edit item</p>\n") +
1117 i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") + 1117 i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") +
1118 i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") + 1118 i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") +
1119 i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+ 1119 i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+
1120 i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+ 1120 i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+
1121 i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+ 1121 i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+
1122 i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+ 1122 i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+
1123 i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ 1123 i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+
1124 i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + 1124 i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") +
1125 i18n("<p><b>White</b>: Item readonly</p>\n"); 1125 i18n("<p><b>White</b>: Item readonly</p>\n");
1126 displayText( text, cap); 1126 displayText( text, cap);
1127 1127
1128} 1128}
1129void MainWindow::aboutAutoSaving() 1129void MainWindow::aboutAutoSaving()
1130{ 1130{
1131 QMessageBox* msg; 1131 QMessageBox* msg;
1132 msg = new QMessageBox( i18n("Auto Saving in KOrganizer/Pi"), 1132 msg = new QMessageBox( i18n("Auto Saving in KOrganizer/Pi"),
1133 i18n("After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configureable) three minutes.\nFor safety reasons there is one autosaving\nafter 10 minutes (of idle time) again. The \ndata is saved automatically when closing KO/Pi\nYou can create a backup file \nwith: File - Save Calendar Backup\n"), QMessageBox::NoIcon, 1133 i18n("After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configureable) three minutes.\nFor safety reasons there is one autosaving\nafter 10 minutes (of idle time) again. The \ndata is saved automatically when closing KO/Pi\nYou can create a backup file \nwith: File - Save Calendar Backup\n"), QMessageBox::NoIcon,
1134 QMessageBox::Ok, 1134 QMessageBox::Ok,
1135 QMessageBox::NoButton, 1135 QMessageBox::NoButton,
1136 QMessageBox::NoButton); 1136 QMessageBox::NoButton);
1137 msg->exec(); 1137 msg->exec();
1138 delete msg; 1138 delete msg;
1139 1139
1140 1140
1141} 1141}
1142void MainWindow::aboutKnownBugs() 1142void MainWindow::aboutKnownBugs()
1143{ 1143{
1144 QMessageBox* msg; 1144 QMessageBox* msg;
1145 msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), 1145 msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"),
1146 i18n("1) Importing *.vcs or *.ics files from\nother applications may not work properly,\nif there are events with properties\nKO/Pi does not support.\n")+ 1146 i18n("1) Importing *.vcs or *.ics files from\nother applications may not work properly,\nif there are events with properties\nKO/Pi does not support.\n")+
1147 i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ 1147 i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+
1148 i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.net\n") + 1148 i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.net\n") +
1149 i18n("\nor report them in the bugtracker on\n") + 1149 i18n("\nor report them in the bugtracker on\n") +
1150 i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), 1150 i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"),
1151 QMessageBox::NoIcon, 1151 QMessageBox::NoIcon,
1152 QMessageBox::Ok, 1152 QMessageBox::Ok,
1153 QMessageBox::NoButton, 1153 QMessageBox::NoButton,
1154 QMessageBox::NoButton); 1154 QMessageBox::NoButton);
1155 msg->exec(); 1155 msg->exec();
1156 delete msg; 1156 delete msg;
1157 1157
1158} 1158}
1159 1159
1160QString MainWindow::defaultFileName() 1160QString MainWindow::defaultFileName()
1161{ 1161{
1162 return locateLocal( "data", "korganizer/mycalendar.ics" ); 1162 return locateLocal( "data", "korganizer/mycalendar.ics" );
1163} 1163}
1164 1164
1165void MainWindow::processIncidenceSelection( Incidence *incidence ) 1165void MainWindow::processIncidenceSelection( Incidence *incidence )
1166{ 1166{
1167 if ( !incidence ) { 1167 if ( !incidence ) {
1168 enableIncidenceActions( false ); 1168 enableIncidenceActions( false );
1169 1169
1170 mNewSubTodoAction->setEnabled( false ); 1170 mNewSubTodoAction->setEnabled( false );
1171 setCaptionToDates(); 1171 setCaptionToDates();
1172 return; 1172 return;
1173 1173
1174 } 1174 }
1175 1175
1176 //KGlobal::locale()->formatDateTime(nextA, true); 1176 //KGlobal::locale()->formatDateTime(nextA, true);
1177 QString startString = ""; 1177 QString startString = "";
1178 if ( incidence->type() != "Todo" ) { 1178 if ( incidence->type() != "Todo" ) {
1179 if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { 1179 if ( incidence->dtStart().date() < incidence->dtEnd().date() ) {
1180 if ( incidence->doesFloat() ) { 1180 if ( incidence->doesFloat() ) {
1181 startString += ": "+incidence->dtStartDateStr( true ); 1181 startString += ": "+incidence->dtStartDateStr( true );
1182 startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); 1182 startString += " --- "+((Event*)incidence)->dtEndDateStr( true );
1183 1183
1184 } else { 1184 } else {
1185 startString = ": "+incidence->dtStartStr(true); 1185 startString = ": "+incidence->dtStartStr(true);
1186 startString += " --- "+((Event*)incidence)->dtEndStr(true); 1186 startString += " --- "+((Event*)incidence)->dtEndStr(true);
1187 1187
1188 } 1188 }
1189 1189
1190 } else { 1190 } else {
1191 if ( incidence->dtStart().time() != incidence->dtEnd().time() ) 1191 if ( incidence->dtStart().time() != incidence->dtEnd().time() )
1192 startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ 1192 startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+
1193 "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); 1193 "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time());
1194 startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); 1194 startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true);
1195 } 1195 }
1196 1196
1197 } 1197 }
1198 else 1198 else
1199 startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); 1199 startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed");
1200 if ( !incidence->location().isEmpty() ) 1200 if ( !incidence->location().isEmpty() )
1201 startString += " (" +incidence->location()+")"; 1201 startString += " (" +incidence->location()+")";
1202 setCaption( incidence->summary()+startString); 1202 setCaption( incidence->summary()+startString);
1203 1203
1204 enableIncidenceActions( true ); 1204 enableIncidenceActions( true );
1205 1205
1206 if ( incidence->type() == "Event" ) { 1206 if ( incidence->type() == "Event" ) {
1207 mShowAction->setText( i18n("Show Event...") ); 1207 mShowAction->setText( i18n("Show Event...") );
1208 mEditAction->setText( i18n("Edit Event...") ); 1208 mEditAction->setText( i18n("Edit Event...") );
1209 mDeleteAction->setText( i18n("Delete Event...") ); 1209 mDeleteAction->setText( i18n("Delete Event...") );
1210 1210
1211 mNewSubTodoAction->setEnabled( false ); 1211 mNewSubTodoAction->setEnabled( false );
1212 } else if ( incidence->type() == "Todo" ) { 1212 } else if ( incidence->type() == "Todo" ) {
1213 mShowAction->setText( i18n("Show Todo...") ); 1213 mShowAction->setText( i18n("Show Todo...") );
1214 mEditAction->setText( i18n("Edit Todo...") ); 1214 mEditAction->setText( i18n("Edit Todo...") );
1215 mDeleteAction->setText( i18n("Delete Todo...") ); 1215 mDeleteAction->setText( i18n("Delete Todo...") );
1216 1216
1217 mNewSubTodoAction->setEnabled( true ); 1217 mNewSubTodoAction->setEnabled( true );
1218 } else { 1218 } else {
1219 mShowAction->setText( i18n("Show...") ); 1219 mShowAction->setText( i18n("Show...") );
1220 mShowAction->setText( i18n("Edit...") ); 1220 mShowAction->setText( i18n("Edit...") );
1221 mShowAction->setText( i18n("Delete...") ); 1221 mShowAction->setText( i18n("Delete...") );
1222 1222
1223 mNewSubTodoAction->setEnabled( false ); 1223 mNewSubTodoAction->setEnabled( false );
1224 } 1224 }
1225} 1225}
1226 1226
1227void MainWindow::enableIncidenceActions( bool enabled ) 1227void MainWindow::enableIncidenceActions( bool enabled )
1228{ 1228{
1229 mShowAction->setEnabled( enabled ); 1229 mShowAction->setEnabled( enabled );
1230 mEditAction->setEnabled( enabled ); 1230 mEditAction->setEnabled( enabled );
1231 mDeleteAction->setEnabled( enabled ); 1231 mDeleteAction->setEnabled( enabled );
1232} 1232}
1233 1233
1234void MainWindow::importOL() 1234void MainWindow::importOL()
1235{ 1235{
1236#ifdef _WIN32_ 1236#ifdef _WIN32_
1237 KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); 1237 KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this );
1238 id->exec(); 1238 id->exec();
1239 delete id; 1239 delete id;
1240 mView->updateView(); 1240 mView->updateView();
1241#endif 1241#endif
1242} 1242}
1243void MainWindow::importBday() 1243void MainWindow::importBday()
1244{ 1244{
1245 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1245 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1246 i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), 1246 i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"),
1247 i18n("Import!"), i18n("Cancel"), 0, 1247 i18n("Import!"), i18n("Cancel"), 0,
1248 0, 1 ); 1248 0, 1 );
1249 if ( result == 0 ) { 1249 if ( result == 0 ) {
1250 mView->importBday(); 1250 mView->importBday();
1251 1251
1252 } 1252 }
1253 1253
1254 1254
1255} 1255}
1256void MainWindow::importQtopia() 1256void MainWindow::importQtopia()
1257{ 1257{
1258#ifndef DESKTOP_VERSION 1258#ifndef DESKTOP_VERSION
1259 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1259 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1260 i18n("When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing"), 1260 i18n("When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing"),
1261 i18n("Import!"), i18n("Cancel"), 0, 1261 i18n("Import!"), i18n("Cancel"), 0,
1262 0, 1 ); 1262 0, 1 );
1263 if ( result == 0 ) { 1263 if ( result == 0 ) {
1264 QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); 1264 QString datebook = Global::applicationFileName( "datebook", "datebook.xml");
1265 QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); 1265 QString todolist = Global::applicationFileName( "todolist", "todolist.xml");
1266 QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; 1266 QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml";
1267 mView->importQtopia( categories, datebook, todolist ); 1267 mView->importQtopia( categories, datebook, todolist );
1268 } 1268 }
1269#else 1269#else
1270 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1270 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1271 i18n("Not supported \non desktop!\n"), 1271 i18n("Not supported \non desktop!\n"),
1272 i18n("Ok"), i18n("Cancel"), 0, 1272 i18n("Ok"), i18n("Cancel"), 0,
1273 0, 1 ); 1273 0, 1 );
1274 1274
1275#endif 1275#endif
1276} 1276}
1277 1277
1278void MainWindow::saveOnClose() 1278void MainWindow::saveOnClose()
1279{ 1279{
1280 KOPrefs *p = KOPrefs::instance(); 1280 KOPrefs *p = KOPrefs::instance();
1281 p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); 1281 p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal );
1282 p->mToolBarUp = iconToolBar->x() > width()/2 || 1282 p->mToolBarUp = iconToolBar->x() > width()/2 ||
1283 iconToolBar->y() > height()/2; 1283 iconToolBar->y() > height()/2;
1284 mView->writeSettings(); 1284 mView->writeSettings();
1285 if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName())) 1285 if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName()))
1286 save(); 1286 save();
1287} 1287}
1288void MainWindow::slotModifiedChanged( bool changed ) 1288void MainWindow::slotModifiedChanged( bool changed )
1289{ 1289{
1290 if ( mBlockAtStartup ) 1290 if ( mBlockAtStartup )
1291 return; 1291 return;
1292 int msec; 1292 int msec;
1293 // we store the changes after 1 minute, 1293 // we store the changes after 1 minute,
1294 // and for safety reasons after 10 minutes again 1294 // and for safety reasons after 10 minutes again
1295 if ( !mBlockSaveFlag ) 1295 if ( !mBlockSaveFlag )
1296 msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; 1296 msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000;
1297 else 1297 else
1298 msec = 1000 * 600; 1298 msec = 1000 * 600;
1299 mSaveTimer.start( msec, true ); // 1 minute 1299 mSaveTimer.start( msec, true ); // 1 minute
1300 qDebug("KO: Saving File in %d secs!", msec/1000); 1300 qDebug("KO: Saving File in %d secs!", msec/1000);
1301 mCalendarModifiedFlag = true; 1301 mCalendarModifiedFlag = true;
1302} 1302}
1303#include <qfileinfo.h> 1303#include <qfileinfo.h>
1304void MainWindow::save() 1304void MainWindow::save()
1305{ 1305{
1306 if ( mBlockSaveFlag ) 1306 if ( mBlockSaveFlag )
1307 return; 1307 return;
1308 bool store = mBlockSaveFlag; 1308 bool store = mBlockSaveFlag;
1309 mBlockSaveFlag = true; 1309 mBlockSaveFlag = true;
1310 if ( mView->checkFileVersion( defaultFileName()) ) { 1310 if ( mView->checkFileVersion( defaultFileName()) ) {
1311 1311
1312 QTime neededSaveTime = QDateTime::currentDateTime().time(); 1312 QTime neededSaveTime = QDateTime::currentDateTime().time();
1313 setCaption(i18n("KO/Pi:Saving Data to File ..." )); 1313 setCaption(i18n("KO/Pi:Saving Data to File ..." ));
1314 qDebug("KO: Start saving data to file!"); 1314 qDebug("KO: Start saving data to file!");
1315 mView->saveCalendar( defaultFileName() ); 1315 mView->saveCalendar( defaultFileName() );
1316 1316
1317 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); 1317 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
1318 mView->setLoadedFileVersion(QDateTime::currentDateTime()); 1318 mView->setLoadedFileVersion(QDateTime::currentDateTime());
1319 qDebug("KO: Needed %d ms for saving.",msNeeded ); 1319 qDebug("KO: Needed %d ms for saving.",msNeeded );
1320 QString savemes; 1320 QString savemes;
1321 savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); 1321 savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 );
1322 setCaption(savemes); 1322 setCaption(savemes);
1323 } else 1323 } else
1324 setCaption(i18n("Saving cancelled!")); 1324 setCaption(i18n("Saving cancelled!"));
1325 mCalendarModifiedFlag = false; 1325 mCalendarModifiedFlag = false;
1326 mBlockSaveFlag = store; 1326 mBlockSaveFlag = store;
1327} 1327}
1328 1328
1329void MainWindow::keyReleaseEvent ( QKeyEvent * e) 1329void MainWindow::keyReleaseEvent ( QKeyEvent * e)
1330{ 1330{
1331 if ( !e->isAutoRepeat() ) { 1331 if ( !e->isAutoRepeat() ) {
1332 mFlagKeyPressed = false; 1332 mFlagKeyPressed = false;
1333 } 1333 }
1334} 1334}
1335void MainWindow::keyPressEvent ( QKeyEvent * e ) 1335void MainWindow::keyPressEvent ( QKeyEvent * e )
1336{ 1336{
1337 qApp->processEvents(); 1337 qApp->processEvents();
1338 if ( e->isAutoRepeat() && !mFlagKeyPressed ) { 1338 if ( e->isAutoRepeat() && !mFlagKeyPressed ) {
1339 e->ignore(); 1339 e->ignore();
1340 // qDebug(" ignore %d",e->isAutoRepeat() ); 1340 // qDebug(" ignore %d",e->isAutoRepeat() );
1341 return; 1341 return;
1342 } 1342 }
1343 if (! e->isAutoRepeat() ) 1343 if (! e->isAutoRepeat() )
1344 mFlagKeyPressed = true; 1344 mFlagKeyPressed = true;
1345 KOPrefs *p = KOPrefs::instance(); 1345 KOPrefs *p = KOPrefs::instance();
1346 bool showSelectedDates = false; 1346 bool showSelectedDates = false;
1347 int size; 1347 int size;
1348 int pro = 0; 1348 int pro = 0;
1349 //qDebug("MainWindow::keyPressEvent "); 1349 //qDebug("MainWindow::keyPressEvent ");
1350 switch ( e->key() ) { 1350 switch ( e->key() ) {
1351 case Qt::Key_Right: 1351 case Qt::Key_Right:
1352 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) 1352 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton)
1353 mView->goNextMonth(); 1353 mView->goNextMonth();
1354 else 1354 else
1355 mView->goNext(); 1355 mView->goNext();
1356 showSelectedDates = true; 1356 showSelectedDates = true;
1357 break; 1357 break;
1358 case Qt::Key_Left: 1358 case Qt::Key_Left:
1359 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1359 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1360 mView->goPreviousMonth(); 1360 mView->goPreviousMonth();
1361 else 1361 else
1362 mView->goPrevious(); 1362 mView->goPrevious();
1363 showSelectedDates = true; 1363 showSelectedDates = true;
1364 break; 1364 break;
1365 case Qt::Key_Down: 1365 case Qt::Key_Down:
1366 mView->viewManager()->agendaView()->scrollOneHourDown(); 1366 mView->viewManager()->agendaView()->scrollOneHourDown();
1367 break; 1367 break;
1368 case Qt::Key_Up: 1368 case Qt::Key_Up:
1369 mView->viewManager()->agendaView()->scrollOneHourUp(); 1369 mView->viewManager()->agendaView()->scrollOneHourUp();
1370 break; 1370 break;
1371 case Qt::Key_I: 1371 case Qt::Key_I:
1372 mView->showIncidence(); 1372 mView->showIncidence();
1373 break; 1373 break;
1374 case Qt::Key_Delete: 1374 case Qt::Key_Delete:
1375 case Qt::Key_Backspace: 1375 case Qt::Key_Backspace:
1376 mView->deleteIncidence(); 1376 mView->deleteIncidence();
1377 break; 1377 break;
1378 case Qt::Key_D: 1378 case Qt::Key_D:
1379 mView->viewManager()->showDayView(); 1379 mView->viewManager()->showDayView();
1380 showSelectedDates = true; 1380 showSelectedDates = true;
1381 break; 1381 break;
1382 case Qt::Key_O: 1382 case Qt::Key_O:
1383 mView->toggleFilerEnabled( ); 1383 mView->toggleFilerEnabled( );
1384 break; 1384 break;
1385 case Qt::Key_0: 1385 case Qt::Key_0:
1386 case Qt::Key_1: 1386 case Qt::Key_1:
1387 case Qt::Key_2: 1387 case Qt::Key_2:
1388 case Qt::Key_3: 1388 case Qt::Key_3:
1389 case Qt::Key_4: 1389 case Qt::Key_4:
1390 case Qt::Key_5: 1390 case Qt::Key_5:
1391 case Qt::Key_6: 1391 case Qt::Key_6:
1392 case Qt::Key_7: 1392 case Qt::Key_7:
1393 case Qt::Key_8: 1393 case Qt::Key_8:
1394 case Qt::Key_9: 1394 case Qt::Key_9:
1395 pro = e->key()-48; 1395 pro = e->key()-48;
1396 if ( pro == 0 ) 1396 if ( pro == 0 )
1397 pro = 10; 1397 pro = 10;
1398 if ( e->state() == Qt::ControlButton) 1398 if ( e->state() == Qt::ControlButton)
1399 pro += 10; 1399 pro += 10;
1400 break; 1400 break;
1401 case Qt::Key_M: 1401 case Qt::Key_M:
1402 mView->viewManager()->showMonthView(); 1402 mView->viewManager()->showMonthView();
1403 showSelectedDates = true; 1403 showSelectedDates = true;
1404 break; 1404 break;
1405 case Qt::Key_Insert: 1405 case Qt::Key_Insert:
1406 mView->newEvent(); 1406 mView->newEvent();
1407 break; 1407 break;
1408 case Qt::Key_S : 1408 case Qt::Key_S :
1409 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) 1409 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton)
1410 mView->newSubTodo(); 1410 mView->newSubTodo();
1411 else 1411 else
1412 mView->dialogManager()->showSearchDialog(); 1412 mView->dialogManager()->showSearchDialog();
1413 break; 1413 break;
1414 case Qt::Key_Y : 1414 case Qt::Key_Y :
1415 case Qt::Key_Z : 1415 case Qt::Key_Z :
1416 mView->viewManager()->showWorkWeekView(); 1416 mView->viewManager()->showWorkWeekView();
1417 showSelectedDates = true; 1417 showSelectedDates = true;
1418 break; 1418 break;
1419 case Qt::Key_U : 1419 case Qt::Key_U :
1420 mView->viewManager()->showWeekView(); 1420 mView->viewManager()->showWeekView();
1421 showSelectedDates = true; 1421 showSelectedDates = true;
1422 break; 1422 break;
1423 case Qt::Key_H : 1423 case Qt::Key_H :
1424 keyBindings(); 1424 keyBindings();
1425 break; 1425 break;
1426 case Qt::Key_W: 1426 case Qt::Key_W:
1427 mView->viewManager()->showWhatsNextView(); 1427 mView->viewManager()->showWhatsNextView();
1428 break; 1428 break;
1429 case Qt::Key_L: 1429 case Qt::Key_L:
1430 mView->viewManager()->showListView(); 1430 mView->viewManager()->showListView();
1431 break; 1431 break;
1432 case Qt::Key_N: 1432 case Qt::Key_N:
1433 mView->viewManager()->showNextXView(); 1433 mView->viewManager()->showNextXView();
1434 showSelectedDates = true; 1434 showSelectedDates = true;
1435 break; 1435 break;
1436 case Qt::Key_V: 1436 case Qt::Key_V:
1437 mView->viewManager()->showTodoView(); 1437 mView->viewManager()->showTodoView();
1438 break; 1438 break;
1439 case Qt::Key_C: 1439 case Qt::Key_C:
1440 mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() ); 1440 mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() );
1441 break; 1441 break;
1442 case Qt::Key_P: 1442 case Qt::Key_P:
1443 mView->showDatePicker( ); 1443 mView->showDatePicker( );
1444 break; 1444 break;
1445 case Qt::Key_F: 1445 case Qt::Key_F:
1446 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1446 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1447 mView->editFilters(); 1447 mView->editFilters();
1448 else 1448 else
1449 mView->toggleFilter(); 1449 mView->toggleFilter();
1450 break; 1450 break;
1451 case Qt::Key_X: 1451 case Qt::Key_X:
1452 mView->toggleDateNavigatorWidget(); 1452 mView->toggleDateNavigatorWidget();
1453 break; 1453 break;
1454 case Qt::Key_Space: 1454 case Qt::Key_Space:
1455 mView->toggleExpand(); 1455 mView->toggleExpand();
1456 break; 1456 break;
1457 case Qt::Key_A: 1457 case Qt::Key_A:
1458 mView->toggleAllDaySize(); 1458 mView->toggleAllDaySize();
1459 break; 1459 break;
1460 case Qt::Key_T: 1460 case Qt::Key_T:
1461 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1461 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1462 mView->newTodo(); 1462 mView->newTodo();
1463 else { 1463 else {
1464 mView->goToday(); 1464 mView->goToday();
1465 showSelectedDates = true; 1465 showSelectedDates = true;
1466 } 1466 }
1467 break; 1467 break;
1468 case Qt::Key_J: 1468 case Qt::Key_J:
1469 mView->viewManager()->showJournalView(); 1469 mView->viewManager()->showJournalView();
1470 break; 1470 break;
1471 case Qt::Key_B: 1471 case Qt::Key_B:
1472 mView->editIncidenceDescription();; 1472 mView->editIncidenceDescription();;
1473 break; 1473 break;
1474 // case Qt::Key_Return: 1474 // case Qt::Key_Return:
1475 case Qt::Key_E: 1475 case Qt::Key_E:
1476 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1476 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1477 mView->newEvent(); 1477 mView->newEvent();
1478 else 1478 else
1479 mView->editIncidence(); 1479 mView->editIncidence();
1480 break; 1480 break;
1481 case Qt::Key_Plus: 1481 case Qt::Key_Plus:
1482 size = p->mHourSize +2; 1482 size = p->mHourSize +2;
1483 if ( size <= 18 ) 1483 if ( size <= 18 )
1484 configureAgenda( size ); 1484 configureAgenda( size );
1485 break; 1485 break;
1486 case Qt::Key_Minus: 1486 case Qt::Key_Minus:
1487 size = p->mHourSize - 2; 1487 size = p->mHourSize - 2;
1488 if ( size >= 4 ) 1488 if ( size >= 4 )
1489 configureAgenda( size ); 1489 configureAgenda( size );
1490 break; 1490 break;
1491 1491
1492 1492
1493 default: 1493 default:
1494 e->ignore(); 1494 e->ignore();
1495 } 1495 }
1496 if ( pro > 0 ) { 1496 if ( pro > 0 ) {
1497 mView->selectFilter( pro-1 ); 1497 mView->selectFilter( pro-1 );
1498 } 1498 }
1499 if ( showSelectedDates ) { 1499 if ( showSelectedDates ) {
1500 ;// setCaptionToDates(); 1500 ;// setCaptionToDates();
1501 } 1501 }
1502 1502
1503} 1503}
1504 1504
1505void MainWindow::configureToolBar( int item ) 1505void MainWindow::configureToolBar( int item )
1506{ 1506{
1507 1507
1508 configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) ); 1508 configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) );
1509 KOPrefs *p = KOPrefs::instance(); 1509 KOPrefs *p = KOPrefs::instance();
1510 p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 ); 1510 p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 );
1511 p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 ); 1511 p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 );
1512 p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 ); 1512 p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 );
1513 p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 ); 1513 p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 );
1514 p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 ); 1514 p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 );
1515 p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 ); 1515 p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 );
1516 p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 ); 1516 p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 );
1517 p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 ); 1517 p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 );
1518 p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 ); 1518 p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 );
1519 p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 ); 1519 p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 );
1520 p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 ); 1520 p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 );
1521 p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 ); 1521 p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 );
1522 p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 ); 1522 p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 );
1523 p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 ); 1523 p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 );
1524 p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 ); 1524 p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 );
1525 p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 ); 1525 p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 );
1526 p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 ); 1526 p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 );
1527 p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 ); 1527 p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 );
1528 p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 ); 1528 p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 );
1529 // initActions(); 1529 // initActions();
1530} 1530}
1531 1531
1532void MainWindow::setCaptionToDates() 1532void MainWindow::setCaptionToDates()
1533{ 1533{
1534 QString selDates; 1534 QString selDates;
1535 selDates = KGlobal::locale()->formatDate(mView->startDate(), true); 1535 selDates = KGlobal::locale()->formatDate(mView->startDate(), true);
1536 if (mView->startDate() < mView->endDate() ) 1536 if (mView->startDate() < mView->endDate() )
1537 selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true); 1537 selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true);
1538 setCaption( i18n("Dates: ") + selDates ); 1538 setCaption( i18n("Dates: ") + selDates );
1539 1539
1540} 1540}
1541// parameter item == 0: reinit 1541// parameter item == 0: reinit
1542void MainWindow::configureAgenda( int item ) 1542void MainWindow::configureAgenda( int item )
1543{ 1543{
1544 1544
1545 KOPrefs *p = KOPrefs::instance(); 1545 KOPrefs *p = KOPrefs::instance();
1546 1546
1547 int i; 1547 int i;
1548 if ( item == 1 ) { 1548 if ( item == 1 ) {
1549 mView->toggleAllDaySize(); 1549 mView->toggleAllDaySize();
1550 return; 1550 return;
1551 } 1551 }
1552 // do not allow 4 for widgets higher than 480 1552 // do not allow 4 for widgets higher than 480
1553 // if ( QApplication::desktop()->height() > 480 ) { 1553 // if ( QApplication::desktop()->height() > 480 ) {
1554// if ( item == 4 ) 1554// if ( item == 4 )
1555// item = 6; 1555// item = 6;
1556// } 1556// }
1557 for ( i = 4; i <= 18; i= i+2 ) 1557 for ( i = 4; i <= 18; i= i+2 )
1558 configureAgendaMenu->setItemChecked( i, false ); 1558 configureAgendaMenu->setItemChecked( i, false );
1559 configureAgendaMenu->setItemChecked( item, true ); 1559 configureAgendaMenu->setItemChecked( item, true );
1560 if ( p->mHourSize == item ) 1560 if ( p->mHourSize == item )
1561 return; 1561 return;
1562 p->mHourSize=item; 1562 p->mHourSize=item;
1563 mView->viewManager()->agendaView()->updateConfig(); 1563 mView->viewManager()->agendaView()->updateConfig();
1564} 1564}
1565 1565
1566void MainWindow::saveCalendar() 1566void MainWindow::saveCalendar()
1567{ 1567{
1568 QString fn = KOPrefs::instance()->mLastSaveFile; 1568 QString fn = KOPrefs::instance()->mLastSaveFile;
1569 fn = KFileDialog::getSaveFileName( fn, i18n("Save backup filename"), this ); 1569 fn = KFileDialog::getSaveFileName( fn, i18n("Save backup filename"), this );
1570 1570
1571 if ( fn == "" ) 1571 if ( fn == "" )
1572 return; 1572 return;
1573 QFileInfo info; 1573 QFileInfo info;
1574 info.setFile( fn ); 1574 info.setFile( fn );
1575 QString mes; 1575 QString mes;
1576 bool createbup = true; 1576 bool createbup = true;
1577 if ( info. exists() ) { 1577 if ( info. exists() ) {
1578 mes = i18n("Backup file\nalready exists!\nOld backup file from:\n%1\nOverwrite?\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )) ; 1578 mes = i18n("Backup file\nalready exists!\nOld backup file from:\n%1\nOverwrite?\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )) ;
1579 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, 1579 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes,
1580 i18n("Overwrite!"), i18n("Cancel"), 0, 1580 i18n("Overwrite!"), i18n("Cancel"), 0,
1581 0, 1 ); 1581 0, 1 );
1582 if ( result != 0 ) { 1582 if ( result != 0 ) {
1583 createbup = false; 1583 createbup = false;
1584 } 1584 }
1585 } 1585 }
1586 if ( createbup ) { 1586 if ( createbup ) {
1587 mView->saveCalendar( fn ); 1587 mView->saveCalendar( fn );
1588 mes = i18n("KO/Pi:Saved %1").arg(fn); 1588 mes = i18n("KO/Pi:Saved %1").arg(fn);
1589 KOPrefs::instance()->mLastSaveFile = fn; 1589 KOPrefs::instance()->mLastSaveFile = fn;
1590 setCaption(mes); 1590 setCaption(mes);
1591 } 1591 }
1592} 1592}
1593void MainWindow::loadCalendar() 1593void MainWindow::loadCalendar()
1594{ 1594{
1595 1595
1596 QString fn = KOPrefs::instance()->mLastLoadFile; 1596 QString fn = KOPrefs::instance()->mLastLoadFile;
1597 fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this ); 1597 fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this );
1598 1598
1599 if ( fn == "" ) 1599 if ( fn == "" )
1600 return; 1600 return;
1601 QFileInfo info; 1601 QFileInfo info;
1602 info.setFile( fn ); 1602 info.setFile( fn );
1603 QString mess; 1603 QString mess;
1604 bool loadbup = true; 1604 bool loadbup = true;
1605 if ( info. exists() ) { 1605 if ( info. exists() ) {
1606 mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); 1606 mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false ));
1607 int result = QMessageBox::warning( this, "KO/Pi: Warning!", 1607 int result = QMessageBox::warning( this, "KO/Pi: Warning!",
1608 mess, 1608 mess,
1609 i18n("Load!"), i18n("Cancel"), 0, 1609 i18n("Load!"), i18n("Cancel"), 0,
1610 0, 1 ); 1610 0, 1 );
1611 if ( result != 0 ) { 1611 if ( result != 0 ) {
1612 loadbup = false; 1612 loadbup = false;
1613 } 1613 }
1614 } else { 1614 } else {
1615 QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1615 QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1616 i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0, 1616 i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0,
1617 0, 1 ); 1617 0, 1 );
1618 1618
1619 return; 1619 return;
1620 } 1620 }
1621 if ( loadbup ) { 1621 if ( loadbup ) {
1622 mView->openCalendar( fn ); 1622 mView->openCalendar( fn );
1623 KOPrefs::instance()->mLastLoadFile = fn; 1623 KOPrefs::instance()->mLastLoadFile = fn;
1624 mess = i18n("KO/Pi:Loaded %1").arg(fn) ; 1624 mess = i18n("KO/Pi:Loaded %1").arg(fn) ;
1625 setCaption(mess); 1625 setCaption(mess);
1626 } 1626 }
1627 1627
1628} 1628}
1629void MainWindow::quickImportIcal() 1629void MainWindow::quickImportIcal()
1630{ 1630{
1631 importFile( KOPrefs::instance()->mLastImportFile, false ); 1631 importFile( KOPrefs::instance()->mLastImportFile, false );
1632} 1632}
1633void MainWindow::importFile( QString fn, bool quick ) 1633void MainWindow::importFile( QString fn, bool quick )
1634{ 1634{
1635 QFileInfo info; 1635 QFileInfo info;
1636 info.setFile( fn ); 1636 info.setFile( fn );
1637 QString mess; 1637 QString mess;
1638 bool loadbup = true; 1638 bool loadbup = true;
1639 if ( !info. exists() ) { 1639 if ( !info. exists() ) {
1640 mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30)); 1640 mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30));
1641 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1641 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1642 mess ); 1642 mess );
1643 return; 1643 return;
1644 } 1644 }
1645 int result = 0; 1645 int result = 0;
1646 if ( !quick ) { 1646 if ( !quick ) {
1647 mess = i18n( "Import file \n...%1\nfrom:\n%2\nDuplicated entries\nwill not be imported!\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); 1647 mess = i18n( "Import file \n...%1\nfrom:\n%2\nDuplicated entries\nwill not be imported!\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false ));
1648 result = QMessageBox::warning( this, "KO/Pi: Warning!", 1648 result = QMessageBox::warning( this, "KO/Pi: Warning!",
1649 mess, 1649 mess,
1650 "Import", "Cancel", 0, 1650 "Import", "Cancel", 0,
1651 0, 1 ); 1651 0, 1 );
1652 } 1652 }
1653 if ( result == 0 ) { 1653 if ( result == 0 ) {
1654 if ( mView->openCalendar( fn, true )) { 1654 if ( mView->openCalendar( fn, true )) {
1655 KOPrefs::instance()->mLastImportFile = fn; 1655 KOPrefs::instance()->mLastImportFile = fn;
1656 setCaption(i18n("Imported file successfully")); 1656 setCaption(i18n("Imported file successfully"));
1657 } else { 1657 } else {
1658 setCaption(i18n("Error importing file")); 1658 setCaption(i18n("Error importing file"));
1659 } 1659 }
1660 } 1660 }
1661} 1661}
1662 1662
1663void MainWindow::importIcal() 1663void MainWindow::importIcal()
1664{ 1664{
1665 1665
1666 QString fn =KOPrefs::instance()->mLastImportFile; 1666 QString fn =KOPrefs::instance()->mLastImportFile;
1667 1667
1668 fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this ); 1668 fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this );
1669 if ( fn == "" ) 1669 if ( fn == "" )
1670 return; 1670 return;
1671 importFile( fn, true ); 1671 importFile( fn, true );
1672 1672
1673} 1673}
1674 1674
1675void MainWindow::exportVCalendar() 1675void MainWindow::exportVCalendar()
1676{ 1676{
1677 QString fn = KOPrefs::instance()->mLastVcalFile; 1677 QString fn = KOPrefs::instance()->mLastVcalFile;
1678 fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this ); 1678 fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this );
1679 if ( fn == "" ) 1679 if ( fn == "" )
1680 return; 1680 return;
1681 QFileInfo info; 1681 QFileInfo info;
1682 info.setFile( fn ); 1682 info.setFile( fn );
1683 QString mes; 1683 QString mes;
1684 bool createbup = true; 1684 bool createbup = true;
1685 if ( info. exists() ) { 1685 if ( info. exists() ) {
1686 mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); 1686 mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) );
1687 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, 1687 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes,
1688 i18n("Overwrite!"), i18n("Cancel"), 0, 1688 i18n("Overwrite!"), i18n("Cancel"), 0,
1689 0, 1 ); 1689 0, 1 );
1690 if ( result != 0 ) { 1690 if ( result != 0 ) {
1691 createbup = false; 1691 createbup = false;
1692 } 1692 }
1693 } 1693 }
1694 if ( createbup ) { 1694 if ( createbup ) {
1695 if ( mView->exportVCalendar( fn ) ) { 1695 if ( mView->exportVCalendar( fn ) ) {
1696 KOPrefs::instance()->mLastVcalFile = fn; 1696 KOPrefs::instance()->mLastVcalFile = fn;
1697 if ( fn.length() > 20 ) 1697 if ( fn.length() > 20 )
1698 mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ; 1698 mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ;
1699 else 1699 else
1700 mes = i18n("KO/Pi:Exported to %1").arg(fn ); 1700 mes = i18n("KO/Pi:Exported to %1").arg(fn );
1701 setCaption(mes); 1701 setCaption(mes);
1702 } 1702 }
1703 } 1703 }
1704 1704
1705} 1705}
1706#include <qpushbutton.h> 1706#include <qpushbutton.h>
1707QString MainWindow::getPassword( ) 1707QString MainWindow::getPassword( )
1708{ 1708{
1709 QString retfile = ""; 1709 QString retfile = "";
1710 QDialog dia ( this, "input-dialog", true ); 1710 QDialog dia ( this, "input-dialog", true );
1711 QLineEdit lab ( &dia ); 1711 QLineEdit lab ( &dia );
1712 lab.setEchoMode( QLineEdit::Password ); 1712 lab.setEchoMode( QLineEdit::Password );
1713 QVBoxLayout lay( &dia ); 1713 QVBoxLayout lay( &dia );
1714 lay.setMargin(7); 1714 lay.setMargin(7);
1715 lay.setSpacing(7); 1715 lay.setSpacing(7);
1716 lay.addWidget( &lab); 1716 lay.addWidget( &lab);
1717 dia.setFixedSize( 230,50 ); 1717 dia.setFixedSize( 230,50 );
1718 dia.setCaption( i18n("Enter password") ); 1718 dia.setCaption( i18n("Enter password") );
1719 QPushButton pb ( "OK", &dia); 1719 QPushButton pb ( "OK", &dia);
1720 lay.addWidget( &pb ); 1720 lay.addWidget( &pb );
1721 connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) ); 1721 connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) );
1722 dia.show(); 1722 dia.show();
1723 int res = dia.exec(); 1723 int res = dia.exec();
1724 if ( res ) 1724 if ( res )
1725 retfile = lab.text(); 1725 retfile = lab.text();
1726 dia.hide(); 1726 dia.hide();
1727 qApp->processEvents(); 1727 qApp->processEvents();
1728 return retfile; 1728 return retfile;
1729 1729
1730} 1730}
1731 1731
1732void MainWindow::syncLocalFile() 1732void MainWindow::syncLocalFile()
1733{ 1733{
1734 1734
1735 QString fn =KOPrefs::instance()->mLastSyncedLocalFile; 1735 QString fn =KOPrefs::instance()->mLastSyncedLocalFile;
1736 1736
1737 fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.ics/*.vcs)"), this ); 1737 fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.ics/*.vcs)"), this );
1738 if ( fn == "" ) 1738 if ( fn == "" )
1739 return; 1739 return;
1740 //mView->setSyncDevice("local-file" ); 1740 //mView->setSyncDevice("local-file" );
1741 if ( syncWithFile( fn, false ) ) { 1741 if ( syncWithFile( fn, false ) ) {
1742 // Event* e = mView->getLastSyncEvent(); 1742 // Event* e = mView->getLastSyncEvent();
1743// e->setReadOnly( false ); 1743// e->setReadOnly( false );
1744// e->setLocation( i18n("Local file: ")+ KOPrefs::instance()->mLastSyncedLocalFile); 1744// e->setLocation( i18n("Local file: ")+ KOPrefs::instance()->mLastSyncedLocalFile);
1745// e->setReadOnly( true ); 1745// e->setReadOnly( true );
1746 } 1746 }
1747 1747
1748} 1748}
1749 1749
1750bool MainWindow::syncWithFile( QString fn , bool quick ) 1750bool MainWindow::syncWithFile( QString fn , bool quick )
1751{ 1751{
1752 bool ret = false; 1752 bool ret = false;
1753 QFileInfo info; 1753 QFileInfo info;
1754 info.setFile( fn ); 1754 info.setFile( fn );
1755 QString mess; 1755 QString mess;
1756 bool loadbup = true; 1756 bool loadbup = true;
1757 if ( !info. exists() ) { 1757 if ( !info. exists() ) {
1758 mess = i18n( "Sync file \n...%1\ndoes not exist!\nNothing synced!\n").arg(fn.right( 30) ); 1758 mess = i18n( "Sync file \n...%1\ndoes not exist!\nNothing synced!\n").arg(fn.right( 30) );
1759 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1759 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1760 mess ); 1760 mess );
1761 return ret; 1761 return ret;
1762 } 1762 }
1763 int result = 0; 1763 int result = 0;
1764 if ( !quick ) { 1764 if ( !quick ) {
1765 mess = i18n("Sync with file \n...%1\nfrom:\n%2\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); 1765 mess = i18n("Sync with file \n...%1\nfrom:\n%2\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false ));
1766 result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1766 result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1767 mess, 1767 mess,
1768 i18n("Sync"), i18n("Cancel"), 0, 1768 i18n("Sync"), i18n("Cancel"), 0,
1769 0, 1 ); 1769 0, 1 );
1770 if ( result ) 1770 if ( result )
1771 return false; 1771 return false;
1772 } 1772 }
1773 if ( KOPrefs::instance()->mAskForPreferences ) 1773 if ( KOPrefs::instance()->mAskForPreferences )
1774 mView->edit_sync_options(); 1774 mView->edit_sync_options();
1775 if ( result == 0 ) { 1775 if ( result == 0 ) {
1776 //qDebug("Now sycing ... "); 1776 //qDebug("Now sycing ... ");
1777 if ( ret = mView->syncCalendar( fn, KOPrefs::instance()->mSyncAlgoPrefs ) ) 1777 if ( ret = mView->syncCalendar( fn, KOPrefs::instance()->mSyncAlgoPrefs ) )
1778 setCaption( i18n("Synchronization successful") ); 1778 setCaption( i18n("Synchronization successful") );
1779 else 1779 else
1780 setCaption( i18n("Sync cancelled or failed. Nothing synced.") ); 1780 setCaption( i18n("Sync cancelled or failed. Nothing synced.") );
1781 if ( ! quick ) 1781 if ( ! quick )
1782 KOPrefs::instance()->mLastSyncedLocalFile = fn; 1782 KOPrefs::instance()->mLastSyncedLocalFile = fn;
1783 slotModifiedChanged( true ); 1783 slotModifiedChanged( true );
1784 } 1784 }
1785 return ret; 1785 return ret;
1786} 1786}
1787void MainWindow::quickSyncLocalFile() 1787void MainWindow::quickSyncLocalFile()
1788{ 1788{
1789 //mView->setSyncDevice("local-file" ); 1789 //mView->setSyncDevice("local-file" );
1790 //qDebug("quickSyncLocalFile() "); 1790 //qDebug("quickSyncLocalFile() ");
1791 if ( syncWithFile( KOPrefs::instance()->mLastSyncedLocalFile, false ) ) { 1791 if ( syncWithFile( KOPrefs::instance()->mLastSyncedLocalFile, false ) ) {
1792 // Event* e = mView->getLastSyncEvent(); 1792 // Event* e = mView->getLastSyncEvent();
1793// e->setReadOnly( false ); 1793// e->setReadOnly( false );
1794// e->setLocation( i18n("Quick with file: ")+ KOPrefs::instance()->mLastSyncedLocalFile); 1794// e->setLocation( i18n("Quick with file: ")+ KOPrefs::instance()->mLastSyncedLocalFile);
1795// e->setReadOnly( true ); 1795// e->setReadOnly( true );
1796 1796
1797 } 1797 }
1798} 1798}
1799 1799
1800void MainWindow::confSync() 1800void MainWindow::confSync()
1801{ 1801{
1802 mView->confSync(); 1802 mView->confSync();
1803 fillSyncMenu(); 1803 fillSyncMenu();
1804 //mView->writeSettings(); 1804 //mView->writeSettings();
1805 1805
1806 1806
1807} 1807}
1808void MainWindow::syncRemote( KSyncProfile* prof, bool ask) 1808void MainWindow::syncRemote( KSyncProfile* prof, bool ask)
1809{ 1809{
1810 QString question; 1810 QString question;
1811 if ( ask ) { 1811 if ( ask ) {
1812 question = i18n("Do you really want\nto remote sync\nwith profile \n")+ prof->getName()+" ?\n"; 1812 question = i18n("Do you really want\nto remote sync\nwith profile \n")+ prof->getName()+" ?\n";
1813 if ( QMessageBox::information( this, i18n("KO/Pi Sync"), 1813 if ( QMessageBox::information( this, i18n("KO/Pi Sync"),
1814 question, 1814 question,
1815 i18n("Yes"), i18n("No"), 1815 i18n("Yes"), i18n("No"),
1816 0, 0 ) != 0 ) 1816 0, 0 ) != 0 )
1817 return; 1817 return;
1818 } 1818 }
1819 QString command = prof->getPreSyncCommand(); 1819 QString command = prof->getPreSyncCommand();
1820 int fi; 1820 int fi;
1821 if ( (fi = command.find("$PWD$")) > 0 ) { 1821 if ( (fi = command.find("$PWD$")) > 0 ) {
1822 QString pwd = getPassword(); 1822 QString pwd = getPassword();
1823 command = command.left( fi )+ pwd + command.mid( fi+5 ); 1823 command = command.left( fi )+ pwd + command.mid( fi+5 );
1824 1824
1825 } 1825 }
1826 int maxlen = 30; 1826 int maxlen = 30;
1827 if ( QApplication::desktop()->width() > 320 ) 1827 if ( QApplication::desktop()->width() > 320 )
1828 maxlen += 25; 1828 maxlen += 25;
1829 setCaption ( i18n( "Copy remote file to local machine..." ) ); 1829 setCaption ( i18n( "Copy remote file to local machine..." ) );
1830 int fileSize = 0; 1830 int fileSize = 0;
1831 int result = system ( command ); 1831 int result = system ( command );
1832 // 0 : okay 1832 // 0 : okay
1833 // 256: no such file or dir 1833 // 256: no such file or dir
1834 // 1834 //
1835 qDebug("KO: Remote copy result(0 = okay): %d ",result ); 1835 qDebug("KO: Remote copy result(0 = okay): %d ",result );
1836 if ( result != 0 ) { 1836 if ( result != 0 ) {
1837 int len = maxlen; 1837 int len = maxlen;
1838 while ( len < command.length() ) { 1838 while ( len < command.length() ) {
1839 command.insert( len , "\n" ); 1839 command.insert( len , "\n" );
1840 len += maxlen +2; 1840 len += maxlen +2;
1841 } 1841 }
1842 question = i18n("Sorry, the copy command failed!\nCommand was:\n%1\n \nTry command on console to get more\ndetailed info about the reason.\n").arg (command) ; 1842 question = i18n("Sorry, the copy command failed!\nCommand was:\n%1\n \nTry command on console to get more\ndetailed info about the reason.\n").arg (command) ;
1843 QMessageBox::information( this, i18n("KO/Pi Sync - ERROR"), 1843 QMessageBox::information( this, i18n("KO/Pi Sync - ERROR"),
1844 question, 1844 question,
1845 i18n("Okay!")) ; 1845 i18n("Okay!")) ;
1846 setCaption ("KO/Pi"); 1846 setCaption ("KO/Pi");
1847 return; 1847 return;
1848 } 1848 }
1849 setCaption ( i18n( "Copying succeed." ) ); 1849 setCaption ( i18n( "Copying succeed." ) );
1850 //qDebug(" file **%s** ",prof->getLocalTempFile().latin1() ); 1850 //qDebug(" file **%s** ",prof->getLocalTempFile().latin1() );
1851 if ( syncWithFile( prof->getLocalTempFile(), true ) ) { 1851 if ( syncWithFile( prof->getLocalTempFile(), true ) ) {
1852// Event* e = mView->getLastSyncEvent(); 1852// Event* e = mView->getLastSyncEvent();
1853// e->setReadOnly( false ); 1853// e->setReadOnly( false );
1854// e->setLocation( KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile]); 1854// e->setLocation( KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile]);
1855// e->setReadOnly( true ); 1855// e->setReadOnly( true );
1856 if ( KOPrefs::instance()->mWriteBackFile ) { 1856 if ( KOPrefs::instance()->mWriteBackFile ) {
1857 command = prof->getPostSyncCommand(); 1857 command = prof->getPostSyncCommand();
1858 setCaption ( i18n( "Writing back file ..." ) ); 1858 setCaption ( i18n( "Writing back file ..." ) );
1859 result = system ( command ); 1859 result = system ( command );
1860 qDebug("KO: Writing back file result: %d ", result); 1860 qDebug("KO: Writing back file result: %d ", result);
1861 if ( result != 0 ) { 1861 if ( result != 0 ) {
1862 setCaption ( i18n( "Writing back file result: " )+QString::number( result ) ); 1862 setCaption ( i18n( "Writing back file result: " )+QString::number( result ) );
1863 return; 1863 return;
1864 } else { 1864 } else {
1865 setCaption ( i18n( "Syncronization sucessfully completed" ) ); 1865 setCaption ( i18n( "Syncronization sucessfully completed" ) );
1866 } 1866 }
1867 } 1867 }
1868 } 1868 }
1869 return; 1869 return;
1870} 1870}
1871void MainWindow::syncSSH() 1871void MainWindow::syncSSH()
1872{ 1872{
1873 // not used anymore 1873 // not used anymore
1874 QTime timer; 1874 QTime timer;
1875 timer.start(); 1875 timer.start();
1876 //qDebug("MainWindow::syncssh() "); 1876 //qDebug("MainWindow::syncssh() ");
1877 KOPrefs *p = KOPrefs::instance(); 1877 KOPrefs *p = KOPrefs::instance();
1878 QString localFile = p->mLocalTempFile; 1878 QString localFile = p->mLocalTempFile;
1879 QString remoteIP = p->mRemoteIP; 1879 QString remoteIP = p->mRemoteIP;
1880 QString remoteUser = p->mRemoteUser; 1880 QString remoteUser = p->mRemoteUser;
1881 QString remoteFile = p->mRemoteFile; 1881 QString remoteFile = p->mRemoteFile;
1882 if ( p->mUsePassWd && p->mRemotePassWd.length() > 0 ) 1882 if ( p->mUsePassWd && p->mRemotePassWd.length() > 0 )
1883 remoteUser += ":" + p->mRemotePassWd; 1883 remoteUser += ":" + p->mRemotePassWd;
1884 1884
1885 QString question = i18n("Do you really want\nto remote sync?\n \n") + 1885 QString question = i18n("Do you really want\nto remote sync?\n \n") +
1886 i18n("IP: " ) +remoteIP +"\n" + 1886 i18n("IP: " ) +remoteIP +"\n" +
1887 i18n("User: " ) + remoteUser +"\n" ; 1887 i18n("User: " ) + remoteUser +"\n" ;
1888 int maxlen = 30; 1888 int maxlen = 30;
1889 if ( QApplication::desktop()->width() > 320 ) 1889 if ( QApplication::desktop()->width() > 320 )
1890 maxlen += 25; 1890 maxlen += 25;
1891 if ( remoteFile.length() > maxlen ) 1891 if ( remoteFile.length() > maxlen )
1892 question += i18n("Remote file:\n..." ) + remoteFile.right(maxlen) +"\n"; 1892 question += i18n("Remote file:\n..." ) + remoteFile.right(maxlen) +"\n";
1893 else 1893 else
1894 question += i18n("Remote file:\n " ) + remoteFile +"\n"; 1894 question += i18n("Remote file:\n " ) + remoteFile +"\n";
1895 if ( localFile.length() > maxlen ) 1895 if ( localFile.length() > maxlen )
1896 question += i18n("Local temp file:\n..." ) + localFile.right(maxlen) +"\n"; 1896 question += i18n("Local temp file:\n..." ) + localFile.right(maxlen) +"\n";
1897 else 1897 else
1898 question += i18n("Local temp file:\n " ) + localFile +"\n"; 1898 question += i18n("Local temp file:\n " ) + localFile +"\n";
1899 1899
1900 if ( QMessageBox::information( this, i18n("KO/Pi Sync"), 1900 if ( QMessageBox::information( this, i18n("KO/Pi Sync"),
1901 question, 1901 question,
1902 i18n("Yes"), i18n("No"), 1902 i18n("Yes"), i18n("No"),
1903 0, 0 ) != 0 ) 1903 0, 0 ) != 0 )
1904 return; 1904 return;
1905 // if ( !p->mUsePassWd ) { 1905 // if ( !p->mUsePassWd ) {
1906 // QString pass = getPassword(); 1906 // QString pass = getPassword();
1907 // if ( pass.length() > 0 ) 1907 // if ( pass.length() > 0 )
1908 // remoteUser += ":" + pass; 1908 // remoteUser += ":" + pass;
1909 // } 1909 // }
1910 QString command = "scp " + remoteUser + "@" + remoteIP +":" + remoteFile +" " +localFile; 1910 QString command = "scp " + remoteUser + "@" + remoteIP +":" + remoteFile +" " +localFile;
1911 setCaption ( i18n( "Copy remote file to local machine..." ) ); 1911 setCaption ( i18n( "Copy remote file to local machine..." ) );
1912 int fileSize = 0; 1912 int fileSize = 0;
1913 int result = system ( command ); 1913 int result = system ( command );
1914 // 0 : okay 1914 // 0 : okay
1915 // 256: no such file or dir 1915 // 256: no such file or dir
1916 // 1916 //
1917 qDebug("KO: Remote copy result(0 = okay): %d ",result ); 1917 qDebug("KO: Remote copy result(0 = okay): %d ",result );
1918 if ( result != 0 ) { 1918 if ( result != 0 ) {
1919 int len = maxlen; 1919 int len = maxlen;
1920 while ( len < command.length() ) { 1920 while ( len < command.length() ) {
1921 command.insert( len , "\n" ); 1921 command.insert( len , "\n" );
1922 len += maxlen +2; 1922 len += maxlen +2;
1923 } 1923 }
1924 question = i18n("Sorry, the copy command failed!\nCommand was:\n%1\n \nTry command on console to get more\ndetailed info about the reason.\n").arg (command) ; 1924 question = i18n("Sorry, the copy command failed!\nCommand was:\n%1\n \nTry command on console to get more\ndetailed info about the reason.\n").arg (command) ;
1925 QMessageBox::information( this, i18n("KO/Pi Sync - ERROR"), 1925 QMessageBox::information( this, i18n("KO/Pi Sync - ERROR"),
1926 question, 1926 question,
1927 i18n("Okay!")) ; 1927 i18n("Okay!")) ;
1928 setCaption ("KO/Pi"); 1928 setCaption ("KO/Pi");
1929 return; 1929 return;
1930 } 1930 }
1931 1931
1932 1932
1933 setCaption ( i18n( "Copying succeed." ) ); 1933 setCaption ( i18n( "Copying succeed." ) );
1934 //mView->setSyncDevice("ssh-scp" ); 1934 //mView->setSyncDevice("ssh-scp" );
1935 if ( syncWithFile(localFile , true ) ) { 1935 if ( syncWithFile(localFile , true ) ) {
1936// Event* e = mView->getLastSyncEvent(); 1936// Event* e = mView->getLastSyncEvent();
1937// e->setReadOnly( false ); 1937// e->setReadOnly( false );
1938// e->setLocation( KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile]); 1938// e->setLocation( KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile]);
1939// e->setReadOnly( true ); 1939// e->setReadOnly( true );
1940 if ( KOPrefs::instance()->mWriteBackFile ) { 1940 if ( KOPrefs::instance()->mWriteBackFile ) {
1941 command = "scp " + localFile +" " +remoteUser + "@" + remoteIP +":" + remoteFile ; 1941 command = "scp " + localFile +" " +remoteUser + "@" + remoteIP +":" + remoteFile ;
1942 setCaption ( i18n( "Writing back file ..." ) ); 1942 setCaption ( i18n( "Writing back file ..." ) );
1943 result = system ( command ); 1943 result = system ( command );
1944 if ( result != 0 ) { 1944 if ( result != 0 ) {
1945 int len = maxlen; 1945 int len = maxlen;
1946 while ( len < command.length() ) { 1946 while ( len < command.length() ) {
1947 command.insert( len , "\n" ); 1947 command.insert( len , "\n" );
1948 len += maxlen +2; 1948 len += maxlen +2;
1949 } 1949 }
1950 question = i18n("Sorry, the copy back command failed!\nCommand was:\n%1\n \nTry command on console to get more\ndetailed info about the reason.\n").arg (command) ; 1950 question = i18n("Sorry, the copy back command failed!\nCommand was:\n%1\n \nTry command on console to get more\ndetailed info about the reason.\n").arg (command) ;
1951 QMessageBox::information( this, i18n("KO/Pi Sync - ERROR"), 1951 QMessageBox::information( this, i18n("KO/Pi Sync - ERROR"),
1952 question, 1952 question,
1953 i18n("Okay!")) ; 1953 i18n("Okay!")) ;
1954 setCaption ("KO/Pi"); 1954 setCaption ("KO/Pi");
1955 return; 1955 return;
1956 } else { 1956 } else {
1957 setCaption ( i18n( "Syncronization sucessfully completed" ) ); 1957 setCaption ( i18n( "Syncronization sucessfully completed" ) );
1958 } 1958 }
1959 } 1959 }
1960 } 1960 }
1961 return; 1961 return;
1962#if 0 1962#if 0
1963 system ("scp zaurus@192.168.0.65:/home/zaurus/Applications/korganizer/mycalendar.ics /home/polo/Applications/korganizer/z_sync.ics"); 1963 system ("scp zaurus@192.168.0.65:/home/zaurus/Applications/korganizer/mycalendar.ics /home/polo/Applications/korganizer/z_sync.ics");
1964 while ( timer.elapsed() < 5000 ) 1964 while ( timer.elapsed() < 5000 )
1965 qApp->processEvents(); 1965 qApp->processEvents();
1966 1966
1967 qDebug("MainWindow::merging) "); 1967 qDebug("MainWindow::merging) ");
1968 mView->syncCalendar( "/home/polo/Applications/korganizer/z_sync.ics", 0 ); 1968 mView->syncCalendar( "/home/polo/Applications/korganizer/z_sync.ics", 0 );
1969 while ( mBlockSaveFlag ) 1969 while ( mBlockSaveFlag )
1970 qApp->processEvents(); 1970 qApp->processEvents();
1971 save(); 1971 save();
1972 system ("scp /home/polo/Applications/korganizer/mycalendar.ics zaurus@192.168.0.65:/home/zaurus/Applications/korganizer/mycalendar.ics"); 1972 system ("scp /home/polo/Applications/korganizer/mycalendar.ics zaurus@192.168.0.65:/home/zaurus/Applications/korganizer/mycalendar.ics");
1973#endif 1973#endif
1974 1974
1975} 1975}
1976 1976
1977 1977
1978void MainWindow::syncSharp() 1978void MainWindow::syncSharp()
1979{ 1979{
1980 if ( mCalendarModifiedFlag ) 1980 if ( mCalendarModifiedFlag )
1981 save(); 1981 save();
1982 mView->syncSharp(); 1982 mView->syncSharp();
1983 slotModifiedChanged( true ); 1983 slotModifiedChanged( true );
1984 1984
1985} 1985}
1986 1986
1987void MainWindow::printSel( ) 1987void MainWindow::printSel( )
1988{ 1988{
1989 mView->viewManager()->agendaView()->agenda()->printSelection(); 1989 mView->viewManager()->agendaView()->agenda()->printSelection();
1990} 1990}
1991 1991
1992void MainWindow::printCal() 1992void MainWindow::printCal()
1993{ 1993{
1994 mView->print();//mCp->showDialog(); 1994 mView->print();//mCp->showDialog();
1995} 1995}
diff --git a/libkdepim/ksyncprefsdialog.cpp b/libkdepim/ksyncprefsdialog.cpp
index 2f38c83..59c8418 100644
--- a/libkdepim/ksyncprefsdialog.cpp
+++ b/libkdepim/ksyncprefsdialog.cpp
@@ -1,615 +1,614 @@
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
71KSyncPrefsDialog::KSyncPrefsDialog(QWidget *parent, char *name, bool modal) : 71KSyncPrefsDialog::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
82KSyncPrefsDialog::~KSyncPrefsDialog() 82KSyncPrefsDialog::~KSyncPrefsDialog()
83{ 83{
84} 84}
85 85
86void KSyncPrefsDialog::setupSyncAlgTab() 86void 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; 166 ++iii;
167 167
168 mWriteBackFile = new QCheckBox( i18n("Write back synced data"), topFrame ); 168 mWriteBackFile = new QCheckBox( i18n("Write back synced data"), topFrame );
169 topLayout->addMultiCellWidget(mWriteBackFile, iii,iii,0,1); 169 topLayout->addMultiCellWidget(mWriteBackFile, iii,iii,0,1);
170 ++iii; 170 ++iii;
171 171
172 mWriteBackExisting= new QCheckBox( i18n("-- Write back (on remote) existing entries only"), topFrame ); 172 mWriteBackExisting= new QCheckBox( i18n("-- Write back (on remote) existing entries only"), topFrame );
173 topLayout->addMultiCellWidget(mWriteBackExisting, iii,iii,0,1); 173 topLayout->addMultiCellWidget(mWriteBackExisting, iii,iii,0,1);
174 ++iii; 174 ++iii;
175 175
176 mWriteBackFuture= new QCheckBox( i18n("-- Write back (calendar) entries in future only"), topFrame ); 176 mWriteBackFuture= new QCheckBox( i18n("-- Write back (calendar) entries in future only"), topFrame );
177 topLayout->addMultiCellWidget(mWriteBackFuture, iii,iii,0,1); 177 topLayout->addMultiCellWidget(mWriteBackFuture, iii,iii,0,1);
178 ++iii; 178 ++iii;
179 topLayout->addMultiCellWidget(new QLabel( i18n("---- Max. weeks in future: ") , topFrame ), iii,iii,0,0); 179 topLayout->addMultiCellWidget(new QLabel( i18n("---- Max. weeks in future: ") , topFrame ), iii,iii,0,0);
180 mWriteBackFutureWeeks= new QSpinBox(1,104, 1, topFrame); 180 mWriteBackFutureWeeks= new QSpinBox(1,104, 1, topFrame);
181 topLayout->addMultiCellWidget(mWriteBackFutureWeeks, iii,iii,1,1); 181 topLayout->addMultiCellWidget(mWriteBackFutureWeeks, iii,iii,1,1);
182 ++iii; 182 ++iii;
183 183
184 proGr = new QButtonGroup ( 1, Qt::Horizontal, i18n("Profile kind"), topFrame); 184 proGr = new QButtonGroup ( 1, Qt::Horizontal, i18n("Profile kind"), topFrame);
185 gr = proGr; 185 gr = proGr;
186 topLayout->addMultiCellWidget(gr, iii,iii,0,1); 186 topLayout->addMultiCellWidget(gr, iii,iii,0,1);
187 ++iii; 187 ++iii;
188 mIsLocal = new QRadioButton ( i18n("Local file"), gr ); 188 mIsLocal = new QRadioButton ( i18n("Local file"), gr );
189 mIsNotLocal = new QRadioButton ( i18n("Remote file (w down/upload command)"), gr ); 189 mIsNotLocal = new QRadioButton ( i18n("Remote file (w down/upload command)"), gr );
190 connect (mIsLocal, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) ); 190 connect (mIsLocal, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) );
191 mIsPhone = new QRadioButton ( i18n("Mobile device (cell phone)"), gr ); 191 mIsPhone = new QRadioButton ( i18n("Mobile device (cell phone)"), gr );
192 connect (mIsPhone, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) ); 192 connect (mIsPhone, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) );
193 193
194 194
195 phoneWidget = new QVBox( topFrame); 195 phoneWidget = new QVBox( topFrame);
196 topLayout->addMultiCellWidget(phoneWidget, iii,iii,0,1); 196 topLayout->addMultiCellWidget(phoneWidget, iii,iii,0,1);
197 ++iii; 197 ++iii;
198 QHBox* temphb = new QHBox( phoneWidget ); 198 QHBox* temphb = new QHBox( phoneWidget );
199 new QLabel( i18n("I/O device: "), temphb ); 199 new QLabel( i18n("I/O device: "), temphb );
200 mPhoneDevice = new QLineEdit( temphb); 200 mPhoneDevice = new QLineEdit( temphb);
201 button = new QPushButton( i18n("Help..."), temphb ); 201 button = new QPushButton( i18n("Help..."), temphb );
202 connect ( button, SIGNAL( clicked()), this, SLOT ( helpDevice() ) ); 202 connect ( button, SIGNAL( clicked()), this, SLOT ( helpDevice() ) );
203 203
204 204
205 temphb = new QHBox( phoneWidget ); 205 temphb = new QHBox( phoneWidget );
206 new QLabel( i18n("Connection: "), temphb ); 206 new QLabel( i18n("Connection: "), temphb );
207 mPhoneConnection = new QLineEdit( temphb); 207 mPhoneConnection = new QLineEdit( temphb);
208 button = new QPushButton( i18n("Help..."), temphb ); 208 button = new QPushButton( i18n("Help..."), temphb );
209 connect ( button, SIGNAL( clicked()), this, SLOT ( helpConnection() ) ); 209 connect ( button, SIGNAL( clicked()), this, SLOT ( helpConnection() ) );
210 210
211 211
212 temphb = new QHBox( phoneWidget ); 212 temphb = new QHBox( phoneWidget );
213 new QLabel( i18n("Model(opt.): "), temphb ); 213 new QLabel( i18n("Model(opt.): "), temphb );
214 mPhoneModel = new QLineEdit( temphb); 214 mPhoneModel = new QLineEdit( temphb);
215 button = new QPushButton( i18n("Help..."), temphb ); 215 button = new QPushButton( i18n("Help..."), temphb );
216 connect ( button, SIGNAL( clicked()), this, SLOT ( helpModel() ) ); 216 connect ( button, SIGNAL( clicked()), this, SLOT ( helpModel() ) );
217 217
218 // *** local 218 // *** local
219 localFileWidget = new QVBox( topFrame); 219 localFileWidget = new QVBox( topFrame);
220 topLayout->addMultiCellWidget(localFileWidget, iii,iii,0,1); 220 topLayout->addMultiCellWidget(localFileWidget, iii,iii,0,1);
221 ++iii; 221 ++iii;
222 temphb = new QHBox( localFileWidget ); 222 temphb = new QHBox( localFileWidget );
223 223
224 lab = new QLabel( i18n("Local file Cal:"), temphb ); 224 lab = new QLabel( i18n("Local file Cal:"), temphb );
225 lab = new QLabel( i18n("Local file ABook:"), temphb ); 225 lab = new QLabel( i18n("Local file ABook:"), temphb );
226 temphb = new QHBox( localFileWidget ); 226 temphb = new QHBox( localFileWidget );
227 button = new QPushButton( i18n("Choose..."), temphb ); 227 button = new QPushButton( i18n("Choose..."), temphb );
228 connect ( button, SIGNAL( clicked()), this, SLOT ( chooseFile() ) ); 228 connect ( button, SIGNAL( clicked()), this, SLOT ( chooseFile() ) );
229 button = new QPushButton( i18n("Choose..."), temphb ); 229 button = new QPushButton( i18n("Choose..."), temphb );
230 connect ( button, SIGNAL( clicked()), this, SLOT ( chooseFileAB() ) ); 230 connect ( button, SIGNAL( clicked()), this, SLOT ( chooseFileAB() ) );
231 temphb = new QHBox( localFileWidget ); 231 temphb = new QHBox( localFileWidget );
232 232
233 mRemoteFile = new QLineEdit( temphb); 233 mRemoteFile = new QLineEdit( temphb);
234 mRemoteFileAB = new QLineEdit( temphb); 234 mRemoteFileAB = new QLineEdit( temphb);
235 235
236 // *** remote 236 // *** remote
237 remoteFileWidget = new QVBox( topFrame); 237 remoteFileWidget = new QVBox( topFrame);
238 topLayout->addMultiCellWidget(remoteFileWidget, iii,iii,0,1); 238 topLayout->addMultiCellWidget(remoteFileWidget, iii,iii,0,1);
239 ++iii; 239 ++iii;
240 temphb = new QHBox( remoteFileWidget ); 240 temphb = new QHBox( remoteFileWidget );
241 new QLabel( i18n("Calendar:"), temphb); 241 new QLabel( i18n("Calendar:"), temphb);
242 new QLabel( i18n("AddressBook:"), temphb); 242 new QLabel( i18n("AddressBook:"), temphb);
243 243
244 lab = new QLabel( i18n("Pre sync (download) command:"), remoteFileWidget); 244 lab = new QLabel( i18n("Pre sync (download) command:"), remoteFileWidget);
245 temphb = new QHBox( remoteFileWidget ); 245 temphb = new QHBox( remoteFileWidget );
246 mRemotePrecommand = new QLineEdit(temphb); 246 mRemotePrecommand = new QLineEdit(temphb);
247 mRemotePrecommandAB = new QLineEdit(temphb); 247 mRemotePrecommandAB = new QLineEdit(temphb);
248 248
249 lab = new QLabel( i18n("Local temp file:"), remoteFileWidget); 249 lab = new QLabel( i18n("Local temp file:"), remoteFileWidget);
250 temphb = new QHBox( remoteFileWidget ); 250 temphb = new QHBox( remoteFileWidget );
251 mLocalTempFile = new QLineEdit(temphb); 251 mLocalTempFile = new QLineEdit(temphb);
252 mLocalTempFileAB = new QLineEdit(temphb); 252 mLocalTempFileAB = new QLineEdit(temphb);
253 253
254 lab = new QLabel( i18n("Post sync (upload) command:"), remoteFileWidget); 254 lab = new QLabel( i18n("Post sync (upload) command:"), remoteFileWidget);
255 temphb = new QHBox( remoteFileWidget ); 255 temphb = new QHBox( remoteFileWidget );
256 mRemotePostcommand = new QLineEdit(temphb ); 256 mRemotePostcommand = new QLineEdit(temphb );
257 mRemotePostcommandAB = new QLineEdit(temphb ); 257 mRemotePostcommandAB = new QLineEdit(temphb );
258 258
259 lab = new QLabel( i18n("Fill in default values for:"), remoteFileWidget); 259 lab = new QLabel( i18n("Fill in default values for:"), remoteFileWidget);
260 temphb = new QHBox( remoteFileWidget ); 260 temphb = new QHBox( remoteFileWidget );
261 button = new QPushButton( i18n("ssh/scp"), temphb ); 261 button = new QPushButton( i18n("ssh/scp"), temphb );
262 connect ( button, SIGNAL( clicked()), this, SLOT (fillSSH() ) ); 262 connect ( button, SIGNAL( clicked()), this, SLOT (fillSSH() ) );
263 button = new QPushButton( i18n("ftp"), temphb ); 263 button = new QPushButton( i18n("ftp"), temphb );
264 connect ( button, SIGNAL( clicked()), this, SLOT (fillFTP() ) ); 264 connect ( button, SIGNAL( clicked()), this, SLOT (fillFTP() ) );
265 lab = new QLabel( i18n("Hint: Use $PWD$ for placeholder of password!"), remoteFileWidget); 265 lab = new QLabel( i18n("Hint: Use $PWD$ for placeholder of password!"), remoteFileWidget);
266 266
267 267
268} 268}
269void KSyncPrefsDialog::slotOK() 269void KSyncPrefsDialog::slotOK()
270{ 270{
271 if ( mMyMachineName->text() == "undefined" ) { 271 if ( mMyMachineName->text() == "undefined" ) {
272 KMessageBox::error(this,i18n("Local device name undefined!\nPlease define device name!"),i18n("KO/Pi config error")); 272 KMessageBox::error(this,i18n("Local device name undefined!\nPlease define device name!"),i18n("KO/Pi config error"));
273 return; 273 return;
274 } 274 }
275 int i; 275 int i;
276 for (i = 0; i < mSyncProfileNames.count(); ++ i) { 276 for (i = 0; i < mSyncProfileNames.count(); ++ i) {
277 if ( mSyncProfileNames.contains( mSyncProfileNames[i]) > 1 ) { 277 if ( mSyncProfileNames.contains( mSyncProfileNames[i]) > 1 ) {
278 KMessageBox::error(this,i18n("Multiple profiles with same name!\nPlease use unique profile names!"),i18n("KO/Pi config error")); 278 KMessageBox::error(this,i18n("Multiple profiles with same name!\nPlease use unique profile names!"),i18n("KO/Pi config error"));
279 return; 279 return;
280 } 280 }
281 } 281 }
282 usrWriteConfig(); 282 usrWriteConfig();
283 QDialog::accept(); 283 QDialog::accept();
284} 284}
285void KSyncPrefsDialog::accept() 285void KSyncPrefsDialog::accept()
286{ 286{
287 slotOK(); 287 slotOK();
288} 288}
289void KSyncPrefsDialog::chooseFile() 289void KSyncPrefsDialog::chooseFile()
290{ 290{
291 QString fn = QDir::homeDirPath(); 291 QString fn = QDir::homeDirPath();
292 292
293 fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.ics/*.vcs)"), this ); 293 fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.ics/*.vcs)"), this );
294 if ( fn == "" ) 294 if ( fn == "" )
295 return; 295 return;
296 mRemoteFile->setText( fn ); 296 mRemoteFile->setText( fn );
297} 297}
298 298
299void KSyncPrefsDialog::chooseFileAB() 299void KSyncPrefsDialog::chooseFileAB()
300{ 300{
301 QString fn = QDir::homeDirPath(); 301 QString fn = QDir::homeDirPath();
302 302
303 fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.ics/*.vcs)"), this ); 303 fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.ics/*.vcs)"), this );
304 if ( fn == "" ) 304 if ( fn == "" )
305 return; 305 return;
306 mRemoteFileAB->setText( fn ); 306 mRemoteFileAB->setText( fn );
307} 307}
308 308
309void KSyncPrefsDialog::textChanged( const QString & s ) 309void KSyncPrefsDialog::textChanged( const QString & s )
310{ 310{
311 if ( mProfileBox->count() == 0 ) 311 if ( mProfileBox->count() == 0 )
312 return; 312 return;
313 if ( currentSelection < 3 ) { 313 if ( currentSelection < 3 ) {
314 //KMessageBox::error(this,i18n("This profil name\ncannot be edited!\n"),i18n("KO/Pi config error")); 314 //KMessageBox::error(this,i18n("This profil name\ncannot be edited!\n"),i18n("KO/Pi config error"));
315 mProfileBox->blockSignals( true ); 315 mProfileBox->blockSignals( true );
316 mProfileBox->setCurrentItem(mProfileBox-> currentItem ()); 316 mProfileBox->setCurrentItem(mProfileBox-> currentItem ());
317 mProfileBox->blockSignals( false ); 317 mProfileBox->blockSignals( false );
318 return; 318 return;
319 } 319 }
320 //qDebug("cur i %d ",mProfileBox-> currentItem () ); 320 //qDebug("cur i %d ",mProfileBox-> currentItem () );
321 mProfileBox->changeItem ( s, mProfileBox-> currentItem () ) ; 321 mProfileBox->changeItem ( s, mProfileBox-> currentItem () ) ;
322 KSyncProfile* prof = mSyncProfiles.at(mProfileBox-> currentItem ()) ; 322 KSyncProfile* prof = mSyncProfiles.at(mProfileBox-> currentItem ()) ;
323 prof->setName( s ); 323 prof->setName( s );
324 mSyncProfileNames[mProfileBox-> currentItem ()] = s; 324 mSyncProfileNames[mProfileBox-> currentItem ()] = s;
325} 325}
326void KSyncPrefsDialog::profileChanged( int item ) 326void KSyncPrefsDialog::profileChanged( int item )
327{ 327{
328 //qDebug("KSyncPrefsDialog::profileChanged %d ", item ); 328 //qDebug("KSyncPrefsDialog::profileChanged %d ", item );
329 KSyncProfile* prof; 329 KSyncProfile* prof;
330 saveProfile(); 330 saveProfile();
331 currentSelection = item; 331 currentSelection = item;
332 prof = mSyncProfiles.at(item) ; 332 prof = mSyncProfiles.at(item) ;
333 mRemotePrecommand->setText(prof->getPreSyncCommand()); 333 mRemotePrecommand->setText(prof->getPreSyncCommand());
334 mRemotePostcommand->setText(prof->getPostSyncCommand()); 334 mRemotePostcommand->setText(prof->getPostSyncCommand());
335 mLocalTempFile->setText(prof->getLocalTempFile()); 335 mLocalTempFile->setText(prof->getLocalTempFile());
336 mRemoteFile->setText(prof->getRemoteFileName()) ; 336 mRemoteFile->setText(prof->getRemoteFileName()) ;
337 337
338 mRemotePrecommandAB->setText(prof->getPreSyncCommandAB()); 338 mRemotePrecommandAB->setText(prof->getPreSyncCommandAB());
339 mRemotePostcommandAB->setText(prof->getPostSyncCommandAB()); 339 mRemotePostcommandAB->setText(prof->getPostSyncCommandAB());
340 mLocalTempFileAB->setText(prof->getLocalTempFileAB()); 340 mLocalTempFileAB->setText(prof->getLocalTempFileAB());
341 mRemoteFileAB->setText(prof->getRemoteFileNameAB()) ; 341 mRemoteFileAB->setText(prof->getRemoteFileNameAB()) ;
342 342
343 mPhoneDevice->setText(prof->getPhoneDevice()); 343 mPhoneDevice->setText(prof->getPhoneDevice());
344 mPhoneConnection->setText(prof->getPhoneConnection()); 344 mPhoneConnection->setText(prof->getPhoneConnection());
345 mPhoneModel->setText(prof->getPhoneModel()); 345 mPhoneModel->setText(prof->getPhoneModel());
346 346
347 mShowSummaryAfterSync->setChecked( prof->getShowSummaryAfterSync()); 347 mShowSummaryAfterSync->setChecked( prof->getShowSummaryAfterSync());
348 mAskForPreferences->setChecked( prof->getAskForPreferences()); 348 mAskForPreferences->setChecked( prof->getAskForPreferences());
349 mWriteBackExisting->setChecked( prof->getWriteBackExisting() ); 349 mWriteBackExisting->setChecked( prof->getWriteBackExisting() );
350 mWriteBackFile->setChecked( prof->getWriteBackFile()); 350 mWriteBackFile->setChecked( prof->getWriteBackFile());
351 mIncludeInRing->setChecked( prof->getIncludeInRingSync() ); 351 mIncludeInRing->setChecked( prof->getIncludeInRingSync() );
352 mIncludeInRingAB->setChecked( prof->getIncludeInRingSyncAB() ); 352 mIncludeInRingAB->setChecked( prof->getIncludeInRingSyncAB() );
353 mWriteBackFuture->setChecked( prof->getWriteBackFuture()); 353 mWriteBackFuture->setChecked( prof->getWriteBackFuture());
354 mWriteBackFutureWeeks->setValue( prof->getWriteBackFutureWeeks() ); 354 mWriteBackFutureWeeks->setValue( prof->getWriteBackFutureWeeks() );
355 355
356 switch ( prof->getSyncPrefs() ) { 356 switch ( prof->getSyncPrefs() ) {
357 case 0: 357 case 0:
358 loc->setChecked( true); 358 loc->setChecked( true);
359 break; 359 break;
360 case 1: 360 case 1:
361 rem->setChecked( true ); 361 rem->setChecked( true );
362 break; 362 break;
363 case 2: 363 case 2:
364 newest->setChecked( true); 364 newest->setChecked( true);
365 break; 365 break;
366 case 3: 366 case 3:
367 ask->setChecked( true); 367 ask->setChecked( true);
368 break; 368 break;
369 case 4: 369 case 4:
370 f_loc->setChecked( true); 370 f_loc->setChecked( true);
371 break; 371 break;
372 case 5: 372 case 5:
373 f_rem->setChecked( true); 373 f_rem->setChecked( true);
374 break; 374 break;
375 case 6: 375 case 6:
376 //both->setChecked( true); 376 //both->setChecked( true);
377 break; 377 break;
378 default: 378 default:
379 break; 379 break;
380 } 380 }
381 mIsLocal->setChecked(prof->getIsLocalFileSync()) ; 381 mIsLocal->setChecked(prof->getIsLocalFileSync()) ;
382 mIsPhone->setChecked(prof->getIsPhoneSync()) ; 382 mIsPhone->setChecked(prof->getIsPhoneSync()) ;
383 mIsNotLocal->setChecked(!prof->getIsLocalFileSync() && !prof->getIsPhoneSync() ); 383 mIsNotLocal->setChecked(!prof->getIsLocalFileSync() && !prof->getIsPhoneSync() );
384 proGr->setEnabled( item > 2 ); 384 proGr->setEnabled( item > 2 );
385 if ( item < 3 ) { 385 if ( item < 3 ) {
386 localFileWidget->hide(); 386 localFileWidget->hide();
387 remoteFileWidget->hide(); 387 remoteFileWidget->hide();
388 phoneWidget->hide(); 388 phoneWidget->hide();
389 389
390 } else 390 } else
391 kindChanged( prof->getIsLocalFileSync() ); 391 kindChanged( prof->getIsLocalFileSync() );
392} 392}
393 393
394void KSyncPrefsDialog::fillSSH() 394void KSyncPrefsDialog::fillSSH()
395{ 395{
396 mRemotePrecommand->setText("scp zaurus@192.168.0.65:/home/zaurus/kdepim/apps/korganizer/mycalendar.ics /tmp/mycalendar.ics" ); 396 mRemotePrecommand->setText("scp zaurus@192.168.0.65:/home/zaurus/kdepim/apps/korganizer/mycalendar.ics /tmp/mycalendar.ics" );
397 mLocalTempFile->setText("/tmp/mycalendar.ics" ); 397 mLocalTempFile->setText("/tmp/mycalendar.ics" );
398 mRemotePostcommand->setText("scp /tmp/mycalendar.ics zaurus@192.168.0.65:/home/zaurus/kdepim/apps/korganizer/mycalendar.ics" ); 398 mRemotePostcommand->setText("scp /tmp/mycalendar.ics zaurus@192.168.0.65:/home/zaurus/kdepim/apps/korganizer/mycalendar.ics" );
399 mRemotePrecommandAB->setText("scp zaurus@192.168.0.65:/home/zaurus/kdepim/apps/kabc/std.vcf /tmp/std.vcf" ); 399 mRemotePrecommandAB->setText("scp zaurus@192.168.0.65:/home/zaurus/kdepim/apps/kabc/std.vcf /tmp/std.vcf" );
400 mLocalTempFileAB->setText("/tmp/std.vcf" ); 400 mLocalTempFileAB->setText("/tmp/std.vcf" );
401 mRemotePostcommandAB->setText("scp /tmp/std.vcf zaurus@192.168.0.65:/home/zaurus/kdepim/apps/kabc/std.vcf" ); 401 mRemotePostcommandAB->setText("scp /tmp/std.vcf zaurus@192.168.0.65:/home/zaurus/kdepim/apps/kabc/std.vcf" );
402} 402}
403void KSyncPrefsDialog::fillFTP() 403void KSyncPrefsDialog::fillFTP()
404{ 404{
405 mRemotePrecommand->setText("cd /tmp;ftp ftp://zaurus:a@192.168.0.65/kdepim/apps/korganizer/mycalendar.ics" ); 405 mRemotePrecommand->setText("cd /tmp;ftp ftp://zaurus:a@192.168.0.65/kdepim/apps/korganizer/mycalendar.ics" );
406 mLocalTempFile->setText("/tmp/mycalendar.ics" ); 406 mLocalTempFile->setText("/tmp/mycalendar.ics" );
407 mRemotePostcommand->setText("ftp -u ftp://zaurus:a@192.168.0.65/kdepim/apps/korganizer/mycalendar.ics /tmp/mycalendar.ics" ); 407 mRemotePostcommand->setText("ftp -u ftp://zaurus:a@192.168.0.65/kdepim/apps/korganizer/mycalendar.ics /tmp/mycalendar.ics" );
408 mRemotePrecommandAB->setText("cd /tmp;ftp ftp://zaurus:a@192.168.0.65/kdepim/apps/kabc/std.vcf" ); 408 mRemotePrecommandAB->setText("cd /tmp;ftp ftp://zaurus:a@192.168.0.65/kdepim/apps/kabc/std.vcf" );
409 mLocalTempFileAB->setText("/tmp/std.vcf" ); 409 mLocalTempFileAB->setText("/tmp/std.vcf" );
410 mRemotePostcommandAB->setText("ftp -u ftp://zaurus:a@192.168.0.65/kdepim/apps/kabc/std.vcf /tmp/std.vcf" ); 410 mRemotePostcommandAB->setText("ftp -u ftp://zaurus:a@192.168.0.65/kdepim/apps/kabc/std.vcf /tmp/std.vcf" );
411 411
412} 412}
413void KSyncPrefsDialog::kindChanged( bool b ) 413void KSyncPrefsDialog::kindChanged( bool b )
414{ 414{
415 415
416 if ( mIsLocal->isChecked () ) 416 if ( mIsLocal->isChecked () )
417 localFileWidget->show(); 417 localFileWidget->show();
418 else 418 else
419 localFileWidget->hide(); 419 localFileWidget->hide();
420 420
421 if ( mIsNotLocal->isChecked () ) 421 if ( mIsNotLocal->isChecked () )
422 remoteFileWidget->show(); 422 remoteFileWidget->show();
423 else 423 else
424 remoteFileWidget->hide(); 424 remoteFileWidget->hide();
425 425
426 if ( mIsPhone->isChecked () ) { 426 if ( mIsPhone->isChecked () ) {
427 phoneWidget->show(); 427 phoneWidget->show();
428 } 428 }
429 else { 429 else {
430 phoneWidget->hide(); 430 phoneWidget->hide();
431 } 431 }
432 432
433} 433}
434void KSyncPrefsDialog::deleteProfile() 434void KSyncPrefsDialog::deleteProfile()
435{ 435{
436 //qDebug("KSyncPrefsDialog::deleteProfile() "); 436 //qDebug("KSyncPrefsDialog::deleteProfile() ");
437 if ( currentSelection >= 0 ) { 437 if ( currentSelection >= 0 ) {
438 if ( currentSelection < 3 ) { 438 if ( currentSelection < 3 ) {
439 KMessageBox::error(this,i18n("This profil cannot be deleted!\n"),i18n("KO/Pi config error")); 439 KMessageBox::error(this,i18n("This profil cannot be deleted!\n"),i18n("KO/Pi config error"));
440 return; 440 return;
441 } 441 }
442 KSyncProfile* temp = mSyncProfiles.at(currentSelection); 442 KSyncProfile* temp = mSyncProfiles.at(currentSelection);
443 mSyncProfiles.remove( temp ); 443 mSyncProfiles.remove( temp );
444 mSyncProfileNames.remove( mSyncProfileNames.at( currentSelection )); 444 mSyncProfileNames.remove( mSyncProfileNames.at( currentSelection ));
445 insertProfiles(); 445 insertProfiles();
446 } 446 }
447} 447}
448 448
449void KSyncPrefsDialog::saveProfile() 449void KSyncPrefsDialog::saveProfile()
450{ 450{
451 KSyncProfile* prof; 451 KSyncProfile* prof;
452 if ( currentSelection >= 0 ) { 452 if ( currentSelection >= 0 ) {
453 prof = mSyncProfiles.at(currentSelection) ; 453 prof = mSyncProfiles.at(currentSelection) ;
454 prof->setPreSyncCommand( mRemotePrecommand->text()); 454 prof->setPreSyncCommand( mRemotePrecommand->text());
455 prof->setPostSyncCommand( mRemotePostcommand->text() ); 455 prof->setPostSyncCommand( mRemotePostcommand->text() );
456 prof->setLocalTempFile( mLocalTempFile->text()); 456 prof->setLocalTempFile( mLocalTempFile->text());
457 prof->setRemoteFileName( mRemoteFile->text() ); 457 prof->setRemoteFileName( mRemoteFile->text() );
458 prof->setPreSyncCommandAB( mRemotePrecommandAB->text()); 458 prof->setPreSyncCommandAB( mRemotePrecommandAB->text());
459 prof->setPostSyncCommandAB( mRemotePostcommandAB->text() ); 459 prof->setPostSyncCommandAB( mRemotePostcommandAB->text() );
460 prof->setLocalTempFileAB( mLocalTempFileAB->text()); 460 prof->setLocalTempFileAB( mLocalTempFileAB->text());
461 prof->setRemoteFileNameAB( mRemoteFileAB->text() ); 461 prof->setRemoteFileNameAB( mRemoteFileAB->text() );
462 prof->setShowSummaryAfterSync( mShowSummaryAfterSync->isChecked() ); 462 prof->setShowSummaryAfterSync( mShowSummaryAfterSync->isChecked() );
463 prof->setAskForPreferences( mAskForPreferences->isChecked()); 463 prof->setAskForPreferences( mAskForPreferences->isChecked());
464 prof->setWriteBackExisting(mWriteBackExisting->isChecked() ); 464 prof->setWriteBackExisting(mWriteBackExisting->isChecked() );
465 prof->setWriteBackFile( mWriteBackFile->isChecked()); 465 prof->setWriteBackFile( mWriteBackFile->isChecked());
466 prof->setIncludeInRingSync( mIncludeInRing->isChecked() ); 466 prof->setIncludeInRingSync( mIncludeInRing->isChecked() );
467 prof->setIncludeInRingSyncAB( mIncludeInRingAB->isChecked() ); 467 prof->setIncludeInRingSyncAB( mIncludeInRingAB->isChecked() );
468 int syncprefs = rem->isChecked()*1+newest->isChecked()*2+ ask->isChecked()*3+ f_loc->isChecked()*4+ f_rem->isChecked()*5 ;//+ both->isChecked()*6 ; 468 int syncprefs = rem->isChecked()*1+newest->isChecked()*2+ ask->isChecked()*3+ f_loc->isChecked()*4+ f_rem->isChecked()*5 ;//+ both->isChecked()*6 ;
469 prof->setSyncPrefs( syncprefs); 469 prof->setSyncPrefs( syncprefs);
470 prof->setIsLocalFileSync( mIsLocal->isChecked() ); 470 prof->setIsLocalFileSync( mIsLocal->isChecked() );
471 prof->setIsPhoneSync( mIsPhone->isChecked() ); 471 prof->setIsPhoneSync( mIsPhone->isChecked() );
472 prof->setWriteBackFuture(mWriteBackFuture->isChecked()); 472 prof->setWriteBackFuture(mWriteBackFuture->isChecked());
473 prof->setWriteBackFutureWeeks(mWriteBackFutureWeeks->value()); 473 prof->setWriteBackFutureWeeks(mWriteBackFutureWeeks->value());
474 prof->setPhoneDevice( mPhoneDevice->text() ); 474 prof->setPhoneDevice( mPhoneDevice->text() );
475 prof->setPhoneConnection( mPhoneConnection->text() ); 475 prof->setPhoneConnection( mPhoneConnection->text() );
476 prof->setPhoneModel( mPhoneModel->text() ); 476 prof->setPhoneModel( mPhoneModel->text() );
477 477
478 } 478 }
479 479
480} 480}
481 481
482void KSyncPrefsDialog::insertProfiles() 482void KSyncPrefsDialog::insertProfiles()
483{ 483{
484 int curItem = mProfileBox->currentItem(); 484 int curItem = mProfileBox->currentItem();
485 mProfileBox->blockSignals( true ); 485 mProfileBox->blockSignals( true );
486 mProfileBox->clear(); 486 mProfileBox->clear();
487 mProfileBox->insertStringList (mSyncProfileNames ); 487 mProfileBox->insertStringList (mSyncProfileNames );
488 int item = mSyncProfileNames.count() -1; 488 int item = mSyncProfileNames.count() -1;
489 if ( curItem >= 0 && mSyncProfileNames.count() > 0 && curItem < mSyncProfileNames.count() ) 489 if ( curItem >= 0 && mSyncProfileNames.count() > 0 && curItem < mSyncProfileNames.count() )
490 mProfileBox->setCurrentItem( curItem ); 490 mProfileBox->setCurrentItem( curItem );
491 else if ( item >= 0 ) { 491 else if ( item >= 0 ) {
492 mProfileBox->setCurrentItem( item ); 492 mProfileBox->setCurrentItem( item );
493 } 493 }
494 currentSelection = -1; 494 currentSelection = -1;
495 if ( mSyncProfileNames.count() > 0 ) { 495 if ( mSyncProfileNames.count() > 0 ) {
496 //qDebug(" profileChanged( mProfileBox->currentItem() "); 496 //qDebug(" profileChanged( mProfileBox->currentItem() ");
497 profileChanged( mProfileBox->currentItem() ); 497 profileChanged( mProfileBox->currentItem() );
498 currentSelection = mProfileBox->currentItem(); 498 currentSelection = mProfileBox->currentItem();
499 } 499 }
500 mProfileBox->blockSignals( false ); 500 mProfileBox->blockSignals( false );
501} 501}
502 502
503void KSyncPrefsDialog::addProfile ( KSyncProfile* temp ) 503void KSyncPrefsDialog::addProfile ( KSyncProfile* temp )
504{ 504{
505 saveProfile(); 505 saveProfile();
506 mSyncProfiles.append( temp ); 506 mSyncProfiles.append( temp );
507 mSyncProfileNames << temp->getName(); 507 mSyncProfileNames << temp->getName();
508 insertProfiles(); 508 insertProfiles();
509 int last = mProfileBox->count() -1; 509 int last = mProfileBox->count() -1;
510 mProfileBox->blockSignals( true ); 510 mProfileBox->blockSignals( true );
511 mProfileBox->setCurrentItem( last ); 511 mProfileBox->setCurrentItem( last );
512 mProfileBox->blockSignals( false ); 512 mProfileBox->blockSignals( false );
513 profileChanged(last); 513 profileChanged(last);
514} 514}
515void KSyncPrefsDialog::newProfile() 515void KSyncPrefsDialog::newProfile()
516{ 516{
517 addProfile ( new KSyncProfile () ); 517 addProfile ( new KSyncProfile () );
518} 518}
519 519
520void KSyncPrefsDialog::cloneProfile() 520void KSyncPrefsDialog::cloneProfile()
521{ 521{
522 if ( currentSelection >= 0 ) 522 if ( currentSelection >= 0 )
523 addProfile (mSyncProfiles.at(currentSelection)->clone()) ; 523 addProfile (mSyncProfiles.at(currentSelection)->clone()) ;
524 else 524 else
525 newProfile(); 525 newProfile();
526} 526}
527 527
528void KSyncPrefsDialog::setLocalMachineName ( const QString& name ) 528void KSyncPrefsDialog::setLocalMachineName ( const QString& name )
529{ 529{
530 mMyMachineName->setText( name ); 530 mMyMachineName->setText( name );
531 531
532} 532}
533QString KSyncPrefsDialog::getLocalMachineName ( ) 533QString KSyncPrefsDialog::getLocalMachineName ( )
534{ 534{
535 return mMyMachineName->text(); 535 return mMyMachineName->text();
536} 536}
537 537
538QStringList KSyncPrefsDialog::getSyncProfileNames() 538QStringList KSyncPrefsDialog::getSyncProfileNames()
539{ 539{
540 return mSyncProfileNames; 540 return mSyncProfileNames;
541} 541}
542void KSyncPrefsDialog::usrReadConfig() 542void KSyncPrefsDialog::usrReadConfig()
543{ 543{
544 //KConfig *config = KOGlobals::config(); 544 //KConfig *config = KOGlobals::config();
545 KConfig config ( locateLocal( "config","syncprofilesrc" ) ); 545 KConfig config ( locateLocal( "config","syncprofilesrc" ) );
546 config.setGroup("SyncProfiles"); 546 config.setGroup("General");
547 mSyncProfileNames =config.readListEntry("SyncProfileNames"); 547 mSyncProfileNames =config.readListEntry("SyncProfileNames");
548 mMyMachineName->setText(config.readEntry("LocalMachineName","undefined")); 548 mMyMachineName->setText(config.readEntry("LocalMachineName","undefined"));
549 int i; 549 int i;
550 KSyncProfile* temp ; 550 KSyncProfile* temp ;
551 mSyncProfiles.clear(); 551 mSyncProfiles.clear();
552 for ( i = 0; i < mSyncProfileNames.count();++i ) { 552 for ( i = 0; i < mSyncProfileNames.count();++i ) {
553 temp = new KSyncProfile (); 553 temp = new KSyncProfile ();
554 temp->setName( mSyncProfileNames[i] ); 554 temp->setName( mSyncProfileNames[i] );
555 temp->readConfig( &config ); 555 temp->readConfig( &config );
556 mSyncProfiles.append( temp ); 556 mSyncProfiles.append( temp );
557 } 557 }
558 insertProfiles(); 558 insertProfiles();
559 //mMyMachineName->setText(KOPrefs::instance()->mLocalMachineName ); 559 //mMyMachineName->setText(KOPrefs::instance()->mLocalMachineName );
560} 560}
561 561
562 562
563void KSyncPrefsDialog::usrWriteConfig() 563void KSyncPrefsDialog::usrWriteConfig()
564{ 564{
565 saveProfile(); 565 saveProfile();
566 if ( currentSelection >= 0 ) 566 if ( currentSelection >= 0 )
567 profileChanged(currentSelection); 567 profileChanged(currentSelection);
568 //KConfig *config = KOGlobals::config(); 568 //KConfig *config = KOGlobals::config();
569 KConfig config ( locateLocal( "config","syncprofilesrc" ) ); 569 KConfig config ( locateLocal( "config","syncprofilesrc" ) );
570 config.setGroup("SyncProfiles");
571 KSyncProfile* prof = mSyncProfiles.first(); 570 KSyncProfile* prof = mSyncProfiles.first();
572 while ( prof ) { 571 while ( prof ) {
573 prof->writeConfig(&config); 572 prof->writeConfig(&config);
574 prof = mSyncProfiles.next(); 573 prof = mSyncProfiles.next();
575 } 574 }
576 //KOPrefs::instance()->mSyncProfileNames = mSyncProfileNames; 575 //KOPrefs::instance()->mSyncProfileNames = mSyncProfileNames;
577 //KOPrefs::instance()->mLocalMachineName = mMyMachineName->text(); 576 //KOPrefs::instance()->mLocalMachineName = mMyMachineName->text();
577 config.setGroup("General");
578 config.writeEntry("SyncProfileNames",mSyncProfileNames); 578 config.writeEntry("SyncProfileNames",mSyncProfileNames);
579 QString name = mMyMachineName->text(); 579 config.writeEntry("LocalMachineName",mMyMachineName->text());
580 config.writeEntry("LocalMachineName",name);
581} 580}
582 581
583void KSyncPrefsDialog::helpDevice() 582void KSyncPrefsDialog::helpDevice()
584{ 583{
585 QString hint = i18n("Insert device where\nphone is connected. E.g.:\n"); 584 QString hint = i18n("Insert device where\nphone is connected. E.g.:\n");
586#ifdef _WIN32_ 585#ifdef _WIN32_
587 hint += "leave empty for Irda\n" 586 hint += "Leave empty for Irda.\n"
588 "com1:\n(first serial port)\n" 587 "com1:\n(first serial port)\n"
589 "usb not supported\n" 588 "usb not supported\n"
590 "???\n(bluetooth device address)\n"; 589 "???\n(bluetooth device address)\n";
591 590
592#else 591#else
593 hint += "/dev/ircomm\n(Irda)\n" 592 hint += "/dev/ircomm\n(Irda)\n"
594 "/dev/ttyS0\n(first serial port)\n" 593 "/dev/ttyS0\n(first serial port)\n"
595 "/dev/ttyUSB0\n(first device usb port)\n" 594 "/dev/ttyUSB0\n(first device usb port)\n"
596 "???\n(bluetooth device address)\n"; 595 "???\n(bluetooth device address)\n";
597#endif 596#endif
598 KMessageBox::information(this,hint,i18n("KDE-Pim sync config")); 597 KMessageBox::information(this,hint,i18n("KDE-Pim sync config"));
599} 598}
600void KSyncPrefsDialog::helpModel() 599void KSyncPrefsDialog::helpModel()
601{ 600{
602 QString hint = i18n("Leave empty or\ninsert name of phone model:\n"); 601 QString hint = i18n("Leave empty or\ninsert name of phone model:\n");
603 hint += "E.g. for Nokia 6310i:\n6310i\nAlso possible:\nobex\nfor Obex connection"; 602 hint += "E.g. for Nokia 6310i:\n6310i\nAlso possible:\nobex\nfor Obex connection";
604 KMessageBox::information(this,hint,i18n("KDE-Pim sync config")); 603 KMessageBox::information(this,hint,i18n("KDE-Pim sync config"));
605 604
606} 605}
607void KSyncPrefsDialog::helpConnection() 606void KSyncPrefsDialog::helpConnection()
608{ 607{
609 QString hint = i18n("Insert kind of connection,e.g.:\n"); 608 QString hint = i18n("Insert kind of connection,e.g.:\n");
610 hint += "irda | Nokia FBUS over infrared\n" 609 hint += "irda | Nokia FBUS over infrared\n"
611 "irdaat | AT commands infrared\n(for Siemens/Sony-Erricsson)\n" 610 "irdaat | AT commands infrared\n(for Siemens/Sony-Erricsson)\n"
612 "irdaobex | set also model as obex\n" 611 "irdaobex | set also model as obex\n"
613 "fbus | Nokia FBUS2 serial\n"; 612 "fbus | Nokia FBUS2 serial\n";
614 KMessageBox::information(this,hint,i18n("KDE-Pim sync config")); 613 KMessageBox::information(this,hint,i18n("KDE-Pim sync config"));
615} 614}
diff --git a/libkdepim/ksyncprofile.cpp b/libkdepim/ksyncprofile.cpp
index 425285e..fcbb326 100644
--- a/libkdepim/ksyncprofile.cpp
+++ b/libkdepim/ksyncprofile.cpp
@@ -1,173 +1,173 @@
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 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
33KSyncProfile::KSyncProfile( const char * name): QObject (0, name ) 33KSyncProfile::KSyncProfile( const char * name): QObject (0, name )
34{ 34{
35 setDefault(); 35 setDefault();
36} 36}
37KSyncProfile::~KSyncProfile() 37KSyncProfile::~KSyncProfile()
38{ 38{
39 39
40} 40}
41 41
42 42
43KSyncProfile* KSyncProfile::clone() 43KSyncProfile* 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->setShowSummaryAfterSync( mShowSummaryAfterSync ); 54 myClone->setShowSummaryAfterSync( mShowSummaryAfterSync );
55 myClone->setAskForPreferences( mAskForPreferences); 55 myClone->setAskForPreferences( mAskForPreferences);
56 myClone->setWriteBackExisting(mWriteBackExisting ); 56 myClone->setWriteBackExisting(mWriteBackExisting );
57 myClone->setWriteBackFile( mWriteBackFile); 57 myClone->setWriteBackFile( mWriteBackFile);
58 myClone->setWriteBackFuture( mWriteBackFuture ); 58 myClone->setWriteBackFuture( mWriteBackFuture );
59 myClone->setWriteBackFutureWeeks( mWriteBackFutureWeeks ); 59 myClone->setWriteBackFutureWeeks( mWriteBackFutureWeeks );
60 myClone->setIncludeInRingSync( mIncludeInRingSync ); 60 myClone->setIncludeInRingSync( mIncludeInRingSync );
61 myClone->setIncludeInRingSyncAB( mIncludeInRingSyncAB ); 61 myClone->setIncludeInRingSyncAB( mIncludeInRingSyncAB );
62 myClone->setSyncPrefs( mSyncPrefs); 62 myClone->setSyncPrefs( mSyncPrefs);
63 myClone->setIsLocalFileSync( mIsLocalFileSync ); 63 myClone->setIsLocalFileSync( mIsLocalFileSync );
64 myClone->setIsPhoneSync( mIsPhoneSync ); 64 myClone->setIsPhoneSync( mIsPhoneSync );
65 myClone->setName( "noName" ); 65 myClone->setName( "noName" );
66 return myClone; 66 return myClone;
67} 67}
68 68
69 69
70void KSyncProfile::setDefault() 70void KSyncProfile::setDefault()
71{ 71{
72 mName = "noName"; 72 mName = "noName";
73 mPreSyncCommand = i18n("command for downloading remote file to local device"); 73 mPreSyncCommand = i18n("command for downloading remote file to local device");
74 mPostSyncCommand = i18n("command for uploading local temp file to remote device"); 74 mPostSyncCommand = i18n("command for uploading local temp file to remote device");
75 mLocalTempFile = "/tmp/mycalendar.ics"; 75 mLocalTempFile = "/tmp/mycalendar.ics";
76 mRemoteFileName = "/home/polo/kdepim/apps/korganizer/localfile.ics"; 76 mRemoteFileName = "/home/polo/kdepim/apps/korganizer/localfile.ics";
77 mPreSyncCommandAB = i18n("command for downloading remote file to local device"); 77 mPreSyncCommandAB = i18n("command for downloading remote file to local device");
78 mPostSyncCommandAB = i18n("command for uploading local temp file to remote device"); 78 mPostSyncCommandAB = i18n("command for uploading local temp file to remote device");
79 mLocalTempFileAB = "/tmp/std.vcf"; 79 mLocalTempFileAB = "/tmp/std.vcf";
80 mRemoteFileNameAB = "/home/polo/kdepim/apps/kabc/localfile.vcf"; 80 mRemoteFileNameAB = "/home/polo/kdepim/apps/kabc/localfile.vcf";
81 mShowSummaryAfterSync = true; 81 mShowSummaryAfterSync = true;
82 mAskForPreferences = true; 82 mAskForPreferences = true;
83 mWriteBackExisting = false; 83 mWriteBackExisting = false;
84 mWriteBackFuture = false; 84 mWriteBackFuture = false;
85 mWriteBackFutureWeeks = 12; 85 mWriteBackFutureWeeks = 12;
86 mWriteBackFile = true; 86 mWriteBackFile = true;
87 mIncludeInRingSync = false; 87 mIncludeInRingSync = false;
88 mIncludeInRingSyncAB = false; 88 mIncludeInRingSyncAB = false;
89 mSyncPrefs = SYNC_PREF_ASK; 89 mSyncPrefs = SYNC_PREF_ASK;
90 mIsLocalFileSync = true; 90 mIsLocalFileSync = true;
91 mIsPhoneSync = false; 91 mIsPhoneSync = false;
92 mPhoneDevice = "/dev/ircomm"; 92 mPhoneDevice = "/dev/ircomm";
93 mPhoneConnection = "irda"; 93 mPhoneConnection = "irda";
94 mPhoneModel = "6310i"; 94 mPhoneModel = "6310i";
95 95
96} 96}
97void KSyncProfile::readConfig(KConfig *config ) 97void KSyncProfile::readConfig(KConfig *config )
98{ 98{
99 config->setGroup("SyncProfiles"); 99 config->setGroup(mName);
100 QString prefix = "Profile_"+mName+"_"; 100 QString prefix = "";
101 //mName = config->readEntry( prefix+ "Name", mName ); 101 //mName = config->readEntry( prefix+ "Name", mName );
102 mPreSyncCommand = config->readEntry( prefix+ "PreSyncCommand",mPreSyncCommand ); 102 mPreSyncCommand = config->readEntry( prefix+ "PreSyncCommand",mPreSyncCommand );
103 mPostSyncCommand = config->readEntry( prefix+ "PostSyncCommand", mPostSyncCommand );; 103 mPostSyncCommand = config->readEntry( prefix+ "PostSyncCommand", mPostSyncCommand );;
104 mLocalTempFile = config->readEntry( prefix+ "LocalTempFile", mLocalTempFile ); 104 mLocalTempFile = config->readEntry( prefix+ "LocalTempFile", mLocalTempFile );
105 mRemoteFileName = config->readEntry( prefix+ "RemoteFileName", mRemoteFileName ); 105 mRemoteFileName = config->readEntry( prefix+ "RemoteFileName", mRemoteFileName );
106 106
107 mPreSyncCommandAB = config->readEntry( prefix+ "PreSyncCommandAB",mPreSyncCommandAB ); 107 mPreSyncCommandAB = config->readEntry( prefix+ "PreSyncCommandAB",mPreSyncCommandAB );
108 mPostSyncCommandAB = config->readEntry( prefix+ "PostSyncCommandAB", mPostSyncCommandAB ); 108 mPostSyncCommandAB = config->readEntry( prefix+ "PostSyncCommandAB", mPostSyncCommandAB );
109 mLocalTempFileAB = config->readEntry( prefix+ "LocalTempFileAB", mLocalTempFileAB ); 109 mLocalTempFileAB = config->readEntry( prefix+ "LocalTempFileAB", mLocalTempFileAB );
110 mRemoteFileNameAB = config->readEntry( prefix+ "RemoteFileNameAB", mRemoteFileNameAB ); 110 mRemoteFileNameAB = config->readEntry( prefix+ "RemoteFileNameAB", mRemoteFileNameAB );
111 111
112 112
113 mPhoneDevice = config->readEntry( prefix+ "PhoneDevice", mPhoneDevice ); 113 mPhoneDevice = config->readEntry( prefix+ "PhoneDevice", mPhoneDevice );
114 mPhoneConnection = config->readEntry( prefix+ "PhoneConnection", mPhoneConnection ); 114 mPhoneConnection = config->readEntry( prefix+ "PhoneConnection", mPhoneConnection );
115 mPhoneModel = config->readEntry( prefix+ "PhoneModel", mPhoneModel ); 115 mPhoneModel = config->readEntry( prefix+ "PhoneModel", mPhoneModel );
116 116
117 mIncludeInRingSync = config->readBoolEntry( prefix+ "IncludeInRingSync",mIncludeInRingSync ); 117 mIncludeInRingSync = config->readBoolEntry( prefix+ "IncludeInRingSync",mIncludeInRingSync );
118 mIncludeInRingSyncAB = config->readBoolEntry( prefix+ "IncludeInRingSyncAB",mIncludeInRingSyncAB ); 118 mIncludeInRingSyncAB = config->readBoolEntry( prefix+ "IncludeInRingSyncAB",mIncludeInRingSyncAB );
119 mShowSummaryAfterSync = config->readBoolEntry( prefix+ "ShowSummaryAfterSync", mShowSummaryAfterSync ); 119 mShowSummaryAfterSync = config->readBoolEntry( prefix+ "ShowSummaryAfterSync", mShowSummaryAfterSync );
120 mAskForPreferences = config->readBoolEntry( prefix+ "AskForPreferences",mAskForPreferences ); 120 mAskForPreferences = config->readBoolEntry( prefix+ "AskForPreferences",mAskForPreferences );
121 mWriteBackExisting = config->readBoolEntry( prefix+ "WriteBackExisting",mWriteBackExisting ); 121 mWriteBackExisting = config->readBoolEntry( prefix+ "WriteBackExisting",mWriteBackExisting );
122 mWriteBackFuture = config->readBoolEntry( prefix+ "WriteBackFuture",mWriteBackFuture ); 122 mWriteBackFuture = config->readBoolEntry( prefix+ "WriteBackFuture",mWriteBackFuture );
123 mSyncPrefs = config->readNumEntry( prefix+ "SyncPrefs", mSyncPrefs ); 123 mSyncPrefs = config->readNumEntry( prefix+ "SyncPrefs", mSyncPrefs );
124 mWriteBackFutureWeeks = config->readNumEntry( prefix+ "WriteBackFutureWeeks", mWriteBackFutureWeeks ); 124 mWriteBackFutureWeeks = config->readNumEntry( prefix+ "WriteBackFutureWeeks", mWriteBackFutureWeeks );
125 mIsLocalFileSync= config->readBoolEntry( prefix+ "IsLocalFileSync", mIsLocalFileSync ); 125 mIsLocalFileSync= config->readBoolEntry( prefix+ "IsLocalFileSync", mIsLocalFileSync );
126 mIsPhoneSync= config->readBoolEntry( prefix+ "IsPhoneSync", mIsPhoneSync ); 126 mIsPhoneSync= config->readBoolEntry( prefix+ "IsPhoneSync", mIsPhoneSync );
127} 127}
128void KSyncProfile::writeConfig( KConfig * config ) 128void KSyncProfile::writeConfig( KConfig * config )
129{ 129{
130 config->setGroup("SyncProfiles"); 130 config->setGroup(mName );
131 QString prefix = "Profile_"+mName+"_"; 131 QString prefix = "";
132 // config->writeEntry( prefix+ "Name", mName ); 132 // config->writeEntry( prefix+ "Name", mName );
133 config->writeEntry( prefix+ "PreSyncCommand",mPreSyncCommand ); 133 config->writeEntry( prefix+ "PreSyncCommand",mPreSyncCommand );
134 config->writeEntry( prefix+ "PostSyncCommand", mPostSyncCommand ); 134 config->writeEntry( prefix+ "PostSyncCommand", mPostSyncCommand );
135 config->writeEntry( prefix+ "LocalTempFile", mLocalTempFile ); 135 config->writeEntry( prefix+ "LocalTempFile", mLocalTempFile );
136 config->writeEntry( prefix+ "RemoteFileName", mRemoteFileName ); 136 config->writeEntry( prefix+ "RemoteFileName", mRemoteFileName );
137 137
138 config->writeEntry( prefix+ "PreSyncCommandAB",mPreSyncCommandAB ); 138 config->writeEntry( prefix+ "PreSyncCommandAB",mPreSyncCommandAB );
139 config->writeEntry( prefix+ "PostSyncCommandAB", mPostSyncCommandAB ); 139 config->writeEntry( prefix+ "PostSyncCommandAB", mPostSyncCommandAB );
140 config->writeEntry( prefix+ "LocalTempFileAB", mLocalTempFileAB ); 140 config->writeEntry( prefix+ "LocalTempFileAB", mLocalTempFileAB );
141 config->writeEntry( prefix+ "RemoteFileNameAB", mRemoteFileNameAB ); 141 config->writeEntry( prefix+ "RemoteFileNameAB", mRemoteFileNameAB );
142 142
143 config->writeEntry( prefix+ "PhoneDevice", mPhoneDevice ); 143 config->writeEntry( prefix+ "PhoneDevice", mPhoneDevice );
144 config->writeEntry( prefix+ "PhoneConnection", mPhoneConnection ); 144 config->writeEntry( prefix+ "PhoneConnection", mPhoneConnection );
145 config->writeEntry( prefix+ "PhoneModel", mPhoneModel ); 145 config->writeEntry( prefix+ "PhoneModel", mPhoneModel );
146 146
147 config->writeEntry( prefix+ "IncludeInRingSync",mIncludeInRingSync ); 147 config->writeEntry( prefix+ "IncludeInRingSync",mIncludeInRingSync );
148 config->writeEntry( prefix+ "IncludeInRingSyncAB",mIncludeInRingSyncAB ); 148 config->writeEntry( prefix+ "IncludeInRingSyncAB",mIncludeInRingSyncAB );
149 config->writeEntry( prefix+ "ShowSummaryAfterSync", mShowSummaryAfterSync ); 149 config->writeEntry( prefix+ "ShowSummaryAfterSync", mShowSummaryAfterSync );
150 config->writeEntry( prefix+ "AskForPreferences",mAskForPreferences ); 150 config->writeEntry( prefix+ "AskForPreferences",mAskForPreferences );
151 config->writeEntry( prefix+ "WriteBackExisting",mWriteBackExisting ); 151 config->writeEntry( prefix+ "WriteBackExisting",mWriteBackExisting );
152 config->writeEntry( prefix+ "WriteBackFuture",mWriteBackFuture ); 152 config->writeEntry( prefix+ "WriteBackFuture",mWriteBackFuture );
153 config->writeEntry( prefix+ "SyncPrefs", mSyncPrefs ); 153 config->writeEntry( prefix+ "SyncPrefs", mSyncPrefs );
154 config->writeEntry( prefix+ "WriteBackFutureWeeks", mWriteBackFutureWeeks); 154 config->writeEntry( prefix+ "WriteBackFutureWeeks", mWriteBackFutureWeeks);
155 config->writeEntry( prefix+ "IsLocalFileSync", mIsLocalFileSync ); 155 config->writeEntry( prefix+ "IsLocalFileSync", mIsLocalFileSync );
156 config->writeEntry( prefix+ "IsPhoneSync", mIsPhoneSync ); 156 config->writeEntry( prefix+ "IsPhoneSync", mIsPhoneSync );
157} 157}
158 158
159/* 159/*
160class KPrefsItemInt : public KPrefsItem { 160class KPrefsItemInt : public KPrefsItem {
161 public: 161 public:
162 KPrefsItemInt(const QString &group,const QString &name,int *,int defaultValue=0); 162 KPrefsItemInt(const QString &group,const QString &name,int *,int defaultValue=0);
163 virtual ~KPrefsItemInt() {} 163 virtual ~KPrefsItemInt() {}
164 164
165 void setDefault(); 165 void setDefault();
166 void readConfig(KConfig *); 166 void readConfig(KConfig *);
167 void writeConfig(KConfig *); 167 void writeConfig(KConfig *);
168 168
169 private: 169 private:
170 int *mReference; 170 int *mReference;
171 int mDefault; 171 int mDefault;
172}; 172};
173*/ 173*/