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