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