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