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