summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-08-17 16:19:18 (UTC)
committer zautrix <zautrix>2005-08-17 16:19:18 (UTC)
commitc21edc19916722f5dd4e939f1522d311a86411fd (patch) (unidiff)
treeed91c2cd9afb7d37c73f2056851c95293eff6038
parent9e6d1f7f45ef1444dc6ee96347a2dbd67a0d79dd (diff)
downloadkdepimpi-c21edc19916722f5dd4e939f1522d311a86411fd.zip
kdepimpi-c21edc19916722f5dd4e939f1522d311a86411fd.tar.gz
kdepimpi-c21edc19916722f5dd4e939f1522d311a86411fd.tar.bz2
minor kopi fixes
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/mainwindow.cpp27
1 files changed, 17 insertions, 10 deletions
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 45775c5..94bc4c1 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -1,2673 +1,2680 @@
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/qpetoolbar.h> 24#include <qpe/qpetoolbar.h>
25#include <qpe/resource.h> 25#include <qpe/resource.h>
26#include <qpe/qpeapplication.h> 26#include <qpe/qpeapplication.h>
27#include <qtopia/alarmserver.h> 27#include <qtopia/alarmserver.h>
28#include <qtopia/qcopenvelope_qws.h> 28#include <qtopia/qcopenvelope_qws.h>
29#include <unistd.h> // for sleep 29#include <unistd.h> // for sleep
30#else 30#else
31#include <qtoolbar.h> 31#include <qtoolbar.h>
32#include <qapplication.h> 32#include <qapplication.h>
33//#include <resource.h> 33//#include <resource.h>
34 34
35#endif 35#endif
36#include <libkcal/calendarlocal.h> 36#include <libkcal/calendarlocal.h>
37#include <libkcal/todo.h> 37#include <libkcal/todo.h>
38#include <libkcal/phoneformat.h> 38#include <libkcal/phoneformat.h>
39#include <libkdepim/ksyncprofile.h> 39#include <libkdepim/ksyncprofile.h>
40#include <libkdepim/phoneaccess.h> 40#include <libkdepim/phoneaccess.h>
41#include <libkcal/kincidenceformatter.h> 41#include <libkcal/kincidenceformatter.h>
42#include <libkdepim/kpimglobalprefs.h> 42#include <libkdepim/kpimglobalprefs.h>
43 43
44#include "calendarview.h" 44#include "calendarview.h"
45#include "koviewmanager.h" 45#include "koviewmanager.h"
46#include "datenavigator.h" 46#include "datenavigator.h"
47#include "koagendaview.h" 47#include "koagendaview.h"
48#include "kojournalview.h" 48#include "kojournalview.h"
49#include "koagenda.h" 49#include "koagenda.h"
50#include "kodialogmanager.h" 50#include "kodialogmanager.h"
51#include "kdialogbase.h" 51#include "kdialogbase.h"
52#include "kapplication.h" 52#include "kapplication.h"
53#include "kofilterview.h" 53#include "kofilterview.h"
54#include "kstandarddirs.h" 54#include "kstandarddirs.h"
55#include "koprefs.h" 55#include "koprefs.h"
56#include "kfiledialog.h" 56#include "kfiledialog.h"
57#include "koglobals.h" 57#include "koglobals.h"
58#include "kglobal.h" 58#include "kglobal.h"
59#include "ktoolbar.h" 59#include "ktoolbar.h"
60#include "klocale.h" 60#include "klocale.h"
61#include "kconfig.h" 61#include "kconfig.h"
62#include "externalapphandler.h" 62#include "externalapphandler.h"
63#include <kglobalsettings.h> 63#include <kglobalsettings.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
75 75
76class KOex2phonePrefs : public QDialog 76class KOex2phonePrefs : public QDialog
77{ 77{
78 public: 78 public:
79 KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) : 79 KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) :
80 QDialog( parent, name, true ) 80 QDialog( parent, name, true )
81 { 81 {
82 setCaption( i18n("Export to phone options") ); 82 setCaption( i18n("Export to phone options") );
83 QVBoxLayout* lay = new QVBoxLayout( this ); 83 QVBoxLayout* lay = new QVBoxLayout( this );
84 lay->setSpacing( 3 ); 84 lay->setSpacing( 3 );
85 lay->setMargin( 3 ); 85 lay->setMargin( 3 );
86 QLabel *lab; 86 QLabel *lab;
87 lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); 87 lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) );
88 lab->setAlignment (AlignHCenter ); 88 lab->setAlignment (AlignHCenter );
89 QHBox* temphb; 89 QHBox* temphb;
90 temphb = new QHBox( this ); 90 temphb = new QHBox( this );
91 new QLabel( i18n("I/O device: "), temphb ); 91 new QLabel( i18n("I/O device: "), temphb );
92 mPhoneDevice = new QLineEdit( temphb); 92 mPhoneDevice = new QLineEdit( temphb);
93 lay->addWidget( temphb ); 93 lay->addWidget( temphb );
94 temphb = new QHBox( this ); 94 temphb = new QHBox( this );
95 new QLabel( i18n("Connection: "), temphb ); 95 new QLabel( i18n("Connection: "), temphb );
96 mPhoneConnection = new QLineEdit( temphb); 96 mPhoneConnection = new QLineEdit( temphb);
97 lay->addWidget( temphb ); 97 lay->addWidget( temphb );
98 temphb = new QHBox( this ); 98 temphb = new QHBox( this );
99 new QLabel( i18n("Model(opt.): "), temphb ); 99 new QLabel( i18n("Model(opt.): "), temphb );
100 mPhoneModel = new QLineEdit( temphb); 100 mPhoneModel = new QLineEdit( temphb);
101 lay->addWidget( temphb ); 101 lay->addWidget( temphb );
102 mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this ); 102 mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this );
103 mWriteBackFuture->setChecked( true ); 103 mWriteBackFuture->setChecked( true );
104 lay->addWidget( mWriteBackFuture ); 104 lay->addWidget( mWriteBackFuture );
105 temphb = new QHBox( this ); 105 temphb = new QHBox( this );
106 new QLabel( i18n("Max. weeks in future: ") , temphb ); 106 new QLabel( i18n("Max. weeks in future: ") , temphb );
107 mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb); 107 mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb);
108 mWriteBackFutureWeeks->setValue( 8 ); 108 mWriteBackFutureWeeks->setValue( 8 );
109 lay->addWidget( temphb ); 109 lay->addWidget( temphb );
110 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) ); 110 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) );
111 lab->setAlignment (AlignHCenter ); 111 lab->setAlignment (AlignHCenter );
112 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); 112 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this );
113 lay->addWidget( ok ); 113 lay->addWidget( ok );
114 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 114 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
115 lay->addWidget( cancel ); 115 lay->addWidget( cancel );
116 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 116 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
117 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 117 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
118 resize( 220, 240 ); 118 resize( 220, 240 );
119 qApp->processEvents(); 119 qApp->processEvents();
120 int dw = QApplication::desktop()->width(); 120 int dw = QApplication::desktop()->width();
121 int dh = QApplication::desktop()->height(); 121 int dh = QApplication::desktop()->height();
122 move( (dw-width())/2, (dh - height() )/2 ); 122 move( (dw-width())/2, (dh - height() )/2 );
123 } 123 }
124 124
125public: 125public:
126 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; 126 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel;
127 QCheckBox* mWriteBackFuture; 127 QCheckBox* mWriteBackFuture;
128 QSpinBox* mWriteBackFutureWeeks; 128 QSpinBox* mWriteBackFutureWeeks;
129}; 129};
130 130
131QPixmap* sgListViewCompletedPix[6]; 131QPixmap* sgListViewCompletedPix[6];
132QPixmap* sgListViewJournalPix; 132QPixmap* sgListViewJournalPix;
133 133
134 134
135int globalFlagBlockStartup; 135int globalFlagBlockStartup;
136MainWindow::MainWindow( QWidget *parent, const char *name ) : 136MainWindow::MainWindow( QWidget *parent, const char *name ) :
137 QMainWindow( parent, name ) 137 QMainWindow( parent, name )
138{ 138{
139 sgListViewCompletedPix[5] = &listviewPix; 139 sgListViewCompletedPix[5] = &listviewPix;
140 sgListViewCompletedPix[0] = &listviewPix0; 140 sgListViewCompletedPix[0] = &listviewPix0;
141 sgListViewCompletedPix[1] = &listviewPix20; 141 sgListViewCompletedPix[1] = &listviewPix20;
142 sgListViewCompletedPix[2] = &listviewPix40; 142 sgListViewCompletedPix[2] = &listviewPix40;
143 sgListViewCompletedPix[3] = &listviewPix60; 143 sgListViewCompletedPix[3] = &listviewPix60;
144 sgListViewCompletedPix[4] = &listviewPix80; 144 sgListViewCompletedPix[4] = &listviewPix80;
145 //int size = 12; 145 //int size = 12;
146 { 146 {
147 sgListViewCompletedPix[5]->resize( 11, 11 ); 147 sgListViewCompletedPix[5]->resize( 11, 11 );
148 sgListViewCompletedPix[5]->fill( Qt::white ); 148 sgListViewCompletedPix[5]->fill( Qt::white );
149 QPainter p ( sgListViewCompletedPix[5] ); 149 QPainter p ( sgListViewCompletedPix[5] );
150 p.drawRect( 0,0,11,11); 150 p.drawRect( 0,0,11,11);
151 p.drawLine ( 2, 5, 4 , 7 ) ; 151 p.drawLine ( 2, 5, 4 , 7 ) ;
152 p.drawLine ( 4 , 7 , 8, 3) ; 152 p.drawLine ( 4 , 7 , 8, 3) ;
153 int iii = 0; 153 int iii = 0;
154 for ( iii = 0; iii < 5; ++iii ) { 154 for ( iii = 0; iii < 5; ++iii ) {
155 sgListViewCompletedPix[iii]->resize( 11, 11 ); 155 sgListViewCompletedPix[iii]->resize( 11, 11 );
156 sgListViewCompletedPix[iii]->fill( Qt::white ); 156 sgListViewCompletedPix[iii]->fill( Qt::white );
157 QPainter p ( sgListViewCompletedPix[iii] ); 157 QPainter p ( sgListViewCompletedPix[iii] );
158 p.drawRect( 0,0,11,11); 158 p.drawRect( 0,0,11,11);
159 if ( iii ) 159 if ( iii )
160 p.fillRect( 1,1,iii*2,9,Qt::gray ); 160 p.fillRect( 1,1,iii*2,9,Qt::gray );
161 } 161 }
162 sgListViewJournalPix = &journalPix; 162 sgListViewJournalPix = &journalPix;
163 sgListViewJournalPix->resize( 11, 11 ); 163 sgListViewJournalPix->resize( 11, 11 );
164 sgListViewJournalPix->fill( Qt::white ); 164 sgListViewJournalPix->fill( Qt::white );
165 { 165 {
166 QPainter p ( sgListViewJournalPix ); 166 QPainter p ( sgListViewJournalPix );
167 p.drawRect( 0,0,11,11); 167 p.drawRect( 0,0,11,11);
168 p.drawLine( 2,3,5,3); 168 p.drawLine( 2,3,5,3);
169 p.drawLine( 2,5,8,5); 169 p.drawLine( 2,5,8,5);
170 p.drawLine( 2,7,6,7); 170 p.drawLine( 2,7,6,7);
171 } 171 }
172 } 172 }
173 mClosed = false; 173 mClosed = false;
174 //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; 174 //QString confFile = KStandardDirs::appDir() + "config/korganizerrc";
175 QString confFile = locateLocal("config","korganizerrc"); 175 QString confFile = locateLocal("config","korganizerrc");
176 QFileInfo finf ( confFile ); 176 QFileInfo finf ( confFile );
177 bool showWarning = !finf.exists(); 177 bool showWarning = !finf.exists();
178 setIcon(SmallIcon( "ko24" ) ); 178 setIcon(SmallIcon( "ko24" ) );
179 mBlockAtStartup = true; 179 mBlockAtStartup = true;
180 mFlagKeyPressed = false; 180 mFlagKeyPressed = false;
181 setCaption("KO/Pi"); 181 setCaption("KO/Pi");
182 KOPrefs *p = KOPrefs::instance(); 182 KOPrefs *p = KOPrefs::instance();
183 //KPimGlobalPrefs::instance()->setGlobalConfig(); 183 //KPimGlobalPrefs::instance()->setGlobalConfig();
184 p->mCurrentDisplayedView = 0; 184 p->mCurrentDisplayedView = 0;
185 if ( p->mHourSize > 22 ) 185 if ( p->mHourSize > 22 )
186 p->mHourSize = 22; 186 p->mHourSize = 22;
187 QMainWindow::ToolBarDock tbd; 187 QMainWindow::ToolBarDock tbd;
188 if ( p->mToolBarHor ) { 188 if ( p->mToolBarHor ) {
189 if ( p->mToolBarUp ) 189 if ( p->mToolBarUp )
190 tbd = Bottom; 190 tbd = Bottom;
191 else 191 else
192 tbd = Top; 192 tbd = Top;
193 } 193 }
194 else { 194 else {
195 if ( p->mToolBarUp ) 195 if ( p->mToolBarUp )
196 tbd = Right; 196 tbd = Right;
197 else 197 else
198 tbd = Left; 198 tbd = Left;
199 } 199 }
200 if ( KOPrefs::instance()->mUseAppColors ) 200 if ( KOPrefs::instance()->mUseAppColors )
201 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); 201 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true );
202 globalFlagBlockStartup = 1; 202 globalFlagBlockStartup = 1;
203 iconToolBar = new QPEToolBar( this ); 203 iconToolBar = new QPEToolBar( this );
204 addToolBar (iconToolBar , tbd ); 204 addToolBar (iconToolBar , tbd );
205 205
206#ifdef DESKTOP_VERSION 206#ifdef DESKTOP_VERSION
207 if ( KOPrefs::instance()->mShowIconFilter ) 207 if ( KOPrefs::instance()->mShowIconFilter )
208#else 208#else
209 if ( KOPrefs::instance()->mShowIconFilter || !p->mShowIconOnetoolbar ) 209 if ( KOPrefs::instance()->mShowIconFilter || ( !p->mShowIconOnetoolbar &&!p->mShowIconFilterview ) )
210#endif 210#endif
211 211
212{ 212{
213 if ( p->mToolBarHorF ) { 213 if ( p->mToolBarHorF ) {
214 if ( p->mToolBarUpF ) 214 if ( p->mToolBarUpF )
215 tbd = Bottom; 215 tbd = Bottom;
216 else 216 else
217 tbd = Top; 217 tbd = Top;
218 } 218 }
219 else { 219 else {
220 if ( p->mToolBarUpF ) 220 if ( p->mToolBarUpF )
221 tbd = Right; 221 tbd = Right;
222 else 222 else
223 tbd = Left; 223 tbd = Left;
224 } 224 }
225 filterToolBar = new QPEToolBar ( this ); 225 filterToolBar = new QPEToolBar ( this );
226 filterMenubar = new KMenuBar( 0 ); 226 filterMenubar = new KMenuBar( 0 );
227 QFontMetrics fm ( filterMenubar->font() ); 227 QFontMetrics fm ( filterMenubar->font() );
228#ifndef DESKTOP_VERSION 228#ifndef DESKTOP_VERSION
229 filterToolBar->setFocusPolicy( NoFocus ); 229 filterToolBar->setFocusPolicy( NoFocus );
230 filterMenubar->setFocusPolicy( NoFocus ); 230 filterMenubar->setFocusPolicy( NoFocus );
231#endif 231#endif
232 filterPopupMenu = new QPopupMenu( this ); 232 filterPopupMenu = new QPopupMenu( this );
233 filterMenubar->insertItem( i18n("No Filter"), filterPopupMenu,0 ); 233 filterMenubar->insertItem( i18n("No Filter"), filterPopupMenu,0 );
234 QString addTest = "A"; 234 QString addTest = "A";
235 filterMenubar->setMinimumWidth( fm.width( i18n("No Filter")+addTest ) ); 235 filterMenubar->setMinimumWidth( fm.width( i18n("No Filter")+addTest ) );
236#ifdef DESKTOP_VERSION 236#ifdef DESKTOP_VERSION
237 addTest = "AAABBBCCCx"; 237 addTest = "AAAAAABBBCCCx";
238#else 238#else
239 addTest = "AAx"; 239 addTest = "AAAAAx";
240#endif 240#endif
241 filterMenubar->setMaximumWidth( fm.width( i18n("No Filter")+addTest ) ); 241 filterMenubar->setMaximumWidth( fm.width( i18n("No Filter")+addTest ) );
242 addToolBar (filterToolBar , tbd ); 242 addToolBar (filterToolBar , tbd );
243 connect ( filterPopupMenu , SIGNAL( activated ( int ) ), this, SLOT (selectFilterPopup( int ) ) ); 243 connect ( filterPopupMenu , SIGNAL( activated ( int ) ), this, SLOT (selectFilterPopup( int ) ) );
244 connect ( filterPopupMenu , SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenuPopup() ) ); 244 connect ( filterPopupMenu , SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenuPopup() ) );
245 if ( !KOPrefs::instance()->mShowIconFilter && !p->mShowIconOnetoolbar ) 245 if ( !KOPrefs::instance()->mShowIconFilter && !p->mShowIconOnetoolbar )
246 filterToolBar->hide(); 246 filterToolBar->hide();
247 } else { 247 } else {
248 filterToolBar = 0; 248 filterToolBar = 0;
249 filterMenubar = 0; 249 filterMenubar = 0;
250 filterPopupMenu = 0; 250 filterPopupMenu = 0;
251 } 251 }
252 if ( p->mShowIconOnetoolbar ) { 252 if ( p->mShowIconOnetoolbar ) {
253 viewToolBar = iconToolBar ; 253 viewToolBar = iconToolBar ;
254 navigatorToolBar = iconToolBar ; 254 navigatorToolBar = iconToolBar ;
255 } else { 255 } else {
256#ifndef DESKTOP_VERSION 256#ifndef DESKTOP_VERSION
257 setToolBarsMovable( false ); 257 setToolBarsMovable( false );
258#endif 258#endif
259 if ( p->mToolBarHorV ) { 259 if ( p->mToolBarHorV ) {
260 if ( p->mToolBarUpV ) 260 if ( p->mToolBarUpV )
261 tbd = Bottom; 261 tbd = Bottom;
262 else 262 else
263 tbd = Top; 263 tbd = Top;
264 } 264 }
265 else { 265 else {
266 if ( p->mToolBarUpV ) 266 if ( p->mToolBarUpV )
267 tbd = Right; 267 tbd = Right;
268 else 268 else
269 tbd = Left; 269 tbd = Left;
270 } 270 }
271 viewToolBar = new QPEToolBar( this ); 271 viewToolBar = new QPEToolBar( this );
272 addToolBar (viewToolBar , tbd ); 272 addToolBar (viewToolBar , tbd );
273 if ( p->mToolBarHorN ) { 273 if ( p->mToolBarHorN ) {
274 if ( p->mToolBarUpN ) 274 if ( p->mToolBarUpN )
275 tbd = Bottom; 275 tbd = Bottom;
276 else 276 else
277 tbd = Top; 277 tbd = Top;
278 } 278 }
279 else { 279 else {
280 if ( p->mToolBarUpN ) 280 if ( p->mToolBarUpN )
281 tbd = Right; 281 tbd = Right;
282 else 282 else
283 tbd = Left; 283 tbd = Left;
284 } 284 }
285 navigatorToolBar = new QPEToolBar( this ); 285 navigatorToolBar = new QPEToolBar( this );
286 addToolBar (navigatorToolBar , tbd ); 286 addToolBar (navigatorToolBar , tbd );
287 } 287 }
288 288
289 289
290 290
291 mCalendarModifiedFlag = false; 291 mCalendarModifiedFlag = false;
292 QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); 292 QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this );
293 splash->setAlignment ( AlignCenter ); 293 splash->setAlignment ( AlignCenter );
294 setCentralWidget( splash ); 294 setCentralWidget( splash );
295#ifndef DESKTOP_VERSION 295#ifndef DESKTOP_VERSION
296 showMaximized(); 296 showMaximized();
297#endif 297#endif
298 298
299 //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); 299 //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ());
300 setDefaultPreferences(); 300 setDefaultPreferences();
301 mCalendar = new CalendarLocal(); 301 mCalendar = new CalendarLocal();
302 mView = new CalendarView( mCalendar, this,"mCalendar " ); 302 mView = new CalendarView( mCalendar, this,"mCalendar " );
303 mView->hide(); 303 mView->hide();
304 //mView->resize(splash->size() ); 304 //mView->resize(splash->size() );
305 initActions(); 305 initActions();
306 mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu); 306 mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu);
307 mSyncManager->setBlockSave(false); 307 mSyncManager->setBlockSave(false);
308 mView->setSyncManager(mSyncManager); 308 mView->setSyncManager(mSyncManager);
309#ifndef DESKTOP_VERSION 309#ifndef DESKTOP_VERSION
310 iconToolBar->show(); 310 iconToolBar->show();
311 qApp->processEvents(); 311 qApp->processEvents();
312#endif 312#endif
313 //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); 313 //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ());
314 int vh = height() ; 314 int vh = height() ;
315 int vw = width(); 315 int vw = width();
316 //qDebug("Toolbar hei %d ",iconToolBar->height() ); 316 //qDebug("Toolbar hei %d ",iconToolBar->height() );
317 if ( iconToolBar->orientation () == Qt:: Horizontal ) { 317 if ( iconToolBar->orientation () == Qt:: Horizontal ) {
318 vh -= iconToolBar->height(); 318 vh -= iconToolBar->height();
319 } else { 319 } else {
320 vw -= iconToolBar->height(); 320 vw -= iconToolBar->height();
321 } 321 }
322 //mView->setMaximumSize( splash->size() ); 322 //mView->setMaximumSize( splash->size() );
323 //mView->resize( splash->size() ); 323 //mView->resize( splash->size() );
324 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); 324 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ());
325 mView->readSettings(); 325 mView->readSettings();
326 bool newFile = false; 326 bool newFile = false;
327 if( !QFile::exists( defaultFileName() ) ) { 327 if( !QFile::exists( defaultFileName() ) ) {
328 QFileInfo finfo ( defaultFileName() ); 328 QFileInfo finfo ( defaultFileName() );
329 QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); 329 QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics");
330 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"; 330 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";
331 finfo.setFile( oldFile ); 331 finfo.setFile( oldFile );
332 if (finfo.exists() ) { 332 if (finfo.exists() ) {
333 KMessageBox::information( this, message); 333 KMessageBox::information( this, message);
334 mView->openCalendar( oldFile ); 334 mView->openCalendar( oldFile );
335 qApp->processEvents(); 335 qApp->processEvents();
336 } else { 336 } else {
337 oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); 337 oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics");
338 finfo.setFile( oldFile ); 338 finfo.setFile( oldFile );
339 if (finfo.exists() ) { 339 if (finfo.exists() ) {
340 KMessageBox::information( this, message); 340 KMessageBox::information( this, message);
341 mView->openCalendar( oldFile ); 341 mView->openCalendar( oldFile );
342 qApp->processEvents(); 342 qApp->processEvents();
343 } 343 }
344 } 344 }
345 mView->saveCalendar( defaultFileName() ); 345 mView->saveCalendar( defaultFileName() );
346 newFile = true; 346 newFile = true;
347 } 347 }
348 348
349 QTime neededSaveTime = QDateTime::currentDateTime().time(); 349 QTime neededSaveTime = QDateTime::currentDateTime().time();
350 mView->loadCalendars(); 350 mView->loadCalendars();
351 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); 351 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
352 qDebug("KO: Calendar loading time: %d ms",msNeeded ); 352 qDebug("KO: Calendar loading time: %d ms",msNeeded );
353 353
354 if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) { 354 if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) {
355 KOPrefs::instance()->setAllDefaults(); 355 KOPrefs::instance()->setAllDefaults();
356 } 356 }
357 processIncidenceSelection( 0 ); 357 processIncidenceSelection( 0 );
358 connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), 358 connect( mView, SIGNAL( incidenceSelected( Incidence * ) ),
359 SLOT( processIncidenceSelection( Incidence * ) ) ); 359 SLOT( processIncidenceSelection( Incidence * ) ) );
360 connect( mView, SIGNAL( modifiedChanged( bool ) ), 360 connect( mView, SIGNAL( modifiedChanged( bool ) ),
361 SLOT( slotModifiedChanged( bool ) ) ); 361 SLOT( slotModifiedChanged( bool ) ) );
362 362
363 363
364 connect( mView, SIGNAL( tempDisableBR(bool) ), 364 connect( mView, SIGNAL( tempDisableBR(bool) ),
365 SLOT( disableBR(bool) ) ); 365 SLOT( disableBR(bool) ) );
366 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); 366 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) );
367 mView->setModified( false ); 367 mView->setModified( false );
368 mBlockAtStartup = false; 368 mBlockAtStartup = false;
369 mView->setModified( false ); 369 mView->setModified( false );
370 setCentralWidget( mView ); 370 setCentralWidget( mView );
371 globalFlagBlockStartup = 0; 371 globalFlagBlockStartup = 0;
372 mView->show(); 372 mView->show();
373 delete splash; 373 delete splash;
374 if ( newFile ) 374 if ( newFile )
375 mView->updateConfig(); 375 mView->updateConfig();
376 // qApp->processEvents(); 376 // qApp->processEvents();
377 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); 377 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ());
378 //fillSyncMenu(); 378 //fillSyncMenu();
379 379
380 380
381 connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); 381 connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) );
382 connect(mView , SIGNAL( save() ), this, SLOT( save() ) ); 382 connect(mView , SIGNAL( save() ), this, SLOT( save() ) );
383 connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) ); 383 connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) );
384 connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); 384 connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) );
385 connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); 385 connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) );
386 mSyncManager->setDefaultFileName( sentSyncFile()); 386 mSyncManager->setDefaultFileName( sentSyncFile());
387 connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); 387 connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) );
388 mSyncManager->fillSyncMenu(); 388 mSyncManager->fillSyncMenu();
389 389
390 390
391 391
392 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); 392 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins );
393 if ( showWarning ) { 393 if ( showWarning ) {
394 KMessageBox::information( this, 394 KMessageBox::information( this,
395 "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"); 395 "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");
396 qApp->processEvents(); 396 qApp->processEvents();
397 mView->dialogManager()->showSyncOptions(); 397 mView->dialogManager()->showSyncOptions();
398 } 398 }
399 399
400 //US listen for result adressed from Ka/Pi 400 //US listen for result adressed from Ka/Pi
401#ifndef DESKTOP_VERSION 401#ifndef DESKTOP_VERSION
402 connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); 402 connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & )));
403#endif 403#endif
404#ifndef DESKTOP_VERSION 404#ifndef DESKTOP_VERSION
405 infrared = 0; 405 infrared = 0;
406#endif 406#endif
407 updateFilterToolbar(); 407 updateFilterToolbar();
408 updateWeek( mView->startDate() ); 408 updateWeek( mView->startDate() );
409 connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ), 409 connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ),
410 SLOT( updateWeekNum( const KCal::DateList & ) ) ); 410 SLOT( updateWeekNum( const KCal::DateList & ) ) );
411 mBRdisabled = false; 411 mBRdisabled = false;
412 //toggleBeamReceive(); 412 //toggleBeamReceive();
413 413
414 QTimer::singleShot( 1000, mView, SLOT ( checkFiles() )); 414 QTimer::singleShot( 1000, mView, SLOT ( checkFiles() ));
415} 415}
416MainWindow::~MainWindow() 416MainWindow::~MainWindow()
417{ 417{
418 //qDebug("MainWindow::~MainWindow() "); 418 //qDebug("MainWindow::~MainWindow() ");
419 //save toolbar location 419 //save toolbar location
420 delete mCalendar; 420 delete mCalendar;
421 delete mSyncManager; 421 delete mSyncManager;
422#ifndef DESKTOP_VERSION 422#ifndef DESKTOP_VERSION
423 if ( infrared ) 423 if ( infrared )
424 delete infrared; 424 delete infrared;
425#endif 425#endif
426 426
427 427
428} 428}
429void MainWindow::slotResetFocus() 429void MainWindow::slotResetFocus()
430{ 430{
431 //qDebug(" CalendarView::slotResetFocus() %x %x %x %x", qApp->focusWidget(), menuBar1, mView,iconToolBar); 431 //qDebug(" CalendarView::slotResetFocus() %x %x %x %x", qApp->focusWidget(), menuBar1, mView,iconToolBar);
432 mFocusLoop = 3; 432 mFocusLoop = 3;
433 QTimer::singleShot( 0, this, SLOT(slotResetFocusLoop() )); 433 QTimer::singleShot( 0, this, SLOT(slotResetFocusLoop() ));
434} 434}
435void MainWindow::slotResetFocusLoop() 435void MainWindow::slotResetFocusLoop()
436{ 436{
437 --mFocusLoop; 437 --mFocusLoop;
438 QWidget* fw = mView->viewManager()->currentView(); 438 QWidget* fw = mView->viewManager()->currentView();
439 if ( fw ) { 439 if ( fw ) {
440 //qDebug("loop "); 440 //qDebug("loop ");
441 fw->setFocus(); 441 fw->setFocus();
442 if ( qApp->focusWidget() != fw && mFocusLoop > 0 ) 442 if ( qApp->focusWidget() != fw && mFocusLoop > 0 )
443 QTimer::singleShot( 0, this, SLOT(slotResetFocusLoop() )); 443 QTimer::singleShot( 0, this, SLOT(slotResetFocusLoop() ));
444 } 444 }
445 445
446} 446}
447void MainWindow::disableBR(bool b) 447void MainWindow::disableBR(bool b)
448{ 448{
449#ifndef DESKTOP_VERSION 449#ifndef DESKTOP_VERSION
450 if ( b ) { 450 if ( b ) {
451 if ( infrared ) { 451 if ( infrared ) {
452 toggleBeamReceive(); 452 toggleBeamReceive();
453 mBRdisabled = true; 453 mBRdisabled = true;
454 } 454 }
455 mBRdisabled = true; 455 mBRdisabled = true;
456 } else { 456 } else {
457 if ( mBRdisabled ) { 457 if ( mBRdisabled ) {
458 mBRdisabled = false; 458 mBRdisabled = false;
459 //makes no sense,because other cal ap is probably running 459 //makes no sense,because other cal ap is probably running
460 // toggleBeamReceive(); 460 // toggleBeamReceive();
461 } 461 }
462 } 462 }
463#endif 463#endif
464 464
465} 465}
466bool MainWindow::beamReceiveEnabled() 466bool MainWindow::beamReceiveEnabled()
467{ 467{
468#ifndef DESKTOP_VERSION 468#ifndef DESKTOP_VERSION
469 return ( infrared != 0 ); 469 return ( infrared != 0 );
470#endif 470#endif
471 return false; 471 return false;
472} 472}
473 473
474void MainWindow::toggleBeamReceive() 474void MainWindow::toggleBeamReceive()
475{ 475{
476 if ( mBRdisabled ) 476 if ( mBRdisabled )
477 return; 477 return;
478#ifndef DESKTOP_VERSION 478#ifndef DESKTOP_VERSION
479 if ( infrared ) { 479 if ( infrared ) {
480 qDebug("KO: Disable BeamReceive "); 480 qDebug("KO: Disable BeamReceive ");
481 delete infrared; 481 delete infrared;
482 infrared = 0; 482 infrared = 0;
483 brAction->setOn(false); 483 brAction->setOn(false);
484 return; 484 return;
485 } 485 }
486 qDebug("KO: Enable BeamReceive "); 486 qDebug("KO: Enable BeamReceive ");
487 brAction->setOn(true); 487 brAction->setOn(true);
488 infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ; 488 infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ;
489 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& ))); 489 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& )));
490#endif 490#endif
491} 491}
492void MainWindow::showMaximized () 492void MainWindow::showMaximized ()
493{ 493{
494#ifndef DESKTOP_VERSION 494#ifndef DESKTOP_VERSION
495 if ( ! globalFlagBlockStartup ) 495 if ( ! globalFlagBlockStartup )
496 if ( mClosed ) 496 if ( mClosed )
497 mView->goToday(); 497 mView->goToday();
498#endif 498#endif
499 QWidget::showMaximized () ; 499 QWidget::showMaximized () ;
500 mClosed = false; 500 mClosed = false;
501} 501}
502void MainWindow::closeEvent( QCloseEvent* ce ) 502void MainWindow::closeEvent( QCloseEvent* ce )
503{ 503{
504 504
505 505
506 506
507 if ( ! KOPrefs::instance()->mAskForQuit ) { 507 if ( ! KOPrefs::instance()->mAskForQuit ) {
508 saveOnClose(); 508 saveOnClose();
509 mClosed = true; 509 mClosed = true;
510 ce->accept(); 510 ce->accept();
511 return; 511 return;
512 512
513 } 513 }
514 514
515 switch( QMessageBox::information( this, "KO/Pi", 515 switch( QMessageBox::information( this, "KO/Pi",
516 i18n("Do you really want\nto close KO/Pi?"), 516 i18n("Do you really want\nto close KO/Pi?"),
517 i18n("Close"), i18n("No"), 517 i18n("Close"), i18n("No"),
518 0, 0 ) ) { 518 0, 0 ) ) {
519 case 0: 519 case 0:
520 saveOnClose(); 520 saveOnClose();
521 mClosed = true; 521 mClosed = true;
522 ce->accept(); 522 ce->accept();
523 break; 523 break;
524 case 1: 524 case 1:
525 ce->ignore(); 525 ce->ignore();
526 break; 526 break;
527 case 2: 527 case 2:
528 528
529 default: 529 default:
530 break; 530 break;
531 } 531 }
532 532
533 533
534} 534}
535 535
536void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) 536void MainWindow::recieve( const QCString& cmsg, const QByteArray& data )
537{ 537{
538 QDataStream stream( data, IO_ReadOnly ); 538 QDataStream stream( data, IO_ReadOnly );
539 // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); 539 // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" );
540 //QString datamess; 540 //QString datamess;
541 //qDebug("message "); 541 //qDebug("message ");
542 qDebug("KO: QCOP message received: %s ", cmsg.data() ); 542 qDebug("KO: QCOP message received: %s ", cmsg.data() );
543 543
544 if ( cmsg == "setDocument(QString)" ) { 544 if ( cmsg == "setDocument(QString)" ) {
545 QDataStream stream( data, IO_ReadOnly ); 545 QDataStream stream( data, IO_ReadOnly );
546 QString fileName; 546 QString fileName;
547 stream >> fileName; 547 stream >> fileName;
548 //qDebug("filename %s ", fileName.latin1()); 548 //qDebug("filename %s ", fileName.latin1());
549 showMaximized(); 549 showMaximized();
550 raise(); 550 raise();
551 KOPrefs::instance()->mLastSyncedLocalFile = fileName ; 551 KOPrefs::instance()->mLastSyncedLocalFile = fileName ;
552 mSyncManager->slotSyncMenu( 1002 ); 552 mSyncManager->slotSyncMenu( 1002 );
553 return; 553 return;
554 } 554 }
555 555
556 if ( cmsg == "-writeFile" ) { 556 if ( cmsg == "-writeFile" ) {
557 // I made from the "-writeFile" an "-writeAlarm" 557 // I made from the "-writeFile" an "-writeAlarm"
558 mView->viewManager()->showWhatsNextView(); 558 mView->viewManager()->showWhatsNextView();
559 mCalendar->checkAlarmForIncidence( 0, true); 559 mCalendar->checkAlarmForIncidence( 0, true);
560 showMaximized(); 560 showMaximized();
561 raise(); 561 raise();
562 return; 562 return;
563 563
564 } 564 }
565 if ( cmsg == "-writeFileSilent" ) { 565 if ( cmsg == "-writeFileSilent" ) {
566 // I made from the "-writeFile" an "-writeAlarm" 566 // I made from the "-writeFile" an "-writeAlarm"
567 // mView->viewManager()->showWhatsNextView(); 567 // mView->viewManager()->showWhatsNextView();
568 mCalendar->checkAlarmForIncidence( 0, true); 568 mCalendar->checkAlarmForIncidence( 0, true);
569 //showMaximized(); 569 //showMaximized();
570 //raise(); 570 //raise();
571 hide(); 571 hide();
572 return; 572 return;
573 } 573 }
574 if ( cmsg == "-newCountdown" ) { 574 if ( cmsg == "-newCountdown" ) {
575 qDebug("newCountdown "); 575 qDebug("newCountdown ");
576 576
577 } 577 }
578 QString msg ; 578 QString msg ;
579 QString allmsg = cmsg; 579 QString allmsg = cmsg;
580 while ( allmsg.length() > 0 ) { 580 while ( allmsg.length() > 0 ) {
581 int nextC = allmsg.find( "-", 1 ); 581 int nextC = allmsg.find( "-", 1 );
582 if ( nextC == -1 ) { 582 if ( nextC == -1 ) {
583 msg = allmsg; 583 msg = allmsg;
584 allmsg = ""; 584 allmsg = "";
585 } else{ 585 } else{
586 msg = allmsg.left( nextC ); 586 msg = allmsg.left( nextC );
587 allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); 587 allmsg = allmsg.mid( nextC, allmsg.length()-nextC );
588 } 588 }
589 //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); 589 //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() );
590 if ( msg == "-newEvent" ) { 590 if ( msg == "-newEvent" ) {
591 QTimer::singleShot( 0, mView, SLOT ( newEvent())); 591 QTimer::singleShot( 0, mView, SLOT ( newEvent()));
592 } 592 }
593 if ( msg == "-newTodo" ) { 593 if ( msg == "-newTodo" ) {
594 QTimer::singleShot( 0, mView, SLOT ( newTodo())); 594 QTimer::singleShot( 0, mView, SLOT ( newTodo()));
595 } 595 }
596 if ( msg == "-showWN" ) { 596 if ( msg == "-showWN" ) {
597 mView->viewManager()->showWhatsNextView(); 597 mView->viewManager()->showWhatsNextView();
598 } 598 }
599 if ( msg == "-showTodo" ) { 599 if ( msg == "-showTodo" ) {
600 mView->viewManager()->showTodoView(); 600 mView->viewManager()->showTodoView();
601 } 601 }
602 if ( msg == "-showList" ) { 602 if ( msg == "-showList" ) {
603 mView->viewManager()->showListView(); 603 mView->viewManager()->showListView();
604 } 604 }
605 else if ( msg == "-showDay" ) { 605 else if ( msg == "-showDay" ) {
606 mView->viewManager()->showDayView(); 606 mView->viewManager()->showDayView();
607 } 607 }
608 else if ( msg == "-showWWeek" ) { 608 else if ( msg == "-showWWeek" ) {
609 mView->viewManager()->showWorkWeekView(); 609 mView->viewManager()->showWorkWeekView();
610 } 610 }
611 else if ( msg == "-ringSync" ) { 611 else if ( msg == "-ringSync" ) {
612 QTimer::singleShot( 0, this, SLOT (startMultiSync())); 612 QTimer::singleShot( 0, this, SLOT (startMultiSync()));
613 } 613 }
614 else if ( msg == "-showWeek" ) { 614 else if ( msg == "-showWeek" ) {
615 mView->viewManager()->showWeekView(); 615 mView->viewManager()->showWeekView();
616 } 616 }
617 else if ( msg == "-showTodo" ) { 617 else if ( msg == "-showTodo" ) {
618 mView->viewManager()->showTodoView(); 618 mView->viewManager()->showTodoView();
619 } 619 }
620 else if ( msg == "-showJournal" ) { 620 else if ( msg == "-showJournal" ) {
621 mView->dateNavigator()->selectDates( 1 ); 621 mView->dateNavigator()->selectDates( 1 );
622 mView->dateNavigator()->selectToday(); 622 mView->dateNavigator()->selectToday();
623 mView->viewManager()->showJournalView(); 623 mView->viewManager()->showJournalView();
624 } 624 }
625 else if ( msg == "-showKO" ) { 625 else if ( msg == "-showKO" ) {
626 mView->viewManager()->showNextXView(); 626 mView->viewManager()->showNextXView();
627 } 627 }
628 else if ( msg == "-showWNext" ) { 628 else if ( msg == "-showWNext" ) {
629 mView->viewManager()->showWhatsNextView(); 629 mView->viewManager()->showWhatsNextView();
630 } 630 }
631 else if ( msg == "nextView()" ) { 631 else if ( msg == "nextView()" ) {
632 mView->viewManager()->showNextView(); 632 mView->viewManager()->showNextView();
633 } 633 }
634 else if ( msg == "-showNextXView" ) { 634 else if ( msg == "-showNextXView" ) {
635 mView->viewManager()->showNextXView(); 635 mView->viewManager()->showNextXView();
636 } 636 }
637 637
638 638
639 } 639 }
640 640
641 showMaximized(); 641 showMaximized();
642 raise(); 642 raise();
643} 643}
644void MainWindow::startMultiSync() 644void MainWindow::startMultiSync()
645{ 645{
646 QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!"); 646 QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!");
647 if ( QMessageBox::information( this, i18n("KDE-Pim Sync"), 647 if ( QMessageBox::information( this, i18n("KDE-Pim Sync"),
648 question, 648 question,
649 i18n("Yes"), i18n("No"), 649 i18n("Yes"), i18n("No"),
650 0, 0 ) != 0 ) { 650 0, 0 ) != 0 ) {
651 setCaption(i18n("Aborted! Nothing synced!")); 651 setCaption(i18n("Aborted! Nothing synced!"));
652 return; 652 return;
653 } 653 }
654 mSyncManager->multiSync( false ); 654 mSyncManager->multiSync( false );
655#ifndef DESKTOP_VERSION 655#ifndef DESKTOP_VERSION
656 QCopEnvelope e("QPE/Application/kapi", "doRingSync"); 656 QCopEnvelope e("QPE/Application/kapi", "doRingSync");
657#endif 657#endif
658} 658}
659QPixmap MainWindow::loadPixmap( QString name ) 659QPixmap MainWindow::loadPixmap( QString name )
660{ 660{
661 return SmallIcon( name ); 661 return SmallIcon( name );
662 662
663} 663}
664void MainWindow::setUsesBigPixmaps ( bool b ) 664void MainWindow::setUsesBigPixmaps ( bool b )
665{ 665{
666 qDebug("KO: MainWindow::setUsesBigPixmaps %d called", b); 666 qDebug("KO: MainWindow::setUsesBigPixmaps %d called", b);
667 if ( b ) 667 if ( b )
668 qDebug("KO: BigPixmaps are not supported "); 668 qDebug("KO: BigPixmaps are not supported ");
669} 669}
670void MainWindow::initActions() 670void MainWindow::initActions()
671{ 671{
672 //KOPrefs::instance()->mShowFullMenu 672 //KOPrefs::instance()->mShowFullMenu
673 iconToolBar->clear(); 673 iconToolBar->clear();
674 KOPrefs *p = KOPrefs::instance(); 674 KOPrefs *p = KOPrefs::instance();
675 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); 675 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar );
676 676
677 QPopupMenu *viewMenu = new QPopupMenu( this ); 677 QPopupMenu *viewMenu = new QPopupMenu( this );
678 QPopupMenu *actionMenu = new QPopupMenu( this ); 678 QPopupMenu *actionMenu = new QPopupMenu( this );
679 mCurrentItemMenu = new QPopupMenu ( this ); 679 mCurrentItemMenu = new QPopupMenu ( this );
680 QPopupMenu *nextConflictMenu = new QPopupMenu ( this ); 680 QPopupMenu *nextConflictMenu = new QPopupMenu ( this );
681 QPopupMenu *importMenu = new QPopupMenu( this ); 681 QPopupMenu *importMenu = new QPopupMenu( this );
682 QPopupMenu *importMenu_X = new QPopupMenu( this ); 682 QPopupMenu *importMenu_X = new QPopupMenu( this );
683 QPopupMenu *exportMenu_X = new QPopupMenu( this ); 683 QPopupMenu *exportMenu_X = new QPopupMenu( this );
684 QPopupMenu *beamMenu_X = new QPopupMenu( this ); 684 QPopupMenu *beamMenu_X = new QPopupMenu( this );
685 selectFilterMenu = new QPopupMenu( this ); 685 selectFilterMenu = new QPopupMenu( this );
686 selectFilterMenu->setCheckable( true ); 686 selectFilterMenu->setCheckable( true );
687 syncMenu = new QPopupMenu( this ); 687 syncMenu = new QPopupMenu( this );
688 configureAgendaMenu = new QPopupMenu( this ); 688 configureAgendaMenu = new QPopupMenu( this );
689 configureToolBarMenu = new QPopupMenu( this ); 689 configureToolBarMenu = new QPopupMenu( this );
690 QPopupMenu *helpMenu = new QPopupMenu( this ); 690 QPopupMenu *helpMenu = new QPopupMenu( this );
691 QIconSet icon; 691 QIconSet icon;
692 int pixWid = 22, pixHei = 22; 692 int pixWid = 22, pixHei = 22;
693 QString pathString = ""; 693 QString pathString = "";
694 if ( !p->mToolBarMiniIcons ) { 694 if ( !p->mToolBarMiniIcons ) {
695 if ( QApplication::desktop()->width() < 480 /*|| QApplication::desktop()->height() < 320*/) { 695 if ( QApplication::desktop()->width() < 480 /*|| QApplication::desktop()->height() < 320*/) {
696 pathString += "icons16/"; 696 pathString += "icons16/";
697 pixWid = 18; pixHei = 16; 697 pixWid = 18; pixHei = 16;
698 } 698 }
699 } else { 699 } else {
700 pathString += "iconsmini/"; 700 pathString += "iconsmini/";
701 pixWid = 18; pixHei = 16; 701 pixWid = 18; pixHei = 16;
702 } 702 }
703 703
704 if ( KOPrefs::instance()->mShowFullMenu ) { 704 if ( KOPrefs::instance()->mShowFullMenu ) {
705 menuBar1 = new KMenuBar( this );//menuBar(); 705 menuBar1 = new KMenuBar( this );//menuBar();
706 //setMenuBar( menuBar1 ); 706 //setMenuBar( menuBar1 );
707 menuBar1->show(); 707 menuBar1->show();
708 menuBar1->insertItem( i18n("File"), importMenu ); 708 menuBar1->insertItem( i18n("File"), importMenu );
709 menuBar1->insertItem( i18n("View"), viewMenu ); 709 menuBar1->insertItem( i18n("View"), viewMenu );
710 menuBar1->insertItem( i18n("Edit"), mCurrentItemMenu ); 710 menuBar1->insertItem( i18n("Edit"), mCurrentItemMenu );
711 menuBar1->insertItem( i18n("Action"), actionMenu ); 711 menuBar1->insertItem( i18n("Action"), actionMenu );
712#ifdef DESKTOP_VERSION 712#ifdef DESKTOP_VERSION
713 menuBar1->insertItem( i18n("Synchronize"), syncMenu ); 713 menuBar1->insertItem( i18n("Synchronize"), syncMenu );
714 menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); 714 menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu );
715#else 715#else
716 menuBar1->insertItem( i18n("Sync"), syncMenu ); 716 menuBar1->insertItem( i18n("Sync"), syncMenu );
717 menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu ); 717 menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu );
718#endif 718#endif
719 //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); 719 //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu );
720 menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); 720 menuBar1->insertItem( i18n("Filter"),selectFilterMenu );
721 menuBar1->insertItem( i18n("Help"), helpMenu ); 721 menuBar1->insertItem( i18n("Help"), helpMenu );
722 } else { 722 } else {
723 menuBar1 = new KMenuBar( iconToolBar ); 723 menuBar1 = new KMenuBar( iconToolBar );
724 QPopupMenu *menuBar = new QPopupMenu( this ); 724 QPopupMenu *menuBar = new QPopupMenu( this );
725 icon = loadPixmap( pathString + "z_menu" ); 725 icon = loadPixmap( pathString + "z_menu" );
726 menuBar1->insertItem( icon.pixmap(), menuBar); 726 menuBar1->insertItem( icon.pixmap(), menuBar);
727 //menuBar1->insertItem( i18n("ME"), menuBar); 727 //menuBar1->insertItem( i18n("ME"), menuBar);
728 menuBar->insertItem( i18n("File"), importMenu ); 728 menuBar->insertItem( i18n("File"), importMenu );
729 menuBar->insertItem( i18n("View"), viewMenu ); 729 menuBar->insertItem( i18n("View"), viewMenu );
730 menuBar->insertItem( i18n("Edit"), mCurrentItemMenu ); 730 menuBar->insertItem( i18n("Edit"), mCurrentItemMenu );
731 menuBar->insertItem( i18n("Action"), actionMenu ); 731 menuBar->insertItem( i18n("Action"), actionMenu );
732 menuBar->insertItem( i18n("Synchronize"), syncMenu ); 732 menuBar->insertItem( i18n("Synchronize"), syncMenu );
733 menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); 733 menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu );
734 menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); 734 menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu );
735 menuBar->insertItem( i18n("Filter"),selectFilterMenu ); 735 menuBar->insertItem( i18n("Filter"),selectFilterMenu );
736 menuBar->insertItem( i18n("Help"), helpMenu ); 736 menuBar->insertItem( i18n("Help"), helpMenu );
737 //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); 737 //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() );
738 menuBar1->setMaximumSize( menuBar1->sizeHint( )); 738 menuBar1->setMaximumSize( menuBar1->sizeHint( ));
739 connect ( menuBar, SIGNAL( aboutToHide () ), this, SLOT ( slotResetFocus() ) ); 739 connect ( menuBar, SIGNAL( aboutToHide () ), this, SLOT ( slotResetFocus() ) );
740 } 740 }
741 connect ( menuBar1, SIGNAL( lostFocus () ), this, SLOT ( slotResetFocus() ) ); 741 connect ( menuBar1, SIGNAL( lostFocus () ), this, SLOT ( slotResetFocus() ) );
742 //connect ( menuBar1, SIGNAL( lostFocus () ), this, SLOT ( slotResetFocus() ) ); 742 //connect ( menuBar1, SIGNAL( lostFocus () ), this, SLOT ( slotResetFocus() ) );
743 connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); 743 connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) );
744 connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) ); 744 connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) );
745 745
746 746
747 mWeekBgColor = iconToolBar->backgroundColor(); 747 mWeekBgColor = iconToolBar->backgroundColor();
748 mWeekPixmap.resize( pixWid , pixHei ); 748 mWeekPixmap.resize( pixWid , pixHei );
749 mWeekPixmap.fill( mWeekBgColor ); 749 mWeekPixmap.fill( mWeekBgColor );
750 icon = mWeekPixmap; 750 icon = mWeekPixmap;
751 mWeekAction = new QAction( i18n("Select week number"),icon, i18n("Select week number"), 0, this ); 751 mWeekAction = new QAction( i18n("Select week number"),icon, i18n("Select week number"), 0, this );
752 if ( p-> mShowIconWeekNum ) 752 if ( p-> mShowIconWeekNum )
753 mWeekAction->addTo( iconToolBar ); 753 mWeekAction->addTo( iconToolBar );
754 mWeekFont = font(); 754 mWeekFont = font();
755 755
756 int fontPoint = mWeekFont.pointSize(); 756 int fontPoint = mWeekFont.pointSize();
757 QFontMetrics f( mWeekFont ); 757 QFontMetrics f( mWeekFont );
758 int fontWid = f.width( "30" ); 758 int fontWid = f.width( "30" );
759 while ( fontWid > pixWid ) { 759 while ( fontWid > pixWid ) {
760 --fontPoint; 760 --fontPoint;
761 mWeekFont.setPointSize( fontPoint ); 761 mWeekFont.setPointSize( fontPoint );
762 QFontMetrics f( mWeekFont ); 762 QFontMetrics f( mWeekFont );
763 fontWid = f.width( "30" ); 763 fontWid = f.width( "30" );
764 //qDebug("dec-- "); 764 //qDebug("dec-- ");
765 } 765 }
766 766
767 connect( mWeekAction, SIGNAL( activated() ), 767 connect( mWeekAction, SIGNAL( activated() ),
768 this, SLOT( weekAction() ) ); 768 this, SLOT( weekAction() ) );
769 769
770 connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) ); 770 connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) );
771 if ( p->mShowIconFilterview ) { 771 if ( p->mShowIconFilterview ) {
772 icon = loadPixmap( pathString + "filter" ); 772 icon = loadPixmap( pathString + "filter" );
773 actionFilterMenuTB = new QAction( i18n("Filter selector"), icon, i18n("Filter selector"), 0, this ); 773 actionFilterMenuTB = new QAction( i18n("Filter selector"), icon, i18n("Filter selector"), 0, this );
774 connect( actionFilterMenuTB, SIGNAL( activated() ), 774 connect( actionFilterMenuTB, SIGNAL( activated() ),
775 this, SLOT( fillFilterMenuTB() ) ); 775 this, SLOT( fillFilterMenuTB() ) );
776 actionFilterMenuTB->addTo( iconToolBar ); 776 actionFilterMenuTB->addTo( iconToolBar );
777 selectFilterMenuTB = new QPopupMenu( this ); 777 selectFilterMenuTB = new QPopupMenu( this );
778 selectFilterMenuTB->setCheckable( true ); 778 selectFilterMenuTB->setCheckable( true );
779 connect ( selectFilterMenuTB, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); 779 connect ( selectFilterMenuTB, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) );
780 } 780 }
781 781
782 //#endif 782 //#endif
783 // ****************** 783 // ******************
784 QAction *action; 784 QAction *action;
785 // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); 785 // QPopupMenu *configureMenu= new QPopupMenu( menuBar );
786 configureToolBarMenu->setCheckable( true ); 786 configureToolBarMenu->setCheckable( true );
787 787
788 788
789 configureAgendaMenu->setCheckable( true ); 789 configureAgendaMenu->setCheckable( true );
790 int iii ; 790 int iii ;
791 for ( iii = 1;iii<= 10 ;++iii ){ 791 for ( iii = 1;iii<= 10 ;++iii ){
792 configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 ); 792 configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 );
793 } 793 }
794 //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); 794 //configureMenu->insertItem( "AgendaSize",configureAgendaMenu );
795 795
796 connect( configureAgendaMenu, SIGNAL( aboutToShow()), 796 connect( configureAgendaMenu, SIGNAL( aboutToShow()),
797 this, SLOT( showConfigureAgenda( ) ) ); 797 this, SLOT( showConfigureAgenda( ) ) );
798 icon = loadPixmap( pathString + "today" ); 798 icon = loadPixmap( pathString + "today" );
799 QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); 799 QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this );
800 today_action->addTo( actionMenu ); 800 today_action->addTo( actionMenu );
801 connect( today_action, SIGNAL( activated() ), 801 connect( today_action, SIGNAL( activated() ),
802 mView, SLOT( goToday() ) ); 802 mView, SLOT( goToday() ) );
803 803
804 icon = loadPixmap( pathString + "picker" ); 804 icon = loadPixmap( pathString + "picker" );
805 QAction* dPickerAction = new QAction( i18n("Select Date..."), icon, i18n("Select Date..."), 0, this ); 805 QAction* dPickerAction = new QAction( i18n("Select Date..."), icon, i18n("Select Date..."), 0, this );
806 dPickerAction->addTo( actionMenu ); 806 dPickerAction->addTo( actionMenu );
807 connect( dPickerAction, SIGNAL( activated() ), 807 connect( dPickerAction, SIGNAL( activated() ),
808 mView, SLOT( showDatePicker() ) ); 808 mView, SLOT( showDatePicker() ) );
809 809
810 icon = loadPixmap( pathString + "search" ); 810 icon = loadPixmap( pathString + "search" );
811 QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); 811 QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this );
812 search_action->addTo( actionMenu ); 812 search_action->addTo( actionMenu );
813 connect( search_action, SIGNAL( activated() ), 813 connect( search_action, SIGNAL( activated() ),
814 mView->dialogManager(), SLOT( showSearchDialog() ) ); 814 mView->dialogManager(), SLOT( showSearchDialog() ) );
815 actionMenu->insertItem( i18n("Show next conflict for"), nextConflictMenu ); 815 actionMenu->insertItem( i18n("Show next conflict for"), nextConflictMenu );
816 816
817 action = new QAction( "Undo Delete", i18n("All events"), 0, this ); 817 action = new QAction( "Undo Delete", i18n("All events"), 0, this );
818 action->addTo( nextConflictMenu ); 818 action->addTo( nextConflictMenu );
819 connect( action, SIGNAL( activated() ), 819 connect( action, SIGNAL( activated() ),
820 mView, SLOT( conflictAll() ) ); 820 mView, SLOT( conflictAll() ) );
821 821
822 action = new QAction( "Undo Delete", i18n("Allday events"), 0, this ); 822 action = new QAction( "Undo Delete", i18n("Allday events"), 0, this );
823 action->addTo( nextConflictMenu ); 823 action->addTo( nextConflictMenu );
824 connect( action, SIGNAL( activated() ), 824 connect( action, SIGNAL( activated() ),
825 mView, SLOT( conflictAllday() ) ); 825 mView, SLOT( conflictAllday() ) );
826 826
827 action = new QAction( "Undo Delete", i18n("Events with time"), 0, this ); 827 action = new QAction( "Undo Delete", i18n("Events with time"), 0, this );
828 action->addTo( nextConflictMenu ); 828 action->addTo( nextConflictMenu );
829 connect( action, SIGNAL( activated() ), 829 connect( action, SIGNAL( activated() ),
830 mView, SLOT( conflictNotAll() ) ); 830 mView, SLOT( conflictNotAll() ) );
831 831
832 actionMenu->insertSeparator(); 832 actionMenu->insertSeparator();
833 833
834 icon = loadPixmap( pathString + "newevent" ); 834 icon = loadPixmap( pathString + "newevent" );
835 QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); 835 QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this );
836 ne_action->addTo( mCurrentItemMenu ); 836 ne_action->addTo( mCurrentItemMenu );
837 connect( ne_action, SIGNAL( activated() ), 837 connect( ne_action, SIGNAL( activated() ),
838 mView, SLOT( newEvent() ) ); 838 mView, SLOT( newEvent() ) );
839 icon = loadPixmap( pathString + "newtodo" ); 839 icon = loadPixmap( pathString + "newtodo" );
840 configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 );
841 QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); 840 QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this );
842 nt_action->addTo( mCurrentItemMenu ); 841 nt_action->addTo( mCurrentItemMenu );
843 connect( nt_action, SIGNAL( activated() ), 842 connect( nt_action, SIGNAL( activated() ),
844 mView, SLOT( newTodo() ) ); 843 mView, SLOT( newTodo() ) );
845 mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0, 844 mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0,
846 this ); 845 this );
847 mNewSubTodoAction->addTo( mCurrentItemMenu ); 846 mNewSubTodoAction->addTo( mCurrentItemMenu );
848 connect( mNewSubTodoAction, SIGNAL( activated() ), 847 connect( mNewSubTodoAction, SIGNAL( activated() ),
849 mView, SLOT( newSubTodo() ) ); 848 mView, SLOT( newSubTodo() ) );
850 849
851 mCurrentItemMenu->insertSeparator(); 850 mCurrentItemMenu->insertSeparator();
852 icon = loadPixmap( pathString + "newevent" ); 851 icon = loadPixmap( pathString + "newevent" );
853 configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); 852 configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 );
854 configureToolBarMenu->insertItem(i18n("Only one toolbar"), 6 ); 853 configureToolBarMenu->insertItem(i18n("Only one toolbar"), 6 );
855 configureToolBarMenu->insertSeparator(); 854 configureToolBarMenu->insertSeparator();
856 configureToolBarMenu->insertItem(i18n("Filtermenu"), 7 ); 855 configureToolBarMenu->insertItem(i18n("Filtermenu"), 7 );
857 configureToolBarMenu->insertSeparator(); 856 configureToolBarMenu->insertSeparator();
858 configureToolBarMenu->insertItem(i18n("Week Number"), 400); 857 configureToolBarMenu->insertItem(i18n("Week Number"), 400);
859 configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); 858 configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 );
859 icon = loadPixmap( pathString + "newtodo" );
860 configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 );
860 861
861 //actionMenu->insertItem ( i18n("Selected Item"), mCurrentItemMenu); 862 //actionMenu->insertItem ( i18n("Selected Item"), mCurrentItemMenu);
862 mShowAction = new QAction( "show_incidence", i18n("Show"), 0, this ); 863 mShowAction = new QAction( "show_incidence", i18n("Show"), 0, this );
863 mShowAction->addTo( mCurrentItemMenu ); 864 mShowAction->addTo( mCurrentItemMenu );
864 connect( mShowAction, SIGNAL( activated() ), 865 connect( mShowAction, SIGNAL( activated() ),
865 mView, SLOT( showIncidence() ) ); 866 mView, SLOT( showIncidence() ) );
866 867
867 mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); 868 mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this );
868 mEditAction->addTo( mCurrentItemMenu ); 869 mEditAction->addTo( mCurrentItemMenu );
869 connect( mEditAction, SIGNAL( activated() ), 870 connect( mEditAction, SIGNAL( activated() ),
870 mView, SLOT( editIncidence() ) ); 871 mView, SLOT( editIncidence() ) );
871 872
872 mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); 873 mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this );
873 mDeleteAction->addTo( mCurrentItemMenu ); 874 mDeleteAction->addTo( mCurrentItemMenu );
874 connect( mDeleteAction, SIGNAL( activated() ), 875 connect( mDeleteAction, SIGNAL( activated() ),
875 mView, SLOT( deleteIncidence() ) ); 876 mView, SLOT( deleteIncidence() ) );
876 877
877 878
878 mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this ); 879 mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this );
879 mCloneAction->addTo( mCurrentItemMenu ); 880 mCloneAction->addTo( mCurrentItemMenu );
880 connect( mCloneAction, SIGNAL( activated() ), 881 connect( mCloneAction, SIGNAL( activated() ),
881 mView, SLOT( cloneIncidence() ) ); 882 mView, SLOT( cloneIncidence() ) );
882 mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this ); 883 mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this );
883 mMoveAction->addTo( mCurrentItemMenu ); 884 mMoveAction->addTo( mCurrentItemMenu );
884 connect( mMoveAction, SIGNAL( activated() ), 885 connect( mMoveAction, SIGNAL( activated() ),
885 mView, SLOT( moveIncidence() ) ); 886 mView, SLOT( moveIncidence() ) );
886#ifndef DESKTOP_VERSION 887#ifndef DESKTOP_VERSION
887 mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this ); 888 mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this );
888 mBeamAction->addTo(mCurrentItemMenu ); 889 mBeamAction->addTo(mCurrentItemMenu );
889 connect( mBeamAction, SIGNAL( activated() ), 890 connect( mBeamAction, SIGNAL( activated() ),
890 mView, SLOT( beamIncidence() ) ); 891 mView, SLOT( beamIncidence() ) );
891#endif 892#endif
892 mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this ); 893 mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this );
893 mCancelAction->addTo( mCurrentItemMenu ); 894 mCancelAction->addTo( mCurrentItemMenu );
894 connect( mCancelAction, SIGNAL( activated() ), 895 connect( mCancelAction, SIGNAL( activated() ),
895 mView, SLOT( toggleCancelIncidence() ) ); 896 mView, SLOT( toggleCancelIncidence() ) );
896 897
897 898
898 mCurrentItemMenu->insertSeparator(); 899 mCurrentItemMenu->insertSeparator();
899 action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this ); 900 action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this );
900 action->addTo( mCurrentItemMenu ); 901 action->addTo( mCurrentItemMenu );
901 connect( action, SIGNAL( activated() ), 902 connect( action, SIGNAL( activated() ),
902 mView, SLOT( undo_delete() ) ); 903 mView, SLOT( undo_delete() ) );
903 904
904 // *********************** 905 // ***********************
905 if ( KOPrefs::instance()->mVerticalScreen ) { 906 if ( KOPrefs::instance()->mVerticalScreen ) {
906 icon = SmallIcon( "1updownarrow" ); 907 icon = SmallIcon( "1updownarrow" );
907 } else { 908 } else {
908 icon = SmallIcon("1leftrightarrow" ); 909 icon = SmallIcon("1leftrightarrow" );
909 } 910 }
910 configureToolBarMenu->insertItem(icon, i18n("Toggle Fullscreen"), 28 ); 911 configureToolBarMenu->insertItem(icon, i18n("Toggle Fullscreen"), 28 );
911 QAction* FSaction = new QAction( i18n("Toggle Fullscreen"), icon, i18n("Toggle Fullscreen"), 0, this ); 912 QAction* FSaction = new QAction( i18n("Toggle Fullscreen"), icon, i18n("Toggle Fullscreen"), 0, this );
912 FSaction->addTo( viewMenu ); 913 FSaction->addTo( viewMenu );
913 connect( FSaction, SIGNAL( activated() ), mView, SLOT( toggleExpand() )); 914 connect( FSaction, SIGNAL( activated() ), mView, SLOT( toggleExpand() ));
914 915
915 916
916 icon = loadPixmap( pathString + "filter" ); 917 icon = loadPixmap( pathString + "filter" );
917 configureToolBarMenu->insertItem(icon, i18n("Filter menu icon"), 26 ); 918 configureToolBarMenu->insertItem(icon, i18n("Filter menu icon"), 26 );
918 icon = loadPixmap( pathString + "configure" ); 919 icon = loadPixmap( pathString + "configure" );
919 action = new QAction( i18n("Toggle Resource View"), icon, i18n("Toggle Resource View"), 0, this ); 920 action = new QAction( i18n("Toggle Resource View"), icon, i18n("Toggle Resource View"), 0, this );
920 action->addTo( viewMenu ); 921 action->addTo( viewMenu );
921 connect( action, SIGNAL( activated() ), 922 connect( action, SIGNAL( activated() ),
922 mView, SLOT( toggleFilter() ) ); 923 mView, SLOT( toggleFilter() ) );
923 mToggleFilter = action; 924 mToggleFilter = action;
924 icon = loadPixmap( pathString + "navi" ); 925 icon = loadPixmap( pathString + "navi" );
925 configureToolBarMenu->insertItem(icon, i18n("Toggle DateNavigator"), 22 ); 926 configureToolBarMenu->insertItem(icon, i18n("Toggle DateNavigator"), 22 );
926 action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); 927 action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this );
927 action->addTo( viewMenu ); 928 action->addTo( viewMenu );
928 connect( action, SIGNAL( activated() ), 929 connect( action, SIGNAL( activated() ),
929 mView, SLOT( toggleDateNavigatorWidget() ) ); 930 mView, SLOT( toggleDateNavigatorWidget() ) );
930 mToggleNav = action ; 931 mToggleNav = action ;
931 icon = loadPixmap( pathString + "allday" ); 932 icon = loadPixmap( pathString + "allday" );
932 configureToolBarMenu->insertItem(icon, i18n("Toggle Allday"), 24 ); 933 configureToolBarMenu->insertItem(icon, i18n("Toggle Allday"), 24 );
933 action = new QAction( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this ); 934 action = new QAction( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this );
934 action->addTo( viewMenu ); 935 action->addTo( viewMenu );
935 connect( action, SIGNAL( activated() ), 936 connect( action, SIGNAL( activated() ),
936 mView, SLOT( toggleAllDaySize() ) ); 937 mView, SLOT( toggleAllDaySize() ) );
937 mToggleAllday = action; 938 mToggleAllday = action;
938 939
939 940
940 connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), 941 connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ),
941 mToggleNav, SLOT( setEnabled ( bool ) ) ); 942 mToggleNav, SLOT( setEnabled ( bool ) ) );
942 //connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), 943 //connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ),
943 // mToggleFilter, SLOT( setEnabled ( bool ) ) ); 944 // mToggleFilter, SLOT( setEnabled ( bool ) ) );
944 connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ), 945 connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ),
945 mToggleAllday, SLOT( setEnabled ( bool ) ) ); 946 mToggleAllday, SLOT( setEnabled ( bool ) ) );
946 // connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ), 947 // connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ),
947 // configureAgendaMenu, SLOT( setEnabled ( bool ) ) ); 948 // configureAgendaMenu, SLOT( setEnabled ( bool ) ) );
948 949
949 950
950 dPickerAction->addTo( iconToolBar ); 951 dPickerAction->addTo( iconToolBar );
951 viewMenu->insertSeparator(); 952 viewMenu->insertSeparator();
952 953
953 if ( p-> mShowIconToggleFull ) 954 if ( p-> mShowIconToggleFull )
954 FSaction->addTo( iconToolBar ); 955 FSaction->addTo( iconToolBar );
955 if ( p->mShowIconNavigator ) mToggleNav ->addTo( iconToolBar ); 956 if ( p->mShowIconNavigator ) mToggleNav ->addTo( iconToolBar );
956 957
957 //******************** 958 //********************
958 if ( p->mShowIconAllday ) mToggleAllday->addTo( iconToolBar ); 959 if ( p->mShowIconAllday ) mToggleAllday->addTo( iconToolBar );
959 960
960 961
961 icon = loadPixmap( pathString + "whatsnext" ); 962 icon = loadPixmap( pathString + "whatsnext" );
962 configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110 ); 963 configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110 );
963 QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this ); 964 QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this );
964 whatsnext_action->addTo( viewMenu ); 965 whatsnext_action->addTo( viewMenu );
965 connect( whatsnext_action, SIGNAL( activated() ), 966 connect( whatsnext_action, SIGNAL( activated() ),
966 mView->viewManager(), SLOT( showWhatsNextView() ) ); 967 mView->viewManager(), SLOT( showWhatsNextView() ) );
967 968
968 icon = loadPixmap( pathString + "xdays" ); 969 icon = loadPixmap( pathString + "xdays" );
969 configureToolBarMenu->insertItem(icon, i18n("Next days"), 100 ); 970 configureToolBarMenu->insertItem(icon, i18n("Next days"), 100 );
970 QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this ); 971 QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this );
971 xdays_action->addTo( viewMenu ); 972 xdays_action->addTo( viewMenu );
972 connect( xdays_action, SIGNAL( activated() ), 973 connect( xdays_action, SIGNAL( activated() ),
973 mView->viewManager(), SLOT( showNextXView() ) ); 974 mView->viewManager(), SLOT( showNextXView() ) );
974 975
975 976
976 icon = loadPixmap( pathString + "journal" ); 977 icon = loadPixmap( pathString + "journal" );
977 configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 ); 978 configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 );
978 QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this ); 979 QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this );
979 viewjournal_action->addTo( viewMenu ); 980 viewjournal_action->addTo( viewMenu );
980 connect( viewjournal_action, SIGNAL( activated() ), 981 connect( viewjournal_action, SIGNAL( activated() ),
981 mView->viewManager(), SLOT( showJournalView() ) ); 982 mView->viewManager(), SLOT( showJournalView() ) );
982 983
983 984
984 icon = loadPixmap( pathString + "day" ); 985 icon = loadPixmap( pathString + "day" );
985 configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 ); 986 configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 );
986 QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this ); 987 QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this );
987 day1_action->addTo( viewMenu ); 988 day1_action->addTo( viewMenu );
988 // action->addTo( toolBar ); 989 // action->addTo( toolBar );
989 connect( day1_action, SIGNAL( activated() ), 990 connect( day1_action, SIGNAL( activated() ),
990 mView->viewManager(), SLOT( showDayView() ) ); 991 mView->viewManager(), SLOT( showDayView() ) );
991 992
992 icon = loadPixmap( pathString + "workweek" ); 993 icon = loadPixmap( pathString + "workweek" );
993 configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 ); 994 configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 );
994 QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this ); 995 QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this );
995 day5_action->addTo( viewMenu ); 996 day5_action->addTo( viewMenu );
996 connect( day5_action, SIGNAL( activated() ), 997 connect( day5_action, SIGNAL( activated() ),
997 mView->viewManager(), SLOT( showWorkWeekView() ) ); 998 mView->viewManager(), SLOT( showWorkWeekView() ) );
998 999
999 icon = loadPixmap( pathString + "week" ); 1000 icon = loadPixmap( pathString + "week" );
1000 configureToolBarMenu->insertItem(icon, i18n("Week"), 60 ); 1001 configureToolBarMenu->insertItem(icon, i18n("Week"), 60 );
1001 QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this ); 1002 QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this );
1002 day7_action->addTo( viewMenu ); 1003 day7_action->addTo( viewMenu );
1003 connect( day7_action, SIGNAL( activated() ), 1004 connect( day7_action, SIGNAL( activated() ),
1004 mView->viewManager(), SLOT( showWeekView() ) ); 1005 mView->viewManager(), SLOT( showWeekView() ) );
1005 1006
1006 icon = loadPixmap( pathString + "workweek2" ); 1007 icon = loadPixmap( pathString + "workweek2" );
1007 configureToolBarMenu->insertItem(icon, i18n("List week view"), 75 ); 1008 configureToolBarMenu->insertItem(icon, i18n("List week view"), 75 );
1008 QAction* day6_action = new QAction( i18n("List week"), icon, i18n("List week"), 0, this ); 1009 QAction* day6_action = new QAction( i18n("List week"), icon, i18n("List week"), 0, this );
1009 day6_action->addTo( viewMenu ); 1010 day6_action->addTo( viewMenu );
1010 connect( day6_action, SIGNAL( activated() ), 1011 connect( day6_action, SIGNAL( activated() ),
1011 mView->viewManager(), SLOT( showMonthViewWeek() ) ); 1012 mView->viewManager(), SLOT( showMonthViewWeek() ) );
1012 1013
1013 icon = loadPixmap( pathString + "month" ); 1014 icon = loadPixmap( pathString + "month" );
1014 configureToolBarMenu->insertItem(icon, i18n("Month"), 70 ); 1015 configureToolBarMenu->insertItem(icon, i18n("Month"), 70 );
1015 QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this ); 1016 QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this );
1016 month_action->addTo( viewMenu ); 1017 month_action->addTo( viewMenu );
1017 connect( month_action, SIGNAL( activated() ), 1018 connect( month_action, SIGNAL( activated() ),
1018 mView->viewManager(), SLOT( showMonthView() ) ); 1019 mView->viewManager(), SLOT( showMonthView() ) );
1019 1020
1020 icon = loadPixmap( pathString + "list" ); 1021 icon = loadPixmap( pathString + "list" );
1021 configureToolBarMenu->insertItem(icon, i18n("List View"), 30 ); 1022 configureToolBarMenu->insertItem(icon, i18n("List View"), 30 );
1022 QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this ); 1023 QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this );
1023 showlist_action->addTo( viewMenu ); 1024 showlist_action->addTo( viewMenu );
1024 connect( showlist_action, SIGNAL( activated() ), 1025 connect( showlist_action, SIGNAL( activated() ),
1025 mView->viewManager(), SLOT( showListView() ) ); 1026 mView->viewManager(), SLOT( showListView() ) );
1026 1027
1027 icon = loadPixmap( pathString + "todo" ); 1028 icon = loadPixmap( pathString + "todo" );
1028 configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 ); 1029 configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 );
1029 QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this ); 1030 QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this );
1030 todoview_action->addTo( viewMenu ); 1031 todoview_action->addTo( viewMenu );
1031 connect( todoview_action, SIGNAL( activated() ), 1032 connect( todoview_action, SIGNAL( activated() ),
1032 mView->viewManager(), SLOT( showTodoView() ) ); 1033 mView->viewManager(), SLOT( showTodoView() ) );
1033 1034
1034 1035
1035 1036
1036#if 0 1037#if 0
1037 action = new QAction( "view_timespan", "Time Span", 0, this ); 1038 action = new QAction( "view_timespan", "Time Span", 0, this );
1038 action->addTo( viewMenu ); 1039 action->addTo( viewMenu );
1039 connect( action, SIGNAL( activated() ), 1040 connect( action, SIGNAL( activated() ),
1040 mView->viewManager(), SLOT( showTimeSpanView() ) ); 1041 mView->viewManager(), SLOT( showTimeSpanView() ) );
1041#endif 1042#endif
1042 1043
1043 1044
1044 1045
1045 action = new QAction( "purge_completed", i18n("Purge Completed..."), 0, 1046 action = new QAction( "purge_completed", i18n("Purge Completed..."), 0,
1046 this ); 1047 this );
1047 action->addTo( actionMenu ); 1048 action->addTo( actionMenu );
1048 connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); 1049 connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) );
1049 1050
1050 1051
1052 icon = loadPixmap( pathString + "search" );
1051 configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 5); 1053 configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 5);
1052 1054
1053 1055
1054 1056
1055 actionMenu->insertSeparator(); 1057 actionMenu->insertSeparator();
1056 action = new QAction( "manage cat", i18n("Edit category list..."), 0, 1058 action = new QAction( "manage cat", i18n("Edit category list..."), 0,
1057 this ); 1059 this );
1058 action->addTo( actionMenu ); 1060 action->addTo( actionMenu );
1059 connect( action, SIGNAL( activated() ), mView, SLOT( editCategories() ) ); 1061 connect( action, SIGNAL( activated() ), mView, SLOT( editCategories() ) );
1060 1062
1061 action = new QAction( "manage cat", i18n("Manage new categories..."), 0, 1063 action = new QAction( "manage cat", i18n("Manage new categories..."), 0,
1062 this ); 1064 this );
1063 action->addTo( actionMenu ); 1065 action->addTo( actionMenu );
1064 connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) ); 1066 connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) );
1065 1067
1066 1068
1067 actionMenu->insertSeparator(); 1069 actionMenu->insertSeparator();
1068 icon = loadPixmap( pathString + "configure" ); 1070 icon = loadPixmap( pathString + "configure" );
1069 action = new QAction( i18n("Configure"),icon, i18n("Configure KO/Pi..."), 0, this ); 1071 action = new QAction( i18n("Configure"),icon, i18n("Configure KO/Pi..."), 0, this );
1070 action->addTo( actionMenu ); 1072 action->addTo( actionMenu );
1071 connect( action, SIGNAL( activated() ), 1073 connect( action, SIGNAL( activated() ),
1072 mView, SLOT( edit_options() ) ); 1074 mView, SLOT( edit_options() ) );
1073 action = new QAction( i18n("Configure"),icon, i18n("Configure Calendar Files..."), 0, this ); 1075 action = new QAction( i18n("Configure"),icon, i18n("Configure Calendar Files..."), 0, this );
1074 action->addTo( actionMenu ); 1076 action->addTo( actionMenu );
1075 connect( action, SIGNAL( activated() ), 1077 connect( action, SIGNAL( activated() ),
1076 this, SLOT( calHint() ) ); 1078 this, SLOT( calHint() ) );
1077 action = new QAction( i18n("Configure"),icon, i18n("Global Settings..."), 0, this ); 1079 action = new QAction( i18n("Configure"),icon, i18n("Global Settings..."), 0, this );
1078 action->addTo( actionMenu ); 1080 action->addTo( actionMenu );
1079 connect( action, SIGNAL( activated() ), 1081 connect( action, SIGNAL( activated() ),
1080 mView, SLOT( edit_global_options() ) ); 1082 mView, SLOT( edit_global_options() ) );
1081 if ( KOPrefs::instance()->mShowFullMenu ) { 1083 if ( KOPrefs::instance()->mShowFullMenu ) {
1082 actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu ); 1084 actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu );
1083 1085
1084 } 1086 }
1085 // actionMenu->insertSeparator(); 1087 // actionMenu->insertSeparator();
1086 action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0, 1088 action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0,
1087 this ); 1089 this );
1088 action->addTo( importMenu_X ); 1090 action->addTo( importMenu_X );
1089 connect( action, SIGNAL( activated() ), SLOT( importIcal() ) ); 1091 connect( action, SIGNAL( activated() ), SLOT( importIcal() ) );
1090 action = new QAction( "import_quick", i18n("Import last file"), 0, 1092 action = new QAction( "import_quick", i18n("Import last file"), 0,
1091 this ); 1093 this );
1092 action->addTo( importMenu_X ); 1094 action->addTo( importMenu_X );
1093 connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) ); 1095 connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) );
1094 importMenu_X->insertSeparator(); 1096 importMenu_X->insertSeparator();
1095 action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0, 1097 action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0,
1096 this ); 1098 this );
1097 action->addTo( importMenu_X ); 1099 action->addTo( importMenu_X );
1098 connect( action, SIGNAL( activated() ), SLOT( importBday() ) ); 1100 connect( action, SIGNAL( activated() ), SLOT( importBday() ) );
1099 //#ifndef DESKTOP_VERSION 1101 //#ifndef DESKTOP_VERSION
1100 importMenu_X->insertSeparator(); 1102 importMenu_X->insertSeparator();
1101 action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0, 1103 action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0,
1102 this ); 1104 this );
1103 action->addTo( importMenu_X ); 1105 action->addTo( importMenu_X );
1104 connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) ); 1106 connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) );
1105 //#else 1107 //#else
1106#ifdef _OL_IMPORT_ 1108#ifdef _OL_IMPORT_
1107 importMenu_X->insertSeparator(); 1109 importMenu_X->insertSeparator();
1108 action = new QAction( "import_ol", i18n("Import from OL"), 0, 1110 action = new QAction( "import_ol", i18n("Import from OL"), 0,
1109 this ); 1111 this );
1110 action->addTo( importMenu_X ); 1112 action->addTo( importMenu_X );
1111 connect( action, SIGNAL( activated() ), SLOT( importOL() ) ); 1113 connect( action, SIGNAL( activated() ), SLOT( importOL() ) );
1112#endif 1114#endif
1113 //#endif 1115 //#endif
1114 1116
1115 //importMenu->insertSeparator(); 1117 //importMenu->insertSeparator();
1116#if 0 1118#if 0
1117 action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0, 1119 action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0,
1118 this ); 1120 this );
1119 action->addTo( importMenu ); 1121 action->addTo( importMenu );
1120 connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) ); 1122 connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) );
1121#endif 1123#endif
1122 action = new QAction( "save_cal", i18n("Save Backup..."), 0, 1124 action = new QAction( "save_cal", i18n("Save Backup..."), 0,
1123 this ); 1125 this );
1124 action->addTo( importMenu ); 1126 action->addTo( importMenu );
1125 connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) ); 1127 connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) );
1126 importMenu->insertSeparator(); 1128 importMenu->insertSeparator();
1127 importMenu->insertItem( i18n("Import"), importMenu_X ); 1129 importMenu->insertItem( i18n("Import"), importMenu_X );
1128 //importMenu->insertSeparator(); 1130 //importMenu->insertSeparator();
1129 action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0, 1131 action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0,
1130 this ); 1132 this );
1131 action->addTo( exportMenu_X ); 1133 action->addTo( exportMenu_X );
1132 connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) ); 1134 connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) );
1133 1135
1134 1136
1135 //LR 1137 //LR
1136 QPopupMenu *ex2phone = new QPopupMenu( this ); 1138 QPopupMenu *ex2phone = new QPopupMenu( this );
1137 ex2phone->insertItem(i18n("Complete calendar..."), 1 ); 1139 ex2phone->insertItem(i18n("Complete calendar..."), 1 );
1138 ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); 1140 ex2phone->insertItem(i18n("Filtered calendar..."), 2 );
1139 connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) ); 1141 connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) );
1140 exportMenu_X->insertItem( i18n("Export to phone"), ex2phone ); 1142 exportMenu_X->insertItem( i18n("Export to phone"), ex2phone );
1141 1143
1142 importMenu->insertItem( i18n("Export"), exportMenu_X ); 1144 importMenu->insertItem( i18n("Export"), exportMenu_X );
1143 mPrintSelAction = 0; 1145 mPrintSelAction = 0;
1144#ifndef DESKTOP_VERSION 1146#ifndef DESKTOP_VERSION
1145 //importMenu->insertSeparator(); 1147 //importMenu->insertSeparator();
1146 brAction = new QAction( "beam toggle", i18n("Beam receive enabled"), 0, 1148 brAction = new QAction( "beam toggle", i18n("Beam receive enabled"), 0,
1147 this ); 1149 this );
1148 brAction->addTo( beamMenu_X ); 1150 brAction->addTo( beamMenu_X );
1149 brAction->setToggleAction (true ) ; 1151 brAction->setToggleAction (true ) ;
1150 connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) ); 1152 connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) );
1151 1153
1152 action = new QAction( "beam all", i18n("Beam complete calendar..."), 0, 1154 action = new QAction( "beam all", i18n("Beam complete calendar..."), 0,
1153 this ); 1155 this );
1154 action->addTo( beamMenu_X ); 1156 action->addTo( beamMenu_X );
1155 connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) ); 1157 connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) );
1156 1158
1157 action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0, 1159 action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0,
1158 this ); 1160 this );
1159 action->addTo( beamMenu_X ); 1161 action->addTo( beamMenu_X );
1160 connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) ); 1162 connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) );
1161 importMenu->insertItem( i18n("Beam"), beamMenu_X ); 1163 importMenu->insertItem( i18n("Beam"), beamMenu_X );
1162#else 1164#else
1163 //importMenu->insertSeparator(); 1165 //importMenu->insertSeparator();
1164 icon = loadPixmap( pathString + "print" ); 1166 icon = loadPixmap( pathString + "print" );
1165 action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this ); 1167 action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this );
1166 action->addTo( beamMenu_X ); 1168 action->addTo( beamMenu_X );
1167 connect( action, SIGNAL( activated() ), 1169 connect( action, SIGNAL( activated() ),
1168 this, SLOT( printCal() ) ); 1170 this, SLOT( printCal() ) );
1169 1171
1170 icon = loadPixmap( pathString + "week" ); 1172 icon = loadPixmap( pathString + "week" );
1171 action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this ); 1173 action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this );
1172 action->addTo( beamMenu_X ); 1174 action->addTo( beamMenu_X );
1173 connect( action, SIGNAL( activated() ), 1175 connect( action, SIGNAL( activated() ),
1174 this, SLOT( printSel() ) ); 1176 this, SLOT( printSel() ) );
1175 icon = loadPixmap( pathString + "whatsnext" ); 1177 icon = loadPixmap( pathString + "whatsnext" );
1176 action = new QAction( i18n("Print What's Next View..."),icon,i18n("Print What's Next View..."), 0, this ); 1178 action = new QAction( i18n("Print What's Next View..."),icon,i18n("Print What's Next View..."), 0, this );
1177 action->addTo( beamMenu_X ); 1179 action->addTo( beamMenu_X );
1178 connect( action, SIGNAL( activated() ), 1180 connect( action, SIGNAL( activated() ),
1179 mView->viewManager(), SLOT( slotprintWNV() ) ); 1181 mView->viewManager(), SLOT( slotprintWNV() ) );
1180 1182
1181 1183
1182 icon = loadPixmap( pathString + "list" ); 1184 icon = loadPixmap( pathString + "list" );
1183 action = new QAction( i18n("Print List View..."),icon,i18n("Print List View..."), 0, this ); 1185 action = new QAction( i18n("Print List View..."),icon,i18n("Print List View..."), 0, this );
1184 action->addTo( beamMenu_X ); 1186 action->addTo( beamMenu_X );
1185 connect( action, SIGNAL( activated() ), 1187 connect( action, SIGNAL( activated() ),
1186 this, SLOT( printListView() ) ); 1188 this, SLOT( printListView() ) );
1187 1189
1188 icon = loadPixmap( pathString + "newevent" ); 1190 icon = loadPixmap( pathString + "newevent" );
1189 action = new QAction( i18n("Print selected event / todo..."),icon,i18n("Print selected event / todo..."), 0, this ); 1191 action = new QAction( i18n("Print selected event / todo..."),icon,i18n("Print selected event / todo..."), 0, this );
1190 action->addTo( beamMenu_X ); 1192 action->addTo( beamMenu_X );
1191 connect( action, SIGNAL( activated() ), 1193 connect( action, SIGNAL( activated() ),
1192 mView, SLOT( slotprintSelInc() ) ); 1194 mView, SLOT( slotprintSelInc() ) );
1193 mPrintSelAction = action; 1195 mPrintSelAction = action;
1194 importMenu->insertItem( i18n("Print"), beamMenu_X ); 1196 importMenu->insertItem( i18n("Print"), beamMenu_X );
1195#endif 1197#endif
1196 1198
1197 importMenu->insertSeparator(); 1199 importMenu->insertSeparator();
1198 action = new QAction( "beam all", i18n("Save"), 0, 1200 action = new QAction( "beam all", i18n("Save"), 0,
1199 this ); 1201 this );
1200 action->addTo( importMenu ); 1202 action->addTo( importMenu );
1201 connect( action, SIGNAL( activated() ), this, SLOT( save() ) ); 1203 connect( action, SIGNAL( activated() ), this, SLOT( save() ) );
1202 action = new QAction( "beam all", i18n("Exit (+save)"), 0, 1204 action = new QAction( "beam all", i18n("Exit (+save)"), 0,
1203 this ); 1205 this );
1204 action->addTo( importMenu ); 1206 action->addTo( importMenu );
1205 connect( action, SIGNAL( activated() ), this, SLOT( close() ) ); 1207 connect( action, SIGNAL( activated() ), this, SLOT( close() ) );
1206 1208
1207 //menuBar->insertItem( "Configure",configureMenu ); 1209 //menuBar->insertItem( "Configure",configureMenu );
1208 //configureMenu->insertItem( "Toolbar",configureToolBarMenu ); 1210 //configureMenu->insertItem( "Toolbar",configureToolBarMenu );
1209 icon = loadPixmap( "korganizer/korganizer" ); 1211 icon = loadPixmap( "korganizer/korganizer" );
1210 1212
1211 action = new QAction( "Whats New", i18n("What's new?"), 0,this ); 1213 action = new QAction( "Whats New", i18n("What's new?"), 0,this );
1212 action->addTo( helpMenu ); 1214 action->addTo( helpMenu );
1213 connect( action, SIGNAL( activated() ), 1215 connect( action, SIGNAL( activated() ),
1214 SLOT( whatsNew() ) ); 1216 SLOT( whatsNew() ) );
1215 action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this ); 1217 action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this );
1216 action->addTo( helpMenu ); 1218 action->addTo( helpMenu );
1217 connect( action, SIGNAL( activated() ), 1219 connect( action, SIGNAL( activated() ),
1218 SLOT( features() ) ); 1220 SLOT( features() ) );
1219 action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this ); 1221 action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this );
1220 action->addTo( helpMenu ); 1222 action->addTo( helpMenu );
1221 connect( action, SIGNAL( activated() ), 1223 connect( action, SIGNAL( activated() ),
1222 SLOT( keyBindings() ) ); 1224 SLOT( keyBindings() ) );
1223 action = new QAction( "Storage Howto", i18n("Storage HowTo..."), 0,this ); 1225 action = new QAction( "Storage Howto", i18n("Storage HowTo..."), 0,this );
1224 action->addTo( helpMenu ); 1226 action->addTo( helpMenu );
1225 connect( action, SIGNAL( activated() ), 1227 connect( action, SIGNAL( activated() ),
1226 SLOT( storagehowto() ) ); 1228 SLOT( storagehowto() ) );
1227 action = new QAction( "Timetracking Howto", i18n("Timetracking HowTo..."), 0,this ); 1229 action = new QAction( "Timetracking Howto", i18n("Timetracking HowTo..."), 0,this );
1228 action->addTo( helpMenu ); 1230 action->addTo( helpMenu );
1229 connect( action, SIGNAL( activated() ), 1231 connect( action, SIGNAL( activated() ),
1230 SLOT( timetrackinghowto() ) ); 1232 SLOT( timetrackinghowto() ) );
1231 action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this ); 1233 action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this );
1232 action->addTo( helpMenu ); 1234 action->addTo( helpMenu );
1233 connect( action, SIGNAL( activated() ), 1235 connect( action, SIGNAL( activated() ),
1234 SLOT( synchowto() ) ); 1236 SLOT( synchowto() ) );
1235 action = new QAction( "KDE Sync Howto", i18n("KDE Sync HowTo..."), 0,this ); 1237 action = new QAction( "KDE Sync Howto", i18n("KDE Sync HowTo..."), 0,this );
1236 action->addTo( helpMenu ); 1238 action->addTo( helpMenu );
1237 connect( action, SIGNAL( activated() ), 1239 connect( action, SIGNAL( activated() ),
1238 SLOT( kdesynchowto() ) ); 1240 SLOT( kdesynchowto() ) );
1239 action = new QAction( "Multi Sync Howto", i18n("Multi Sync HowTo..."), 0,this ); 1241 action = new QAction( "Multi Sync Howto", i18n("Multi Sync HowTo..."), 0,this );
1240 action->addTo( helpMenu ); 1242 action->addTo( helpMenu );
1241 connect( action, SIGNAL( activated() ), 1243 connect( action, SIGNAL( activated() ),
1242 SLOT( multisynchowto() ) ); 1244 SLOT( multisynchowto() ) );
1243 action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this ); 1245 action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this );
1244 action->addTo( helpMenu ); 1246 action->addTo( helpMenu );
1245 connect( action, SIGNAL( activated() ), 1247 connect( action, SIGNAL( activated() ),
1246 SLOT( aboutAutoSaving() ) ); 1248 SLOT( aboutAutoSaving() ) );
1247 action = new QAction( "Problemd", i18n("Known Problems..."), 0,this ); 1249 action = new QAction( "Problemd", i18n("Known Problems..."), 0,this );
1248 action->addTo( helpMenu ); 1250 action->addTo( helpMenu );
1249 connect( action, SIGNAL( activated() ), 1251 connect( action, SIGNAL( activated() ),
1250 SLOT( aboutKnownBugs() ) ); 1252 SLOT( aboutKnownBugs() ) );
1251 action = new QAction( "Translate Howto", i18n("User translation..."), 0,this ); 1253 action = new QAction( "Translate Howto", i18n("User translation..."), 0,this );
1252 action->addTo( helpMenu ); 1254 action->addTo( helpMenu );
1253 connect( action, SIGNAL( activated() ), 1255 connect( action, SIGNAL( activated() ),
1254 SLOT( usertrans() ) ); 1256 SLOT( usertrans() ) );
1255 action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this ); 1257 action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this );
1256 action->addTo( helpMenu ); 1258 action->addTo( helpMenu );
1257 connect( action, SIGNAL( activated() ), 1259 connect( action, SIGNAL( activated() ),
1258 SLOT( faq() ) ); 1260 SLOT( faq() ) );
1259 action = new QAction( "licence", i18n("Licence..."), 0, this ); 1261 action = new QAction( "licence", i18n("Licence..."), 0, this );
1260 action->addTo( helpMenu ); 1262 action->addTo( helpMenu );
1261 connect( action, SIGNAL( activated() ), 1263 connect( action, SIGNAL( activated() ),
1262 SLOT( licence() ) ); 1264 SLOT( licence() ) );
1263 action = new QAction( "about", i18n("About..."), 0, this ); 1265 action = new QAction( "about", i18n("About..."), 0, this );
1264 action->addTo( helpMenu ); 1266 action->addTo( helpMenu );
1265 connect( action, SIGNAL( activated() ), 1267 connect( action, SIGNAL( activated() ),
1266 SLOT( about() ) ); 1268 SLOT( about() ) );
1267 //menuBar->insertSeparator(); 1269 //menuBar->insertSeparator();
1268 1270
1269 // ****************************************************** 1271 // ******************************************************
1270 // menubar icons 1272 // menubar icons
1271 1273
1272 1274
1273 1275
1274 //menuBar->insertItem( iconToolBar ); 1276 //menuBar->insertItem( iconToolBar );
1275 //xdays_action 1277 //xdays_action
1276 if (p-> mShowIconNewEvent) 1278 if (p-> mShowIconNewEvent)
1277 ne_action->addTo( iconToolBar ); 1279 ne_action->addTo( iconToolBar );
1278 if (p->mShowIconNewTodo ) 1280 if (p->mShowIconNewTodo )
1279 nt_action->addTo( iconToolBar ); 1281 nt_action->addTo( iconToolBar );
1280 if (p-> mShowIconSearch) 1282 if (p-> mShowIconSearch)
1281 search_action->addTo( iconToolBar ); 1283 search_action->addTo( iconToolBar );
1282 if (p-> mShowIconWhatsThis) 1284 if (p-> mShowIconWhatsThis)
1283 QWhatsThis::whatsThisButton ( iconToolBar ); 1285 QWhatsThis::whatsThisButton ( iconToolBar );
1284 if (p-> mShowIconNext) 1286 if (p-> mShowIconNext)
1285 whatsnext_action->addTo( viewToolBar ); 1287 whatsnext_action->addTo( viewToolBar );
1286 if (p-> mShowIconNextDays) 1288 if (p-> mShowIconNextDays)
1287 xdays_action->addTo( viewToolBar ); 1289 xdays_action->addTo( viewToolBar );
1288 if (p-> mShowIconJournal) 1290 if (p-> mShowIconJournal)
1289 viewjournal_action->addTo( viewToolBar ); 1291 viewjournal_action->addTo( viewToolBar );
1290 if (p-> mShowIconDay1) 1292 if (p-> mShowIconDay1)
1291 day1_action->addTo( viewToolBar ); 1293 day1_action->addTo( viewToolBar );
1292 if (p-> mShowIconDay5) 1294 if (p-> mShowIconDay5)
1293 day5_action->addTo( viewToolBar ); 1295 day5_action->addTo( viewToolBar );
1294 if (p-> mShowIconDay7) 1296 if (p-> mShowIconDay7)
1295 day7_action->addTo( viewToolBar ); 1297 day7_action->addTo( viewToolBar );
1296 if (p-> mShowIconDay6) 1298 if (p-> mShowIconDay6)
1297 day6_action->addTo( viewToolBar ); 1299 day6_action->addTo( viewToolBar );
1298 if (p-> mShowIconMonth) 1300 if (p-> mShowIconMonth)
1299 month_action->addTo( viewToolBar ); 1301 month_action->addTo( viewToolBar );
1300 if (p-> mShowIconList) 1302 if (p-> mShowIconList)
1301 showlist_action->addTo( viewToolBar ); 1303 showlist_action->addTo( viewToolBar );
1302 if (p-> mShowIconTodoview) 1304 if (p-> mShowIconTodoview)
1303 todoview_action->addTo( viewToolBar ); 1305 todoview_action->addTo( viewToolBar );
1304 1306
1305 icon = loadPixmap( pathString + "2leftarrowB" ); 1307 icon = loadPixmap( pathString + "2leftarrowB" );
1306 configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200); 1308 configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200);
1307 if (p-> mShowIconBackFast) { 1309 if (p-> mShowIconBackFast) {
1308 action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this ); 1310 action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this );
1309 connect( action, SIGNAL( activated() ), 1311 connect( action, SIGNAL( activated() ),
1310 mView, SLOT( goPreviousMonth() ) ); 1312 mView, SLOT( goPreviousMonth() ) );
1311 action->addTo( navigatorToolBar ); 1313 action->addTo( navigatorToolBar );
1312 } 1314 }
1313 icon = loadPixmap( pathString + "1leftarrowB" ); 1315 icon = loadPixmap( pathString + "1leftarrowB" );
1314 configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210); 1316 configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210);
1315 if (p-> mShowIconBack) { 1317 if (p-> mShowIconBack) {
1316 action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this ); 1318 action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this );
1317 connect( action, SIGNAL( activated() ), 1319 connect( action, SIGNAL( activated() ),
1318 mView, SLOT( goPrevious() ) ); 1320 mView, SLOT( goPrevious() ) );
1319 action->addTo( navigatorToolBar ); 1321 action->addTo( navigatorToolBar );
1320 } 1322 }
1321 icon = loadPixmap( pathString + "today" ); 1323 icon = loadPixmap( pathString + "today" );
1322 configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130); 1324 configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130);
1323 if (p-> mShowIconToday) 1325 if (p-> mShowIconToday)
1324 today_action->addTo( navigatorToolBar ); 1326 today_action->addTo( navigatorToolBar );
1325 icon = loadPixmap( pathString + "1rightarrowB" ); 1327 icon = loadPixmap( pathString + "1rightarrowB" );
1326 configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220); 1328 configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220);
1327 if (p-> mShowIconForward) { 1329 if (p-> mShowIconForward) {
1328 action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this ); 1330 action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this );
1329 connect( action, SIGNAL( activated() ), 1331 connect( action, SIGNAL( activated() ),
1330 mView, SLOT( goNext() ) ); 1332 mView, SLOT( goNext() ) );
1331 action->addTo( navigatorToolBar ); 1333 action->addTo( navigatorToolBar );
1332 } 1334 }
1333 icon = loadPixmap( pathString + "2rightarrowB" ); 1335 icon = loadPixmap( pathString + "2rightarrowB" );
1334 configureToolBarMenu->insertItem(icon, i18n("Next month"), 230); 1336 configureToolBarMenu->insertItem(icon, i18n("Next month"), 230);
1335 if (p-> mShowIconForwardFast) { 1337 if (p-> mShowIconForwardFast) {
1336 action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this ); 1338 action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this );
1337 connect( action, SIGNAL( activated() ), 1339 connect( action, SIGNAL( activated() ),
1338 mView, SLOT( goNextMonth() ) ); 1340 mView, SLOT( goNextMonth() ) );
1339 action->addTo( navigatorToolBar ); 1341 action->addTo( navigatorToolBar );
1340 } 1342 }
1341 1343
1342 1344
1343 configureToolBarMenu->insertItem(i18n("What's This?"), 300, 6); 1345 configureToolBarMenu->insertItem(i18n("What's This?"), 300, 6);
1344 1346
1345 1347
1346 if ( p->mShowIconNavigator ) configureToolBarMenu->setItemChecked( 22 , true); 1348 if ( p->mShowIconNavigator ) configureToolBarMenu->setItemChecked( 22 , true);
1347 if ( p->mShowIconAllday ) configureToolBarMenu->setItemChecked( 24 , true); 1349 if ( p->mShowIconAllday ) configureToolBarMenu->setItemChecked( 24 , true);
1348 if ( p->mShowIconFilterview ) configureToolBarMenu->setItemChecked( 26 , true); 1350 if ( p->mShowIconFilterview ) configureToolBarMenu->setItemChecked( 26 , true);
1349 if ( p->mShowIconToggleFull ) configureToolBarMenu->setItemChecked( 28 , true); 1351 if ( p->mShowIconToggleFull ) configureToolBarMenu->setItemChecked( 28 , true);
1350 1352
1351 if (p-> mShowIconNewEvent) 1353 if (p-> mShowIconNewEvent)
1352 configureToolBarMenu->setItemChecked( 10, true ); 1354 configureToolBarMenu->setItemChecked( 10, true );
1353 if (p->mShowIconNewTodo ) 1355 if (p->mShowIconNewTodo )
1354 configureToolBarMenu->setItemChecked( 20, true ); 1356 configureToolBarMenu->setItemChecked( 20, true );
1355 if (p-> mShowIconSearch) 1357 if (p-> mShowIconSearch)
1356 configureToolBarMenu->setItemChecked( 120, true ); 1358 configureToolBarMenu->setItemChecked( 120, true );
1357 if (p-> mShowIconList) 1359 if (p-> mShowIconList)
1358 configureToolBarMenu->setItemChecked( 30, true ); 1360 configureToolBarMenu->setItemChecked( 30, true );
1359 if (p-> mShowIconDay1) 1361 if (p-> mShowIconDay1)
1360 configureToolBarMenu->setItemChecked( 40, true ); 1362 configureToolBarMenu->setItemChecked( 40, true );
1361 if (p-> mShowIconDay5) 1363 if (p-> mShowIconDay5)
1362 configureToolBarMenu->setItemChecked( 50, true ); 1364 configureToolBarMenu->setItemChecked( 50, true );
1363 if (p-> mShowIconDay6) 1365 if (p-> mShowIconDay6)
1364 configureToolBarMenu->setItemChecked( 75, true ); 1366 configureToolBarMenu->setItemChecked( 75, true );
1365 if (p-> mShowIconDay7) 1367 if (p-> mShowIconDay7)
1366 configureToolBarMenu->setItemChecked( 60, true ); 1368 configureToolBarMenu->setItemChecked( 60, true );
1367 if (p-> mShowIconMonth) 1369 if (p-> mShowIconMonth)
1368 configureToolBarMenu->setItemChecked( 70, true ); 1370 configureToolBarMenu->setItemChecked( 70, true );
1369 if (p-> mShowIconTodoview) 1371 if (p-> mShowIconTodoview)
1370 configureToolBarMenu->setItemChecked( 80, true ); 1372 configureToolBarMenu->setItemChecked( 80, true );
1371 if (p-> mShowIconBackFast) 1373 if (p-> mShowIconBackFast)
1372 configureToolBarMenu->setItemChecked( 200, true ); 1374 configureToolBarMenu->setItemChecked( 200, true );
1373 if (p-> mShowIconBack) 1375 if (p-> mShowIconBack)
1374 configureToolBarMenu->setItemChecked( 210, true ); 1376 configureToolBarMenu->setItemChecked( 210, true );
1375 if (p-> mShowIconToday) 1377 if (p-> mShowIconToday)
1376 configureToolBarMenu->setItemChecked( 130, true ); 1378 configureToolBarMenu->setItemChecked( 130, true );
1377 if (p-> mShowIconForward) 1379 if (p-> mShowIconForward)
1378 configureToolBarMenu->setItemChecked( 220, true ); 1380 configureToolBarMenu->setItemChecked( 220, true );
1379 if (p-> mShowIconForwardFast) 1381 if (p-> mShowIconForwardFast)
1380 configureToolBarMenu->setItemChecked( 230, true ); 1382 configureToolBarMenu->setItemChecked( 230, true );
1381 if (p-> mShowIconNextDays) 1383 if (p-> mShowIconNextDays)
1382 configureToolBarMenu->setItemChecked( 100, true ); 1384 configureToolBarMenu->setItemChecked( 100, true );
1383 if (p-> mShowIconNext) 1385 if (p-> mShowIconNext)
1384 configureToolBarMenu->setItemChecked( 110, true ); 1386 configureToolBarMenu->setItemChecked( 110, true );
1385 if (p-> mShowIconJournal) 1387 if (p-> mShowIconJournal)
1386 configureToolBarMenu->setItemChecked( 90, true ); 1388 configureToolBarMenu->setItemChecked( 90, true );
1387 if (p-> mShowIconWhatsThis) 1389 if (p-> mShowIconWhatsThis)
1388 configureToolBarMenu->setItemChecked( 300, true ); 1390 configureToolBarMenu->setItemChecked( 300, true );
1389 if (p-> mShowIconWeekNum) 1391 if (p-> mShowIconWeekNum)
1390 configureToolBarMenu->setItemChecked( 400, true ); 1392 configureToolBarMenu->setItemChecked( 400, true );
1391 if (!p-> mShowIconStretch) { 1393 if (!p-> mShowIconStretch) {
1392 QLabel* dummy = new QLabel( iconToolBar ); 1394 QLabel* dummy = new QLabel( iconToolBar );
1393 dummy->setBackgroundColor( iconToolBar->backgroundColor() ); 1395 dummy->setBackgroundColor( iconToolBar->backgroundColor() );
1394 dummy->setMinimumWidth( 0 ); 1396 dummy->setMinimumWidth( 0 );
1395 iconToolBar->setStretchableWidget ( dummy ) ; 1397 iconToolBar->setStretchableWidget ( dummy ) ;
1396 } 1398 }
1397 else { 1399 else {
1398 iconToolBar->setHorizontalStretchable (true ); 1400 iconToolBar->setHorizontalStretchable (true );
1399 viewToolBar->setHorizontalStretchable (true ); 1401 viewToolBar->setHorizontalStretchable (true );
1400 navigatorToolBar->setHorizontalStretchable (true ); 1402 navigatorToolBar->setHorizontalStretchable (true );
1401 iconToolBar->setVerticalStretchable (true ); 1403 iconToolBar->setVerticalStretchable (true );
1402 viewToolBar->setVerticalStretchable (true ); 1404 viewToolBar->setVerticalStretchable (true );
1403 navigatorToolBar->setVerticalStretchable (true ); 1405 navigatorToolBar->setVerticalStretchable (true );
1404 configureToolBarMenu->setItemChecked( 5, true ); 1406 configureToolBarMenu->setItemChecked( 5, true );
1405 } 1407 }
1406 if (p-> mShowIconFilter) 1408 if (p-> mShowIconFilter)
1407 configureToolBarMenu->setItemChecked( 7, true ); 1409 configureToolBarMenu->setItemChecked( 7, true );
1408 if (p-> mShowIconOnetoolbar) 1410 if (p-> mShowIconOnetoolbar)
1409 configureToolBarMenu->setItemChecked( 6, true ); 1411 configureToolBarMenu->setItemChecked( 6, true );
1410 1412
1411 1413
1412 if ( filterMenubar ) { 1414 if ( filterMenubar ) {
1413 filterMenubar->reparent(filterToolBar,0,QPoint(0,0) ); 1415 filterMenubar->reparent(filterToolBar,0,QPoint(0,0) );
1414 connect( mView, SIGNAL( filtersUpdated() ), SLOT( updateFilterToolbar() ) ); 1416 connect( mView, SIGNAL( filtersUpdated() ), SLOT( updateFilterToolbar() ) );
1415 } 1417 }
1416 connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) ); 1418 connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) );
1417 configureAgenda( p->mHourSize ); 1419 configureAgenda( p->mHourSize );
1418 connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) ); 1420 connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) );
1419} 1421}
1420void MainWindow::calHint() 1422void MainWindow::calHint()
1421{ 1423{
1422 QString message = i18n("You can use and display <b>more than one</b> calendar file in KO/Pi. A calendar file is called a <b>resource</b>. To add a calendar or change calendar settings please use menu: <b>View -> Toggle Resource View</b>."); 1424 QString message = i18n("You can use and display <b>more than one</b> calendar file in KO/Pi. A calendar file is called a <b>resource</b>. To add a calendar or change calendar settings please use menu: <b>View -> Toggle Resource View</b>.");
1423 1425
1424 KMessageBox::information( this, message); 1426 KMessageBox::information( this, message);
1425} 1427}
1426void MainWindow::exportToPhone( int mode ) 1428void MainWindow::exportToPhone( int mode )
1427{ 1429{
1428 1430
1429 //ex2phone->insertItem(i18n("Complete calendar..."), 1 ); 1431 //ex2phone->insertItem(i18n("Complete calendar..."), 1 );
1430 //ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); 1432 //ex2phone->insertItem(i18n("Filtered calendar..."), 2 );
1431 KOex2phonePrefs ex2phone; 1433 KOex2phonePrefs ex2phone;
1432 1434
1433 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); 1435 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection );
1434 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); 1436 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice );
1435 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); 1437 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel );
1436 if ( mode == 1 ) 1438 if ( mode == 1 )
1437 ex2phone.setCaption(i18n("Export complete calendar")); 1439 ex2phone.setCaption(i18n("Export complete calendar"));
1438 if ( mode == 2 ) 1440 if ( mode == 2 )
1439 ex2phone.setCaption(i18n("Export filtered calendar")); 1441 ex2phone.setCaption(i18n("Export filtered calendar"));
1440 1442
1441 if ( !ex2phone.exec() ) { 1443 if ( !ex2phone.exec() ) {
1442 return; 1444 return;
1443 } 1445 }
1444 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); 1446 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text();
1445 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); 1447 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text();
1446 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); 1448 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text();
1447 1449
1448 int inFuture = 0; 1450 int inFuture = 0;
1449 if ( ex2phone.mWriteBackFuture->isChecked() ) 1451 if ( ex2phone.mWriteBackFuture->isChecked() )
1450 inFuture = ex2phone.mWriteBackFutureWeeks->value(); 1452 inFuture = ex2phone.mWriteBackFutureWeeks->value();
1451 QPtrList<Incidence> delSel; 1453 QPtrList<Incidence> delSel;
1452 if ( mode == 1 ) 1454 if ( mode == 1 )
1453 delSel = mCalendar->rawIncidences(); 1455 delSel = mCalendar->rawIncidences();
1454 if ( mode == 2 ) 1456 if ( mode == 2 )
1455 delSel = mCalendar->incidences(); 1457 delSel = mCalendar->incidences();
1456 CalendarLocal* cal = new CalendarLocal(); 1458 CalendarLocal* cal = new CalendarLocal();
1457 cal->setLocalTime(); 1459 cal->setLocalTime();
1458 Incidence *incidence = delSel.first(); 1460 Incidence *incidence = delSel.first();
1459 QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); 1461 QDateTime cur = QDateTime::currentDateTime().addDays( -7 );
1460 QDateTime end = cur.addDays( ( inFuture +1 ) *7 ); 1462 QDateTime end = cur.addDays( ( inFuture +1 ) *7 );
1461 while ( incidence ) { 1463 while ( incidence ) {
1462 if ( incidence->typeID() != journalID ) { 1464 if ( incidence->typeID() != journalID ) {
1463 bool add = true; 1465 bool add = true;
1464 if ( inFuture ) { 1466 if ( inFuture ) {
1465 QDateTime dt; 1467 QDateTime dt;
1466 if ( incidence->typeID() == todoID ) { 1468 if ( incidence->typeID() == todoID ) {
1467 Todo * t = (Todo*)incidence; 1469 Todo * t = (Todo*)incidence;
1468 if ( t->hasDueDate() ) 1470 if ( t->hasDueDate() )
1469 dt = t->dtDue(); 1471 dt = t->dtDue();
1470 else 1472 else
1471 dt = cur.addSecs( 62 ); 1473 dt = cur.addSecs( 62 );
1472 } 1474 }
1473 else { 1475 else {
1474 bool ok; 1476 bool ok;
1475 dt = incidence->getNextOccurence( cur, &ok ); 1477 dt = incidence->getNextOccurence( cur, &ok );
1476 if ( !ok ) 1478 if ( !ok )
1477 dt = cur.addSecs( -62 ); 1479 dt = cur.addSecs( -62 );
1478 } 1480 }
1479 if ( dt < cur || dt > end ) { 1481 if ( dt < cur || dt > end ) {
1480 add = false; 1482 add = false;
1481 } 1483 }
1482 } 1484 }
1483 if ( add ) { 1485 if ( add ) {
1484 Incidence *in = incidence->clone(); 1486 Incidence *in = incidence->clone();
1485 cal->addIncidence( in ); 1487 cal->addIncidence( in );
1486 } 1488 }
1487 } 1489 }
1488 incidence = delSel.next(); 1490 incidence = delSel.next();
1489 } 1491 }
1490 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, 1492 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice,
1491 KPimGlobalPrefs::instance()->mEx2PhoneConnection, 1493 KPimGlobalPrefs::instance()->mEx2PhoneConnection,
1492 KPimGlobalPrefs::instance()->mEx2PhoneModel ); 1494 KPimGlobalPrefs::instance()->mEx2PhoneModel );
1493 1495
1494 setCaption( i18n("Writing to phone...")); 1496 setCaption( i18n("Writing to phone..."));
1495 if ( PhoneFormat::writeToPhone( cal ) ) 1497 if ( PhoneFormat::writeToPhone( cal ) )
1496 setCaption( i18n("Export to phone successful!")); 1498 setCaption( i18n("Export to phone successful!"));
1497 else 1499 else
1498 setCaption( i18n("Error exporting to phone!")); 1500 setCaption( i18n("Error exporting to phone!"));
1499 delete cal; 1501 delete cal;
1500} 1502}
1501 1503
1502 1504
1503void MainWindow::setDefaultPreferences() 1505void MainWindow::setDefaultPreferences()
1504{ 1506{
1505 KOPrefs *p = KOPrefs::instance(); 1507 KOPrefs *p = KOPrefs::instance();
1506 1508
1507 p->mCompactDialogs = true; 1509 p->mCompactDialogs = true;
1508 p->mConfirm = true; 1510 p->mConfirm = true;
1509 // p->mEnableQuickTodo = false; 1511 // p->mEnableQuickTodo = false;
1510 1512
1511} 1513}
1512 1514
1513QString MainWindow::resourcePath() 1515QString MainWindow::resourcePath()
1514{ 1516{
1515 return KGlobal::iconLoader()->iconPath(); 1517 return KGlobal::iconLoader()->iconPath();
1516} 1518}
1517 1519
1518void MainWindow::displayText( QString text ,QString cap ) 1520void MainWindow::displayText( QString text ,QString cap )
1519{ 1521{
1520 QDialog dia( this, "name", true ); ; 1522 QDialog dia( this, "name", true ); ;
1521 dia.setCaption( cap ); 1523 dia.setCaption( cap );
1522 QVBoxLayout* lay = new QVBoxLayout( &dia ); 1524 QVBoxLayout* lay = new QVBoxLayout( &dia );
1523 lay->setSpacing( 3 ); 1525 lay->setSpacing( 3 );
1524 lay->setMargin( 3 ); 1526 lay->setMargin( 3 );
1525 QTextBrowser tb ( &dia ); 1527 QTextBrowser tb ( &dia );
1526 lay->addWidget( &tb ); 1528 lay->addWidget( &tb );
1527 tb.setText( text ); 1529 tb.setText( text );
1528#ifdef DESKTOP_VERSION 1530#ifdef DESKTOP_VERSION
1529 dia.resize( 640, 480); 1531 dia.resize( 640, 480);
1530#else 1532#else
1531 dia.showMaximized(); 1533 dia.showMaximized();
1532#endif 1534#endif
1533 dia.exec(); 1535 dia.exec();
1534} 1536}
1535 1537
1536void MainWindow::features() 1538void MainWindow::features()
1537{ 1539{
1538 1540
1539 KApplication::showFile( i18n("KO/Pi Features and hints"), "kdepim/korganizer/featuresKOPI.txt" ); 1541 KApplication::showFile( i18n("KO/Pi Features and hints"), "kdepim/korganizer/featuresKOPI.txt" );
1540} 1542}
1541 1543
1542void MainWindow::usertrans() 1544void MainWindow::usertrans()
1543{ 1545{
1544 1546
1545 KApplication::showFile( i18n("KO/Pi User translation HowTo"), "kdepim/korganizer/usertranslationHOWTO.txt" ); 1547 KApplication::showFile( i18n("KO/Pi User translation HowTo"), "kdepim/korganizer/usertranslationHOWTO.txt" );
1546} 1548}
1547 1549
1548void MainWindow::storagehowto() 1550void MainWindow::storagehowto()
1549{ 1551{
1550 KApplication::showFile( "KDE-Pim/Pi Storage HowTo", "kdepim/storagehowto.txt" ); 1552 KApplication::showFile( "KDE-Pim/Pi Storage HowTo", "kdepim/storagehowto.txt" );
1551} 1553}
1552void MainWindow::timetrackinghowto() 1554void MainWindow::timetrackinghowto()
1553{ 1555{
1554 KApplication::showFile( "KO/Pi Timetracking HowTo", "kdepim/timetrackerhowto.txt" ); 1556 KApplication::showFile( "KO/Pi Timetracking HowTo", "kdepim/timetrackerhowto.txt" );
1555} 1557}
1556void MainWindow::kdesynchowto() 1558void MainWindow::kdesynchowto()
1557{ 1559{
1558 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" ); 1560 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" );
1559} 1561}
1560void MainWindow::multisynchowto() 1562void MainWindow::multisynchowto()
1561{ 1563{
1562 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" ); 1564 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" );
1563} 1565}
1564void MainWindow::synchowto() 1566void MainWindow::synchowto()
1565{ 1567{
1566 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); 1568 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" );
1567} 1569}
1568void MainWindow::faq() 1570void MainWindow::faq()
1569{ 1571{
1570 KApplication::showFile( i18n("KO/Pi FAQ"), "kdepim/korganizer/kopiFAQ.txt" ); 1572 KApplication::showFile( i18n("KO/Pi FAQ"), "kdepim/korganizer/kopiFAQ.txt" );
1571 1573
1572} 1574}
1573void MainWindow::whatsNew() 1575void MainWindow::whatsNew()
1574{ 1576{
1575 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); 1577 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" );
1576 1578
1577} 1579}
1578void MainWindow::licence() 1580void MainWindow::licence()
1579{ 1581{
1580 KApplication::showLicence(); 1582 KApplication::showLicence();
1581 1583
1582} 1584}
1583void MainWindow::about() 1585void MainWindow::about()
1584{ 1586{
1585 QString version; 1587 QString version;
1586#include <../version> 1588#include <../version>
1587 QMessageBox::about( this, i18n("About KOrganizer/Pi"), 1589 QMessageBox::about( this, i18n("About KOrganizer/Pi"),
1588 i18n("KOrganizer/Platform-independent\n") + 1590 i18n("KOrganizer/Platform-independent\n") +
1589 "(KO/Pi) " + version + " - " + 1591 "(KO/Pi) " + version + " - " +
1590 1592
1591#ifdef DESKTOP_VERSION 1593#ifdef DESKTOP_VERSION
1592 i18n("Desktop Edition\n") + 1594 i18n("Desktop Edition\n") +
1593#else 1595#else
1594 i18n("PDA-Edition\nfor: Zaurus 5x00/7x0/860/3000/6000\n") + 1596 i18n("PDA-Edition\nfor: Zaurus 5x00/7x0/860/3000/6000\n") +
1595#endif 1597#endif
1596 i18n("(c)2004 Lutz Rogowski (rogowski@kde.org)\nKO/Pi is based on KOrganizer\n(c)2002,2003 Cornelius Schumacher\n(schumacher@kde.org) and the KDE team.\nKOrganizer/Pi is licensed under the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.pi-sync.info --- www.korganizer.org\nSpecial thanks to Michael and Ben\nfor intensive testing!") ); 1598 i18n("(c)2004 Lutz Rogowski (rogowski@kde.org)\nKO/Pi is based on KOrganizer\n(c)2002,2003 Cornelius Schumacher\n(schumacher@kde.org) and the KDE team.\nKOrganizer/Pi is licensed under the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.pi-sync.info --- www.korganizer.org\nSpecial thanks to Michael and Ben\nfor intensive testing!") );
1597} 1599}
1598void MainWindow::keyBindings() 1600void MainWindow::keyBindings()
1599{ 1601{
1600 QString cap = i18n("KO/Pi Keys + Colors"); 1602 QString cap = i18n("KO/Pi Keys + Colors");
1601 QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") + 1603 QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") +
1602 i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+ 1604 i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+
1603 i18n("<p><b>N</b>: Switch to next view which has a toolbar icon</p>\n") + 1605 i18n("<p><b>N</b>: Switch to next view which has a toolbar icon</p>\n") +
1604 i18n("<p><b>A+(shift or ctrl)</b>: Show occurence of next alarm</p>\n") + 1606 i18n("<p><b>A+(shift or ctrl)</b>: Show occurence of next alarm</p>\n") +
1605 i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") + 1607 i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") +
1606 i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+ 1608 i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+
1607 i18n("<p><b>R</b>: Toggle Resource View |<b>F</b>: Edit filter </p>\n")+ 1609 i18n("<p><b>R</b>: Toggle Resource View |<b>F</b>: Edit filter </p>\n")+
1608 i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+ 1610 i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+
1609 i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+ 1611 i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+
1610 i18n("<p><b>X</b>: Next X days view| <b>W</b>: What's next view\n ")+ 1612 i18n("<p><b>X</b>: Next X days view| <b>W</b>: What's next view\n ")+
1611 i18n("<p><b>Q</b>: Show next date with conflicting events\n ")+ 1613 i18n("<p><b>Q</b>: Show next date with conflicting events\n ")+
1612 i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+ 1614 i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+
1613 i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+ 1615 i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+
1614 i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+ 1616 i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+
1615 i18n("<p><b>K</b>: Week view in Month view syle</p>\n")+ 1617 i18n("<p><b>K</b>: Week view in Month view syle</p>\n")+
1616 i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+ 1618 i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+
1617 i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+ 1619 i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+
1618 i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X+ctrl</b>: Toggle datenavigator</p>\n")+ 1620 i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X+ctrl</b>: Toggle datenavigator</p>\n")+
1619 i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+ 1621 i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+
1620 i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+ 1622 i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+
1621 i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+ 1623 i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+
1622 i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+ 1624 i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+
1623 i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+ 1625 i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+
1624 i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+ 1626 i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+
1625 i18n("<p><h3>In agenda view:</h3></p>\n") + 1627 i18n("<p><h3>In agenda view:</h3></p>\n") +
1626 i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+ 1628 i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+
1627 i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+ 1629 i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+
1628 i18n("<p><h3>In todo view:</h3></p>\n") + 1630 i18n("<p><h3>In todo view:</h3></p>\n") +
1629 i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+ 1631 i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+
1630 i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+ 1632 i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+
1631 i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+ 1633 i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+
1632 i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+ 1634 i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+
1633 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ 1635 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+
1634 i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+ 1636 i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+
1635 i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+ 1637 i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+
1636 i18n("<p><h3>In list view:</h3></p>\n") + 1638 i18n("<p><h3>In list view:</h3></p>\n") +
1637 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ 1639 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+
1638 i18n("<p><b>return</b>: Select item+one step down</p>\n")+ 1640 i18n("<p><b>return</b>: Select item+one step down</p>\n")+
1639 i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+ 1641 i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+
1640 i18n("<p><b>up/down</b>: Next/prev item</p>\n")+ 1642 i18n("<p><b>up/down</b>: Next/prev item</p>\n")+
1641 i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+ 1643 i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+
1642 i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+ 1644 i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+
1643 i18n("<p><h3>In event/todo viewer:</h3></p>\n") + 1645 i18n("<p><h3>In event/todo viewer:</h3></p>\n") +
1644 i18n("<p><b>I,C</b>: Close dialog.</p>\n")+ 1646 i18n("<p><b>I,C</b>: Close dialog.</p>\n")+
1645 i18n("<p><b>A</b>: Show agenda view.</p>\n")+ 1647 i18n("<p><b>A</b>: Show agenda view.</p>\n")+
1646 i18n("<p><b>E</b>: Edit item</p>\n") + 1648 i18n("<p><b>E</b>: Edit item</p>\n") +
1647 i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") + 1649 i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") +
1648 i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") + 1650 i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") +
1649 i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+ 1651 i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+
1650 i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+ 1652 i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+
1651 i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+ 1653 i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+
1652 i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+ 1654 i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+
1653 i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ 1655 i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+
1654 i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + 1656 i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") +
1655 i18n("<p><b>White</b>: Item readonly</p>\n"); 1657 i18n("<p><b>White</b>: Item readonly</p>\n");
1656 displayText( text, cap); 1658 displayText( text, cap);
1657} 1659}
1658void MainWindow::aboutAutoSaving() 1660void MainWindow::aboutAutoSaving()
1659{ 1661{
1660 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"); 1662 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");
1661 1663
1662 KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text); 1664 KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text);
1663 1665
1664} 1666}
1665void MainWindow::aboutKnownBugs() 1667void MainWindow::aboutKnownBugs()
1666{ 1668{
1667 QMessageBox* msg; 1669 QMessageBox* msg;
1668 msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), 1670 msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"),
1669 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")+ 1671 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")+
1670 i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ 1672 i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+
1671 i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.info\n") + 1673 i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.info\n") +
1672 i18n("\nor report them in the bugtracker on\n") + 1674 i18n("\nor report them in the bugtracker on\n") +
1673 i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), 1675 i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"),
1674 QMessageBox::NoIcon, 1676 QMessageBox::NoIcon,
1675 QMessageBox::Ok, 1677 QMessageBox::Ok,
1676 QMessageBox::NoButton, 1678 QMessageBox::NoButton,
1677 QMessageBox::NoButton); 1679 QMessageBox::NoButton);
1678 msg->exec(); 1680 msg->exec();
1679 delete msg; 1681 delete msg;
1680 1682
1681} 1683}
1682 1684
1683QString MainWindow::defaultFileName() 1685QString MainWindow::defaultFileName()
1684{ 1686{
1685 return locateLocal( "data", "korganizer/mycalendar.ics" ); 1687 return locateLocal( "data", "korganizer/mycalendar.ics" );
1686} 1688}
1687QString MainWindow::syncFileName() 1689QString MainWindow::syncFileName()
1688{ 1690{
1689#ifdef DESKTOP_VERSION 1691#ifdef DESKTOP_VERSION
1690 return locateLocal( "tmp", "synccalendar.ics" ); 1692 return locateLocal( "tmp", "synccalendar.ics" );
1691#else 1693#else
1692 return QString( "/tmp/synccalendar.ics" ); 1694 return QString( "/tmp/synccalendar.ics" );
1693#endif 1695#endif
1694} 1696}
1695#include "koglobals.h" 1697#include "koglobals.h"
1696#include <kcalendarsystem.h> 1698#include <kcalendarsystem.h>
1697void MainWindow::updateWeek(QDate seda) 1699void MainWindow::updateWeek(QDate seda)
1698{ 1700{
1699 int weekNum = KGlobal::locale()->weekNum ( seda ); 1701 int weekNum = KGlobal::locale()->weekNum ( seda );
1700 mWeekPixmap.fill( mWeekBgColor ); 1702 mWeekPixmap.fill( mWeekBgColor );
1701 QPainter p ( &mWeekPixmap ); 1703 QPainter p ( &mWeekPixmap );
1702 p.setFont( mWeekFont ); 1704 p.setFont( mWeekFont );
1703 p.drawText( 0,0,mWeekPixmap.width(), mWeekPixmap.height(),AlignCenter, QString::number( weekNum) ); 1705 p.drawText( 0,0,mWeekPixmap.width(), mWeekPixmap.height(),AlignCenter, QString::number( weekNum) );
1704 p.end(); 1706 p.end();
1705 QIconSet icon3 ( mWeekPixmap ); 1707 QIconSet icon3 ( mWeekPixmap );
1706 mWeekAction->setIconSet ( icon3 ); 1708 mWeekAction->setIconSet ( icon3 );
1707 1709
1708} 1710}
1709void MainWindow::updateWeekNum(const DateList &selectedDates) 1711void MainWindow::updateWeekNum(const DateList &selectedDates)
1710{ 1712{
1711 updateWeek( selectedDates.first() ); 1713 updateWeek( selectedDates.first() );
1712} 1714}
1713void MainWindow::processIncidenceSelection( Incidence *incidence ) 1715void MainWindow::processIncidenceSelection( Incidence *incidence )
1714{ 1716{
1715 if ( !incidence ) { 1717 if ( !incidence ) {
1716 mShowAction->setMenuText( i18n("Show") ); 1718 mShowAction->setMenuText( i18n("Show") );
1717 enableIncidenceActions( false ); 1719 enableIncidenceActions( false );
1718 mNewSubTodoAction->setEnabled( false ); 1720 mNewSubTodoAction->setEnabled( false );
1719 setCaptionToDates(); 1721 setCaptionToDates();
1720 return; 1722 return;
1721 } 1723 }
1722 QString startString = ""; 1724 QString startString = "";
1723 if ( incidence->typeID() != todoID ) { 1725 if ( incidence->typeID() != todoID ) {
1724 if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { 1726 if ( incidence->dtStart().date() < incidence->dtEnd().date() ) {
1725 if ( incidence->doesFloat() ) { 1727 if ( incidence->doesFloat() ) {
1726 startString += ": "+incidence->dtStartDateStr( true ); 1728 startString += ": "+incidence->dtStartDateStr( true );
1727 startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); 1729 startString += " --- "+((Event*)incidence)->dtEndDateStr( true );
1728 } else { 1730 } else {
1729 startString = ": "+incidence->dtStartStr(true); 1731 startString = ": "+incidence->dtStartStr(true);
1730 startString += " --- "+((Event*)incidence)->dtEndStr(true); 1732 startString += " --- "+((Event*)incidence)->dtEndStr(true);
1731 } 1733 }
1732 } else { 1734 } else {
1733 if ( incidence->dtStart().time() != incidence->dtEnd().time() ) 1735 if ( incidence->dtStart().time() != incidence->dtEnd().time() )
1734 startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ 1736 startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+
1735 "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); 1737 "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time());
1736 if ( incidence->isBirthday() || incidence->isAnniversary() ) { 1738 if ( incidence->isBirthday() || incidence->isAnniversary() ) {
1737 bool ok; 1739 bool ok;
1738 QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok ); 1740 QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok );
1739 if ( ok ) { 1741 if ( ok ) {
1740 int years = noc.date().year() - incidence->dtStart().date().year(); 1742 int years = noc.date().year() - incidence->dtStart().date().year();
1741 startString += i18n(" (%1 y.)"). arg( years ); 1743 startString += i18n(" (%1 y.)"). arg( years );
1742 } 1744 }
1743 } 1745 }
1744 else 1746 else
1745 startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); 1747 startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true);
1746 } 1748 }
1747 } 1749 }
1748 else { 1750 else {
1749 if ( (( KCal::Todo*)incidence)->percentComplete() == 100 ) 1751 if ( (( KCal::Todo*)incidence)->percentComplete() == 100 )
1750 startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+i18n("completed on %1").arg( (( KCal::Todo*)incidence)->completedStr(true) ); 1752 startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+i18n("completed on %1").arg( (( KCal::Todo*)incidence)->completedStr(true) );
1751 else 1753 else
1752 startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); 1754 startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed");
1753 } 1755 }
1754 if ( !incidence->location().isEmpty() ) 1756 if ( !incidence->location().isEmpty() )
1755 startString += " (" +incidence->location()+")"; 1757 startString += " (" +incidence->location()+")";
1756 setCaption( incidence->summary()+startString); 1758 setCaption( incidence->summary()+startString);
1757 enableIncidenceActions( true ); 1759 enableIncidenceActions( true );
1758 if ( incidence->typeID() == eventID ) { 1760 if ( incidence->typeID() == eventID ) {
1759 mShowAction->setMenuText( i18n("Show Event") ); 1761 mShowAction->setMenuText( i18n("Show Event") );
1760 mNewSubTodoAction->setEnabled( false ); 1762 mNewSubTodoAction->setEnabled( false );
1761 } else if ( incidence->typeID() == todoID ) { 1763 } else if ( incidence->typeID() == todoID ) {
1762 mShowAction->setMenuText( i18n("Show Todo") ); 1764 mShowAction->setMenuText( i18n("Show Todo") );
1763 mNewSubTodoAction->setEnabled( true ); 1765 mNewSubTodoAction->setEnabled( true );
1764 } else { 1766 } else {
1765 mShowAction->setMenuText( i18n("Show") ); 1767 mShowAction->setMenuText( i18n("Show") );
1766 mNewSubTodoAction->setEnabled( false ); 1768 mNewSubTodoAction->setEnabled( false );
1767 } 1769 }
1768#ifdef DESKTOP_VERSION 1770#ifdef DESKTOP_VERSION
1769 static QPixmap jP = SmallIcon( "journal" ); 1771 static QPixmap jP = SmallIcon( "journal" );
1770 static QPixmap eP = SmallIcon( "newevent" ); 1772 static QPixmap eP = SmallIcon( "newevent" );
1771 static QPixmap tP = SmallIcon( "newtodo" ); 1773 static QPixmap tP = SmallIcon( "newtodo" );
1772 QIconSet icon; 1774 QIconSet icon;
1773 if ( incidence->typeID() == todoID ) 1775 if ( incidence->typeID() == todoID )
1774 icon = QIconSet ( tP ); 1776 icon = QIconSet ( tP );
1775 else if ( incidence->typeID() == eventID ) 1777 else if ( incidence->typeID() == eventID )
1776 icon = QIconSet ( eP ); 1778 icon = QIconSet ( eP );
1777 else if ( incidence->typeID() == journalID ) 1779 else if ( incidence->typeID() == journalID )
1778 icon = QIconSet ( jP ); 1780 icon = QIconSet ( jP );
1779 mPrintSelAction->setIconSet ( icon ); 1781 mPrintSelAction->setIconSet ( icon );
1780#endif 1782#endif
1781} 1783}
1782 1784
1783void MainWindow::enableIncidenceActions( bool enabled ) 1785void MainWindow::enableIncidenceActions( bool enabled )
1784{ 1786{
1785 mShowAction->setEnabled( enabled ); 1787 mShowAction->setEnabled( enabled );
1786 mEditAction->setEnabled( enabled ); 1788 mEditAction->setEnabled( enabled );
1787 mDeleteAction->setEnabled( enabled ); 1789 mDeleteAction->setEnabled( enabled );
1788 1790
1789 mCloneAction->setEnabled( enabled ); 1791 mCloneAction->setEnabled( enabled );
1790 mMoveAction->setEnabled( enabled ); 1792 mMoveAction->setEnabled( enabled );
1791#ifndef DESKTOP_VERSION 1793#ifndef DESKTOP_VERSION
1792 mBeamAction->setEnabled( enabled ); 1794 mBeamAction->setEnabled( enabled );
1793#else 1795#else
1794 mPrintSelAction->setEnabled( enabled ); 1796 mPrintSelAction->setEnabled( enabled );
1795#endif 1797#endif
1796 mCancelAction->setEnabled( enabled ); 1798 mCancelAction->setEnabled( enabled );
1797} 1799}
1798 1800
1799void MainWindow::importOL() 1801void MainWindow::importOL()
1800{ 1802{
1801#ifdef _OL_IMPORT_ 1803#ifdef _OL_IMPORT_
1802 mView->clearAllViews(); 1804 mView->clearAllViews();
1803 KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); 1805 KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this );
1804 id->exec(); 1806 id->exec();
1805 delete id; 1807 delete id;
1806 mView->calendar()->checkAlarmForIncidence( 0, true ); 1808 mView->calendar()->checkAlarmForIncidence( 0, true );
1807 mView->updateView(); 1809 mView->updateView();
1808#endif 1810#endif
1809} 1811}
1810void MainWindow::importBday() 1812void MainWindow::importBday()
1811{ 1813{
1812 int result = QMessageBox::warning( this, i18n("KO/Pi import information!"), 1814 int result = QMessageBox::warning( this, i18n("KO/Pi import information!"),
1813 i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), 1815 i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"),
1814 i18n("Import!"), i18n("Cancel"), 0, 1816 i18n("Import!"), i18n("Cancel"), 0,
1815 0, 1 ); 1817 0, 1 );
1816 if ( result == 0 ) { 1818 if ( result == 0 ) {
1817 mView->importBday(); 1819 mView->importBday();
1818 1820
1819 } 1821 }
1820 1822
1821 1823
1822} 1824}
1823void MainWindow::importQtopia() 1825void MainWindow::importQtopia()
1824{ 1826{
1825 //#ifndef DESKTOP_VERSION 1827 //#ifndef DESKTOP_VERSION
1826 QString mess = 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"); 1828 QString mess = 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");
1827#ifdef DESKTOP_VERSION 1829#ifdef DESKTOP_VERSION
1828 mess += i18n("The content of the following files will be\nimported (located in your home directory (hd)):\n(hd)/Applications/datebook/datebook.xml\n(hd)/Applications/todolist/todolist.xml\nThe following category file will be used:\n(hd)/Settings/Categories.xml"); 1830 mess += i18n("The content of the following files will be\nimported (located in your home directory (hd)):\n(hd)/Applications/datebook/datebook.xml\n(hd)/Applications/todolist/todolist.xml\nThe following category file will be used:\n(hd)/Settings/Categories.xml");
1829#endif 1831#endif
1830 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mess, 1832 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mess,
1831 i18n("Import!"), i18n("Cancel"), 0, 1833 i18n("Import!"), i18n("Cancel"), 0,
1832 0, 1 ); 1834 0, 1 );
1833 if ( result == 0 ) { 1835 if ( result == 0 ) {
1834#ifndef DESKTOP_VERSION 1836#ifndef DESKTOP_VERSION
1835 QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); 1837 QString datebook = Global::applicationFileName( "datebook", "datebook.xml");
1836 QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); 1838 QString todolist = Global::applicationFileName( "todolist", "todolist.xml");
1837 QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; 1839 QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml";
1838#else 1840#else
1839 QString datebook = QDir::homeDirPath()+ "/Applications/datebook/datebook.xml"; 1841 QString datebook = QDir::homeDirPath()+ "/Applications/datebook/datebook.xml";
1840 QString todolist = QDir::homeDirPath()+ "/Applications/todolist/todolist.xml"; 1842 QString todolist = QDir::homeDirPath()+ "/Applications/todolist/todolist.xml";
1841 QString categories = QDir::homeDirPath()+ "/Settings/Categories.xml"; 1843 QString categories = QDir::homeDirPath()+ "/Settings/Categories.xml";
1842#endif 1844#endif
1843 mView->importQtopia( categories, datebook, todolist ); 1845 mView->importQtopia( categories, datebook, todolist );
1844 } 1846 }
1845 mView->calendar()->reInitAlarmSettings(); 1847 mView->calendar()->reInitAlarmSettings();
1846#if 0 1848#if 0
1847 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1849 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1848 i18n("Not supported \non desktop!\n"), 1850 i18n("Not supported \non desktop!\n"),
1849 i18n("Ok"), i18n("Cancel"), 0, 1851 i18n("Ok"), i18n("Cancel"), 0,
1850 0, 1 ); 1852 0, 1 );
1851 1853
1852#endif 1854#endif
1853} 1855}
1854 1856
1855void MainWindow::saveOnClose() 1857void MainWindow::saveOnClose()
1856{ 1858{
1857 KOPrefs *p = KOPrefs::instance(); 1859 KOPrefs *p = KOPrefs::instance();
1858 p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); 1860 p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal );
1859 p->mToolBarHorV = ( viewToolBar->orientation () == Qt:: Horizontal ); 1861 p->mToolBarHorV = ( viewToolBar->orientation () == Qt:: Horizontal );
1860 p->mToolBarHorN = ( navigatorToolBar->orientation () == Qt:: Horizontal ); 1862 p->mToolBarHorN = ( navigatorToolBar->orientation () == Qt:: Horizontal );
1861 if ( filterToolBar ) { 1863 if ( filterToolBar ) {
1862 p->mToolBarHorF = ( filterToolBar->orientation () == Qt:: Horizontal ); 1864 p->mToolBarHorF = ( filterToolBar->orientation () == Qt:: Horizontal );
1863 } 1865 }
1864#ifdef DESKTOP_VERSION 1866#ifdef DESKTOP_VERSION
1865 1867
1866 QPoint myP; 1868 QPoint myP;
1867 myP = mapFromGlobal( iconToolBar->mapToGlobal( QPoint( 0,0) ) ); 1869 myP = mapFromGlobal( iconToolBar->mapToGlobal( QPoint( 0,0) ) );
1868 if ( p->mToolBarHor ) 1870 if ( p->mToolBarHor )
1869 p->mToolBarUp = myP.y() > height()/2; 1871 p->mToolBarUp = myP.y() > height()/2;
1870 else 1872 else
1871 p->mToolBarUp = myP.x() > width()/2; 1873 p->mToolBarUp = myP.x() > width()/2;
1872 myP = mapFromGlobal( viewToolBar->mapToGlobal( QPoint( 0,0) ) ); 1874 myP = mapFromGlobal( viewToolBar->mapToGlobal( QPoint( 0,0) ) );
1873 if ( p->mToolBarHorV ) 1875 if ( p->mToolBarHorV )
1874 p->mToolBarUpV = myP.y() > height()/2; 1876 p->mToolBarUpV = myP.y() > height()/2;
1875 else 1877 else
1876 p->mToolBarUpV = myP.x() > width()/2 ; 1878 p->mToolBarUpV = myP.x() > width()/2 ;
1877 myP = mapFromGlobal( navigatorToolBar->mapToGlobal( QPoint( 0,0) ) ); 1879 myP = mapFromGlobal( navigatorToolBar->mapToGlobal( QPoint( 0,0) ) );
1878 if ( p->mToolBarHorN ) 1880 if ( p->mToolBarHorN )
1879 p->mToolBarUpN = myP.y() > height()/2; 1881 p->mToolBarUpN = myP.y() > height()/2;
1880 else 1882 else
1881 p->mToolBarUpN = myP.x() > width()/2 ; 1883 p->mToolBarUpN = myP.x() > width()/2 ;
1882 if ( filterToolBar ) { 1884 if ( filterToolBar ) {
1883 myP = mapFromGlobal( filterToolBar->mapToGlobal( QPoint( 0,0) ) ); 1885 myP = mapFromGlobal( filterToolBar->mapToGlobal( QPoint( 0,0) ) );
1884 if ( p->mToolBarHorF ) 1886 if ( p->mToolBarHorF )
1885 p->mToolBarUpF = myP.y() > height()/2; 1887 p->mToolBarUpF = myP.y() > height()/2;
1886 else 1888 else
1887 p->mToolBarUpF = myP.x() > width()/2 ; 1889 p->mToolBarUpF = myP.x() > width()/2 ;
1888 } 1890 }
1889#else 1891#else
1890 if ( p->mToolBarHor ) 1892 if ( p->mToolBarHor )
1891 p->mToolBarUp = iconToolBar->y() > height()/2; 1893 p->mToolBarUp = iconToolBar->y() > height()/2;
1892 else 1894 else
1893 p->mToolBarUp = iconToolBar->x() > width()/2; 1895 p->mToolBarUp = iconToolBar->x() > width()/2;
1894 if ( p->mToolBarHorV ) 1896 if ( p->mToolBarHorV )
1895 p->mToolBarUpV = viewToolBar->y() > height()/2; 1897 p->mToolBarUpV = viewToolBar->y() > height()/2;
1896 else 1898 else
1897 p->mToolBarUpV = viewToolBar->x() > width()/2 ; 1899 p->mToolBarUpV = viewToolBar->x() > width()/2 ;
1898 1900
1899 if ( p->mToolBarHorN ) 1901 if ( p->mToolBarHorN )
1900 p->mToolBarUpN = navigatorToolBar->y() > height()/2; 1902 p->mToolBarUpN = navigatorToolBar->y() > height()/2;
1901 else 1903 else
1902 p->mToolBarUpN = navigatorToolBar->x() > width()/2 ; 1904 p->mToolBarUpN = navigatorToolBar->x() > width()/2 ;
1903 if ( filterToolBar ) { 1905 if ( filterToolBar ) {
1904 if ( p->mToolBarHorF ) 1906 if ( p->mToolBarHorF )
1905 p->mToolBarUpF = filterToolBar->y() > height()/2; 1907 p->mToolBarUpF = filterToolBar->y() > height()/2;
1906 else 1908 else
1907 p->mToolBarUpF = filterToolBar->x() > width()/2 ; 1909 p->mToolBarUpF = filterToolBar->x() > width()/2 ;
1908 } 1910 }
1909#endif 1911#endif
1910 save(); 1912 save();
1911 mView->writeSettings(); 1913 mView->writeSettings();
1912 mView->checkSuspendAlarm(); 1914 mView->checkSuspendAlarm();
1913} 1915}
1914void MainWindow::slotModifiedChanged( bool ) 1916void MainWindow::slotModifiedChanged( bool )
1915{ 1917{
1916 if ( mBlockAtStartup ) 1918 if ( mBlockAtStartup )
1917 return; 1919 return;
1918 1920
1919 int msec; 1921 int msec;
1920 if ( mCalendarModifiedFlag ) { 1922 if ( mCalendarModifiedFlag ) {
1921 //qDebug(" MainWindow timer is running "); 1923 //qDebug(" MainWindow timer is running ");
1922 return; 1924 return;
1923 } 1925 }
1924 // we store the changes after 1 minute, 1926 // we store the changes after 1 minute,
1925 // and for safety reasons after 10 minutes again 1927 // and for safety reasons after 10 minutes again
1926 if ( !mSyncManager->blockSave() ) 1928 if ( !mSyncManager->blockSave() )
1927 msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; 1929 msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000;
1928 else 1930 else
1929 msec = 1000 * 600; 1931 msec = 1000 * 600;
1930 mSaveTimer.start( msec, true ); // 1 minute 1932 mSaveTimer.start( msec, true ); // 1 minute
1931 qDebug("KO: Saving File in %d secs!", msec/1000); 1933 qDebug("KO: Saving File in %d secs!", msec/1000);
1932 mCalendarModifiedFlag = true; 1934 mCalendarModifiedFlag = true;
1933} 1935}
1934void MainWindow::saveStopTimer() 1936void MainWindow::saveStopTimer()
1935{ 1937{
1936 mSaveTimer.stop(); 1938 mSaveTimer.stop();
1937} 1939}
1938void MainWindow::backupAllFiles() 1940void MainWindow::backupAllFiles()
1939{ 1941{
1940 QDate reference ( 2000,1,1); 1942 QDate reference ( 2000,1,1);
1941 int daysTo = reference.daysTo ( QDate::currentDate() ); 1943 int daysTo = reference.daysTo ( QDate::currentDate() );
1942 setCaption(i18n("Creating backup ... please wait ..." )); 1944 setCaption(i18n("Creating backup ... please wait ..." ));
1943 qDebug("KO: Last backup was %d days ago ", daysTo - KOPrefs::instance()->mLastBackupDate); 1945 qDebug("KO: Last backup was %d days ago ", daysTo - KOPrefs::instance()->mLastBackupDate);
1944 // we need the file path, the backup dir and the number of bups as param 1946 // we need the file path, the backup dir and the number of bups as param
1945 QString bupDir = KPimGlobalPrefs::instance()->mBackupDatadir; 1947 QString bupDir = KPimGlobalPrefs::instance()->mBackupDatadir;
1946 if ( KPimGlobalPrefs::instance()->mBackupUseDefaultDir) 1948 if ( KPimGlobalPrefs::instance()->mBackupUseDefaultDir)
1947 bupDir = KGlobalSettings::backupDataDir(); 1949 bupDir = KGlobalSettings::backupDataDir();
1948 int retval = KApplication::createBackup( defaultFileName(), bupDir, KPimGlobalPrefs::instance()->mBackupNumbers ); 1950 int retval = KApplication::createBackup( defaultFileName(), bupDir, KPimGlobalPrefs::instance()->mBackupNumbers );
1949 if ( retval == 0 ) { 1951 if ( retval == 0 ) {
1950 setCaption(i18n("Backup cancelled" )); 1952 setCaption(i18n("Backup cancelled" ));
1951 qDebug("KO: Backup cancelled. Will try again tomorrow "); 1953 qDebug("KO: Backup cancelled. Will try again tomorrow ");
1952 // retval == 0 : backup skipped for today, try again tomorrow 1954 // retval == 0 : backup skipped for today, try again tomorrow
1953 KOPrefs::instance()->mLastBackupDate = daysTo- KPimGlobalPrefs::instance()->mBackupDayCount+1; 1955 KOPrefs::instance()->mLastBackupDate = daysTo- KPimGlobalPrefs::instance()->mBackupDayCount+1;
1954 } else if ( retval == 1 ){ 1956 } else if ( retval == 1 ){
1955 qDebug("KO: Backup created."); 1957 qDebug("KO: Backup created.");
1956 // backup ok 1958 // backup ok
1957 QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; 1959 QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars;
1958 KopiCalendarFile * cal = calendars.first(); 1960 KopiCalendarFile * cal = calendars.first();
1959 cal = calendars.next(); 1961 cal = calendars.next();
1960 while ( cal ) { 1962 while ( cal ) {
1961 if ( !cal->mErrorOnLoad ) { 1963 if ( !cal->mErrorOnLoad ) {
1962 KApplication::createBackup( cal->mFileName, bupDir, KPimGlobalPrefs::instance()->mBackupNumbers ); 1964 KApplication::createBackup( cal->mFileName, bupDir, KPimGlobalPrefs::instance()->mBackupNumbers );
1963 } 1965 }
1964 cal = calendars.next(); 1966 cal = calendars.next();
1965 } 1967 }
1966 KOPrefs::instance()->mLastBackupDate = daysTo; 1968 KOPrefs::instance()->mLastBackupDate = daysTo;
1967 setCaption(i18n("Backup succesfully finished" )); 1969 setCaption(i18n("Backup succesfully finished" ));
1968 } else if ( retval == 2 ){ 1970 } else if ( retval == 2 ){
1969 setCaption(i18n("Backup globally disabled" )); 1971 setCaption(i18n("Backup globally disabled" ));
1970 qDebug("KO: Backup globally cancelled."); 1972 qDebug("KO: Backup globally cancelled.");
1971 // backup globally cancelled 1973 // backup globally cancelled
1972 KPimGlobalPrefs::instance()->mBackupEnabled = false; 1974 KPimGlobalPrefs::instance()->mBackupEnabled = false;
1973 } 1975 }
1974 // retval == 3: do nothing, try again later 1976 // retval == 3: do nothing, try again later
1975} 1977}
1976void MainWindow::save() 1978void MainWindow::save()
1977{ 1979{
1978 1980
1979 if ( mView->viewManager()->journalView() ) 1981 if ( mView->viewManager()->journalView() )
1980 mView->viewManager()->journalView()->checkModified(); 1982 mView->viewManager()->journalView()->checkModified();
1981 if ( !mCalendarModifiedFlag ) { 1983 if ( !mCalendarModifiedFlag ) {
1982 qDebug("KO: Calendar not modified. Nothing saved."); 1984 qDebug("KO: Calendar not modified. Nothing saved.");
1983 return; 1985 return;
1984 } 1986 }
1985 if ( mSyncManager->blockSave() ) { 1987 if ( mSyncManager->blockSave() ) {
1986 slotModifiedChanged( true ); 1988 slotModifiedChanged( true );
1987 return; 1989 return;
1988 } 1990 }
1989 mSyncManager->setBlockSave(true); 1991 mSyncManager->setBlockSave(true);
1990 if ( mView->checkAllFileVersions() ) { 1992 if ( mView->checkAllFileVersions() ) {
1991 if ( KPimGlobalPrefs::instance()->mBackupEnabled ){ 1993 if ( KPimGlobalPrefs::instance()->mBackupEnabled ){
1992 QDate reference ( 2000,1,1); 1994 QDate reference ( 2000,1,1);
1993 int daysTo = reference.daysTo ( QDate::currentDate() ); 1995 int daysTo = reference.daysTo ( QDate::currentDate() );
1994 if ( daysTo - KPimGlobalPrefs::instance()->mBackupDayCount >= KOPrefs::instance()->mLastBackupDate ) { 1996 if ( daysTo - KPimGlobalPrefs::instance()->mBackupDayCount >= KOPrefs::instance()->mLastBackupDate ) {
1995 backupAllFiles(); 1997 backupAllFiles();
1996 } 1998 }
1997 ; // KPimGlobalPrefs::instance()->mLastBackupDate 1999 ; // KPimGlobalPrefs::instance()->mLastBackupDate
1998 } 2000 }
1999 QTime neededSaveTime = QDateTime::currentDateTime().time(); 2001 QTime neededSaveTime = QDateTime::currentDateTime().time();
2000 if ( !isMinimized () ) 2002 if ( !isMinimized () )
2001 setCaption(i18n("KO/Pi:Saving Data to File ..." )); 2003 setCaption(i18n("KO/Pi:Saving Data to File ..." ));
2002 qDebug("KO: Start saving data to file!"); 2004 qDebug("KO: Start saving data to file!");
2003 mView->saveCalendars(); 2005 mView->saveCalendars();
2004 mCalendarModifiedFlag = false; 2006 mCalendarModifiedFlag = false;
2005 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); 2007 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
2006 qDebug("KO: Needed %d ms for saving.",msNeeded ); 2008 qDebug("KO: Needed %d ms for saving.",msNeeded );
2007 QString savemes; 2009 QString savemes;
2008 savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); 2010 savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 );
2009 if ( !isMinimized () ) 2011 if ( !isMinimized () )
2010 setCaption(savemes); 2012 setCaption(savemes);
2011 else 2013 else
2012 qDebug(savemes); 2014 qDebug(savemes);
2013 } else { 2015 } else {
2014 setCaption(i18n("Saving cancelled!")); 2016 setCaption(i18n("Saving cancelled!"));
2015 mCalendarModifiedFlag = false; 2017 mCalendarModifiedFlag = false;
2016 slotModifiedChanged( true ); 2018 slotModifiedChanged( true );
2017 } 2019 }
2018 mSyncManager->setBlockSave( false ); 2020 mSyncManager->setBlockSave( false );
2019} 2021}
2020 2022
2021void MainWindow::keyReleaseEvent ( QKeyEvent * e) 2023void MainWindow::keyReleaseEvent ( QKeyEvent * e)
2022{ 2024{
2023 if ( !e->isAutoRepeat() ) { 2025 if ( !e->isAutoRepeat() ) {
2024 mFlagKeyPressed = false; 2026 mFlagKeyPressed = false;
2025 } 2027 }
2026} 2028}
2027void MainWindow::keyPressEvent ( QKeyEvent * e ) 2029void MainWindow::keyPressEvent ( QKeyEvent * e )
2028{ 2030{
2029 qApp->processEvents(); 2031 qApp->processEvents();
2030 if ( e->isAutoRepeat() && !mFlagKeyPressed ) { 2032 if ( e->isAutoRepeat() && !mFlagKeyPressed ) {
2031 e->ignore(); 2033 e->ignore();
2032 // qDebug(" ignore %d",e->isAutoRepeat() ); 2034 // qDebug(" ignore %d",e->isAutoRepeat() );
2033 return; 2035 return;
2034 } 2036 }
2035 if (! e->isAutoRepeat() ) 2037 if (! e->isAutoRepeat() )
2036 mFlagKeyPressed = true; 2038 mFlagKeyPressed = true;
2037 KOPrefs *p = KOPrefs::instance(); 2039 KOPrefs *p = KOPrefs::instance();
2038 bool showSelectedDates = false; 2040 bool showSelectedDates = false;
2039 int size; 2041 int size;
2040 int pro = 0; 2042 int pro = 0;
2041 //qDebug("MainWindow::keyPressEvent "); 2043 //qDebug("MainWindow::keyPressEvent ");
2042 switch ( e->key() ) { 2044 switch ( e->key() ) {
2043 case Qt::Key_Right: 2045 case Qt::Key_Right:
2044 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) 2046 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton)
2045 mView->goNextMonth(); 2047 mView->goNextMonth();
2046 else 2048 else
2047 mView->goNext(); 2049 mView->goNext();
2048 showSelectedDates = true; 2050 showSelectedDates = true;
2049 break; 2051 break;
2050 case Qt::Key_Left: 2052 case Qt::Key_Left:
2051 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 2053 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
2052 mView->goPreviousMonth(); 2054 mView->goPreviousMonth();
2053 else 2055 else
2054 mView->goPrevious(); 2056 mView->goPrevious();
2055 showSelectedDates = true; 2057 showSelectedDates = true;
2056 break; 2058 break;
2057 case Qt::Key_Down: 2059 case Qt::Key_Down:
2058 mView->viewManager()->agendaView()->scrollOneHourDown(); 2060 mView->viewManager()->agendaView()->scrollOneHourDown();
2059 break; 2061 break;
2060 case Qt::Key_Up: 2062 case Qt::Key_Up:
2061 mView->viewManager()->agendaView()->scrollOneHourUp(); 2063 mView->viewManager()->agendaView()->scrollOneHourUp();
2062 break; 2064 break;
2063 case Qt::Key_K: 2065 case Qt::Key_K:
2064 mView->viewManager()->showMonthViewWeek(); 2066 mView->viewManager()->showMonthViewWeek();
2065 break; 2067 break;
2066 case Qt::Key_I: 2068 case Qt::Key_I:
2067 mView->showIncidence(); 2069 mView->showIncidence();
2068 break; 2070 break;
2069 case Qt::Key_Delete: 2071 case Qt::Key_Delete:
2070 case Qt::Key_Backspace: 2072 case Qt::Key_Backspace:
2071 mView->deleteIncidence(); 2073 mView->deleteIncidence();
2072 break; 2074 break;
2073 case Qt::Key_D: 2075 case Qt::Key_D:
2074 mView->viewManager()->showDayView(); 2076 mView->viewManager()->showDayView();
2075 showSelectedDates = true; 2077 showSelectedDates = true;
2076 break; 2078 break;
2077 case Qt::Key_O: 2079 case Qt::Key_O:
2078 mView->toggleFilerEnabled( ); 2080 mView->toggleFilerEnabled( );
2079 break; 2081 break;
2080 case Qt::Key_0: 2082 case Qt::Key_0:
2081 case Qt::Key_1: 2083 case Qt::Key_1:
2082 case Qt::Key_2: 2084 case Qt::Key_2:
2083 case Qt::Key_3: 2085 case Qt::Key_3:
2084 case Qt::Key_4: 2086 case Qt::Key_4:
2085 case Qt::Key_5: 2087 case Qt::Key_5:
2086 case Qt::Key_6: 2088 case Qt::Key_6:
2087 case Qt::Key_7: 2089 case Qt::Key_7:
2088 case Qt::Key_8: 2090 case Qt::Key_8:
2089 case Qt::Key_9: 2091 case Qt::Key_9:
2090 pro = e->key()-48; 2092 pro = e->key()-48;
2091 if ( pro == 0 ) 2093 if ( pro == 0 )
2092 pro = 10; 2094 pro = 10;
2093 if ( e->state() == Qt::ControlButton) 2095 if ( e->state() == Qt::ControlButton)
2094 pro += 10; 2096 pro += 10;
2095 break; 2097 break;
2096 case Qt::Key_M: 2098 case Qt::Key_M:
2097 mView->viewManager()->showMonthView(); 2099 mView->viewManager()->showMonthView();
2098 showSelectedDates = true; 2100 showSelectedDates = true;
2099 break; 2101 break;
2100 case Qt::Key_Insert: 2102 case Qt::Key_Insert:
2101 mView->newEvent(); 2103 mView->newEvent();
2102 break; 2104 break;
2103 case Qt::Key_S : 2105 case Qt::Key_S :
2104 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) 2106 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton)
2105 mView->newSubTodo(); 2107 mView->newSubTodo();
2106 else 2108 else
2107 mView->dialogManager()->showSearchDialog(); 2109 mView->dialogManager()->showSearchDialog();
2108 break; 2110 break;
2109 case Qt::Key_Y : 2111 case Qt::Key_Y :
2110 case Qt::Key_Z : 2112 case Qt::Key_Z :
2111 mView->viewManager()->showWorkWeekView(); 2113 mView->viewManager()->showWorkWeekView();
2112 showSelectedDates = true; 2114 showSelectedDates = true;
2113 break; 2115 break;
2114 case Qt::Key_U : 2116 case Qt::Key_U :
2115 mView->viewManager()->showWeekView(); 2117 mView->viewManager()->showWeekView();
2116 showSelectedDates = true; 2118 showSelectedDates = true;
2117 break; 2119 break;
2118 case Qt::Key_H : 2120 case Qt::Key_H :
2119 keyBindings(); 2121 keyBindings();
2120 break; 2122 break;
2121 case Qt::Key_W: 2123 case Qt::Key_W:
2122 mView->viewManager()->showWhatsNextView(); 2124 mView->viewManager()->showWhatsNextView();
2123 break; 2125 break;
2124 case Qt::Key_L: 2126 case Qt::Key_L:
2125 mView->viewManager()->showListView(); 2127 mView->viewManager()->showListView();
2126 break; 2128 break;
2127 case Qt::Key_N: 2129 case Qt::Key_N:
2128 mView->viewManager()->showNextView(); 2130 mView->viewManager()->showNextView();
2129 break; 2131 break;
2130 case Qt::Key_V: 2132 case Qt::Key_V:
2131 mView->viewManager()->showTodoView(); 2133 mView->viewManager()->showTodoView();
2132 break; 2134 break;
2133 case Qt::Key_C: 2135 case Qt::Key_C:
2134 mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() ); 2136 mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() );
2135 break; 2137 break;
2136 case Qt::Key_P: 2138 case Qt::Key_P:
2137 mView->showDatePicker( ); 2139 mView->showDatePicker( );
2138 break; 2140 break;
2139 case Qt::Key_F: 2141 case Qt::Key_F:
2140 mView->editFilters(); 2142 mView->editFilters();
2141 break; 2143 break;
2142 case Qt::Key_R: 2144 case Qt::Key_R:
2143 mView->toggleFilter(); 2145 mView->toggleFilter();
2144 break; 2146 break;
2145 case Qt::Key_X: 2147 case Qt::Key_X:
2146 if ( e->state() == Qt::ControlButton ) 2148 if ( e->state() == Qt::ControlButton )
2147 mView->toggleDateNavigatorWidget(); 2149 mView->toggleDateNavigatorWidget();
2148 else { 2150 else {
2149 mView->viewManager()->showNextXView(); 2151 mView->viewManager()->showNextXView();
2150 showSelectedDates = true; 2152 showSelectedDates = true;
2151 } 2153 }
2152 break; 2154 break;
2153 case Qt::Key_Space: 2155 case Qt::Key_Space:
2154 mView->toggleExpand(); 2156 mView->toggleExpand();
2155 break; 2157 break;
2156 case Qt::Key_A: 2158 case Qt::Key_A:
2157 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton ) 2159 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton )
2158 mView->showNextAlarms(); 2160 mView->showNextAlarms();
2159 else 2161 else
2160 mView->toggleAllDaySize(); 2162 mView->toggleAllDaySize();
2161 break; 2163 break;
2162 case Qt::Key_T: 2164 case Qt::Key_T:
2163 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 2165 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
2164 mView->newTodo(); 2166 mView->newTodo();
2165 else { 2167 else {
2166 mView->goToday(); 2168 mView->goToday();
2167 showSelectedDates = true; 2169 showSelectedDates = true;
2168 } 2170 }
2169 break; 2171 break;
2170 case Qt::Key_Q: 2172 case Qt::Key_Q:
2171 if ( e->state() == Qt::ControlButton ) 2173 if ( e->state() == Qt::ControlButton )
2172 mView->conflictNotAll(); 2174 mView->conflictNotAll();
2173 else if ( e->state() == Qt::ShiftButton ) 2175 else if ( e->state() == Qt::ShiftButton )
2174 mView->conflictAllday(); 2176 mView->conflictAllday();
2175 else 2177 else
2176 mView->conflictAll(); 2178 mView->conflictAll();
2177 break; 2179 break;
2178 case Qt::Key_J: 2180 case Qt::Key_J:
2179 mView->viewManager()->showJournalView(); 2181 mView->viewManager()->showJournalView();
2180 break; 2182 break;
2181 case Qt::Key_B: 2183 case Qt::Key_B:
2182 mView->editIncidenceDescription();; 2184 mView->editIncidenceDescription();;
2183 break; 2185 break;
2184 // case Qt::Key_Return: 2186 // case Qt::Key_Return:
2185 case Qt::Key_E: 2187 case Qt::Key_E:
2186 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 2188 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
2187 mView->newEvent(); 2189 mView->newEvent();
2188 else 2190 else
2189 mView->editIncidence(); 2191 mView->editIncidence();
2190 break; 2192 break;
2191 case Qt::Key_Plus: 2193 case Qt::Key_Plus:
2192 size = p->mHourSize +2; 2194 size = p->mHourSize +2;
2193 if ( size <= 22 ) 2195 if ( size <= 22 )
2194 configureAgenda( size ); 2196 configureAgenda( size );
2195 break; 2197 break;
2196 case Qt::Key_Minus: 2198 case Qt::Key_Minus:
2197 size = p->mHourSize - 2; 2199 size = p->mHourSize - 2;
2198 if ( size >= 4 ) 2200 if ( size >= 4 )
2199 configureAgenda( size ); 2201 configureAgenda( size );
2200 break; 2202 break;
2201 2203
2202 2204
2203 default: 2205 default:
2204 e->ignore(); 2206 e->ignore();
2205 } 2207 }
2206 if ( pro > 0 ) { 2208 if ( pro > 0 ) {
2207 selectFilter( pro+1 ); 2209 selectFilter( pro+1 );
2208 } 2210 }
2209 if ( showSelectedDates ) { 2211 if ( showSelectedDates ) {
2210 ;// setCaptionToDates(); 2212 ;// setCaptionToDates();
2211 } 2213 }
2212 2214
2213} 2215}
2214void MainWindow::fillFilterMenuTB() 2216void MainWindow::fillFilterMenuTB()
2215{ 2217{
2216 selectFilterMenuTB->clear(); 2218 selectFilterMenuTB->clear();
2217 selectFilterMenuTB->insertItem(i18n ( "Edit Filters" ), 0 ); 2219 selectFilterMenuTB->insertItem(i18n ( "Edit Filters" ), 0 );
2218 selectFilterMenuTB->insertSeparator(); 2220 selectFilterMenuTB->insertSeparator();
2219 selectFilterMenuTB->insertItem(i18n ( "No Filter" ), 1 ); 2221 selectFilterMenuTB->insertItem(i18n ( "No Filter" ), 1 );
2220 2222
2221 selectFilterMenuTB->insertSeparator(); 2223 selectFilterMenuTB->insertSeparator();
2222 QPtrList<CalFilter> fili = mView->filters(); 2224 QPtrList<CalFilter> fili = mView->filters();
2223 CalFilter *curfilter = mView->filterView()->selectedFilter(); 2225 CalFilter *curfilter = mView->filterView()->selectedFilter();
2224 CalFilter *filter = fili.first(); 2226 CalFilter *filter = fili.first();
2225 int iii = 2; 2227 int iii = 2;
2226 bool checkitem = mView->filterView()->filtersEnabled(); 2228 bool checkitem = mView->filterView()->filtersEnabled();
2227 while(filter) { 2229 while(filter) {
2228 selectFilterMenuTB->insertItem( filter->name(), iii ); 2230 selectFilterMenuTB->insertItem( filter->name(), iii );
2229 if ( filter == curfilter) 2231 if ( filter == curfilter)
2230 selectFilterMenuTB->setItemChecked( iii, checkitem ); 2232 selectFilterMenuTB->setItemChecked( iii, checkitem );
2231 filter = fili.next(); 2233 filter = fili.next();
2232 ++iii; 2234 ++iii;
2233 } 2235 }
2234 if ( !checkitem ) 2236 if ( !checkitem )
2235 selectFilterMenuTB->setItemChecked( 1, true ); 2237 selectFilterMenuTB->setItemChecked( 1, true );
2236 2238
2237 int x = 0; 2239 int x = 0;
2238 int y = iconToolBar->height(); 2240 int y = iconToolBar->height();
2239 int dX = 0; 2241 int dX = 0;
2240 int dY = 0; 2242 int dY = 0;
2241 if ( iconToolBar->orientation () == Qt:: Horizontal ) { 2243 if ( iconToolBar->orientation () == Qt:: Horizontal ) {
2242 if ( iconToolBar->y() > height()/2 ) { 2244 if ( iconToolBar->y() > height()/2 ) {
2243 dY = selectFilterMenuTB->sizeHint().height()+8; 2245 dY = selectFilterMenuTB->sizeHint().height()+8;
2244 y = 0; 2246 y = 0;
2245 } 2247 }
2246 } else { 2248 } else {
2247 if ( iconToolBar->x() > width()/2 ) { // right side 2249 if ( iconToolBar->x() > width()/2 ) { // right side
2248 x=0; 2250 x=0;
2249 dX= selectFilterMenuTB->sizeHint().width()+8; 2251 dX= selectFilterMenuTB->sizeHint().width()+8;
2250 y = 0; 2252 y = 0;
2251 } else { 2253 } else {
2252 x= iconToolBar->width(); 2254 x= iconToolBar->width();
2253 y = 0; 2255 y = 0;
2254 } 2256 }
2255 } 2257 }
2256 //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() ); 2258 //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() );
2257 selectFilterMenuTB->popup(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY))); 2259 selectFilterMenuTB->popup(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY)));
2258} 2260}
2259void MainWindow::fillFilterMenu() 2261void MainWindow::fillFilterMenu()
2260{ 2262{
2261 selectFilterMenu->clear(); 2263 selectFilterMenu->clear();
2262 selectFilterMenu->insertItem(i18n ( "Edit Filters" ), 0 ); 2264 selectFilterMenu->insertItem(i18n ( "Edit Filters" ), 0 );
2263 selectFilterMenu->insertSeparator(); 2265 selectFilterMenu->insertSeparator();
2264 selectFilterMenu->insertItem(i18n ( "No Filter" ), 1 ); 2266 selectFilterMenu->insertItem(i18n ( "No Filter" ), 1 );
2265 2267
2266 selectFilterMenu->insertSeparator(); 2268 selectFilterMenu->insertSeparator();
2267 QPtrList<CalFilter> fili = mView->filters(); 2269 QPtrList<CalFilter> fili = mView->filters();
2268 CalFilter *curfilter = mView->filterView()->selectedFilter(); 2270 CalFilter *curfilter = mView->filterView()->selectedFilter();
2269 CalFilter *filter = fili.first(); 2271 CalFilter *filter = fili.first();
2270 int iii = 2; 2272 int iii = 2;
2271 bool checkitem = mView->filterView()->filtersEnabled(); 2273 bool checkitem = mView->filterView()->filtersEnabled();
2272 while(filter) { 2274 while(filter) {
2273 selectFilterMenu->insertItem( filter->name(), iii ); 2275 selectFilterMenu->insertItem( filter->name(), iii );
2274 if ( filter == curfilter) 2276 if ( filter == curfilter)
2275 selectFilterMenu->setItemChecked( iii, checkitem ); 2277 selectFilterMenu->setItemChecked( iii, checkitem );
2276 filter = fili.next(); 2278 filter = fili.next();
2277 ++iii; 2279 ++iii;
2278 } 2280 }
2279 if ( !checkitem ) 2281 if ( !checkitem )
2280 selectFilterMenu->setItemChecked( 1, true ); 2282 selectFilterMenu->setItemChecked( 1, true );
2281} 2283}
2282void MainWindow::fillFilterMenuPopup() 2284void MainWindow::fillFilterMenuPopup()
2283{ 2285{
2284 filterPopupMenu->clear(); 2286 filterPopupMenu->clear();
2285 filterPopupMenu->insertItem(i18n ( "No Filter" ), 0 ); 2287 filterPopupMenu->insertItem(i18n ( "No Filter" ), 0 );
2286 2288
2287 filterPopupMenu->insertSeparator(); 2289 filterPopupMenu->insertSeparator();
2288 QPtrList<CalFilter> fili = mView->filters(); 2290 QPtrList<CalFilter> fili = mView->filters();
2289 CalFilter *curfilter = mView->filterView()->selectedFilter(); 2291 CalFilter *curfilter = mView->filterView()->selectedFilter();
2290 CalFilter *filter = fili.first(); 2292 CalFilter *filter = fili.first();
2291 int iii = 1; 2293 int iii = 1;
2292 bool checkitem = mView->filterView()->filtersEnabled(); 2294 bool checkitem = mView->filterView()->filtersEnabled();
2293 while(filter) { 2295 while(filter) {
2294 filterPopupMenu->insertItem( filter->name(), iii ); 2296 filterPopupMenu->insertItem( filter->name(), iii );
2295 if ( filter == curfilter) 2297 if ( filter == curfilter)
2296 filterPopupMenu->setItemChecked( iii, checkitem ); 2298 filterPopupMenu->setItemChecked( iii, checkitem );
2297 filter = fili.next(); 2299 filter = fili.next();
2298 ++iii; 2300 ++iii;
2299 } 2301 }
2300 if ( !checkitem ) 2302 if ( !checkitem )
2301 filterPopupMenu->setItemChecked( 0, true ); 2303 filterPopupMenu->setItemChecked( 0, true );
2302} 2304}
2303void MainWindow::selectFilter( int fil ) 2305void MainWindow::selectFilter( int fil )
2304{ 2306{
2305 2307
2306 if ( fil == 0 ) { 2308 if ( fil == 0 ) {
2307 mView->editFilters( ); 2309 mView->editFilters( );
2308 } else if ( fil == 1 ){ 2310 } else if ( fil == 1 ){
2309 if ( mView->filterView()->filtersEnabled() ) 2311 if ( mView->filterView()->filtersEnabled() )
2310 mView->toggleFilerEnabled( ); 2312 mView->toggleFilerEnabled( );
2311 } else { 2313 } else {
2312 if ( !mView->filterView()->filtersEnabled() ) { 2314 if ( !mView->filterView()->filtersEnabled() ) {
2313 mView->filterView()->blockSignals( true ); 2315 mView->filterView()->blockSignals( true );
2314 mView->toggleFilerEnabled( ); 2316 mView->toggleFilerEnabled( );
2315 mView->filterView()->blockSignals( false ); 2317 mView->filterView()->blockSignals( false );
2316 } 2318 }
2317 mView->selectFilter( fil-2 ); 2319 mView->selectFilter( fil-2 );
2318 } 2320 }
2319} 2321}
2320void MainWindow::updateFilterToolbar() 2322void MainWindow::updateFilterToolbar()
2321{ 2323{
2322 if ( filterMenubar ) { 2324 if ( filterMenubar ) {
2323 if ( !mView->filterView()->filtersEnabled() ) { 2325 if ( !mView->filterView()->filtersEnabled() ) {
2324 filterMenubar->changeItem( 0, i18n("No Filter") ); 2326 filterMenubar->changeItem( 0, i18n("No Filter") );
2325 } else { 2327 } else {
2326 CalFilter *curfilter = mView->filterView()->selectedFilter(); 2328 CalFilter *curfilter = mView->filterView()->selectedFilter();
2327 if ( curfilter ) { 2329 if ( curfilter ) {
2328 filterMenubar->changeItem( 0, curfilter->name() ); 2330 QString name = curfilter->name();
2331 if ( name.length() > 12 )
2332 name = name.left(10)+"...";
2333 filterMenubar->changeItem( 0, name );
2329 } 2334 }
2330 } 2335 }
2331 } 2336 }
2332} 2337}
2333void MainWindow::selectFilterPopup( int fil ) 2338void MainWindow::selectFilterPopup( int fil )
2334{ 2339{
2335 selectFilter( fil + 1 ); 2340 selectFilter( fil + 1 );
2336 2341
2337} 2342}
2338void MainWindow::configureToolBar( int item ) 2343void MainWindow::configureToolBar( int item )
2339{ 2344{
2340 2345
2341 configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) ); 2346 configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) );
2342 KOPrefs *p = KOPrefs::instance(); 2347 KOPrefs *p = KOPrefs::instance();
2343 p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 ); 2348 p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 );
2344 p-> mShowIconOnetoolbar = configureToolBarMenu->isItemChecked( 6 ); 2349 p-> mShowIconOnetoolbar = configureToolBarMenu->isItemChecked( 6 );
2345 p-> mShowIconFilter = configureToolBarMenu->isItemChecked( 7 ); 2350 p-> mShowIconFilter = configureToolBarMenu->isItemChecked( 7 );
2346 p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 ); 2351 p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 );
2347 p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 ); 2352 p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 );
2348 p->mShowIconNavigator = configureToolBarMenu->isItemChecked( 22 ); 2353 p->mShowIconNavigator = configureToolBarMenu->isItemChecked( 22 );
2349 p->mShowIconAllday = configureToolBarMenu->isItemChecked( 24 ); 2354 p->mShowIconAllday = configureToolBarMenu->isItemChecked( 24 );
2350 p->mShowIconFilterview = configureToolBarMenu->isItemChecked( 26 ); 2355 p->mShowIconFilterview = configureToolBarMenu->isItemChecked( 26 );
2351 p->mShowIconToggleFull = configureToolBarMenu->isItemChecked( 28 ); 2356 p->mShowIconToggleFull = configureToolBarMenu->isItemChecked( 28 );
2352 p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 ); 2357 p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 );
2353 p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 ); 2358 p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 );
2354 p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 ); 2359 p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 );
2355 p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 ); 2360 p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 );
2356 p-> mShowIconDay6= configureToolBarMenu->isItemChecked( 75 ); 2361 p-> mShowIconDay6= configureToolBarMenu->isItemChecked( 75 );
2357 p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 ); 2362 p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 );
2358 p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 ); 2363 p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 );
2359 p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 ); 2364 p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 );
2360 p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 ); 2365 p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 );
2361 p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 ); 2366 p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 );
2362 p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 ); 2367 p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 );
2363 p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 ); 2368 p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 );
2364 p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 ); 2369 p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 );
2365 p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 ); 2370 p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 );
2366 p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 ); 2371 p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 );
2367 p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 ); 2372 p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 );
2368 p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 ); 2373 p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 );
2369 p-> mShowIconWeekNum= configureToolBarMenu->isItemChecked( 400 ); 2374 p-> mShowIconWeekNum= configureToolBarMenu->isItemChecked( 400 );
2370 // initActions(); 2375 // initActions();
2371 setCaption ( i18n("Toolbar changes needs a restart!") ); 2376 setCaption ( i18n("Toolbar changes needs a restart!") );
2372} 2377}
2373void MainWindow::setCaption ( const QString & c ) 2378void MainWindow::setCaption ( const QString & c )
2374{ 2379{
2375 QString cap = c; 2380 QString cap = c;
2376 cap.replace( QRegExp("\n"), " " ); 2381 cap.replace( QRegExp("\n"), " " );
2377 cap = cap.stripWhiteSpace(); 2382 cap = cap.stripWhiteSpace();
2378 if ( cap.isEmpty() ) 2383 if ( cap.isEmpty() )
2379 cap = "KO/Pi"; 2384 cap = "KO/Pi";
2380 QWidget::setCaption( cap ); 2385 QWidget::setCaption( cap );
2381} 2386}
2382void MainWindow::setCaptionToDates() 2387void MainWindow::setCaptionToDates()
2383{ 2388{
2384 QString selDates; 2389 QString selDates;
2385 QDate date = mView->startDate(); 2390 QDate date = mView->startDate();
2386 if ( ! date.isValid() ) { 2391 if ( ! date.isValid() ) {
2387 setCaption(""); 2392 setCaption("");
2388 return; 2393 return;
2389 } 2394 }
2390 selDates = KGlobal::locale()->formatDate( date, true); 2395 selDates = KGlobal::locale()->formatDate( date, true);
2391 if (mView->startDate() < mView->endDate() ) 2396 if (mView->startDate() < mView->endDate() )
2392 selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true); 2397 selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true);
2393 else { 2398 else {
2394 QString addString; 2399 QString addString;
2395 if ( date == QDateTime::currentDateTime().date() ) 2400 if ( date == QDateTime::currentDateTime().date() )
2396 addString = i18n("Today"); 2401 addString = i18n("Today");
2397 else if ( date == QDateTime::currentDateTime().date().addDays(1) ) 2402 else if ( date == QDateTime::currentDateTime().date().addDays(1) )
2398 addString = i18n("Tomorrow"); 2403 addString = i18n("Tomorrow");
2399 if ( !addString.isEmpty() ) 2404 if ( !addString.isEmpty() )
2400 selDates = addString+", "+selDates ; 2405 selDates = addString+", "+selDates ;
2401 } 2406 }
2402 setCaption( i18n("Dates: ") + selDates ); 2407 setCaption( i18n("Dates: ") + selDates );
2403 2408
2404} 2409}
2405void MainWindow::showConfigureAgenda( ) 2410void MainWindow::showConfigureAgenda( )
2406{ 2411{
2407 int iii; 2412 int iii;
2408 for ( iii = 1;iii<= 10 ;++iii ){ 2413 for ( iii = 1;iii<= 10 ;++iii ){
2409 configureAgendaMenu->setItemChecked( (iii+1)*2, false ); 2414 configureAgendaMenu->setItemChecked( (iii+1)*2, false );
2410 } 2415 }
2411 configureAgendaMenu->setItemChecked( (KOPrefs::instance()->mHourSize/2)*2, true ); 2416 configureAgendaMenu->setItemChecked( (KOPrefs::instance()->mHourSize/2)*2, true );
2412} 2417}
2413void MainWindow::configureAgenda( int item ) 2418void MainWindow::configureAgenda( int item )
2414{ 2419{
2415 if ( KOPrefs::instance()->mHourSize == item ) 2420 if ( KOPrefs::instance()->mHourSize == item )
2416 return; 2421 return;
2417 KOPrefs::instance()->mHourSize=item; 2422 KOPrefs::instance()->mHourSize=item;
2418 mView->viewManager()->agendaView()->updateConfig(); 2423 mView->viewManager()->agendaView()->updateConfig();
2419} 2424}
2420 2425
2421void MainWindow::saveCalendar() 2426void MainWindow::saveCalendar()
2422{ 2427{
2423 QString bupDir = KPimGlobalPrefs::instance()->mBackupDatadir; 2428 QString bupDir = KPimGlobalPrefs::instance()->mBackupDatadir;
2424 if ( KPimGlobalPrefs::instance()->mBackupUseDefaultDir) 2429 if ( KPimGlobalPrefs::instance()->mBackupUseDefaultDir)
2425 bupDir = KGlobalSettings::backupDataDir(); 2430 bupDir = KGlobalSettings::backupDataDir();
2426 bupDir = KGlobal::formatMessage ( bupDir, 0 ); 2431 bupDir = KGlobal::formatMessage ( bupDir, 0 );
2427 QString bupHint; 2432 QString bupHint;
2428 if ( !KPimGlobalPrefs::instance()->mBackupEnabled ) 2433 if ( !KPimGlobalPrefs::instance()->mBackupEnabled )
2429 bupHint = i18n("(Hint: You can enable automatic backup in the global settings!)"); 2434 bupHint = i18n("(Hint: You can enable automatic backup in the global settings!)");
2430 if ( KMessageBox::warningContinueCancel( this, i18n("This will <b>backup all calendar files</b> to the directory %1 %2").arg(bupDir).arg(bupHint),i18n("Information") ) != KMessageBox::Continue ) return; 2435 if ( KMessageBox::warningContinueCancel( this, i18n("This will <b>backup all calendar files</b> to the directory %1 %2").arg(bupDir).arg(bupHint),i18n("Information") ) != KMessageBox::Continue ) return;
2431 bool enabled = KPimGlobalPrefs::instance()->mBackupEnabled; 2436 bool enabled = KPimGlobalPrefs::instance()->mBackupEnabled;
2432 KPimGlobalPrefs::instance()->mBackupEnabled = false; 2437 KPimGlobalPrefs::instance()->mBackupEnabled = false;
2433 save(); 2438 save();
2434 KPimGlobalPrefs::instance()->mBackupEnabled = enabled; 2439 KPimGlobalPrefs::instance()->mBackupEnabled = enabled;
2435 backupAllFiles(); 2440 backupAllFiles();
2436} 2441}
2437void MainWindow::loadCalendar() 2442void MainWindow::loadCalendar()
2438{ 2443{
2439 2444
2440 2445
2441#if 0 2446#if 0
2442 QString fn = KOPrefs::instance()->mLastLoadFile; 2447 QString fn = KOPrefs::instance()->mLastLoadFile;
2443 fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this ); 2448 fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this );
2444 2449
2445 if ( fn == "" ) 2450 if ( fn == "" )
2446 return; 2451 return;
2447 QFileInfo info; 2452 QFileInfo info;
2448 info.setFile( fn ); 2453 info.setFile( fn );
2449 QString mess; 2454 QString mess;
2450 bool loadbup = true; 2455 bool loadbup = true;
2451 if ( info. exists() ) { 2456 if ( info. exists() ) {
2452 mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); 2457 mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false ));
2453 int result = QMessageBox::warning( this, "KO/Pi: Warning!", 2458 int result = QMessageBox::warning( this, "KO/Pi: Warning!",
2454 mess, 2459 mess,
2455 i18n("Load!"), i18n("Cancel"), 0, 2460 i18n("Load!"), i18n("Cancel"), 0,
2456 0, 1 ); 2461 0, 1 );
2457 if ( result != 0 ) { 2462 if ( result != 0 ) {
2458 loadbup = false; 2463 loadbup = false;
2459 } 2464 }
2460 } else { 2465 } else {
2461 QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 2466 QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
2462 i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0, 2467 i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0,
2463 0, 1 ); 2468 0, 1 );
2464 2469
2465 return; 2470 return;
2466 } 2471 }
2467 if ( loadbup ) { 2472 if ( loadbup ) {
2468 mView->openCalendar( fn ); 2473 mView->openCalendar( fn );
2469 KOPrefs::instance()->mLastLoadFile = fn; 2474 KOPrefs::instance()->mLastLoadFile = fn;
2470 mess = i18n("KO/Pi:Loaded %1").arg(fn) ; 2475 mess = i18n("KO/Pi:Loaded %1").arg(fn) ;
2471 setCaption(mess); 2476 setCaption(mess);
2472 } 2477 }
2473#endif 2478#endif
2474 2479
2475} 2480}
2476void MainWindow::quickImportIcal() 2481void MainWindow::quickImportIcal()
2477{ 2482{
2478 importFile( KOPrefs::instance()->mLastImportFile, false ); 2483 importFile( KOPrefs::instance()->mLastImportFile, false );
2479} 2484}
2480void MainWindow::importFile( QString fn, bool quick ) 2485void MainWindow::importFile( QString fn, bool quick )
2481{ 2486{
2482 QFileInfo info; 2487 QFileInfo info;
2483 info.setFile( fn ); 2488 info.setFile( fn );
2484 QString mess; 2489 QString mess;
2485 if ( !info. exists() ) { 2490 if ( !info. exists() ) {
2486 mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30)); 2491 mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30));
2487 QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 2492 QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
2488 mess ); 2493 mess );
2489 return; 2494 return;
2490 } 2495 }
2491 int result = 0; 2496 int result = 0;
2492 if ( !quick ) { 2497 if ( !quick ) {
2493 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 )); 2498 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 ));
2494 result = QMessageBox::warning( this, "KO/Pi: Warning!", 2499 result = QMessageBox::warning( this, "KO/Pi: Warning!",
2495 mess, 2500 mess,
2496 "Import", "Cancel", 0, 2501 "Import", "Cancel", 0,
2497 0, 1 ); 2502 0, 1 );
2498 } 2503 }
2499 if ( result == 0 ) { 2504 if ( result == 0 ) {
2500 if ( mView->openCalendar( fn, true )) { 2505 if ( mView->openCalendar( fn, true )) {
2501 KOPrefs::instance()->mLastImportFile = fn; 2506 KOPrefs::instance()->mLastImportFile = fn;
2502 setCaption(i18n("Imported file successfully")); 2507 setCaption(i18n("Imported file successfully"));
2503 } else { 2508 } else {
2504 setCaption(i18n("Error importing file")); 2509 setCaption(i18n("Error importing file"));
2505 } 2510 }
2506 } 2511 }
2507} 2512}
2508 2513
2509void MainWindow::importIcal() 2514void MainWindow::importIcal()
2510{ 2515{
2511 2516
2512 QString fn =KOPrefs::instance()->mLastImportFile; 2517 QString fn =KOPrefs::instance()->mLastImportFile;
2513 2518
2514 fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this ); 2519 fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this );
2515 if ( fn == "" ) 2520 if ( fn == "" )
2516 return; 2521 return;
2517 importFile( fn, true ); 2522 importFile( fn, true );
2518 2523
2519} 2524}
2520 2525
2521void MainWindow::exportVCalendar() 2526void MainWindow::exportVCalendar()
2522{ 2527{
2523 QString fn = KOPrefs::instance()->mLastVcalFile; 2528 QString fn = KOPrefs::instance()->mLastVcalFile;
2524 fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this ); 2529 fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this );
2525 if ( fn == "" ) 2530 if ( fn == "" )
2526 return; 2531 return;
2527 QFileInfo info; 2532 QFileInfo info;
2528 info.setFile( fn ); 2533 info.setFile( fn );
2529 QString mes; 2534 QString mes;
2530 bool createbup = true; 2535 bool createbup = true;
2531 if ( info. exists() ) { 2536 if ( info. exists() ) {
2532 mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); 2537 mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) );
2533 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, 2538 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes,
2534 i18n("Overwrite!"), i18n("Cancel"), 0, 2539 i18n("Overwrite!"), i18n("Cancel"), 0,
2535 0, 1 ); 2540 0, 1 );
2536 if ( result != 0 ) { 2541 if ( result != 0 ) {
2537 createbup = false; 2542 createbup = false;
2538 } 2543 }
2539 } 2544 }
2540 if ( createbup ) { 2545 if ( createbup ) {
2541 if ( mView->exportVCalendar( fn ) ) { 2546 if ( mView->exportVCalendar( fn ) ) {
2542 KOPrefs::instance()->mLastVcalFile = fn; 2547 KOPrefs::instance()->mLastVcalFile = fn;
2543 if ( fn.length() > 20 ) 2548 if ( fn.length() > 20 )
2544 mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ; 2549 mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ;
2545 else 2550 else
2546 mes = i18n("KO/Pi:Exported to %1").arg(fn ); 2551 mes = i18n("KO/Pi:Exported to %1").arg(fn );
2547 setCaption(mes); 2552 setCaption(mes);
2548 } 2553 }
2549 } 2554 }
2550 2555
2551} 2556}
2552QString MainWindow::sentSyncFile() 2557QString MainWindow::sentSyncFile()
2553{ 2558{
2554#ifdef DESKTOP_VERSION 2559#ifdef DESKTOP_VERSION
2555 return locateLocal( "tmp", "copysynccal.ics" ); 2560 return locateLocal( "tmp", "copysynccal.ics" );
2556#else 2561#else
2557 return QString( "/tmp/copysynccal.ics" ); 2562 return QString( "/tmp/copysynccal.ics" );
2558#endif 2563#endif
2559} 2564}
2560 2565
2561void MainWindow::syncFileRequest() 2566void MainWindow::syncFileRequest()
2562{ 2567{
2563 while ( mSyncManager->blockSave() ) { 2568 while ( mSyncManager->blockSave() ) {
2564 qApp->processEvents(); 2569 qApp->processEvents();
2565 } 2570 }
2566 mSyncManager->setBlockSave(true); 2571 mSyncManager->setBlockSave(true);
2567 2572
2568 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { 2573 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) {
2569 mSyncManager->slotSyncMenu( 999 ); 2574 mSyncManager->slotSyncMenu( 999 );
2570 } 2575 }
2571 2576
2572 setCaption(i18n("Saving Data to temp file ..." )); 2577 setCaption(i18n("Saving Data to temp file ..." ));
2573 mView->saveCalendar( sentSyncFile() ); 2578 mView->saveCalendar( sentSyncFile() );
2574 setCaption(i18n("Data saved to temp file!" )); 2579 setCaption(i18n("Data saved to temp file!" ));
2575 mSyncManager->setBlockSave( false ); 2580 mSyncManager->setBlockSave( false );
2576 2581
2577} 2582}
2578void MainWindow::getFile( bool success ) 2583void MainWindow::getFile( bool success )
2579{ 2584{
2580 if ( ! success ) { 2585 if ( ! success ) {
2581 setCaption( i18n("Error receiving file. Nothing changed!") ); 2586 setCaption( i18n("Error receiving file. Nothing changed!") );
2582 return; 2587 return;
2583 } 2588 }
2584 mView->mergeFile( sentSyncFile() ); 2589 mView->mergeFile( sentSyncFile() );
2585 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { 2590 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) {
2586 mSyncManager->slotSyncMenu( 999 ); 2591 mSyncManager->slotSyncMenu( 999 );
2587 } 2592 }
2588 setCaption( i18n("Pi-Sync successful!") ); 2593 setCaption( i18n("Pi-Sync successful!") );
2589} 2594}
2590void MainWindow::printListView() 2595void MainWindow::printListView()
2591{ 2596{
2592 2597
2593 QString message = i18n("You can make a printout of the <b>List View</b> and the list view in the <b>Search Dialog</b>! To do this, please go to the <b>List View/Search Dialog</b>. Right click on the list. Select in the popup menu the entry <b>Print complete list</b>. That prints the list as you see it. You can remove items from the list before printing without deleting the corresponding event/todo! Simply select all items you do not want to print out. Then right click on one of the items and choose <b>Hide selected items</b>. After that you can print the list without these items."); 2598 QString message = i18n("You can make a printout of the <b>List View</b> and the list view in the <b>Search Dialog</b>! To do this, please go to the <b>List View/Search Dialog</b>. Right click on the list. Select in the popup menu the entry <b>Print complete list</b>. That prints the list as you see it. You can remove items from the list before printing without deleting the corresponding event/todo! Simply select all items you do not want to print out. Then right click on one of the items and choose <b>Hide selected items</b>. After that you can print the list without these items.");
2594 2599
2595 KMessageBox::information( this, message); 2600 KMessageBox::information( this, message);
2596} 2601}
2597void MainWindow::printSel( ) 2602void MainWindow::printSel( )
2598{ 2603{
2599 mView->viewManager()->agendaView()->agenda()->printSelection(); 2604 mView->viewManager()->agendaView()->agenda()->printSelection();
2600} 2605}
2601 2606
2602void MainWindow::printCal() 2607void MainWindow::printCal()
2603{ 2608{
2604 mView->print();//mCp->showDialog(); 2609 mView->print();//mCp->showDialog();
2605} 2610}
2606 2611
2607 2612
2608#include "libkdepim/kdatepicker.h" 2613#include "libkdepim/kdatepicker.h"
2609#include <kdatetbl.h> 2614#include <kdatetbl.h>
2610 2615
2611void MainWindow::weekAction() 2616void MainWindow::weekAction()
2612{ 2617{
2613 int month; 2618 int month;
2614 KPopupFrame* popup = new KPopupFrame(this); 2619 KPopupFrame* popup = new KPopupFrame(this);
2615 KDateInternalWeekPicker* picker = new KDateInternalWeekPicker(popup); 2620 KDateInternalWeekPicker* picker = new KDateInternalWeekPicker(popup);
2616 // ----- 2621 // -----
2617 picker->resize(picker->sizeHint()); 2622 picker->resize(picker->sizeHint());
2618 popup->setMainWidget(picker); 2623 popup->setMainWidget(picker);
2619 picker->setFocus(); 2624 picker->setFocus();
2620 connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int))); 2625 connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int)));
2621 int x = 0; 2626 int x = 0;
2622 int y = iconToolBar->height(); 2627 int y = iconToolBar->height();
2623 int dX = 0; 2628 int dX = 0;
2624 int dY = 0; 2629 int dY = 0;
2625 if ( iconToolBar->orientation () == Qt:: Horizontal ) { 2630 if ( iconToolBar->orientation () == Qt:: Horizontal ) {
2626 if ( iconToolBar->y() > height()/2 ) { 2631 if ( iconToolBar->y() > height()/2 ) {
2627 dY = picker->sizeHint().height()+8; 2632 dY = picker->sizeHint().height()+8;
2628 y = 0; 2633 y = 0;
2629 } 2634 }
2630 } else { 2635 } else {
2631 if ( iconToolBar->x() > width()/2 ) { // right side 2636 if ( iconToolBar->x() > width()/2 ) { // right side
2632 x=0; 2637 x=0;
2633 dX= picker->sizeHint().width()+8; 2638 dX= picker->sizeHint().width()+8;
2634 y = 0; 2639 y = 0;
2635 } else { 2640 } else {
2636 x= iconToolBar->width(); 2641 x= iconToolBar->width();
2637 y = 0; 2642 y = 0;
2638 } 2643 }
2639 } 2644 }
2640 //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() ); 2645 //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() );
2641 if(popup->exec(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY)))) 2646 if(popup->exec(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY))))
2642 { 2647 {
2643 month = picker->getResult(); 2648 month = picker->getResult();
2644 emit selectWeek ( month ); 2649 emit selectWeek ( month );
2645 //qDebug("weekSelected %d ", month); 2650 //qDebug("weekSelected %d ", month);
2646 } 2651 }
2647 delete popup; 2652 delete popup;
2648} 2653}
2649 2654
2650void MainWindow::hideEvent ( QHideEvent * ) 2655void MainWindow::hideEvent ( QHideEvent * )
2651{ 2656{
2652 QString message; 2657 QString message;
2653 QDateTime nextA = mCalendar->nextAlarmEventDateTime(); 2658 QDateTime nextA = mCalendar->nextAlarmEventDateTime();
2654 if ( nextA.isValid() ) { 2659 if ( nextA.isValid() ) {
2655 QString sum = mCalendar->nextSummary(); 2660 QString sum = mCalendar->nextSummary();
2656 2661
2657 message = i18n("%1 %2 - %3 (next event/todo with alarm)").arg( KGlobal::locale()->formatTime(nextA.time() , false)).arg(sum ).arg( KGlobal::locale()->formatDate(nextA.date() , false)); 2662 message = i18n("%1 %2 - %3 (next event/todo with alarm)").arg( KGlobal::locale()->formatTime(nextA.time() , false)).arg(sum ).arg( KGlobal::locale()->formatDate(nextA.date() , false));
2658 setCaption( message ); 2663 setCaption( message );
2659 } 2664 }
2660} 2665}
2661 2666
2662void MainWindow::resizeEvent( QResizeEvent* e) 2667void MainWindow::resizeEvent( QResizeEvent* e)
2663{ 2668{
2664#ifndef DESKTOP_VERSION 2669#ifndef DESKTOP_VERSION
2665 if ( !KOPrefs::instance()->mShowIconFilter && !KOPrefs::instance()->mShowIconOnetoolbar && QApplication::desktop()->width() > 320) { 2670 if ( filterToolBar ) {
2666 if (QApplication::desktop()->width() > QApplication::desktop()->height() ) 2671 if ( !KOPrefs::instance()->mShowIconFilter && !KOPrefs::instance()->mShowIconOnetoolbar && QApplication::desktop()->width() > 320) {
2667 filterToolBar->hide(); 2672 if (QApplication::desktop()->width() > QApplication::desktop()->height() )
2668 else 2673 filterToolBar->hide();
2669 filterToolBar->show(); 2674 else
2675 filterToolBar->show();
2676 }
2670 } 2677 }
2671#endif 2678#endif
2672 QMainWindow::resizeEvent( e); 2679 QMainWindow::resizeEvent( e);
2673} 2680}