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