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