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