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