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