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