summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/mainwindow.cpp178
-rw-r--r--korganizer/mainwindow.h34
-rw-r--r--version2
3 files changed, 143 insertions, 71 deletions
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 10cb2a2..e4b7869 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -1,587 +1,585 @@
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 mTimerCommandSocket = new QTimer ( this );
75 connect( mTimerCommandSocket, SIGNAL ( timeout () ), this, SLOT ( deleteCommandSocket() ) );
76#ifdef DESKTOP_VERSION 74#ifdef DESKTOP_VERSION
77 setFont( QFont("Arial"), 14 ); 75 setFont( QFont("Arial"), 14 );
78#endif 76#endif
79 mCommandSocket = 0; 77 mCommandSocket = 0;
80 mCommandSocketFinish = 0; 78 mCommandSocketFinish = 0;
81 mSyncActionDialog = 0; 79 mSyncActionDialog = 0;
82 mServerSocket = 0; 80 mServerSocket = 0;
83 mClosed = false; 81 mClosed = false;
84 //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; 82 //QString confFile = KStandardDirs::appDir() + "config/korganizerrc";
85 QString confFile = locateLocal("config","korganizerrc"); 83 QString confFile = locateLocal("config","korganizerrc");
86 QFileInfo finf ( confFile ); 84 QFileInfo finf ( confFile );
87 bool showWarning = !finf.exists(); 85 bool showWarning = !finf.exists();
88 setIcon(SmallIcon( "ko24" ) ); 86 setIcon(SmallIcon( "ko24" ) );
89 mBlockAtStartup = true; 87 mBlockAtStartup = true;
90 mFlagKeyPressed = false; 88 mFlagKeyPressed = false;
91 setCaption("KOrganizer/Pi"); 89 setCaption("KOrganizer/Pi");
92 KOPrefs *p = KOPrefs::instance(); 90 KOPrefs *p = KOPrefs::instance();
93 KPimGlobalPrefs::instance()->setGlobalConfig(); 91 KPimGlobalPrefs::instance()->setGlobalConfig();
94 // if ( QApplication::desktop()->height() > 480 ) { 92 // if ( QApplication::desktop()->height() > 480 ) {
95// if ( p->mHourSize == 4 ) 93// if ( p->mHourSize == 4 )
96// p->mHourSize = 6; 94// p->mHourSize = 6;
97// } 95// }
98 if ( p->mHourSize > 18 ) 96 if ( p->mHourSize > 18 )
99 p->mHourSize = 18; 97 p->mHourSize = 18;
100 QMainWindow::ToolBarDock tbd; 98 QMainWindow::ToolBarDock tbd;
101 if ( p->mToolBarHor ) { 99 if ( p->mToolBarHor ) {
102 if ( p->mToolBarUp ) 100 if ( p->mToolBarUp )
103 tbd = Bottom; 101 tbd = Bottom;
104 else 102 else
105 tbd = Top; 103 tbd = Top;
106 } 104 }
107 else { 105 else {
108 if ( p->mToolBarUp ) 106 if ( p->mToolBarUp )
109 tbd = Right; 107 tbd = Right;
110 else 108 else
111 tbd = Left; 109 tbd = Left;
112 } 110 }
113 if ( KOPrefs::instance()->mUseAppColors ) 111 if ( KOPrefs::instance()->mUseAppColors )
114 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); 112 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true );
115 globalFlagBlockStartup = 1; 113 globalFlagBlockStartup = 1;
116 iconToolBar = new QPEToolBar( this ); 114 iconToolBar = new QPEToolBar( this );
117 addToolBar (iconToolBar , tbd ); 115 addToolBar (iconToolBar , tbd );
118 mBlockSaveFlag = false; 116 mBlockSaveFlag = false;
119 mCalendarModifiedFlag = false; 117 mCalendarModifiedFlag = false;
120 118
121 QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); 119 QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this );
122 splash->setAlignment ( AlignCenter ); 120 splash->setAlignment ( AlignCenter );
123 setCentralWidget( splash ); 121 setCentralWidget( splash );
124#ifndef DESKTOP_VERSION 122#ifndef DESKTOP_VERSION
125 showMaximized(); 123 showMaximized();
126#endif 124#endif
127 //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 ());
128 setDefaultPreferences(); 126 setDefaultPreferences();
129 mCalendar = new CalendarLocal(); 127 mCalendar = new CalendarLocal();
130 mView = new CalendarView( mCalendar, this,"mCalendar " ); 128 mView = new CalendarView( mCalendar, this,"mCalendar " );
131 mView->hide(); 129 mView->hide();
132 //mView->resize(splash->size() ); 130 //mView->resize(splash->size() );
133 initActions(); 131 initActions();
134#ifndef DESKTOP_VERSION 132#ifndef DESKTOP_VERSION
135 iconToolBar->show(); 133 iconToolBar->show();
136 qApp->processEvents(); 134 qApp->processEvents();
137#endif 135#endif
138 //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 ());
139 int vh = height() ; 137 int vh = height() ;
140 int vw = width(); 138 int vw = width();
141 //qDebug("Toolbar hei %d ",iconToolBar->height() ); 139 //qDebug("Toolbar hei %d ",iconToolBar->height() );
142 if ( iconToolBar->orientation () == Qt:: Horizontal ) { 140 if ( iconToolBar->orientation () == Qt:: Horizontal ) {
143 vh -= iconToolBar->height(); 141 vh -= iconToolBar->height();
144 } else { 142 } else {
145 vw -= iconToolBar->height(); 143 vw -= iconToolBar->height();
146 } 144 }
147 //mView->setMaximumSize( splash->size() ); 145 //mView->setMaximumSize( splash->size() );
148 //mView->resize( splash->size() ); 146 //mView->resize( splash->size() );
149 //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 ());
150 mView->readSettings(); 148 mView->readSettings();
151 bool oldOpened = false; 149 bool oldOpened = false;
152 bool newFile = false; 150 bool newFile = false;
153 if( !QFile::exists( defaultFileName() ) ) { 151 if( !QFile::exists( defaultFileName() ) ) {
154 QFileInfo finfo ( defaultFileName() ); 152 QFileInfo finfo ( defaultFileName() );
155 QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); 153 QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics");
156 qDebug("oldfile %s ", oldFile.latin1()); 154 qDebug("oldfile %s ", oldFile.latin1());
157 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";
158 finfo.setFile( oldFile ); 156 finfo.setFile( oldFile );
159 if (finfo.exists() ) { 157 if (finfo.exists() ) {
160 KMessageBox::information( this, message); 158 KMessageBox::information( this, message);
161 mView->openCalendar( oldFile ); 159 mView->openCalendar( oldFile );
162 qApp->processEvents(); 160 qApp->processEvents();
163 } else { 161 } else {
164 oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); 162 oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics");
165 finfo.setFile( oldFile ); 163 finfo.setFile( oldFile );
166 if (finfo.exists() ) { 164 if (finfo.exists() ) {
167 KMessageBox::information( this, message); 165 KMessageBox::information( this, message);
168 mView->openCalendar( oldFile ); 166 mView->openCalendar( oldFile );
169 qApp->processEvents(); 167 qApp->processEvents();
170 } 168 }
171 } 169 }
172 mView->saveCalendar( defaultFileName() ); 170 mView->saveCalendar( defaultFileName() );
173 newFile = true; 171 newFile = true;
174 } 172 }
175 173
176 QTime neededSaveTime = QDateTime::currentDateTime().time(); 174 QTime neededSaveTime = QDateTime::currentDateTime().time();
177 if ( ! oldOpened ) 175 if ( ! oldOpened )
178 mView->openCalendar( defaultFileName() ); 176 mView->openCalendar( defaultFileName() );
179 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); 177 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
180 qDebug("KO: Calendar loading time: %d ms",msNeeded ); 178 qDebug("KO: Calendar loading time: %d ms",msNeeded );
181 179
182 if ( KOPrefs::instance()->mLanguageChanged ) { 180 if ( KOPrefs::instance()->mLanguageChanged ) {
183 KOPrefs::instance()->setCategoryDefaults(); 181 KOPrefs::instance()->setCategoryDefaults();
184 int count = mView->addCategories(); 182 int count = mView->addCategories();
185 KOPrefs::instance()->mLanguageChanged = false; 183 KOPrefs::instance()->mLanguageChanged = false;
186 } 184 }
187 processIncidenceSelection( 0 ); 185 processIncidenceSelection( 0 );
188 connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), 186 connect( mView, SIGNAL( incidenceSelected( Incidence * ) ),
189 SLOT( processIncidenceSelection( Incidence * ) ) ); 187 SLOT( processIncidenceSelection( Incidence * ) ) );
190 connect( mView, SIGNAL( modifiedChanged( bool ) ), 188 connect( mView, SIGNAL( modifiedChanged( bool ) ),
191 SLOT( slotModifiedChanged( bool ) ) ); 189 SLOT( slotModifiedChanged( bool ) ) );
192 190
193 191
194 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); 192 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) );
195 mView->setModified( false ); 193 mView->setModified( false );
196 mBlockAtStartup = false; 194 mBlockAtStartup = false;
197 mView->setModified( false ); 195 mView->setModified( false );
198 setCentralWidget( mView ); 196 setCentralWidget( mView );
199 globalFlagBlockStartup = 0; 197 globalFlagBlockStartup = 0;
200 mView->show(); 198 mView->show();
201 delete splash; 199 delete splash;
202 if ( newFile ) 200 if ( newFile )
203 mView->updateConfig(); 201 mView->updateConfig();
204 // qApp->processEvents(); 202 // qApp->processEvents();
205 //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 ());
206 fillSyncMenu(); 204 fillSyncMenu();
207 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); 205 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins );
208 if ( showWarning ) { 206 if ( showWarning ) {
209 KMessageBox::information( this, 207 KMessageBox::information( this,
210 "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");
211 qApp->processEvents(); 209 qApp->processEvents();
212 mView->dialogManager()->showSyncOptions(); 210 mView->dialogManager()->showSyncOptions();
213 } 211 }
214 212
215 //US listen for result adressed from Ka/Pi 213 //US listen for result adressed from Ka/Pi
216#ifndef DESKTOP_VERSION 214#ifndef DESKTOP_VERSION
217 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 & )));
218#endif 216#endif
219} 217}
220MainWindow::~MainWindow() 218MainWindow::~MainWindow()
221{ 219{
222 //qDebug("MainWindow::~MainWindow() "); 220 //qDebug("MainWindow::~MainWindow() ");
223 //save toolbar location 221 //save toolbar location
224 delete mServerSocket; 222 delete mServerSocket;
225 delete mCalendar; 223 delete mCalendar;
226 delete KOPrefs::instance(); 224 delete KOPrefs::instance();
227 delete KIncidenceFormatter::instance(); 225 delete KIncidenceFormatter::instance();
228 226
229 227
230} 228}
231void MainWindow::showMaximized () 229void MainWindow::showMaximized ()
232{ 230{
233#ifndef DESKTOP_VERSION 231#ifndef DESKTOP_VERSION
234 if ( ! globalFlagBlockStartup ) 232 if ( ! globalFlagBlockStartup )
235 if ( mClosed ) 233 if ( mClosed )
236 mView->goToday(); 234 mView->goToday();
237#endif 235#endif
238 QWidget::showMaximized () ; 236 QWidget::showMaximized () ;
239 mClosed = false; 237 mClosed = false;
240} 238}
241void MainWindow::closeEvent( QCloseEvent* ce ) 239void MainWindow::closeEvent( QCloseEvent* ce )
242{ 240{
243 241
244 242
245 243
246 if ( ! KOPrefs::instance()->mAskForQuit ) { 244 if ( ! KOPrefs::instance()->mAskForQuit ) {
247 saveOnClose(); 245 saveOnClose();
248 mClosed = true; 246 mClosed = true;
249 ce->accept(); 247 ce->accept();
250 return; 248 return;
251 249
252 } 250 }
253 251
254 switch( QMessageBox::information( this, "KO/Pi", 252 switch( QMessageBox::information( this, "KO/Pi",
255 i18n("Do you really want\nto close KO/Pi?"), 253 i18n("Do you really want\nto close KO/Pi?"),
256 i18n("Close"), i18n("No"), 254 i18n("Close"), i18n("No"),
257 0, 0 ) ) { 255 0, 0 ) ) {
258 case 0: 256 case 0:
259 saveOnClose(); 257 saveOnClose();
260 mClosed = true; 258 mClosed = true;
261 ce->accept(); 259 ce->accept();
262 break; 260 break;
263 case 1: 261 case 1:
264 ce->ignore(); 262 ce->ignore();
265 break; 263 break;
266 case 2: 264 case 2:
267 265
268 default: 266 default:
269 break; 267 break;
270 } 268 }
271 269
272 270
273} 271}
274 272
275void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) 273void MainWindow::recieve( const QCString& cmsg, const QByteArray& data )
276{ 274{
277 QDataStream stream( data, IO_ReadOnly ); 275 QDataStream stream( data, IO_ReadOnly );
278 // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); 276 // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" );
279 //QString datamess; 277 //QString datamess;
280 //qDebug("message "); 278 //qDebug("message ");
281 qDebug("KO: QCOP message received: %s ", cmsg.data() ); 279 qDebug("KO: QCOP message received: %s ", cmsg.data() );
282 280
283 if ( cmsg == "-writeFile" ) { 281 if ( cmsg == "-writeFile" ) {
284 // I made from the "-writeFile" an "-writeAlarm" 282 // I made from the "-writeFile" an "-writeAlarm"
285 mView->viewManager()->showWhatsNextView(); 283 mView->viewManager()->showWhatsNextView();
286 mCalendar->checkAlarmForIncidence( 0, true); 284 mCalendar->checkAlarmForIncidence( 0, true);
287 showMaximized(); 285 showMaximized();
288 raise(); 286 raise();
289 return; 287 return;
290 } 288 }
291 289
292 if ( cmsg == "-writeFile" ) { 290 if ( cmsg == "-writeFile" ) {
293 // I made from the "-writeFile" an "-writeAlarm" 291 // I made from the "-writeFile" an "-writeAlarm"
294 mView->viewManager()->showWhatsNextView(); 292 mView->viewManager()->showWhatsNextView();
295 mCalendar->checkAlarmForIncidence( 0, true); 293 mCalendar->checkAlarmForIncidence( 0, true);
296 showMaximized(); 294 showMaximized();
297 raise(); 295 raise();
298 return; 296 return;
299 297
300 } 298 }
301 if ( cmsg == "-writeFileSilent" ) { 299 if ( cmsg == "-writeFileSilent" ) {
302 // I made from the "-writeFile" an "-writeAlarm" 300 // I made from the "-writeFile" an "-writeAlarm"
303 // mView->viewManager()->showWhatsNextView(); 301 // mView->viewManager()->showWhatsNextView();
304 mCalendar->checkAlarmForIncidence( 0, true); 302 mCalendar->checkAlarmForIncidence( 0, true);
305 //showMaximized(); 303 //showMaximized();
306 //raise(); 304 //raise();
307 hide(); 305 hide();
308 return; 306 return;
309 } 307 }
310 if ( cmsg == "-newCountdown" ) { 308 if ( cmsg == "-newCountdown" ) {
311 qDebug("newCountdown "); 309 qDebug("newCountdown ");
312 310
313 } 311 }
314 QString msg ; 312 QString msg ;
315 QString allmsg = cmsg; 313 QString allmsg = cmsg;
316 while ( allmsg.length() > 0 ) { 314 while ( allmsg.length() > 0 ) {
317 int nextC = allmsg.find( "-", 1 ); 315 int nextC = allmsg.find( "-", 1 );
318 if ( nextC == -1 ) { 316 if ( nextC == -1 ) {
319 msg = allmsg; 317 msg = allmsg;
320 allmsg = ""; 318 allmsg = "";
321 } else{ 319 } else{
322 msg = allmsg.left( nextC ); 320 msg = allmsg.left( nextC );
323 allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); 321 allmsg = allmsg.mid( nextC, allmsg.length()-nextC );
324 } 322 }
325 //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); 323 //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() );
326 if ( msg == "-newEvent" ) { 324 if ( msg == "-newEvent" ) {
327 mView->newEvent(); 325 mView->newEvent();
328 } 326 }
329 if ( msg == "-newTodo" ) { 327 if ( msg == "-newTodo" ) {
330 mView->newTodo(); 328 mView->newTodo();
331 329
332 } 330 }
333 if ( msg == "-showWN" ) { 331 if ( msg == "-showWN" ) {
334 mView->viewManager()->showWhatsNextView(); 332 mView->viewManager()->showWhatsNextView();
335 } 333 }
336 if ( msg == "-showTodo" ) { 334 if ( msg == "-showTodo" ) {
337 mView->viewManager()->showTodoView(); 335 mView->viewManager()->showTodoView();
338 } 336 }
339 if ( msg == "-showList" ) { 337 if ( msg == "-showList" ) {
340 mView->viewManager()->showListView(); 338 mView->viewManager()->showListView();
341 } 339 }
342 else if ( msg == "-showDay" ) { 340 else if ( msg == "-showDay" ) {
343 mView->viewManager()->showDayView(); 341 mView->viewManager()->showDayView();
344 } 342 }
345 else if ( msg == "-showWWeek" ) { 343 else if ( msg == "-showWWeek" ) {
346 mView->viewManager()->showWorkWeekView(); 344 mView->viewManager()->showWorkWeekView();
347 } 345 }
348 else if ( msg == "-ringSync" ) { 346 else if ( msg == "-ringSync" ) {
349 multiSync( false ); 347 multiSync( false );
350 } 348 }
351 else if ( msg == "-showWeek" ) { 349 else if ( msg == "-showWeek" ) {
352 mView->viewManager()->showWeekView(); 350 mView->viewManager()->showWeekView();
353 } 351 }
354 else if ( msg == "-showTodo" ) { 352 else if ( msg == "-showTodo" ) {
355 mView->viewManager()->showTodoView(); 353 mView->viewManager()->showTodoView();
356 } 354 }
357 else if ( msg == "-showJournal" ) { 355 else if ( msg == "-showJournal" ) {
358 mView->dateNavigator()->selectDates( 1 ); 356 mView->dateNavigator()->selectDates( 1 );
359 mView->dateNavigator()->selectToday(); 357 mView->dateNavigator()->selectToday();
360 mView->viewManager()->showJournalView(); 358 mView->viewManager()->showJournalView();
361 } 359 }
362 else if ( msg == "-showKO" ) { 360 else if ( msg == "-showKO" ) {
363 mView->viewManager()->showNextXView(); 361 mView->viewManager()->showNextXView();
364 } 362 }
365 else if ( msg == "-showWNext" || msg == "nextView()" ) { 363 else if ( msg == "-showWNext" || msg == "nextView()" ) {
366 mView->viewManager()->showWhatsNextView(); 364 mView->viewManager()->showWhatsNextView();
367 } 365 }
368 else if ( msg == "-showNextXView" ) { 366 else if ( msg == "-showNextXView" ) {
369 mView->viewManager()->showNextXView(); 367 mView->viewManager()->showNextXView();
370 } 368 }
371 369
372 370
373 } 371 }
374 372
375 showMaximized(); 373 showMaximized();
376 raise(); 374 raise();
377} 375}
378 376
379QPixmap MainWindow::loadPixmap( QString name ) 377QPixmap MainWindow::loadPixmap( QString name )
380{ 378{
381 return SmallIcon( name ); 379 return SmallIcon( name );
382 380
383} 381}
384void MainWindow::initActions() 382void MainWindow::initActions()
385{ 383{
386 //KOPrefs::instance()->mShowFullMenu 384 //KOPrefs::instance()->mShowFullMenu
387 iconToolBar->clear(); 385 iconToolBar->clear();
388 KOPrefs *p = KOPrefs::instance(); 386 KOPrefs *p = KOPrefs::instance();
389 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); 387 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar );
390 388
391 QPopupMenu *viewMenu = new QPopupMenu( this ); 389 QPopupMenu *viewMenu = new QPopupMenu( this );
392 QPopupMenu *actionMenu = new QPopupMenu( this ); 390 QPopupMenu *actionMenu = new QPopupMenu( this );
393 QPopupMenu *importMenu = new QPopupMenu( this ); 391 QPopupMenu *importMenu = new QPopupMenu( this );
394 selectFilterMenu = new QPopupMenu( this ); 392 selectFilterMenu = new QPopupMenu( this );
395 selectFilterMenu->setCheckable( true ); 393 selectFilterMenu->setCheckable( true );
396 syncMenu = new QPopupMenu( this ); 394 syncMenu = new QPopupMenu( this );
397 configureAgendaMenu = new QPopupMenu( this ); 395 configureAgendaMenu = new QPopupMenu( this );
398 configureToolBarMenu = new QPopupMenu( this ); 396 configureToolBarMenu = new QPopupMenu( this );
399 QPopupMenu *helpMenu = new QPopupMenu( this ); 397 QPopupMenu *helpMenu = new QPopupMenu( this );
400 if ( KOPrefs::instance()->mShowFullMenu ) { 398 if ( KOPrefs::instance()->mShowFullMenu ) {
401 QMenuBar *menuBar1; 399 QMenuBar *menuBar1;
402 menuBar1 = menuBar(); 400 menuBar1 = menuBar();
403 menuBar1->insertItem( i18n("File"), importMenu ); 401 menuBar1->insertItem( i18n("File"), importMenu );
404 menuBar1->insertItem( i18n("View"), viewMenu ); 402 menuBar1->insertItem( i18n("View"), viewMenu );
405 menuBar1->insertItem( i18n("Actions"), actionMenu ); 403 menuBar1->insertItem( i18n("Actions"), actionMenu );
406 menuBar1->insertItem( i18n("Synchronize"), syncMenu ); 404 menuBar1->insertItem( i18n("Synchronize"), syncMenu );
407 menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); 405 menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu );
408 //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); 406 //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu );
409 menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); 407 menuBar1->insertItem( i18n("Filter"),selectFilterMenu );
410 menuBar1->insertItem( i18n("Help"), helpMenu ); 408 menuBar1->insertItem( i18n("Help"), helpMenu );
411 } else { 409 } else {
412 QPEMenuBar *menuBar1; 410 QPEMenuBar *menuBar1;
413 menuBar1 = new QPEMenuBar( iconToolBar ); 411 menuBar1 = new QPEMenuBar( iconToolBar );
414 QPopupMenu *menuBar = new QPopupMenu( this ); 412 QPopupMenu *menuBar = new QPopupMenu( this );
415 menuBar1->insertItem( i18n("ME"), menuBar); 413 menuBar1->insertItem( i18n("ME"), menuBar);
416 menuBar->insertItem( i18n("File"), importMenu ); 414 menuBar->insertItem( i18n("File"), importMenu );
417 menuBar->insertItem( i18n("View"), viewMenu ); 415 menuBar->insertItem( i18n("View"), viewMenu );
418 menuBar->insertItem( i18n("Actions"), actionMenu ); 416 menuBar->insertItem( i18n("Actions"), actionMenu );
419 menuBar->insertItem( i18n("Synchronize"), syncMenu ); 417 menuBar->insertItem( i18n("Synchronize"), syncMenu );
420 menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); 418 menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu );
421 menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); 419 menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu );
422 menuBar->insertItem( i18n("Filter"),selectFilterMenu ); 420 menuBar->insertItem( i18n("Filter"),selectFilterMenu );
423 menuBar->insertItem( i18n("Help"), helpMenu ); 421 menuBar->insertItem( i18n("Help"), helpMenu );
424 //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); 422 //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() );
425 menuBar1->setMaximumSize( menuBar1->sizeHint( )); 423 menuBar1->setMaximumSize( menuBar1->sizeHint( ));
426 } 424 }
427 connect ( syncMenu, SIGNAL( activated ( int ) ), this, SLOT (slotSyncMenu( int ) ) ); 425 connect ( syncMenu, SIGNAL( activated ( int ) ), this, SLOT (slotSyncMenu( int ) ) );
428 connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); 426 connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) );
429 connect ( selectFilterMenu, SIGNAL( aboutToShow () ), this, SLOT (fillFilterMenu() ) ); 427 connect ( selectFilterMenu, SIGNAL( aboutToShow () ), this, SLOT (fillFilterMenu() ) );
430 428
431 // ****************** 429 // ******************
432 QAction *action; 430 QAction *action;
433 QIconSet icon; 431 QIconSet icon;
434 // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); 432 // QPopupMenu *configureMenu= new QPopupMenu( menuBar );
435 configureToolBarMenu->setCheckable( true ); 433 configureToolBarMenu->setCheckable( true );
436 434
437 QString pathString = ""; 435 QString pathString = "";
438 if ( !p->mToolBarMiniIcons ) { 436 if ( !p->mToolBarMiniIcons ) {
439 if ( QApplication::desktop()->width() < 480 ) 437 if ( QApplication::desktop()->width() < 480 )
440 pathString += "icons16/"; 438 pathString += "icons16/";
441 } else 439 } else
442 pathString += "iconsmini/"; 440 pathString += "iconsmini/";
443 configureAgendaMenu->setCheckable( true ); 441 configureAgendaMenu->setCheckable( true );
444 configureAgendaMenu->insertItem(i18n("Toggle Allday"), 1 ); 442 configureAgendaMenu->insertItem(i18n("Toggle Allday"), 1 );
445 configureAgendaMenu->insertSeparator(); 443 configureAgendaMenu->insertSeparator();
446 configureAgendaMenu->insertItem(i18n("Tiny"), 4 ); 444 configureAgendaMenu->insertItem(i18n("Tiny"), 4 );
447 configureAgendaMenu->insertItem(i18n("Small"), 6 ); 445 configureAgendaMenu->insertItem(i18n("Small"), 6 );
448 configureAgendaMenu->insertItem(i18n("Medium"), 8 ); 446 configureAgendaMenu->insertItem(i18n("Medium"), 8 );
449 configureAgendaMenu->insertItem(i18n("Normal"), 10 ); 447 configureAgendaMenu->insertItem(i18n("Normal"), 10 );
450 configureAgendaMenu->insertItem(i18n("Large"), 12 ); 448 configureAgendaMenu->insertItem(i18n("Large"), 12 );
451 configureAgendaMenu->insertItem(i18n("Big"), 14 ); 449 configureAgendaMenu->insertItem(i18n("Big"), 14 );
452 configureAgendaMenu->insertItem(i18n("Bigger"), 16 ); 450 configureAgendaMenu->insertItem(i18n("Bigger"), 16 );
453 configureAgendaMenu->insertItem(i18n("Biggest"), 18 ); 451 configureAgendaMenu->insertItem(i18n("Biggest"), 18 );
454 //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); 452 //configureMenu->insertItem( "AgendaSize",configureAgendaMenu );
455 453
456 icon = loadPixmap( pathString + "configure" ); 454 icon = loadPixmap( pathString + "configure" );
457 action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this ); 455 action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this );
458 action->addTo( actionMenu ); 456 action->addTo( actionMenu );
459 connect( action, SIGNAL( activated() ), 457 connect( action, SIGNAL( activated() ),
460 mView, SLOT( edit_options() ) ); 458 mView, SLOT( edit_options() ) );
461 actionMenu->insertSeparator(); 459 actionMenu->insertSeparator();
462 icon = loadPixmap( pathString + "newevent" ); 460 icon = loadPixmap( pathString + "newevent" );
463 configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); 461 configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 );
464 configureToolBarMenu->insertSeparator(); 462 configureToolBarMenu->insertSeparator();
465 configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); 463 configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 );
466 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 );
467 ne_action->addTo( actionMenu ); 465 ne_action->addTo( actionMenu );
468 connect( ne_action, SIGNAL( activated() ), 466 connect( ne_action, SIGNAL( activated() ),
469 mView, SLOT( newEvent() ) ); 467 mView, SLOT( newEvent() ) );
470 icon = loadPixmap( pathString + "newtodo" ); 468 icon = loadPixmap( pathString + "newtodo" );
471 configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); 469 configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 );
472 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 );
473 nt_action->addTo( actionMenu ); 471 nt_action->addTo( actionMenu );
474 connect( nt_action, SIGNAL( activated() ), 472 connect( nt_action, SIGNAL( activated() ),
475 mView, SLOT( newTodo() ) ); 473 mView, SLOT( newTodo() ) );
476 icon = loadPixmap( pathString + "navi" ); 474 icon = loadPixmap( pathString + "navi" );
477 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 );
478 action->addTo( viewMenu ); 476 action->addTo( viewMenu );
479 connect( action, SIGNAL( activated() ), 477 connect( action, SIGNAL( activated() ),
480 mView, SLOT( toggleDateNavigatorWidget() ) ); 478 mView, SLOT( toggleDateNavigatorWidget() ) );
481 icon = loadPixmap( pathString + "filter" ); 479 icon = loadPixmap( pathString + "filter" );
482 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 );
483 action->addTo( viewMenu ); 481 action->addTo( viewMenu );
484 connect( action, SIGNAL( activated() ), 482 connect( action, SIGNAL( activated() ),
485 mView, SLOT( toggleFilter() ) ); 483 mView, SLOT( toggleFilter() ) );
486 484
487 485
488 viewMenu->insertSeparator(); 486 viewMenu->insertSeparator();
489 icon = loadPixmap( pathString + "picker" ); 487 icon = loadPixmap( pathString + "picker" );
490 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 );
491 action->addTo( viewMenu ); 489 action->addTo( viewMenu );
492 connect( action, SIGNAL( activated() ), 490 connect( action, SIGNAL( activated() ),
493 mView, SLOT( showDatePicker() ) ); 491 mView, SLOT( showDatePicker() ) );
494 action->addTo( iconToolBar ); 492 action->addTo( iconToolBar );
495 viewMenu->insertSeparator(); 493 viewMenu->insertSeparator();
496 icon = loadPixmap( pathString + "list" ); 494 icon = loadPixmap( pathString + "list" );
497 configureToolBarMenu->insertItem(icon, i18n("List View"), 30 ); 495 configureToolBarMenu->insertItem(icon, i18n("List View"), 30 );
498 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 );
499 showlist_action->addTo( viewMenu ); 497 showlist_action->addTo( viewMenu );
500 connect( showlist_action, SIGNAL( activated() ), 498 connect( showlist_action, SIGNAL( activated() ),
501 mView->viewManager(), SLOT( showListView() ) ); 499 mView->viewManager(), SLOT( showListView() ) );
502 500
503 501
504 icon = loadPixmap( pathString + "day" ); 502 icon = loadPixmap( pathString + "day" );
505 configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 ); 503 configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 );
506 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 );
507 day1_action->addTo( viewMenu ); 505 day1_action->addTo( viewMenu );
508 // action->addTo( toolBar ); 506 // action->addTo( toolBar );
509 connect( day1_action, SIGNAL( activated() ), 507 connect( day1_action, SIGNAL( activated() ),
510 mView->viewManager(), SLOT( showDayView() ) ); 508 mView->viewManager(), SLOT( showDayView() ) );
511 509
512 icon = loadPixmap( pathString + "workweek" ); 510 icon = loadPixmap( pathString + "workweek" );
513 configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 ); 511 configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 );
514 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 );
515 day5_action->addTo( viewMenu ); 513 day5_action->addTo( viewMenu );
516 connect( day5_action, SIGNAL( activated() ), 514 connect( day5_action, SIGNAL( activated() ),
517 mView->viewManager(), SLOT( showWorkWeekView() ) ); 515 mView->viewManager(), SLOT( showWorkWeekView() ) );
518 516
519 icon = loadPixmap( pathString + "week" ); 517 icon = loadPixmap( pathString + "week" );
520 configureToolBarMenu->insertItem(icon, i18n("Week"), 60 ); 518 configureToolBarMenu->insertItem(icon, i18n("Week"), 60 );
521 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 );
522 day7_action->addTo( viewMenu ); 520 day7_action->addTo( viewMenu );
523 connect( day7_action, SIGNAL( activated() ), 521 connect( day7_action, SIGNAL( activated() ),
524 mView->viewManager(), SLOT( showWeekView() ) ); 522 mView->viewManager(), SLOT( showWeekView() ) );
525 523
526 icon = loadPixmap( pathString + "month" ); 524 icon = loadPixmap( pathString + "month" );
527 configureToolBarMenu->insertItem(icon, i18n("Month"), 70 ); 525 configureToolBarMenu->insertItem(icon, i18n("Month"), 70 );
528 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 );
529 month_action->addTo( viewMenu ); 527 month_action->addTo( viewMenu );
530 connect( month_action, SIGNAL( activated() ), 528 connect( month_action, SIGNAL( activated() ),
531 mView->viewManager(), SLOT( showMonthView() ) ); 529 mView->viewManager(), SLOT( showMonthView() ) );
532 530
533 icon = loadPixmap( pathString + "todo" ); 531 icon = loadPixmap( pathString + "todo" );
534 configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 ); 532 configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 );
535 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 );
536 todoview_action->addTo( viewMenu ); 534 todoview_action->addTo( viewMenu );
537 connect( todoview_action, SIGNAL( activated() ), 535 connect( todoview_action, SIGNAL( activated() ),
538 mView->viewManager(), SLOT( showTodoView() ) ); 536 mView->viewManager(), SLOT( showTodoView() ) );
539 537
540 icon = loadPixmap( pathString + "journal" ); 538 icon = loadPixmap( pathString + "journal" );
541 configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 ); 539 configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 );
542 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 );
543 viewjournal_action->addTo( viewMenu ); 541 viewjournal_action->addTo( viewMenu );
544 connect( viewjournal_action, SIGNAL( activated() ), 542 connect( viewjournal_action, SIGNAL( activated() ),
545 mView->viewManager(), SLOT( showJournalView() ) ); 543 mView->viewManager(), SLOT( showJournalView() ) );
546 544
547 icon = loadPixmap( pathString + "xdays" ); 545 icon = loadPixmap( pathString + "xdays" );
548 configureToolBarMenu->insertItem(icon, i18n("Next days"), 100,4 ); 546 configureToolBarMenu->insertItem(icon, i18n("Next days"), 100,4 );
549 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 );
550 xdays_action->addTo( viewMenu ); 548 xdays_action->addTo( viewMenu );
551 connect( xdays_action, SIGNAL( activated() ), 549 connect( xdays_action, SIGNAL( activated() ),
552 mView->viewManager(), SLOT( showNextXView() ) ); 550 mView->viewManager(), SLOT( showNextXView() ) );
553 551
554 icon = loadPixmap( pathString + "whatsnext" ); 552 icon = loadPixmap( pathString + "whatsnext" );
555 configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110, 4 ); 553 configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110, 4 );
556 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 );
557 whatsnext_action->addTo( viewMenu ); 555 whatsnext_action->addTo( viewMenu );
558 connect( whatsnext_action, SIGNAL( activated() ), 556 connect( whatsnext_action, SIGNAL( activated() ),
559 mView->viewManager(), SLOT( showWhatsNextView() ) ); 557 mView->viewManager(), SLOT( showWhatsNextView() ) );
560 558
561#if 0 559#if 0
562 action = new QAction( "view_timespan", "Time Span", 0, this ); 560 action = new QAction( "view_timespan", "Time Span", 0, this );
563 action->addTo( viewMenu ); 561 action->addTo( viewMenu );
564 connect( action, SIGNAL( activated() ), 562 connect( action, SIGNAL( activated() ),
565 mView->viewManager(), SLOT( showTimeSpanView() ) ); 563 mView->viewManager(), SLOT( showTimeSpanView() ) );
566#endif 564#endif
567 565
568 mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0, 566 mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0,
569 this ); 567 this );
570 mNewSubTodoAction->addTo( actionMenu ); 568 mNewSubTodoAction->addTo( actionMenu );
571 connect( mNewSubTodoAction, SIGNAL( activated() ), 569 connect( mNewSubTodoAction, SIGNAL( activated() ),
572 mView, SLOT( newSubTodo() ) ); 570 mView, SLOT( newSubTodo() ) );
573 571
574 actionMenu->insertSeparator(); 572 actionMenu->insertSeparator();
575 573
576 mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this ); 574 mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this );
577 mShowAction->addTo( actionMenu ); 575 mShowAction->addTo( actionMenu );
578 connect( mShowAction, SIGNAL( activated() ), 576 connect( mShowAction, SIGNAL( activated() ),
579 mView, SLOT( showIncidence() ) ); 577 mView, SLOT( showIncidence() ) );
580 578
581 mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); 579 mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this );
582 mEditAction->addTo( actionMenu ); 580 mEditAction->addTo( actionMenu );
583 connect( mEditAction, SIGNAL( activated() ), 581 connect( mEditAction, SIGNAL( activated() ),
584 mView, SLOT( editIncidence() ) ); 582 mView, SLOT( editIncidence() ) );
585 583
586 mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); 584 mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this );
587 mDeleteAction->addTo( actionMenu ); 585 mDeleteAction->addTo( actionMenu );
@@ -1594,1011 +1592,1057 @@ void MainWindow::keyPressEvent ( QKeyEvent * e )
1594 break; 1592 break;
1595 case Qt::Key_J: 1593 case Qt::Key_J:
1596 mView->viewManager()->showJournalView(); 1594 mView->viewManager()->showJournalView();
1597 break; 1595 break;
1598 case Qt::Key_B: 1596 case Qt::Key_B:
1599 mView->editIncidenceDescription();; 1597 mView->editIncidenceDescription();;
1600 break; 1598 break;
1601 // case Qt::Key_Return: 1599 // case Qt::Key_Return:
1602 case Qt::Key_E: 1600 case Qt::Key_E:
1603 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1601 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1604 mView->newEvent(); 1602 mView->newEvent();
1605 else 1603 else
1606 mView->editIncidence(); 1604 mView->editIncidence();
1607 break; 1605 break;
1608 case Qt::Key_Plus: 1606 case Qt::Key_Plus:
1609 size = p->mHourSize +2; 1607 size = p->mHourSize +2;
1610 if ( size <= 18 ) 1608 if ( size <= 18 )
1611 configureAgenda( size ); 1609 configureAgenda( size );
1612 break; 1610 break;
1613 case Qt::Key_Minus: 1611 case Qt::Key_Minus:
1614 size = p->mHourSize - 2; 1612 size = p->mHourSize - 2;
1615 if ( size >= 4 ) 1613 if ( size >= 4 )
1616 configureAgenda( size ); 1614 configureAgenda( size );
1617 break; 1615 break;
1618 1616
1619 1617
1620 default: 1618 default:
1621 e->ignore(); 1619 e->ignore();
1622 } 1620 }
1623 if ( pro > 0 ) { 1621 if ( pro > 0 ) {
1624 mView->selectFilter( pro-1 ); 1622 mView->selectFilter( pro-1 );
1625 } 1623 }
1626 if ( showSelectedDates ) { 1624 if ( showSelectedDates ) {
1627 ;// setCaptionToDates(); 1625 ;// setCaptionToDates();
1628 } 1626 }
1629 1627
1630} 1628}
1631 1629
1632void MainWindow::fillFilterMenu() 1630void MainWindow::fillFilterMenu()
1633{ 1631{
1634 selectFilterMenu->clear(); 1632 selectFilterMenu->clear();
1635 bool disable = false; 1633 bool disable = false;
1636 if ( mView->filterView()->filtersEnabled() ) { 1634 if ( mView->filterView()->filtersEnabled() ) {
1637 selectFilterMenu->insertItem(i18n ( "Turn filter off" ), 0 ); 1635 selectFilterMenu->insertItem(i18n ( "Turn filter off" ), 0 );
1638 } 1636 }
1639 else { 1637 else {
1640 selectFilterMenu->insertItem(i18n ( "Turn filter on" ), 0 ); 1638 selectFilterMenu->insertItem(i18n ( "Turn filter on" ), 0 );
1641 disable = true; 1639 disable = true;
1642 } 1640 }
1643 selectFilterMenu->insertSeparator(); 1641 selectFilterMenu->insertSeparator();
1644 QPtrList<CalFilter> fili = mView->filters(); 1642 QPtrList<CalFilter> fili = mView->filters();
1645 CalFilter *curfilter = mView->filterView()->selectedFilter(); 1643 CalFilter *curfilter = mView->filterView()->selectedFilter();
1646 CalFilter *filter = fili.first(); 1644 CalFilter *filter = fili.first();
1647 int iii = 1; 1645 int iii = 1;
1648 while(filter) { 1646 while(filter) {
1649 selectFilterMenu->insertItem( filter->name(), iii ); 1647 selectFilterMenu->insertItem( filter->name(), iii );
1650 if ( filter == curfilter) 1648 if ( filter == curfilter)
1651 selectFilterMenu->setItemChecked( iii, true ); 1649 selectFilterMenu->setItemChecked( iii, true );
1652 if ( disable ) 1650 if ( disable )
1653 selectFilterMenu->setItemEnabled( iii, false ); 1651 selectFilterMenu->setItemEnabled( iii, false );
1654 filter = fili.next(); 1652 filter = fili.next();
1655 ++iii; 1653 ++iii;
1656 } 1654 }
1657} 1655}
1658void MainWindow::selectFilter( int fil ) 1656void MainWindow::selectFilter( int fil )
1659{ 1657{
1660 if ( fil == 0 ) { 1658 if ( fil == 0 ) {
1661 mView->toggleFilerEnabled( ); 1659 mView->toggleFilerEnabled( );
1662 } else { 1660 } else {
1663 mView->selectFilter( fil-1 ); 1661 mView->selectFilter( fil-1 );
1664 } 1662 }
1665} 1663}
1666void MainWindow::configureToolBar( int item ) 1664void MainWindow::configureToolBar( int item )
1667{ 1665{
1668 1666
1669 configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) ); 1667 configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) );
1670 KOPrefs *p = KOPrefs::instance(); 1668 KOPrefs *p = KOPrefs::instance();
1671 p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 ); 1669 p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 );
1672 p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 ); 1670 p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 );
1673 p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 ); 1671 p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 );
1674 p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 ); 1672 p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 );
1675 p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 ); 1673 p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 );
1676 p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 ); 1674 p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 );
1677 p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 ); 1675 p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 );
1678 p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 ); 1676 p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 );
1679 p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 ); 1677 p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 );
1680 p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 ); 1678 p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 );
1681 p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 ); 1679 p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 );
1682 p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 ); 1680 p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 );
1683 p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 ); 1681 p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 );
1684 p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 ); 1682 p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 );
1685 p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 ); 1683 p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 );
1686 p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 ); 1684 p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 );
1687 p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 ); 1685 p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 );
1688 p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 ); 1686 p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 );
1689 p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 ); 1687 p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 );
1690 // initActions(); 1688 // initActions();
1691} 1689}
1692 1690
1693void MainWindow::setCaptionToDates() 1691void MainWindow::setCaptionToDates()
1694{ 1692{
1695 QString selDates; 1693 QString selDates;
1696 selDates = KGlobal::locale()->formatDate(mView->startDate(), true); 1694 selDates = KGlobal::locale()->formatDate(mView->startDate(), true);
1697 if (mView->startDate() < mView->endDate() ) 1695 if (mView->startDate() < mView->endDate() )
1698 selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true); 1696 selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true);
1699 setCaption( i18n("Dates: ") + selDates ); 1697 setCaption( i18n("Dates: ") + selDates );
1700 1698
1701} 1699}
1702// parameter item == 0: reinit 1700// parameter item == 0: reinit
1703void MainWindow::configureAgenda( int item ) 1701void MainWindow::configureAgenda( int item )
1704{ 1702{
1705 1703
1706 KOPrefs *p = KOPrefs::instance(); 1704 KOPrefs *p = KOPrefs::instance();
1707 1705
1708 int i; 1706 int i;
1709 if ( item == 1 ) { 1707 if ( item == 1 ) {
1710 mView->toggleAllDaySize(); 1708 mView->toggleAllDaySize();
1711 return; 1709 return;
1712 } 1710 }
1713 // do not allow 4 for widgets higher than 480 1711 // do not allow 4 for widgets higher than 480
1714 // if ( QApplication::desktop()->height() > 480 ) { 1712 // if ( QApplication::desktop()->height() > 480 ) {
1715// if ( item == 4 ) 1713// if ( item == 4 )
1716// item = 6; 1714// item = 6;
1717// } 1715// }
1718 for ( i = 4; i <= 18; i= i+2 ) 1716 for ( i = 4; i <= 18; i= i+2 )
1719 configureAgendaMenu->setItemChecked( i, false ); 1717 configureAgendaMenu->setItemChecked( i, false );
1720 configureAgendaMenu->setItemChecked( item, true ); 1718 configureAgendaMenu->setItemChecked( item, true );
1721 if ( p->mHourSize == item ) 1719 if ( p->mHourSize == item )
1722 return; 1720 return;
1723 p->mHourSize=item; 1721 p->mHourSize=item;
1724 mView->viewManager()->agendaView()->updateConfig(); 1722 mView->viewManager()->agendaView()->updateConfig();
1725} 1723}
1726 1724
1727void MainWindow::saveCalendar() 1725void MainWindow::saveCalendar()
1728{ 1726{
1729 QString fn = KOPrefs::instance()->mLastSaveFile; 1727 QString fn = KOPrefs::instance()->mLastSaveFile;
1730 fn = KFileDialog::getSaveFileName( fn, i18n("Save backup filename"), this ); 1728 fn = KFileDialog::getSaveFileName( fn, i18n("Save backup filename"), this );
1731 1729
1732 if ( fn == "" ) 1730 if ( fn == "" )
1733 return; 1731 return;
1734 QFileInfo info; 1732 QFileInfo info;
1735 info.setFile( fn ); 1733 info.setFile( fn );
1736 QString mes; 1734 QString mes;
1737 bool createbup = true; 1735 bool createbup = true;
1738 if ( info. exists() ) { 1736 if ( info. exists() ) {
1739 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 )) ;
1740 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, 1738 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes,
1741 i18n("Overwrite!"), i18n("Cancel"), 0, 1739 i18n("Overwrite!"), i18n("Cancel"), 0,
1742 0, 1 ); 1740 0, 1 );
1743 if ( result != 0 ) { 1741 if ( result != 0 ) {
1744 createbup = false; 1742 createbup = false;
1745 } 1743 }
1746 } 1744 }
1747 if ( createbup ) { 1745 if ( createbup ) {
1748 mView->saveCalendar( fn ); 1746 mView->saveCalendar( fn );
1749 mes = i18n("KO/Pi:Saved %1").arg(fn); 1747 mes = i18n("KO/Pi:Saved %1").arg(fn);
1750 KOPrefs::instance()->mLastSaveFile = fn; 1748 KOPrefs::instance()->mLastSaveFile = fn;
1751 setCaption(mes); 1749 setCaption(mes);
1752 } 1750 }
1753} 1751}
1754void MainWindow::loadCalendar() 1752void MainWindow::loadCalendar()
1755{ 1753{
1756 1754
1757 QString fn = KOPrefs::instance()->mLastLoadFile; 1755 QString fn = KOPrefs::instance()->mLastLoadFile;
1758 fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this ); 1756 fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this );
1759 1757
1760 if ( fn == "" ) 1758 if ( fn == "" )
1761 return; 1759 return;
1762 QFileInfo info; 1760 QFileInfo info;
1763 info.setFile( fn ); 1761 info.setFile( fn );
1764 QString mess; 1762 QString mess;
1765 bool loadbup = true; 1763 bool loadbup = true;
1766 if ( info. exists() ) { 1764 if ( info. exists() ) {
1767 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 ));
1768 int result = QMessageBox::warning( this, "KO/Pi: Warning!", 1766 int result = QMessageBox::warning( this, "KO/Pi: Warning!",
1769 mess, 1767 mess,
1770 i18n("Load!"), i18n("Cancel"), 0, 1768 i18n("Load!"), i18n("Cancel"), 0,
1771 0, 1 ); 1769 0, 1 );
1772 if ( result != 0 ) { 1770 if ( result != 0 ) {
1773 loadbup = false; 1771 loadbup = false;
1774 } 1772 }
1775 } else { 1773 } else {
1776 QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1774 QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1777 i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0, 1775 i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0,
1778 0, 1 ); 1776 0, 1 );
1779 1777
1780 return; 1778 return;
1781 } 1779 }
1782 if ( loadbup ) { 1780 if ( loadbup ) {
1783 mView->openCalendar( fn ); 1781 mView->openCalendar( fn );
1784 KOPrefs::instance()->mLastLoadFile = fn; 1782 KOPrefs::instance()->mLastLoadFile = fn;
1785 mess = i18n("KO/Pi:Loaded %1").arg(fn) ; 1783 mess = i18n("KO/Pi:Loaded %1").arg(fn) ;
1786 setCaption(mess); 1784 setCaption(mess);
1787 } 1785 }
1788 1786
1789} 1787}
1790void MainWindow::quickImportIcal() 1788void MainWindow::quickImportIcal()
1791{ 1789{
1792 importFile( KOPrefs::instance()->mLastImportFile, false ); 1790 importFile( KOPrefs::instance()->mLastImportFile, false );
1793} 1791}
1794void MainWindow::importFile( QString fn, bool quick ) 1792void MainWindow::importFile( QString fn, bool quick )
1795{ 1793{
1796 QFileInfo info; 1794 QFileInfo info;
1797 info.setFile( fn ); 1795 info.setFile( fn );
1798 QString mess; 1796 QString mess;
1799 bool loadbup = true; 1797 bool loadbup = true;
1800 if ( !info. exists() ) { 1798 if ( !info. exists() ) {
1801 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));
1802 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1800 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1803 mess ); 1801 mess );
1804 return; 1802 return;
1805 } 1803 }
1806 int result = 0; 1804 int result = 0;
1807 if ( !quick ) { 1805 if ( !quick ) {
1808 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 ));
1809 result = QMessageBox::warning( this, "KO/Pi: Warning!", 1807 result = QMessageBox::warning( this, "KO/Pi: Warning!",
1810 mess, 1808 mess,
1811 "Import", "Cancel", 0, 1809 "Import", "Cancel", 0,
1812 0, 1 ); 1810 0, 1 );
1813 } 1811 }
1814 if ( result == 0 ) { 1812 if ( result == 0 ) {
1815 if ( mView->openCalendar( fn, true )) { 1813 if ( mView->openCalendar( fn, true )) {
1816 KOPrefs::instance()->mLastImportFile = fn; 1814 KOPrefs::instance()->mLastImportFile = fn;
1817 setCaption(i18n("Imported file successfully")); 1815 setCaption(i18n("Imported file successfully"));
1818 } else { 1816 } else {
1819 setCaption(i18n("Error importing file")); 1817 setCaption(i18n("Error importing file"));
1820 } 1818 }
1821 } 1819 }
1822} 1820}
1823 1821
1824void MainWindow::importIcal() 1822void MainWindow::importIcal()
1825{ 1823{
1826 1824
1827 QString fn =KOPrefs::instance()->mLastImportFile; 1825 QString fn =KOPrefs::instance()->mLastImportFile;
1828 1826
1829 fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this ); 1827 fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this );
1830 if ( fn == "" ) 1828 if ( fn == "" )
1831 return; 1829 return;
1832 importFile( fn, true ); 1830 importFile( fn, true );
1833 1831
1834} 1832}
1835 1833
1836void MainWindow::exportVCalendar() 1834void MainWindow::exportVCalendar()
1837{ 1835{
1838 QString fn = KOPrefs::instance()->mLastVcalFile; 1836 QString fn = KOPrefs::instance()->mLastVcalFile;
1839 fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this ); 1837 fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this );
1840 if ( fn == "" ) 1838 if ( fn == "" )
1841 return; 1839 return;
1842 QFileInfo info; 1840 QFileInfo info;
1843 info.setFile( fn ); 1841 info.setFile( fn );
1844 QString mes; 1842 QString mes;
1845 bool createbup = true; 1843 bool createbup = true;
1846 if ( info. exists() ) { 1844 if ( info. exists() ) {
1847 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 ) );
1848 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, 1846 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes,
1849 i18n("Overwrite!"), i18n("Cancel"), 0, 1847 i18n("Overwrite!"), i18n("Cancel"), 0,
1850 0, 1 ); 1848 0, 1 );
1851 if ( result != 0 ) { 1849 if ( result != 0 ) {
1852 createbup = false; 1850 createbup = false;
1853 } 1851 }
1854 } 1852 }
1855 if ( createbup ) { 1853 if ( createbup ) {
1856 if ( mView->exportVCalendar( fn ) ) { 1854 if ( mView->exportVCalendar( fn ) ) {
1857 KOPrefs::instance()->mLastVcalFile = fn; 1855 KOPrefs::instance()->mLastVcalFile = fn;
1858 if ( fn.length() > 20 ) 1856 if ( fn.length() > 20 )
1859 mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ; 1857 mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ;
1860 else 1858 else
1861 mes = i18n("KO/Pi:Exported to %1").arg(fn ); 1859 mes = i18n("KO/Pi:Exported to %1").arg(fn );
1862 setCaption(mes); 1860 setCaption(mes);
1863 } 1861 }
1864 } 1862 }
1865 1863
1866} 1864}
1867QString MainWindow::getPassword( ) 1865QString MainWindow::getPassword( )
1868{ 1866{
1869 QString retfile = ""; 1867 QString retfile = "";
1870 QDialog dia ( this, "input-dialog", true ); 1868 QDialog dia ( this, "input-dialog", true );
1871 QLineEdit lab ( &dia ); 1869 QLineEdit lab ( &dia );
1872 lab.setEchoMode( QLineEdit::Password ); 1870 lab.setEchoMode( QLineEdit::Password );
1873 QVBoxLayout lay( &dia ); 1871 QVBoxLayout lay( &dia );
1874 lay.setMargin(7); 1872 lay.setMargin(7);
1875 lay.setSpacing(7); 1873 lay.setSpacing(7);
1876 lay.addWidget( &lab); 1874 lay.addWidget( &lab);
1877 dia.setFixedSize( 230,50 ); 1875 dia.setFixedSize( 230,50 );
1878 dia.setCaption( i18n("Enter password") ); 1876 dia.setCaption( i18n("Enter password") );
1879 QPushButton pb ( "OK", &dia); 1877 QPushButton pb ( "OK", &dia);
1880 lay.addWidget( &pb ); 1878 lay.addWidget( &pb );
1881 connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) ); 1879 connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) );
1882 dia.show(); 1880 dia.show();
1883 int res = dia.exec(); 1881 int res = dia.exec();
1884 if ( res ) 1882 if ( res )
1885 retfile = lab.text(); 1883 retfile = lab.text();
1886 dia.hide(); 1884 dia.hide();
1887 qApp->processEvents(); 1885 qApp->processEvents();
1888 return retfile; 1886 return retfile;
1889 1887
1890} 1888}
1891 1889
1892void MainWindow::enableQuick() 1890void MainWindow::enableQuick()
1893{ 1891{
1894 QString passWordPiSync = "bhdrvmk"; 1892 QString passWordPiSync = "bhdrvmk";
1895 QString retfile = ""; 1893 QString retfile = "";
1896 QDialog dia ( this, "input-dialog", true ); 1894 QDialog dia ( this, "input-dialog", true );
1897 QLineEdit lab ( &dia ); 1895 QLineEdit lab ( &dia );
1898 QVBoxLayout lay( &dia ); 1896 QVBoxLayout lay( &dia );
1899 lab.setText( KOPrefs::instance()->mPassiveSyncPort ); 1897 lab.setText( KOPrefs::instance()->mPassiveSyncPort );
1900 lay.setMargin(7); 1898 lay.setMargin(7);
1901 lay.setSpacing(7); 1899 lay.setSpacing(7);
1902 QLabel label ( i18n("Port number (Default: 9197)"), &dia ); 1900 QLabel label ( i18n("Port number (Default: 9197)"), &dia );
1903 lay.addWidget( &label); 1901 lay.addWidget( &label);
1904 lay.addWidget( &lab); 1902 lay.addWidget( &lab);
1905 1903
1906 QLineEdit lepw ( &dia ); 1904 QLineEdit lepw ( &dia );
1907 lepw.setText( "abc" ); 1905 lepw.setText( "abc" );
1908 QLabel label2 ( i18n("Password to enable\naccess from remote:"), &dia ); 1906 QLabel label2 ( i18n("Password to enable\naccess from remote:"), &dia );
1909 lay.addWidget( &label2); 1907 lay.addWidget( &label2);
1910 lay.addWidget( &lepw); 1908 lay.addWidget( &lepw);
1911 dia.setFixedSize( 230,80 ); 1909 dia.setFixedSize( 230,80 );
1912 dia.setCaption( i18n("Enter port for Pi-Sync") ); 1910 dia.setCaption( i18n("Enter port for Pi-Sync") );
1913 QPushButton pb ( "OK", &dia); 1911 QPushButton pb ( "OK", &dia);
1914 lay.addWidget( &pb ); 1912 lay.addWidget( &pb );
1915 connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) ); 1913 connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) );
1916 dia.show(); 1914 dia.show();
1917 int res = dia.exec(); 1915 int res = dia.exec();
1918 if ( res ) 1916 if ( res )
1919 retfile = lab.text(); 1917 retfile = lab.text();
1920 else 1918 else
1921 return; 1919 return;
1922 dia.hide(); 1920 dia.hide();
1923 passWordPiSync = lepw.text(); 1921 passWordPiSync = lepw.text();
1924 qApp->processEvents(); 1922 qApp->processEvents();
1925 KOPrefs::instance()->mPassiveSyncPort = retfile; 1923 KOPrefs::instance()->mPassiveSyncPort = retfile;
1926 bool ok; 1924 bool ok;
1927 Q_UINT16 port = retfile.toUInt(&ok); 1925 Q_UINT16 port = retfile.toUInt(&ok);
1928 if ( ! ok ) { 1926 if ( ! ok ) {
1929 KMessageBox::information( this, i18n("No valid port")); 1927 KMessageBox::information( this, i18n("No valid port"));
1930 return; 1928 return;
1931 } 1929 }
1932 qDebug("port %d ", port); 1930 qDebug("port %d ", port);
1933 mServerSocket = new KServerSocket ( passWordPiSync, port ,1 ); 1931 mServerSocket = new KServerSocket ( passWordPiSync, port ,1 );
1934 qDebug("connected "); 1932 qDebug("connected ");
1935 if ( !mServerSocket->ok() ) { 1933 if ( !mServerSocket->ok() ) {
1936 qWarning("Failed to bind to port %d", port); 1934 qWarning("Failed to bind to port %d", port);
1937 delete mServerSocket; 1935 delete mServerSocket;
1938 mServerSocket = 0; 1936 mServerSocket = 0;
1939 return; 1937 return;
1940 } 1938 }
1941 connect( mServerSocket, SIGNAL ( sendFile(QSocket*) ), this, SLOT ( sendFile(QSocket*) ) ); 1939 connect( mServerSocket, SIGNAL ( sendFile(QSocket*) ), this, SLOT ( sendFile(QSocket*) ) );
1942 connect( mServerSocket, SIGNAL ( getFile(QSocket*) ), this, SLOT ( getFile(QSocket*) ) ); 1940 connect( mServerSocket, SIGNAL ( getFile(QSocket*) ), this, SLOT ( getFile(QSocket*) ) );
1943} 1941}
1944void MainWindow::sendFile(QSocket* socket) 1942void MainWindow::sendFile(QSocket* socket)
1945{ 1943{
1946 setCaption( i18n("Received request for file") ); 1944 setCaption( i18n("Received request for file") );
1947 qDebug("MainWindow::sendFile(QSocket* s) "); 1945 qDebug("MainWindow::sendFile(QSocket* s) ");
1948 if ( mSyncActionDialog ) 1946 if ( mSyncActionDialog )
1949 delete mSyncActionDialog; 1947 delete mSyncActionDialog;
1950 mSyncActionDialog = new QDialog ( this, "input-dialog", true ); 1948 mSyncActionDialog = new QDialog ( this, "input-dialog", true );
1951 mSyncActionDialog->setCaption(i18n("KO/Pi - WARNING")); 1949 mSyncActionDialog->setCaption(i18n("KO/Pi - WARNING"));
1952 QLabel* label = new QLabel( i18n("Synchronizing...\nDo not use\nthis application!\n"), mSyncActionDialog ); 1950 QLabel* label = new QLabel( i18n("Synchronizing...\nDo not use\nthis application!\n"), mSyncActionDialog );
1953 QVBoxLayout* lay = new QVBoxLayout( mSyncActionDialog ); 1951 QVBoxLayout* lay = new QVBoxLayout( mSyncActionDialog );
1954 lay->addWidget( label); 1952 lay->addWidget( label);
1955 lay->setMargin(7); 1953 lay->setMargin(7);
1956 lay->setSpacing(7); 1954 lay->setSpacing(7);
1957 mSyncActionDialog->setFixedSize( 200,100 ); 1955 mSyncActionDialog->setFixedSize( 200,100 );
1958 mSyncActionDialog->show(); 1956 mSyncActionDialog->show();
1959 qDebug("saving ... "); 1957 qDebug("saving ... ");
1960 save(); 1958 save();
1961 qApp->processEvents(); 1959 qApp->processEvents();
1962 QString fileName = defaultFileName(); 1960 QString fileName = defaultFileName();
1963 QFile file( fileName ); 1961 QFile file( fileName );
1964 if (!file.open( IO_ReadOnly ) ) { 1962 if (!file.open( IO_ReadOnly ) ) {
1965 setCaption( i18n("Error open file") ); 1963 setCaption( i18n("Error open file") );
1966 delete mSyncActionDialog; 1964 delete mSyncActionDialog;
1967 mSyncActionDialog = 0; 1965 mSyncActionDialog = 0;
1968 qDebug("error open cal file "); 1966 qDebug("error open cal file ");
1969 return ; 1967 return ;
1970 1968
1971 } 1969 }
1972 setCaption( i18n("Sending file...") ); 1970 setCaption( i18n("Sending file...") );
1973 QTextStream ts( &file ); 1971 QTextStream ts( &file );
1974 ts.setCodec( QTextCodec::codecForName("utf8") ); 1972 ts.setCodec( QTextCodec::codecForName("utf8") );
1975 QTextStream os( socket ); 1973 QTextStream os( socket );
1976 os.setCodec( QTextCodec::codecForName("utf8") ); 1974 os.setCodec( QTextCodec::codecForName("utf8") );
1977 //os.setEncoding( QTextStream::UnicodeUTF8 ); 1975 //os.setEncoding( QTextStream::UnicodeUTF8 );
1978 while ( ! ts.atEnd() ) { 1976 while ( ! ts.atEnd() ) {
1979 os << ts.readLine() << "\n"; 1977 os << ts.readLine() << "\n";
1980 } 1978 }
1981 //os << ts.read(); 1979 //os << ts.read();
1982 socket->close(); 1980 socket->close();
1983 file.close(); 1981 file.close();
1984 setCaption( i18n("File sent. Waiting to get back synced file") ); 1982 setCaption( i18n("File sent. Waiting to get back synced file") );
1985 qDebug("file sent "); 1983 qDebug("file sent ");
1986} 1984}
1987void MainWindow::getFile(QSocket* socket) 1985void MainWindow::getFile(QSocket* socket)
1988{ 1986{
1989 setCaption( i18n("Receiving synced file...") ); 1987 setCaption( i18n("Receiving synced file...") );
1990 1988
1991 piTime.start(); 1989 piTime.start();
1992 piSocket = socket; 1990 piSocket = socket;
1993 piFileString = ""; 1991 piFileString = "";
1994 QTimer::singleShot( 1, this , SLOT (readBackFileFromSocket( ) )); 1992 QTimer::singleShot( 1, this , SLOT (readBackFileFromSocket( ) ));
1995 1993
1996 1994
1997} 1995}
1998void MainWindow::readBackFileFromSocket() 1996void MainWindow::readBackFileFromSocket()
1999{ 1997{
2000 qDebug("readBackFileFromSocket() %d ", piTime.elapsed ()); 1998 qDebug("readBackFileFromSocket() %d ", piTime.elapsed ());
2001 while ( piSocket->canReadLine () ) { 1999 while ( piSocket->canReadLine () ) {
2002 piTime.restart(); 2000 piTime.restart();
2003 QString line = piSocket->readLine (); 2001 QString line = piSocket->readLine ();
2004 piFileString += line; 2002 piFileString += line;
2005 qDebug("readline: %s ", line.latin1()); 2003 qDebug("readline: %s ", line.latin1());
2006 setCaption( i18n("Received %1 bytes").arg( piFileString.length() ) ); 2004 setCaption( i18n("Received %1 bytes").arg( piFileString.length() ) );
2007 2005
2008 } 2006 }
2009 if ( piTime.elapsed () < 3000 ) { 2007 if ( piTime.elapsed () < 3000 ) {
2010 // wait for more 2008 // wait for more
2011 qDebug("waitformore "); 2009 qDebug("waitformore ");
2012 QTimer::singleShot( 100, this , SLOT (readBackFileFromSocket( ) )); 2010 QTimer::singleShot( 100, this , SLOT (readBackFileFromSocket( ) ));
2013 return; 2011 return;
2014 } 2012 }
2015 QString fileName = defaultFileName(); 2013 QString fileName = defaultFileName();
2016 QFile file ( fileName ); 2014 QFile file ( fileName );
2017 if (!file.open( IO_WriteOnly ) ) { 2015 if (!file.open( IO_WriteOnly ) ) {
2018 setCaption( i18n("Error open file for writing!") ); 2016 setCaption( i18n("Error open file for writing!") );
2019 delete mSyncActionDialog; 2017 delete mSyncActionDialog;
2020 mSyncActionDialog = 0; 2018 mSyncActionDialog = 0;
2021 qDebug("error open cal file "); 2019 qDebug("error open cal file ");
2022 piFileString = ""; 2020 piFileString = "";
2023 return ; 2021 return ;
2024 2022
2025 } 2023 }
2026 2024
2027 mView->setLoadedFileVersion(QDateTime::currentDateTime().addSecs( -1)); 2025 mView->setLoadedFileVersion(QDateTime::currentDateTime().addSecs( -1));
2028 QTextStream ts ( &file ); 2026 QTextStream ts ( &file );
2029 ts.setCodec( QTextCodec::codecForName("utf8") ); 2027 ts.setCodec( QTextCodec::codecForName("utf8") );
2030 qDebug("finish "); 2028 qDebug("finish ");
2031 setCaption( i18n("Writing file to disk...") ); 2029 setCaption( i18n("Writing file to disk...") );
2032 ts << piFileString; 2030 ts << piFileString;
2033 setCaption( i18n("File received - reloading calendar...") ); 2031 setCaption( i18n("File received - reloading calendar...") );
2034 piSocket->close(); 2032 piSocket->close();
2035 file.close(); 2033 file.close();
2036 mView->watchSavedFile(); 2034 mView->watchSavedFile();
2037 mView->openCalendar( defaultFileName() ); 2035 mView->openCalendar( defaultFileName() );
2038 setCaption( i18n("Pi-Sync successful!") ); 2036 setCaption( i18n("Pi-Sync successful!") );
2039 delete mSyncActionDialog; 2037 delete mSyncActionDialog;
2040 mSyncActionDialog = 0; 2038 mSyncActionDialog = 0;
2041 piFileString = ""; 2039 piFileString = "";
2042 2040
2043 2041
2044} 2042}
2045void MainWindow::endConnect() 2043void MainWindow::endConnect()
2046{ 2044{
2047 setCaption( i18n("No file received - syncing successful") ); 2045 setCaption( i18n("No file received - syncing successful") );
2048 delete mSyncActionDialog; 2046 delete mSyncActionDialog;
2049 mSyncActionDialog = 0; 2047 mSyncActionDialog = 0;
2050} 2048}
2051void MainWindow::performQuick() 2049void MainWindow::performQuick()
2052{ 2050{
2053 2051
2054 setCaption( i18n("Please input connection settings") ); 2052 setCaption( i18n("Please input connection settings") );
2055 QString retfile = ""; 2053 QString retfile = "";
2056 QDialog dia ( this, "input-dialog", true ); 2054 QDialog dia ( this, "input-dialog", true );
2057 QLineEdit lab ( &dia ); 2055 QLineEdit lab ( &dia );
2058 QVBoxLayout lay( &dia ); 2056 QVBoxLayout lay( &dia );
2059 QLabel label ( i18n("IP address\n(Example: 192.168.0.40)"), &dia ); 2057 QLabel label ( i18n("IP address\n(Example: 192.168.0.40)"), &dia );
2060 lay.addWidget( &label); 2058 lay.addWidget( &label);
2061 lab.setText( KOPrefs::instance()->mActiveSyncIP ); 2059 lab.setText( KOPrefs::instance()->mActiveSyncIP );
2062 lay.setMargin(7); 2060 lay.setMargin(7);
2063 lay.setSpacing(7); 2061 lay.setSpacing(7);
2064 lay.addWidget( &lab); 2062 lay.addWidget( &lab);
2065 QLabel label2 ( i18n("Port number (Default: 9197)"), &dia ); 2063 QLabel label2 ( i18n("Port number (Default: 9197)"), &dia );
2066 lay.addWidget( &label2); 2064 lay.addWidget( &label2);
2067 QLineEdit lab2 ( &dia ); 2065 QLineEdit lab2 ( &dia );
2068 lab2.setText( KOPrefs::instance()->mActiveSyncPort ); 2066 lab2.setText( KOPrefs::instance()->mActiveSyncPort );
2069 lay.addWidget( &lab2); 2067 lay.addWidget( &lab2);
2070 2068
2071 QLineEdit lepw ( &dia ); 2069 QLineEdit lepw ( &dia );
2072 lepw.setText( mPassWordPiSync ); 2070 lepw.setText( mPassWordPiSync );
2073 QLabel label3 ( i18n("Password to enable\naccess to remote:"), &dia ); 2071 QLabel label3 ( i18n("Password to enable\naccess to remote:"), &dia );
2074 lay.addWidget( &label3); 2072 lay.addWidget( &label3);
2075 lay.addWidget( &lepw); 2073 lay.addWidget( &lepw);
2076 2074
2077 dia.setFixedSize( 230,200 ); 2075 dia.setFixedSize( 230,200 );
2078 dia.setCaption( i18n("Enter port for Pi-Sync ") ); 2076 dia.setCaption( i18n("Enter port for Pi-Sync ") );
2079 QPushButton pb ( "OK", &dia); 2077 QPushButton pb ( "OK", &dia);
2080 lay.addWidget( &pb ); 2078 lay.addWidget( &pb );
2081 connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) ); 2079 connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) );
2082 dia.show(); 2080 dia.show();
2083 int res = dia.exec(); 2081 int res = dia.exec();
2084 if ( !res ) { 2082 if ( !res ) {
2085 setCaption( i18n("Syncing cancelled!") ); 2083 setCaption( i18n("Syncing cancelled!") );
2086 return; 2084 return;
2087 } 2085 }
2088 mPassWordPiSync = lepw.text(); 2086 mPassWordPiSync = lepw.text();
2089 dia.hide(); 2087 dia.hide();
2090 KOPrefs::instance()->mActiveSyncPort = lab2.text(); 2088 KOPrefs::instance()->mActiveSyncPort = lab2.text();
2091 KOPrefs::instance()->mActiveSyncIP = lab.text(); 2089 KOPrefs::instance()->mActiveSyncIP = lab.text();
2092 qApp->processEvents(); 2090 qApp->processEvents();
2093 performQuickQuick(); 2091 performQuickQuick();
2094} 2092}
2095 2093
2096void MainWindow::performQuickQuick() 2094void MainWindow::performQuickQuick()
2097{ 2095{
2098 // setCaption( i18n("") ); 2096 // setCaption( i18n("") );
2099 2097
2100 bool ok; 2098 bool ok;
2101 Q_UINT16 port = KOPrefs::instance()->mActiveSyncPort.toUInt(&ok); 2099 Q_UINT16 port = KOPrefs::instance()->mActiveSyncPort.toUInt(&ok);
2102 if ( ! ok ) { 2100 if ( ! ok ) {
2103 setCaption( i18n("Sorry, no valid port.Syncing cancelled.") ); 2101 setCaption( i18n("Sorry, no valid port.Syncing cancelled.") );
2104 return; 2102 return;
2105 } 2103 }
2106 if ( !mCommandSocket ) { 2104 mCommandSocket = new KCommandSocket( mPassWordPiSync, port, KOPrefs::instance()->mActiveSyncIP, this );
2107 mCommandSocket = new QSocket( this ); 2105 connect( mCommandSocket, SIGNAL(commandFinished( bool )), this, SLOT(deleteCommandSocket(bool)) );
2108 // delete mCommandSocket;
2109 //mCommandSocket = new QSocket( this );
2110 connect( mCommandSocket, SIGNAL(readyRead()), this, SLOT(readFileFromSocket()) );
2111 connect( mCommandSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteCommandSocket()) );
2112 }
2113 QString host = KOPrefs::instance()->mActiveSyncIP;
2114 mCommandSocket->connectToHost( host, port );
2115 QTextStream os( mCommandSocket );
2116 os.setEncoding( QTextStream::UnicodeUTF8 );
2117 os << "GET " << mPassWordPiSync << "\r\n";
2118 setCaption( i18n("Sending request for remote file ...") ); 2106 setCaption( i18n("Sending request for remote file ...") );
2119 mTimerCommandSocket->start( 10000 ); 2107 QString fileName;
2120 2108#ifdef _WIN32_
2109 fileName = defaultFileName() +"sync";
2110#else
2111 fileName = "/tmp/kopitempfile.ics";
2112#endif
2113 mCommandSocket->readFile( fileName );
2121} 2114}
2122void MainWindow::deleteCommandSocket() 2115void MainWindow::deleteCommandSocket( bool success)
2123{ 2116{
2124 if ( !mCommandSocket) 2117 if ( ! success ) {
2118 setCaption( i18n("ERROR:Receiving remote file failed.") );
2119 // pending : send stop
2125 return; 2120 return;
2126 if ( mTimerCommandSocket->isActive () ) { 2121
2127 KMessageBox::information( 0, i18n("ERROR:\nConnection to remote host timed out "));
2128 mTimerCommandSocket->stop();
2129 } 2122 }
2130 //KMessageBox::information( 0, i18n("MainWindow::deleteCommandSocket ")); 2123 QTimer::singleShot( 1, this , SLOT ( readFileFromSocket()));
2131 qDebug("MainWindow::deletemCommandSocket() "); 2124 delete mCommandSocket;
2132 delete mCommandSocket;
2133 mCommandSocket = 0;
2134} 2125}
2135void MainWindow::deleteCommandSocketFinish() 2126void MainWindow::deleteCommandSocketFinish()
2136{ 2127{
2137 if ( ! mCommandSocketFinish) 2128 if ( ! mCommandSocketFinish)
2138 return; 2129 return;
2139 // KMessageBox::information( 0, i18n("MainWindow::deleteCommandSocketFinish() ")); 2130 // KMessageBox::information( 0, i18n("MainWindow::deleteCommandSocketFinish() "));
2140 qDebug("MainWindow::deletemCommandSocketFinish() "); 2131 qDebug("MainWindow::deletemCommandSocketFinish() ");
2141 delete mCommandSocketFinish; 2132 delete mCommandSocketFinish;
2142 mCommandSocketFinish = 0; 2133 mCommandSocketFinish = 0;
2143} 2134}
2144void MainWindow::readFileFromSocket() 2135void MainWindow::readFileFromSocket()
2145{ 2136{
2146 mTimerCommandSocket->stop(); 2137 // mTimerCommandSocket->stop();
2147 setCaption( i18n("Receiving remote file ...") ); 2138 setCaption( i18n("Receiving remote file ...") );
2148 qDebug("MainWindow::readFileFromSocket() "); 2139 qDebug("MainWindow::readFileFromSocket() ");
2149 QString fileName; 2140 QString fileName;
2150#ifdef _WIN32_ 2141#ifdef _WIN32_
2151 fileName = defaultFileName() +"sync"; 2142 fileName = defaultFileName() +"sync";
2152#else 2143#else
2153 fileName = "/tmp/kopitempfile.ics"; 2144 fileName = "/tmp/kopitempfile.ics";
2154#endif 2145#endif
2155 QFile file( fileName ); 2146
2156 if (!file.open( IO_WriteOnly ) ) {
2157 setCaption( i18n("Error: Cannot open temp file for write.") );
2158 qDebug("Error open temp calender file for writing: %s",fileName.latin1() );
2159 return ;
2160 }
2161
2162 //QTextStream os2( mCommandSocket );
2163 //os2.setEncoding( QTextStream::UnicodeUTF8 );
2164
2165 QTextStream ts( &file );
2166 ts.setCodec( QTextCodec::codecForName("utf8") );
2167 bool first = true;
2168 while ( mCommandSocket->canReadLine () || first) {
2169 first = false;
2170 while ( mCommandSocket->canReadLine () ) {
2171 ts << mCommandSocket->readLine ();
2172 }
2173 QTime ti;
2174 ti.start();
2175 while ( ti.elapsed () < 3000 && !mCommandSocket->canReadLine () ) {
2176 qApp->processEvents();
2177 qDebug("waiting2 %d ",ti.elapsed () );
2178 if ( !mCommandSocket->canReadLine () )
2179 mCommandSocket->waitForMore ( 100 );
2180 }
2181 //mCommandSocket->waitForMore ( 5000 );
2182 }
2183 file.close();
2184 mCommandSocket->close();
2185 if ( mCommandSocket->state() == QSocket::Idle )
2186 deleteCommandSocket();
2187 // pending: deleting after signal SIGNAL(delayedCloseFinished())
2188 //delete mCommandSocket;
2189 setCaption( i18n("Remote file saved to temp file.") ); 2147 setCaption( i18n("Remote file saved to temp file.") );
2190 //mCommandSocket = 0; 2148 //mCommandSocket = 0;
2191 mCurrentSyncProfile = 2 ; // last file 2149 mCurrentSyncProfile = 2 ; // last file
2192 mView->setSyncDevice(KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile] ); 2150 mView->setSyncDevice(KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile] );
2193 mView->setSyncName( KOPrefs::instance()->mLocalMachineName ); 2151 mView->setSyncName( KOPrefs::instance()->mLocalMachineName );
2194 KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); 2152 KConfig config ( locateLocal( "config","ksyncprofilesrc" ) );
2195 KSyncProfile* temp = new KSyncProfile (); 2153 KSyncProfile* temp = new KSyncProfile ();
2196 temp->setName(KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile]); 2154 temp->setName(KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile]);
2197 temp->readConfig(&config); 2155 temp->readConfig(&config);
2198 KOPrefs::instance()->mAskForPreferences = temp->getAskForPreferences(); 2156 KOPrefs::instance()->mAskForPreferences = temp->getAskForPreferences();
2199 KOPrefs::instance()->mSyncAlgoPrefs = temp->getSyncPrefs(); 2157 KOPrefs::instance()->mSyncAlgoPrefs = temp->getSyncPrefs();
2200 KOPrefs::instance()->mWriteBackFile = temp->getWriteBackFile(); 2158 KOPrefs::instance()->mWriteBackFile = temp->getWriteBackFile();
2201 KOPrefs::instance()->mWriteBackExistingOnly = temp->getWriteBackExisting(); 2159 KOPrefs::instance()->mWriteBackExistingOnly = temp->getWriteBackExisting();
2202 KOPrefs::instance()->mWriteBackInFuture = 0; 2160 KOPrefs::instance()->mWriteBackInFuture = 0;
2203 if ( temp->getWriteBackFuture() ) 2161 if ( temp->getWriteBackFuture() )
2204 KOPrefs::instance()->mWriteBackInFuture = temp->getWriteBackFutureWeeks( ); 2162 KOPrefs::instance()->mWriteBackInFuture = temp->getWriteBackFutureWeeks( );
2205 KOPrefs::instance()->mShowSyncSummary = temp->getShowSummaryAfterSync(); 2163 KOPrefs::instance()->mShowSyncSummary = temp->getShowSummaryAfterSync();
2206 delete temp; 2164 delete temp;
2207 setCaption( i18n("Remote file saved to temp file.") ); 2165 setCaption( i18n("Remote file saved to temp file.") );
2208 if ( ! syncWithFile( fileName , true ) ) { 2166 if ( ! syncWithFile( fileName , true ) ) {
2209 setCaption( i18n("Syncing failed.") ); 2167 setCaption( i18n("Syncing failed.") );
2210 qDebug("Syncing failed "); 2168 qDebug("Syncing failed ");
2211 return; 2169 return;
2212 } 2170 }
2213 2171
2214 if ( !mCommandSocketFinish ) { 2172 if ( !mCommandSocketFinish ) {
2215 mCommandSocketFinish = new QSocket( this ); 2173 mCommandSocketFinish = new QSocket( this );
2216 connect( mCommandSocketFinish, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteCommandSocketFinish()) ); 2174 connect( mCommandSocketFinish, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteCommandSocketFinish()) );
2217 } 2175 }
2218 mCommandSocketFinish->connectToHost( KOPrefs::instance()->mActiveSyncIP, KOPrefs::instance()->mActiveSyncPort.toUInt() ); 2176 mCommandSocketFinish->connectToHost( KOPrefs::instance()->mActiveSyncIP, KOPrefs::instance()->mActiveSyncPort.toUInt() );
2219 2177
2220 // pending connect signals connected () and error to new slots
2221 QString host = KOPrefs::instance()->mActiveSyncIP; 2178 QString host = KOPrefs::instance()->mActiveSyncIP;
2222 QFile file2( fileName ); 2179 QFile file2( fileName );
2223 if (!file2.open( IO_ReadOnly ) ) { 2180 if (!file2.open( IO_ReadOnly ) ) {
2224 setCaption( i18n("Error: Cannot open temp file for read.") ); 2181 setCaption( i18n("Error: Cannot open temp file for read.") );
2225 qDebug("error open cal file "); 2182 qDebug("error open cal file ");
2226 return ; 2183 return ;
2227 2184
2228 } 2185 }
2229 QTextStream ts2( &file2 ); 2186 QTextStream ts2( &file2 );
2230 ts2.setCodec( QTextCodec::codecForName("utf8") ); 2187 ts2.setCodec( QTextCodec::codecForName("utf8") );
2231 QTextStream os2( mCommandSocketFinish ); 2188 QTextStream os2( mCommandSocketFinish );
2232 os2.setCodec( QTextCodec::codecForName("utf8") ); 2189 os2.setCodec( QTextCodec::codecForName("utf8") );
2233 //os.setEncoding( QTextStream::UnicodeUTF8 ); 2190 //os.setEncoding( QTextStream::UnicodeUTF8 );
2234 if ( KOPrefs::instance()->mWriteBackFile ) { 2191 if ( KOPrefs::instance()->mWriteBackFile ) {
2235 setCaption( i18n("Sending back synced file...") ); 2192 setCaption( i18n("Sending back synced file...") );
2236 os2 << "PUT " << mPassWordPiSync << "\r\n";; 2193 os2 << "PUT " << mPassWordPiSync << "\r\n";;
2237 while ( ! ts2.atEnd() ) { 2194 while ( ! ts2.atEnd() ) {
2238 os2 << ts2.readLine() << "\n"; 2195 os2 << ts2.readLine() << "\n";
2239 } 2196 }
2240 } else { 2197 } else {
2241 os2 << "STOP\r\n"; 2198 os2 << "STOP\r\n";
2242 } 2199 }
2243 mCommandSocketFinish->close(); 2200 mCommandSocketFinish->close();
2244 if ( mCommandSocketFinish->state() == QSocket::Idle ) 2201 if ( mCommandSocketFinish->state() == QSocket::Idle )
2245 QTimer::singleShot( 10, this , SLOT ( deleteCommandSocketFinish())); 2202 QTimer::singleShot( 10, this , SLOT ( deleteCommandSocketFinish()));
2246 file.close(); 2203 file2.close();
2247 qDebug("Syncing succesful! "); 2204 qDebug("Syncing succesful! ");
2248 setCaption( i18n("Pi-Sync succesful!") ); 2205 setCaption( i18n("Pi-Sync succesful!") );
2249 2206
2250 // KMessageBox::information( 0, i18n(" Pi-Sync succesful! ")); 2207 // KMessageBox::information( 0, i18n(" Pi-Sync succesful! "));
2251 2208
2252} 2209}
2253 2210
2254void MainWindow::syncLocalFile() 2211void MainWindow::syncLocalFile()
2255{ 2212{
2256 2213
2257 QString fn =KOPrefs::instance()->mLastSyncedLocalFile; 2214 QString fn =KOPrefs::instance()->mLastSyncedLocalFile;
2258 2215
2259 fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.ics/*.vcs)"), this ); 2216 fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.ics/*.vcs)"), this );
2260 if ( fn == "" ) 2217 if ( fn == "" )
2261 return; 2218 return;
2262 //mView->setSyncDevice("local-file" ); 2219 //mView->setSyncDevice("local-file" );
2263 if ( syncWithFile( fn, false ) ) { 2220 if ( syncWithFile( fn, false ) ) {
2264 // Event* e = mView->getLastSyncEvent(); 2221 // Event* e = mView->getLastSyncEvent();
2265// e->setReadOnly( false ); 2222// e->setReadOnly( false );
2266// e->setLocation( i18n("Local file: ")+ KOPrefs::instance()->mLastSyncedLocalFile); 2223// e->setLocation( i18n("Local file: ")+ KOPrefs::instance()->mLastSyncedLocalFile);
2267// e->setReadOnly( true ); 2224// e->setReadOnly( true );
2268 } 2225 }
2269 2226
2270} 2227}
2271 2228
2272bool MainWindow::syncWithFile( QString fn , bool quick ) 2229bool MainWindow::syncWithFile( QString fn , bool quick )
2273{ 2230{
2274 bool ret = false; 2231 bool ret = false;
2275 QFileInfo info; 2232 QFileInfo info;
2276 info.setFile( fn ); 2233 info.setFile( fn );
2277 QString mess; 2234 QString mess;
2278 bool loadbup = true; 2235 bool loadbup = true;
2279 if ( !info. exists() ) { 2236 if ( !info. exists() ) {
2280 mess = i18n( "Sync file \n...%1\ndoes not exist!\nNothing synced!\n").arg(fn.right( 30) ); 2237 mess = i18n( "Sync file \n...%1\ndoes not exist!\nNothing synced!\n").arg(fn.right( 30) );
2281 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 2238 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
2282 mess ); 2239 mess );
2283 return ret; 2240 return ret;
2284 } 2241 }
2285 int result = 0; 2242 int result = 0;
2286 if ( !quick ) { 2243 if ( !quick ) {
2287 mess = i18n("Sync with file \n...%1\nfrom:\n%2\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); 2244 mess = i18n("Sync with file \n...%1\nfrom:\n%2\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false ));
2288 result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 2245 result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
2289 mess, 2246 mess,
2290 i18n("Sync"), i18n("Cancel"), 0, 2247 i18n("Sync"), i18n("Cancel"), 0,
2291 0, 1 ); 2248 0, 1 );
2292 if ( result ) 2249 if ( result )
2293 return false; 2250 return false;
2294 } 2251 }
2295 if ( KOPrefs::instance()->mAskForPreferences ) 2252 if ( KOPrefs::instance()->mAskForPreferences )
2296 mView->edit_sync_options(); 2253 mView->edit_sync_options();
2297 if ( result == 0 ) { 2254 if ( result == 0 ) {
2298 //qDebug("Now sycing ... "); 2255 //qDebug("Now sycing ... ");
2299 if ( ret = mView->syncCalendar( fn, KOPrefs::instance()->mSyncAlgoPrefs ) ) 2256 if ( ret = mView->syncCalendar( fn, KOPrefs::instance()->mSyncAlgoPrefs ) )
2300 setCaption( i18n("Synchronization successful") ); 2257 setCaption( i18n("Synchronization successful") );
2301 else 2258 else
2302 setCaption( i18n("Sync cancelled or failed. Nothing synced.") ); 2259 setCaption( i18n("Sync cancelled or failed. Nothing synced.") );
2303 if ( ! quick ) 2260 if ( ! quick )
2304 KOPrefs::instance()->mLastSyncedLocalFile = fn; 2261 KOPrefs::instance()->mLastSyncedLocalFile = fn;
2305 slotModifiedChanged( true ); 2262 slotModifiedChanged( true );
2306 } 2263 }
2307 return ret; 2264 return ret;
2308} 2265}
2309void MainWindow::quickSyncLocalFile() 2266void MainWindow::quickSyncLocalFile()
2310{ 2267{
2311 //mView->setSyncDevice("local-file" ); 2268 //mView->setSyncDevice("local-file" );
2312 //qDebug("quickSyncLocalFile() "); 2269 //qDebug("quickSyncLocalFile() ");
2313 if ( syncWithFile( KOPrefs::instance()->mLastSyncedLocalFile, false ) ) { 2270 if ( syncWithFile( KOPrefs::instance()->mLastSyncedLocalFile, false ) ) {
2314 // Event* e = mView->getLastSyncEvent(); 2271 // Event* e = mView->getLastSyncEvent();
2315// e->setReadOnly( false ); 2272// e->setReadOnly( false );
2316// e->setLocation( i18n("Quick with file: ")+ KOPrefs::instance()->mLastSyncedLocalFile); 2273// e->setLocation( i18n("Quick with file: ")+ KOPrefs::instance()->mLastSyncedLocalFile);
2317// e->setReadOnly( true ); 2274// e->setReadOnly( true );
2318 2275
2319 } 2276 }
2320} 2277}
2321 2278
2322void MainWindow::confSync() 2279void MainWindow::confSync()
2323{ 2280{
2324 mView->confSync(); 2281 mView->confSync();
2325 fillSyncMenu(); 2282 fillSyncMenu();
2326} 2283}
2327void MainWindow::syncRemote( KSyncProfile* prof, bool ask) 2284void MainWindow::syncRemote( KSyncProfile* prof, bool ask)
2328{ 2285{
2329 QString question; 2286 QString question;
2330 if ( ask ) { 2287 if ( ask ) {
2331 question = i18n("Do you really want\nto remote sync\nwith profile \n")+ prof->getName()+" ?\n"; 2288 question = i18n("Do you really want\nto remote sync\nwith profile \n")+ prof->getName()+" ?\n";
2332 if ( QMessageBox::information( this, i18n("KO/Pi Sync"), 2289 if ( QMessageBox::information( this, i18n("KO/Pi Sync"),
2333 question, 2290 question,
2334 i18n("Yes"), i18n("No"), 2291 i18n("Yes"), i18n("No"),
2335 0, 0 ) != 0 ) 2292 0, 0 ) != 0 )
2336 return; 2293 return;
2337 } 2294 }
2338 QString command = prof->getPreSyncCommand(); 2295 QString command = prof->getPreSyncCommand();
2339 int fi; 2296 int fi;
2340 if ( (fi = command.find("$PWD$")) > 0 ) { 2297 if ( (fi = command.find("$PWD$")) > 0 ) {
2341 QString pwd = getPassword(); 2298 QString pwd = getPassword();
2342 command = command.left( fi )+ pwd + command.mid( fi+5 ); 2299 command = command.left( fi )+ pwd + command.mid( fi+5 );
2343 2300
2344 } 2301 }
2345 int maxlen = 30; 2302 int maxlen = 30;
2346 if ( QApplication::desktop()->width() > 320 ) 2303 if ( QApplication::desktop()->width() > 320 )
2347 maxlen += 25; 2304 maxlen += 25;
2348 setCaption ( i18n( "Copy remote file to local machine..." ) ); 2305 setCaption ( i18n( "Copy remote file to local machine..." ) );
2349 int fileSize = 0; 2306 int fileSize = 0;
2350 int result = system ( command ); 2307 int result = system ( command );
2351 // 0 : okay 2308 // 0 : okay
2352 // 256: no such file or dir 2309 // 256: no such file or dir
2353 // 2310 //
2354 qDebug("KO: Remote copy result(0 = okay): %d ",result ); 2311 qDebug("KO: Remote copy result(0 = okay): %d ",result );
2355 if ( result != 0 ) { 2312 if ( result != 0 ) {
2356 int len = maxlen; 2313 int len = maxlen;
2357 while ( len < command.length() ) { 2314 while ( len < command.length() ) {
2358 command.insert( len , "\n" ); 2315 command.insert( len , "\n" );
2359 len += maxlen +2; 2316 len += maxlen +2;
2360 } 2317 }
2361 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) ; 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) ;
2362 QMessageBox::information( this, i18n("KO/Pi Sync - ERROR"), 2319 QMessageBox::information( this, i18n("KO/Pi Sync - ERROR"),
2363 question, 2320 question,
2364 i18n("Okay!")) ; 2321 i18n("Okay!")) ;
2365 setCaption ("KO/Pi"); 2322 setCaption ("KO/Pi");
2366 return; 2323 return;
2367 } 2324 }
2368 setCaption ( i18n( "Copying succeed." ) ); 2325 setCaption ( i18n( "Copying succeed." ) );
2369 //qDebug(" file **%s** ",prof->getLocalTempFile().latin1() ); 2326 //qDebug(" file **%s** ",prof->getLocalTempFile().latin1() );
2370 if ( syncWithFile( prof->getLocalTempFile(), true ) ) { 2327 if ( syncWithFile( prof->getLocalTempFile(), true ) ) {
2371// Event* e = mView->getLastSyncEvent(); 2328// Event* e = mView->getLastSyncEvent();
2372// e->setReadOnly( false ); 2329// e->setReadOnly( false );
2373// e->setLocation( KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile]); 2330// e->setLocation( KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile]);
2374// e->setReadOnly( true ); 2331// e->setReadOnly( true );
2375 if ( KOPrefs::instance()->mWriteBackFile ) { 2332 if ( KOPrefs::instance()->mWriteBackFile ) {
2376 command = prof->getPostSyncCommand(); 2333 command = prof->getPostSyncCommand();
2377 int fi; 2334 int fi;
2378 if ( (fi = command.find("$PWD$")) > 0 ) { 2335 if ( (fi = command.find("$PWD$")) > 0 ) {
2379 QString pwd = getPassword(); 2336 QString pwd = getPassword();
2380 command = command.left( fi )+ pwd + command.mid( fi+5 ); 2337 command = command.left( fi )+ pwd + command.mid( fi+5 );
2381 2338
2382 } 2339 }
2383 setCaption ( i18n( "Writing back file ..." ) ); 2340 setCaption ( i18n( "Writing back file ..." ) );
2384 result = system ( command ); 2341 result = system ( command );
2385 qDebug("KO: Writing back file result: %d ", result); 2342 qDebug("KO: Writing back file result: %d ", result);
2386 if ( result != 0 ) { 2343 if ( result != 0 ) {
2387 setCaption ( i18n( "Writing back file result: " )+QString::number( result ) ); 2344 setCaption ( i18n( "Writing back file result: " )+QString::number( result ) );
2388 return; 2345 return;
2389 } else { 2346 } else {
2390 setCaption ( i18n( "Syncronization sucessfully completed" ) ); 2347 setCaption ( i18n( "Syncronization sucessfully completed" ) );
2391 } 2348 }
2392 } 2349 }
2393 } 2350 }
2394 return; 2351 return;
2395} 2352}
2396void MainWindow::syncSSH() 2353void MainWindow::syncSSH()
2397{ 2354{
2398 // not used anymore 2355 // not used anymore
2399 QTime timer; 2356 QTime timer;
2400 timer.start(); 2357 timer.start();
2401 //qDebug("MainWindow::syncssh() "); 2358 //qDebug("MainWindow::syncssh() ");
2402 KOPrefs *p = KOPrefs::instance(); 2359 KOPrefs *p = KOPrefs::instance();
2403 QString localFile = p->mLocalTempFile; 2360 QString localFile = p->mLocalTempFile;
2404 QString remoteIP = p->mRemoteIP; 2361 QString remoteIP = p->mRemoteIP;
2405 QString remoteUser = p->mRemoteUser; 2362 QString remoteUser = p->mRemoteUser;
2406 QString remoteFile = p->mRemoteFile; 2363 QString remoteFile = p->mRemoteFile;
2407 if ( p->mUsePassWd && p->mRemotePassWd.length() > 0 ) 2364 if ( p->mUsePassWd && p->mRemotePassWd.length() > 0 )
2408 remoteUser += ":" + p->mRemotePassWd; 2365 remoteUser += ":" + p->mRemotePassWd;
2409 2366
2410 QString question = i18n("Do you really want\nto remote sync?\n \n") + 2367 QString question = i18n("Do you really want\nto remote sync?\n \n") +
2411 i18n("IP: " ) +remoteIP +"\n" + 2368 i18n("IP: " ) +remoteIP +"\n" +
2412 i18n("User: " ) + remoteUser +"\n" ; 2369 i18n("User: " ) + remoteUser +"\n" ;
2413 int maxlen = 30; 2370 int maxlen = 30;
2414 if ( QApplication::desktop()->width() > 320 ) 2371 if ( QApplication::desktop()->width() > 320 )
2415 maxlen += 25; 2372 maxlen += 25;
2416 if ( remoteFile.length() > maxlen ) 2373 if ( remoteFile.length() > maxlen )
2417 question += i18n("Remote file:\n..." ) + remoteFile.right(maxlen) +"\n"; 2374 question += i18n("Remote file:\n..." ) + remoteFile.right(maxlen) +"\n";
2418 else 2375 else
2419 question += i18n("Remote file:\n " ) + remoteFile +"\n"; 2376 question += i18n("Remote file:\n " ) + remoteFile +"\n";
2420 if ( localFile.length() > maxlen ) 2377 if ( localFile.length() > maxlen )
2421 question += i18n("Local temp file:\n..." ) + localFile.right(maxlen) +"\n"; 2378 question += i18n("Local temp file:\n..." ) + localFile.right(maxlen) +"\n";
2422 else 2379 else
2423 question += i18n("Local temp file:\n " ) + localFile +"\n"; 2380 question += i18n("Local temp file:\n " ) + localFile +"\n";
2424 2381
2425 if ( QMessageBox::information( this, i18n("KO/Pi Sync"), 2382 if ( QMessageBox::information( this, i18n("KO/Pi Sync"),
2426 question, 2383 question,
2427 i18n("Yes"), i18n("No"), 2384 i18n("Yes"), i18n("No"),
2428 0, 0 ) != 0 ) 2385 0, 0 ) != 0 )
2429 return; 2386 return;
2430 // if ( !p->mUsePassWd ) { 2387 // if ( !p->mUsePassWd ) {
2431 // QString pass = getPassword(); 2388 // QString pass = getPassword();
2432 // if ( pass.length() > 0 ) 2389 // if ( pass.length() > 0 )
2433 // remoteUser += ":" + pass; 2390 // remoteUser += ":" + pass;
2434 // } 2391 // }
2435 QString command = "scp " + remoteUser + "@" + remoteIP +":" + remoteFile +" " +localFile; 2392 QString command = "scp " + remoteUser + "@" + remoteIP +":" + remoteFile +" " +localFile;
2436 setCaption ( i18n( "Copy remote file to local machine..." ) ); 2393 setCaption ( i18n( "Copy remote file to local machine..." ) );
2437 int fileSize = 0; 2394 int fileSize = 0;
2438 int result = system ( command ); 2395 int result = system ( command );
2439 // 0 : okay 2396 // 0 : okay
2440 // 256: no such file or dir 2397 // 256: no such file or dir
2441 // 2398 //
2442 qDebug("KO: Remote copy result(0 = okay): %d ",result ); 2399 qDebug("KO: Remote copy result(0 = okay): %d ",result );
2443 if ( result != 0 ) { 2400 if ( result != 0 ) {
2444 int len = maxlen; 2401 int len = maxlen;
2445 while ( len < command.length() ) { 2402 while ( len < command.length() ) {
2446 command.insert( len , "\n" ); 2403 command.insert( len , "\n" );
2447 len += maxlen +2; 2404 len += maxlen +2;
2448 } 2405 }
2449 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) ; 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) ;
2450 QMessageBox::information( this, i18n("KO/Pi Sync - ERROR"), 2407 QMessageBox::information( this, i18n("KO/Pi Sync - ERROR"),
2451 question, 2408 question,
2452 i18n("Okay!")) ; 2409 i18n("Okay!")) ;
2453 setCaption ("KO/Pi"); 2410 setCaption ("KO/Pi");
2454 return; 2411 return;
2455 } 2412 }
2456 2413
2457 2414
2458 setCaption ( i18n( "Copying succeed." ) ); 2415 setCaption ( i18n( "Copying succeed." ) );
2459 //mView->setSyncDevice("ssh-scp" ); 2416 //mView->setSyncDevice("ssh-scp" );
2460 if ( syncWithFile(localFile , true ) ) { 2417 if ( syncWithFile(localFile , true ) ) {
2461// Event* e = mView->getLastSyncEvent(); 2418// Event* e = mView->getLastSyncEvent();
2462// e->setReadOnly( false ); 2419// e->setReadOnly( false );
2463// e->setLocation( KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile]); 2420// e->setLocation( KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile]);
2464// e->setReadOnly( true ); 2421// e->setReadOnly( true );
2465 if ( KOPrefs::instance()->mWriteBackFile ) { 2422 if ( KOPrefs::instance()->mWriteBackFile ) {
2466 command = "scp " + localFile +" " +remoteUser + "@" + remoteIP +":" + remoteFile ; 2423 command = "scp " + localFile +" " +remoteUser + "@" + remoteIP +":" + remoteFile ;
2467 setCaption ( i18n( "Writing back file ..." ) ); 2424 setCaption ( i18n( "Writing back file ..." ) );
2468 result = system ( command ); 2425 result = system ( command );
2469 if ( result != 0 ) { 2426 if ( result != 0 ) {
2470 int len = maxlen; 2427 int len = maxlen;
2471 while ( len < command.length() ) { 2428 while ( len < command.length() ) {
2472 command.insert( len , "\n" ); 2429 command.insert( len , "\n" );
2473 len += maxlen +2; 2430 len += maxlen +2;
2474 } 2431 }
2475 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) ; 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) ;
2476 QMessageBox::information( this, i18n("KO/Pi Sync - ERROR"), 2433 QMessageBox::information( this, i18n("KO/Pi Sync - ERROR"),
2477 question, 2434 question,
2478 i18n("Okay!")) ; 2435 i18n("Okay!")) ;
2479 setCaption ("KO/Pi"); 2436 setCaption ("KO/Pi");
2480 return; 2437 return;
2481 } else { 2438 } else {
2482 setCaption ( i18n( "Syncronization sucessfully completed" ) ); 2439 setCaption ( i18n( "Syncronization sucessfully completed" ) );
2483 } 2440 }
2484 } 2441 }
2485 } 2442 }
2486 return; 2443 return;
2487#if 0 2444#if 0
2488 system ("scp zaurus@192.168.0.65:/home/zaurus/Applications/korganizer/mycalendar.ics /home/polo/Applications/korganizer/z_sync.ics"); 2445 system ("scp zaurus@192.168.0.65:/home/zaurus/Applications/korganizer/mycalendar.ics /home/polo/Applications/korganizer/z_sync.ics");
2489 while ( timer.elapsed() < 5000 ) 2446 while ( timer.elapsed() < 5000 )
2490 qApp->processEvents(); 2447 qApp->processEvents();
2491 2448
2492 qDebug("MainWindow::merging) "); 2449 qDebug("MainWindow::merging) ");
2493 mView->syncCalendar( "/home/polo/Applications/korganizer/z_sync.ics", 0 ); 2450 mView->syncCalendar( "/home/polo/Applications/korganizer/z_sync.ics", 0 );
2494 while ( mBlockSaveFlag ) 2451 while ( mBlockSaveFlag )
2495 qApp->processEvents(); 2452 qApp->processEvents();
2496 save(); 2453 save();
2497 system ("scp /home/polo/Applications/korganizer/mycalendar.ics zaurus@192.168.0.65:/home/zaurus/Applications/korganizer/mycalendar.ics"); 2454 system ("scp /home/polo/Applications/korganizer/mycalendar.ics zaurus@192.168.0.65:/home/zaurus/Applications/korganizer/mycalendar.ics");
2498#endif 2455#endif
2499 2456
2500} 2457}
2501 2458
2502 2459
2503void MainWindow::syncSharp() 2460void MainWindow::syncSharp()
2504{ 2461{
2505 if ( mCalendarModifiedFlag ) 2462 if ( mCalendarModifiedFlag )
2506 save(); 2463 save();
2507 mView->syncSharp(); 2464 mView->syncSharp();
2508 slotModifiedChanged( true ); 2465 slotModifiedChanged( true );
2509 2466
2510} 2467}
2511void MainWindow::syncPhone() 2468void MainWindow::syncPhone()
2512{ 2469{
2513 if ( mCalendarModifiedFlag ) 2470 if ( mCalendarModifiedFlag )
2514 save(); 2471 save();
2515 mView->syncPhone(); 2472 mView->syncPhone();
2516 slotModifiedChanged( true ); 2473 slotModifiedChanged( true );
2517 2474
2518} 2475}
2519 2476
2520void MainWindow::printSel( ) 2477void MainWindow::printSel( )
2521{ 2478{
2522 mView->viewManager()->agendaView()->agenda()->printSelection(); 2479 mView->viewManager()->agendaView()->agenda()->printSelection();
2523} 2480}
2524 2481
2525void MainWindow::printCal() 2482void MainWindow::printCal()
2526{ 2483{
2527 mView->print();//mCp->showDialog(); 2484 mView->print();//mCp->showDialog();
2528} 2485}
2529 2486
2530 2487
2531 2488
2532KServerSocket:: KServerSocket ( QString pw, Q_UINT16 port, int backlog, QObject * parent, const char * name ) : QServerSocket( port, backlog, parent, name ) 2489KServerSocket:: KServerSocket ( QString pw, Q_UINT16 port, int backlog, QObject * parent, const char * name ) : QServerSocket( port, backlog, parent, name )
2533{ 2490{
2534 mPassWord = pw; 2491 mPassWord = pw;
2535 mSocket = 0; 2492 mSocket = 0;
2536}; 2493};
2537 2494
2538void KServerSocket::newConnection ( int socket ) 2495void KServerSocket::newConnection ( int socket )
2539{ 2496{
2540 qDebug("KServerSocket:New connection %d ", socket); 2497 qDebug("KServerSocket:New connection %d ", socket);
2541 if ( mSocket ) { 2498 if ( mSocket ) {
2542 qDebug("KServerSocket::newConnection Socket deleted! "); 2499 qDebug("KServerSocket::newConnection Socket deleted! ");
2543 delete mSocket; 2500 delete mSocket;
2544 mSocket = 0; 2501 mSocket = 0;
2545 } 2502 }
2546 mSocket = new QSocket( this ); 2503 mSocket = new QSocket( this );
2547 connect( mSocket , SIGNAL(readyRead()), this, SLOT(readClient()) ); 2504 connect( mSocket , SIGNAL(readyRead()), this, SLOT(readClient()) );
2548 connect( mSocket , SIGNAL(delayedCloseFinished()), this, SLOT(discardClient()) ); 2505 connect( mSocket , SIGNAL(delayedCloseFinished()), this, SLOT(discardClient()) );
2549 mSocket->setSocket( socket ); 2506 mSocket->setSocket( socket );
2550} 2507}
2551 2508
2552void KServerSocket::discardClient() 2509void KServerSocket::discardClient()
2553{ 2510{
2554 qDebug(" KServerSocket::discardClient()"); 2511 qDebug(" KServerSocket::discardClient()");
2555 if ( mSocket ) { 2512 if ( mSocket ) {
2556 qDebug("delete "); 2513 qDebug("delete ");
2557 delete mSocket; 2514 delete mSocket;
2558 mSocket = 0; 2515 mSocket = 0;
2559 } 2516 }
2560 //emit endConnect(); 2517 //emit endConnect();
2561} 2518}
2562void KServerSocket::readClient() 2519void KServerSocket::readClient()
2563{ 2520{
2564 if ( mSocket == 0 ) { 2521 if ( mSocket == 0 ) {
2565 qDebug("ERROR::KServerSocket::readClient(): mSocket == 0 "); 2522 qDebug("ERROR::KServerSocket::readClient(): mSocket == 0 ");
2566 return; 2523 return;
2567 } 2524 }
2568 qDebug("KServerSocket readClient()"); 2525 qDebug("KServerSocket readClient()");
2569 if ( mSocket->canReadLine() ) { 2526 if ( mSocket->canReadLine() ) {
2570 QStringList tokens = QStringList::split( QRegExp("[ \r\n][ \r\n]*"), mSocket->readLine() ); 2527 QStringList tokens = QStringList::split( QRegExp("[ \r\n][ \r\n]*"), mSocket->readLine() );
2571 qDebug("KServerSocket socket->canReadLine()"); 2528 qDebug("KServerSocket socket->canReadLine()");
2572 if ( tokens[0] == "GET" ) { 2529 if ( tokens[0] == "GET" ) {
2573 if ( tokens[1] == mPassWord ) 2530 if ( tokens[1] == mPassWord )
2574 emit sendFile( mSocket ); 2531 emit sendFile( mSocket );
2575 else { 2532 else {
2576 KMessageBox::information( 0, i18n("ERROR:\nGot send file request\nwith invalid password")); 2533 KMessageBox::information( 0, i18n("ERROR:\nGot send file request\nwith invalid password"));
2577 qDebug("password %s, invalid password %s ",mPassWord.latin1(), tokens[1].latin1() ); 2534 qDebug("password %s, invalid password %s ",mPassWord.latin1(), tokens[1].latin1() );
2578 } 2535 }
2579 } 2536 }
2580 if ( tokens[0] == "PUT" ) { 2537 if ( tokens[0] == "PUT" ) {
2581 if ( tokens[1] == mPassWord ) 2538 if ( tokens[1] == mPassWord )
2582 emit getFile( mSocket ); 2539 emit getFile( mSocket );
2583 else { 2540 else {
2584 KMessageBox::information( 0, i18n("ERROR:\nGot receive file request\nwith invalid password")); 2541 KMessageBox::information( 0, i18n("ERROR:\nGot receive file request\nwith invalid password"));
2585 qDebug("password %s, invalid password %s ",mPassWord.latin1(), tokens[1].latin1() ); 2542 qDebug("password %s, invalid password %s ",mPassWord.latin1(), tokens[1].latin1() );
2586 } 2543 }
2587 } 2544 }
2588 if ( tokens[0] == "STOP" ) { 2545 if ( tokens[0] == "STOP" ) {
2589 emit endConnect(); 2546 emit endConnect();
2590 } 2547 }
2591 } 2548 }
2592} 2549}
2593 2550
2551KCommandSocket::KCommandSocket ( QString password, Q_UINT16 port, QString host, QObject * parent, const char * name ): QObject( parent, name )
2552{
2553 mPassWord = password;
2554 mSocket = 0;
2555 mPort = port;
2556 mHost = host;
2594 2557
2558 mRetVal = false;
2559 mTimerSocket = new QTimer ( this );
2560 connect( mTimerSocket, SIGNAL ( timeout () ), this, SLOT ( deleteSocket() ) );
2561}
2562void KCommandSocket::readFile( QString fn )
2563{
2564 if ( !mSocket ) {
2565 mSocket = new QSocket( this );
2566 connect( mSocket, SIGNAL(readyRead()), this, SLOT(startReadFileFromSocket()) );
2567 connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) );
2568 }
2569 mFileString = "";
2570 mFileName = fn;
2571 mFirst = true;
2572 mSocket->connectToHost( mHost, mPort );
2573 QTextStream os( mSocket );
2574 os.setEncoding( QTextStream::UnicodeUTF8 );
2575 os << "GET " << mPassWord << "\r\n";
2576 mTimerSocket->start( 10000 );
2577}
2595 2578
2579void KCommandSocket::writeFile( QString )
2580{
2596 2581
2582}
2583void KCommandSocket::startReadFileFromSocket()
2584{
2585 if ( ! mFirst )
2586 return;
2587 mFirst = false;
2588 mTimerSocket->stop();
2589 mFileString = "";
2590 mTime.start();
2591 QTimer::singleShot( 1, this , SLOT (readFileFromSocket( ) ));
2597 2592
2593}
2594void KCommandSocket::readFileFromSocket()
2595{
2596 qDebug("readBackFileFromSocket() %d ", mTime.elapsed ());
2597 while ( mSocket->canReadLine () ) {
2598 mTime.restart();
2599 QString line = mSocket->readLine ();
2600 mFileString += line;
2601 qDebug("readline: %s ", line.latin1());
2602 }
2603 if ( mTime.elapsed () < 3000 ) {
2604 // wait for more
2605 qDebug("waitformore ");
2606 QTimer::singleShot( 100, this , SLOT (readFileFromSocket( ) ));
2607 return;
2608 }
2609 QString fileName = mFileName;
2610 QFile file ( fileName );
2611 if (!file.open( IO_WriteOnly ) ) {
2612 mFileString = "";
2613 mRetVal = false;
2614 qDebug("Error open temp calender file for writing: %s",fileName.latin1() );
2615 deleteSocket();
2616 return ;
2617
2618 }
2619 // mView->setLoadedFileVersion(QDateTime::currentDateTime().addSecs( -1));
2620 QTextStream ts ( &file );
2621 ts.setCodec( QTextCodec::codecForName("utf8") );
2622 qDebug("finish ");
2623 ts << mFileString;
2624 file.close();
2625 mFileString = "";
2626 mRetVal = true;
2627 mSocket->close();
2628 // if state is not idle, deleteSocket(); is called via
2629 // connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) );
2630 if ( mSocket->state() == QSocket::Idle )
2631 deleteSocket();
2632}
2598 2633
2599 2634void KCommandSocket::deleteSocket()
2600 2635{
2601 2636 if ( !mSocket)
2602 2637 return;
2603 2638 if ( mTimerSocket->isActive () ) {
2639 mTimerSocket->stop();
2640 KMessageBox::information( 0, i18n("ERROR:\nConnection to remote host timed out "));
2641 mRetVal = false;
2642 }
2643 qDebug("KCommandSocket::deleteSocket() %d", mRetVal);
2644 delete mSocket;
2645 mSocket = 0;
2646 emit commandFinished( mRetVal );
2647}
2604 2648
diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h
index d217578..11a816c 100644
--- a/korganizer/mainwindow.h
+++ b/korganizer/mainwindow.h
@@ -1,173 +1,201 @@
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 36
37signals: 37signals:
38 void sendFile(QSocket*); 38 void sendFile(QSocket*);
39 void getFile(QSocket*); 39 void getFile(QSocket*);
40 void endConnect(); 40 void endConnect();
41private slots: 41private slots:
42 void discardClient(); 42 void discardClient();
43 void readClient(); 43 void readClient();
44 private : 44 private :
45 QSocket* mSocket; 45 QSocket* mSocket;
46 QString mPassWord; 46 QString mPassWord;
47}; 47};
48 48
49class KCommandSocket : public QObject
50{
51 Q_OBJECT
52
53public:
54 KCommandSocket ( QString password, Q_UINT16 port, QString host, QObject * parent=0, const char * name=0 );
55 void readFile( QString );
56 void writeFile( QString );
57
58
59signals:
60 void commandFinished( bool );
61private slots:
62 void startReadFileFromSocket();
63 void readFileFromSocket();
64 void deleteSocket();
65 private :
66 QSocket* mSocket;
67 QString mPassWord;
68 Q_UINT16 mPort;
69 QString mHost;
70 QString mFileName;
71 QTimer* mTimerSocket;
72 bool mRetVal;
73 QTime mTime;
74 QString mFileString;
75 bool mFirst;
76};
49 77
50namespace KCal { 78namespace KCal {
51class CalendarLocal; 79class CalendarLocal;
52} 80}
53 81
54using namespace KCal; 82using namespace KCal;
55 83
56class MainWindow : public QMainWindow 84class MainWindow : public QMainWindow
57{ 85{
58 Q_OBJECT 86 Q_OBJECT
59 public: 87 public:
60 MainWindow( QWidget *parent = 0, const char *name = 0, QString command = ""); 88 MainWindow( QWidget *parent = 0, const char *name = 0, QString command = "");
61 ~MainWindow(); 89 ~MainWindow();
62 public slots: 90 public slots:
63 virtual void showMaximized (); 91 virtual void showMaximized ();
64 void configureAgenda( int ); 92 void configureAgenda( int );
65 void recieve( const QCString& msg, const QByteArray& data ); 93 void recieve( const QCString& msg, const QByteArray& data );
66 static QString defaultFileName(); 94 static QString defaultFileName();
67 static QString resourcePath(); 95 static QString resourcePath();
68 protected slots: 96 protected slots:
69 void setCaptionToDates(); 97 void setCaptionToDates();
70 int ringSync(); 98 int ringSync();
71 void multiSync( bool askforPrefs = false ); 99 void multiSync( bool askforPrefs = false );
72 void about(); 100 void about();
73 void licence(); 101 void licence();
74 void faq(); 102 void faq();
75 void usertrans(); 103 void usertrans();
76 void features(); 104 void features();
77 void synchowto(); 105 void synchowto();
78 void whatsNew(); 106 void whatsNew();
79 void keyBindings(); 107 void keyBindings();
80 void aboutAutoSaving();; 108 void aboutAutoSaving();;
81 void aboutKnownBugs(); 109 void aboutKnownBugs();
82 110
83 void processIncidenceSelection( Incidence * ); 111 void processIncidenceSelection( Incidence * );
84 112
85 void importQtopia(); 113 void importQtopia();
86 void importBday(); 114 void importBday();
87 void importOL(); 115 void importOL();
88 void importIcal(); 116 void importIcal();
89 void importFile( QString, bool ); 117 void importFile( QString, bool );
90 void quickImportIcal(); 118 void quickImportIcal();
91 119
92 void slotModifiedChanged( bool ); 120 void slotModifiedChanged( bool );
93 121
94 void save(); 122 void save();
95 void configureToolBar( int ); 123 void configureToolBar( int );
96 void printSel(); 124 void printSel();
97 void printCal(); 125 void printCal();
98 void saveCalendar(); 126 void saveCalendar();
99 void loadCalendar(); 127 void loadCalendar();
100 void exportVCalendar(); 128 void exportVCalendar();
101 void fillFilterMenu(); 129 void fillFilterMenu();
102 void selectFilter( int ); 130 void selectFilter( int );
103 131
104 void slotSyncMenu( int ); 132 void slotSyncMenu( int );
105 void syncSSH(); 133 void syncSSH();
106 void confSync(); 134 void confSync();
107 void syncSharp(); 135 void syncSharp();
108 void syncPhone(); 136 void syncPhone();
109 void syncLocalFile(); 137 void syncLocalFile();
110 bool syncWithFile( QString, bool ); 138 bool syncWithFile( QString, bool );
111 void quickSyncLocalFile(); 139 void quickSyncLocalFile();
112 140
113 141
114 protected: 142 protected:
115 void displayText( QString, QString); 143 void displayText( QString, QString);
116 void displayFile( QString, QString); 144 void displayFile( QString, QString);
117 145
118 void enableIncidenceActions( bool ); 146 void enableIncidenceActions( bool );
119 147
120 private slots: 148 private slots:
121 QSocket* piSocket; 149 QSocket* piSocket;
122 QString piFileString; 150 QString piFileString;
123 QTime piTime; 151 QTime piTime;
124 void deleteCommandSocket(); 152 void deleteCommandSocket(bool);
125 void deleteCommandSocketFinish(); 153 void deleteCommandSocketFinish();
126 void fillSyncMenu(); 154 void fillSyncMenu();
127 void sendFile(QSocket* s); 155 void sendFile(QSocket* s);
128 void getFile(QSocket* socket); 156 void getFile(QSocket* socket);
129 void readFileFromSocket(); 157 void readFileFromSocket();
130 void readBackFileFromSocket(); 158 void readBackFileFromSocket();
131 void endConnect(); 159 void endConnect();
132 private: 160 private:
133 QTimer* mTimerCommandSocket; 161 //QTimer* mTimerCommandSocket;
134 QString mPassWordPiSync; 162 QString mPassWordPiSync;
135 QSocket* mCommandSocket; 163 KCommandSocket* mCommandSocket;
136 QSocket* mCommandSocketFinish; 164 QSocket* mCommandSocketFinish;
137 KServerSocket * mServerSocket; 165 KServerSocket * mServerSocket;
138 bool mClosed; 166 bool mClosed;
139 void saveOnClose(); 167 void saveOnClose();
140 int mCurrentSyncProfile; 168 int mCurrentSyncProfile;
141 void enableQuick(); 169 void enableQuick();
142 void performQuick(); 170 void performQuick();
143 void performQuickQuick(); 171 void performQuickQuick();
144 void syncRemote( KSyncProfile* , bool ask = true); 172 void syncRemote( KSyncProfile* , bool ask = true);
145 bool mFlagKeyPressed; 173 bool mFlagKeyPressed;
146 bool mBlockAtStartup; 174 bool mBlockAtStartup;
147 QPEToolBar *iconToolBar; 175 QPEToolBar *iconToolBar;
148 void initActions(); 176 void initActions();
149 void setDefaultPreferences(); 177 void setDefaultPreferences();
150 void keyPressEvent ( QKeyEvent * ) ; 178 void keyPressEvent ( QKeyEvent * ) ;
151 void keyReleaseEvent ( QKeyEvent * ) ; 179 void keyReleaseEvent ( QKeyEvent * ) ;
152 QPopupMenu *configureToolBarMenu; 180 QPopupMenu *configureToolBarMenu;
153 QPopupMenu *selectFilterMenu; 181 QPopupMenu *selectFilterMenu;
154 QPopupMenu *configureAgendaMenu, *syncMenu; 182 QPopupMenu *configureAgendaMenu, *syncMenu;
155 CalendarLocal *mCalendar; 183 CalendarLocal *mCalendar;
156 CalendarView *mView; 184 CalendarView *mView;
157 QString getPassword(); 185 QString getPassword();
158 QAction *mNewSubTodoAction; 186 QAction *mNewSubTodoAction;
159 187
160 QAction *mShowAction; 188 QAction *mShowAction;
161 QAction *mEditAction; 189 QAction *mEditAction;
162 QAction *mDeleteAction; 190 QAction *mDeleteAction;
163 void closeEvent( QCloseEvent* ce ); 191 void closeEvent( QCloseEvent* ce );
164 SimpleAlarmClient mAlarmClient; 192 SimpleAlarmClient mAlarmClient;
165 QTimer mSaveTimer; 193 QTimer mSaveTimer;
166 bool mBlockSaveFlag; 194 bool mBlockSaveFlag;
167 bool mCalendarModifiedFlag; 195 bool mCalendarModifiedFlag;
168 QPixmap loadPixmap( QString ); 196 QPixmap loadPixmap( QString );
169 QDialog * mSyncActionDialog; 197 QDialog * mSyncActionDialog;
170}; 198};
171 199
172 200
173#endif 201#endif
diff --git a/version b/version
index 576852d..f085278 100644
--- a/version
+++ b/version
@@ -1 +1 @@
version = "1.9.6"; version = "1.9.7";