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