summaryrefslogtreecommitdiffabout
path: root/korganizer
authorzautrix <zautrix>2005-02-09 19:31:50 (UTC)
committer zautrix <zautrix>2005-02-09 19:31:50 (UTC)
commita9eff860d8399a198a9fdc04e09ed369097fc745 (patch) (unidiff)
treec953f38ef75bed96bdedd61b1b4bf369e08cddee /korganizer
parent22d5db839c9741cb2e988e84bbb367617934ebd9 (diff)
downloadkdepimpi-a9eff860d8399a198a9fdc04e09ed369097fc745.zip
kdepimpi-a9eff860d8399a198a9fdc04e09ed369097fc745.tar.gz
kdepimpi-a9eff860d8399a198a9fdc04e09ed369097fc745.tar.bz2
fixes
Diffstat (limited to 'korganizer') (more/less context) (show whitespace changes)
-rw-r--r--korganizer/mainwindow.cpp18
-rw-r--r--korganizer/mainwindow.h1
2 files changed, 16 insertions, 3 deletions
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 468fd5b..18a4b12 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -220,97 +220,97 @@ MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) :
220 if (finfo.exists() ) { 220 if (finfo.exists() ) {
221 KMessageBox::information( this, message); 221 KMessageBox::information( this, message);
222 mView->openCalendar( oldFile ); 222 mView->openCalendar( oldFile );
223 qApp->processEvents(); 223 qApp->processEvents();
224 } 224 }
225 } 225 }
226 mView->saveCalendar( defaultFileName() ); 226 mView->saveCalendar( defaultFileName() );
227 newFile = true; 227 newFile = true;
228 } 228 }
229 229
230 QTime neededSaveTime = QDateTime::currentDateTime().time(); 230 QTime neededSaveTime = QDateTime::currentDateTime().time();
231 mView->openCalendar( defaultFileName() ); 231 mView->openCalendar( defaultFileName() );
232 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); 232 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
233 qDebug("KO: Calendar loading time: %d ms",msNeeded ); 233 qDebug("KO: Calendar loading time: %d ms",msNeeded );
234 234
235 if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) { 235 if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) {
236 KOPrefs::instance()->setAllDefaults(); 236 KOPrefs::instance()->setAllDefaults();
237 int count = mView->addCategories(); 237 int count = mView->addCategories();
238 } 238 }
239 processIncidenceSelection( 0 ); 239 processIncidenceSelection( 0 );
240 connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), 240 connect( mView, SIGNAL( incidenceSelected( Incidence * ) ),
241 SLOT( processIncidenceSelection( Incidence * ) ) ); 241 SLOT( processIncidenceSelection( Incidence * ) ) );
242 connect( mView, SIGNAL( modifiedChanged( bool ) ), 242 connect( mView, SIGNAL( modifiedChanged( bool ) ),
243 SLOT( slotModifiedChanged( bool ) ) ); 243 SLOT( slotModifiedChanged( bool ) ) );
244 244
245 245
246 connect( mView, SIGNAL( tempDisableBR(bool) ), 246 connect( mView, SIGNAL( tempDisableBR(bool) ),
247 SLOT( disableBR(bool) ) ); 247 SLOT( disableBR(bool) ) );
248 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); 248 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) );
249 mView->setModified( false ); 249 mView->setModified( false );
250 mBlockAtStartup = false; 250 mBlockAtStartup = false;
251 mView->setModified( false ); 251 mView->setModified( false );
252 setCentralWidget( mView ); 252 setCentralWidget( mView );
253 globalFlagBlockStartup = 0; 253 globalFlagBlockStartup = 0;
254 mView->show(); 254 mView->show();
255 delete splash; 255 delete splash;
256 if ( newFile ) 256 if ( newFile )
257 mView->updateConfig(); 257 mView->updateConfig();
258 // qApp->processEvents(); 258 // qApp->processEvents();
259 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); 259 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ());
260 //fillSyncMenu(); 260 //fillSyncMenu();
261 261
262 262
263 connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); 263 connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) );
264 connect(mView , SIGNAL( save() ), this, SLOT( save() ) ); 264 connect(mView , SIGNAL( save() ), this, SLOT( save() ) );
265 connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) ); 265 connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) );
266 connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); 266 connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) );
267 connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); 267 connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) );
268 mSyncManager->setDefaultFileName( defaultFileName()); 268 mSyncManager->setDefaultFileName( sentSyncFile());
269 connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); 269 connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) );
270 mSyncManager->fillSyncMenu(); 270 mSyncManager->fillSyncMenu();
271 271
272 272
273 273
274 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); 274 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins );
275 if ( showWarning ) { 275 if ( showWarning ) {
276 KMessageBox::information( this, 276 KMessageBox::information( this,
277 "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"); 277 "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");
278 qApp->processEvents(); 278 qApp->processEvents();
279 mView->dialogManager()->showSyncOptions(); 279 mView->dialogManager()->showSyncOptions();
280 } 280 }
281 281
282 //US listen for result adressed from Ka/Pi 282 //US listen for result adressed from Ka/Pi
283#ifndef DESKTOP_VERSION 283#ifndef DESKTOP_VERSION
284 connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); 284 connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & )));
285#endif 285#endif
286#ifndef DESKTOP_VERSION 286#ifndef DESKTOP_VERSION
287 infrared = 0; 287 infrared = 0;
288#endif 288#endif
289 updateWeek( mView->startDate() ); 289 updateWeek( mView->startDate() );
290 connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ), 290 connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ),
291 SLOT( updateWeekNum( const KCal::DateList & ) ) ); 291 SLOT( updateWeekNum( const KCal::DateList & ) ) );
292 mBRdisabled = false; 292 mBRdisabled = false;
293 //toggleBeamReceive(); 293 //toggleBeamReceive();
294} 294}
295MainWindow::~MainWindow() 295MainWindow::~MainWindow()
296{ 296{
297 //qDebug("MainWindow::~MainWindow() "); 297 //qDebug("MainWindow::~MainWindow() ");
298 //save toolbar location 298 //save toolbar location
299 delete mCalendar; 299 delete mCalendar;
300 delete mSyncManager; 300 delete mSyncManager;
301#ifndef DESKTOP_VERSION 301#ifndef DESKTOP_VERSION
302 if ( infrared ) 302 if ( infrared )
303 delete infrared; 303 delete infrared;
304#endif 304#endif
305 305
306 306
307} 307}
308 308
309void MainWindow::disableBR(bool b) 309void MainWindow::disableBR(bool b)
310{ 310{
311#ifndef DESKTOP_VERSION 311#ifndef DESKTOP_VERSION
312 if ( b ) { 312 if ( b ) {
313 if ( infrared ) { 313 if ( infrared ) {
314 toggleBeamReceive(); 314 toggleBeamReceive();
315 mBRdisabled = true; 315 mBRdisabled = true;
316 } 316 }
@@ -1947,111 +1947,123 @@ void MainWindow::importFile( QString fn, bool quick )
1947 setCaption(i18n("Error importing file")); 1947 setCaption(i18n("Error importing file"));
1948 } 1948 }
1949 } 1949 }
1950} 1950}
1951 1951
1952void MainWindow::importIcal() 1952void MainWindow::importIcal()
1953{ 1953{
1954 1954
1955 QString fn =KOPrefs::instance()->mLastImportFile; 1955 QString fn =KOPrefs::instance()->mLastImportFile;
1956 1956
1957 fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this ); 1957 fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this );
1958 if ( fn == "" ) 1958 if ( fn == "" )
1959 return; 1959 return;
1960 importFile( fn, true ); 1960 importFile( fn, true );
1961 1961
1962} 1962}
1963 1963
1964void MainWindow::exportVCalendar() 1964void MainWindow::exportVCalendar()
1965{ 1965{
1966 QString fn = KOPrefs::instance()->mLastVcalFile; 1966 QString fn = KOPrefs::instance()->mLastVcalFile;
1967 fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this ); 1967 fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this );
1968 if ( fn == "" ) 1968 if ( fn == "" )
1969 return; 1969 return;
1970 QFileInfo info; 1970 QFileInfo info;
1971 info.setFile( fn ); 1971 info.setFile( fn );
1972 QString mes; 1972 QString mes;
1973 bool createbup = true; 1973 bool createbup = true;
1974 if ( info. exists() ) { 1974 if ( info. exists() ) {
1975 mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); 1975 mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) );
1976 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, 1976 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes,
1977 i18n("Overwrite!"), i18n("Cancel"), 0, 1977 i18n("Overwrite!"), i18n("Cancel"), 0,
1978 0, 1 ); 1978 0, 1 );
1979 if ( result != 0 ) { 1979 if ( result != 0 ) {
1980 createbup = false; 1980 createbup = false;
1981 } 1981 }
1982 } 1982 }
1983 if ( createbup ) { 1983 if ( createbup ) {
1984 if ( mView->exportVCalendar( fn ) ) { 1984 if ( mView->exportVCalendar( fn ) ) {
1985 KOPrefs::instance()->mLastVcalFile = fn; 1985 KOPrefs::instance()->mLastVcalFile = fn;
1986 if ( fn.length() > 20 ) 1986 if ( fn.length() > 20 )
1987 mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ; 1987 mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ;
1988 else 1988 else
1989 mes = i18n("KO/Pi:Exported to %1").arg(fn ); 1989 mes = i18n("KO/Pi:Exported to %1").arg(fn );
1990 setCaption(mes); 1990 setCaption(mes);
1991 } 1991 }
1992 } 1992 }
1993 1993
1994} 1994}
1995QString MainWindow::sentSyncFile()
1996{
1997#ifdef DESKTOP_VERSION
1998 return locateLocal( "tmp", "copysynccal.ics" );
1999#else
2000 return QString( "/tmp/copysynccal.ics" );
2001#endif
2002}
1995 2003
1996void MainWindow::syncFileRequest() 2004void MainWindow::syncFileRequest()
1997{ 2005{
1998 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { 2006 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) {
1999 mSyncManager->slotSyncMenu( 999 ); 2007 mSyncManager->slotSyncMenu( 999 );
2000 } 2008 }
2001 save(); 2009
2010 setCaption(i18n("Saving Data to temp file ..." ));
2011 mView->saveCalendar( sentSyncFile() );
2012 setCaption(i18n("Data saved to temp file!" ));
2013
2002} 2014}
2003void MainWindow::getFile( bool success ) 2015void MainWindow::getFile( bool success )
2004{ 2016{
2005 if ( ! success ) { 2017 if ( ! success ) {
2006 setCaption( i18n("Error receiving file. Nothing changed!") ); 2018 setCaption( i18n("Error receiving file. Nothing changed!") );
2007 return; 2019 return;
2008 } 2020 }
2009 mView->openCalendar( defaultFileName() ); 2021 mView->openCalendar( sentSyncFile() );
2010 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { 2022 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) {
2011 mSyncManager->slotSyncMenu( 999 ); 2023 mSyncManager->slotSyncMenu( 999 );
2012 } 2024 }
2013 setCaption( i18n("Pi-Sync successful!") ); 2025 setCaption( i18n("Pi-Sync successful!") );
2014} 2026}
2015 2027
2016void MainWindow::printSel( ) 2028void MainWindow::printSel( )
2017{ 2029{
2018 mView->viewManager()->agendaView()->agenda()->printSelection(); 2030 mView->viewManager()->agendaView()->agenda()->printSelection();
2019} 2031}
2020 2032
2021void MainWindow::printCal() 2033void MainWindow::printCal()
2022{ 2034{
2023 mView->print();//mCp->showDialog(); 2035 mView->print();//mCp->showDialog();
2024} 2036}
2025 2037
2026 2038
2027#include "libkdepim/kdatepicker.h" 2039#include "libkdepim/kdatepicker.h"
2028#include <kdatetbl.h> 2040#include <kdatetbl.h>
2029void MainWindow::weekAction() 2041void MainWindow::weekAction()
2030{ 2042{
2031 int month; 2043 int month;
2032 KPopupFrame* popup = new KPopupFrame(this); 2044 KPopupFrame* popup = new KPopupFrame(this);
2033 KDateInternalWeekPicker* picker = new KDateInternalWeekPicker(popup); 2045 KDateInternalWeekPicker* picker = new KDateInternalWeekPicker(popup);
2034 // ----- 2046 // -----
2035 picker->resize(picker->sizeHint()); 2047 picker->resize(picker->sizeHint());
2036 popup->setMainWidget(picker); 2048 popup->setMainWidget(picker);
2037 picker->setFocus(); 2049 picker->setFocus();
2038 connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int))); 2050 connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int)));
2039 int x = 0; 2051 int x = 0;
2040 int y = iconToolBar->height(); 2052 int y = iconToolBar->height();
2041 int dX = 0; 2053 int dX = 0;
2042 int dY = 0; 2054 int dY = 0;
2043 if ( iconToolBar->orientation () == Qt:: Horizontal ) { 2055 if ( iconToolBar->orientation () == Qt:: Horizontal ) {
2044 if ( iconToolBar->y() > height()/2 ) { 2056 if ( iconToolBar->y() > height()/2 ) {
2045 dY = picker->sizeHint().height()+8; 2057 dY = picker->sizeHint().height()+8;
2046 y = 0; 2058 y = 0;
2047 } 2059 }
2048 } else { 2060 } else {
2049 if ( iconToolBar->x() > width()/2 ) { // right side 2061 if ( iconToolBar->x() > width()/2 ) { // right side
2050 x=0; 2062 x=0;
2051 dX= picker->sizeHint().width()+8; 2063 dX= picker->sizeHint().width()+8;
2052 y = 0; 2064 y = 0;
2053 } else { 2065 } else {
2054 x= iconToolBar->width(); 2066 x= iconToolBar->width();
2055 y = 0; 2067 y = 0;
2056 } 2068 }
2057 } 2069 }
diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h
index 5b9f903..5808700 100644
--- a/korganizer/mainwindow.h
+++ b/korganizer/mainwindow.h
@@ -58,96 +58,97 @@ class MainWindow : public QMainWindow
58 protected slots: 58 protected slots:
59 void setCaptionToDates(); 59 void setCaptionToDates();
60 void weekAction(); 60 void weekAction();
61 void about(); 61 void about();
62 void licence(); 62 void licence();
63 void faq(); 63 void faq();
64 void usertrans(); 64 void usertrans();
65 void features(); 65 void features();
66 void synchowto(); 66 void synchowto();
67 void kdesynchowto(); 67 void kdesynchowto();
68 void multisynchowto(); 68 void multisynchowto();
69 void whatsNew(); 69 void whatsNew();
70 void keyBindings(); 70 void keyBindings();
71 void aboutAutoSaving();; 71 void aboutAutoSaving();;
72 void aboutKnownBugs(); 72 void aboutKnownBugs();
73 73
74 void processIncidenceSelection( Incidence * ); 74 void processIncidenceSelection( Incidence * );
75 75
76 void importQtopia(); 76 void importQtopia();
77 void importBday(); 77 void importBday();
78 void importOL(); 78 void importOL();
79 void importIcal(); 79 void importIcal();
80 void importFile( QString, bool ); 80 void importFile( QString, bool );
81 void quickImportIcal(); 81 void quickImportIcal();
82 82
83 void slotModifiedChanged( bool ); 83 void slotModifiedChanged( bool );
84 84
85 void save(); 85 void save();
86 void saveStopTimer(); 86 void saveStopTimer();
87 void configureToolBar( int ); 87 void configureToolBar( int );
88 void printSel(); 88 void printSel();
89 void printCal(); 89 void printCal();
90 void saveCalendar(); 90 void saveCalendar();
91 void loadCalendar(); 91 void loadCalendar();
92 void exportVCalendar(); 92 void exportVCalendar();
93 void fillFilterMenu(); 93 void fillFilterMenu();
94 void selectFilter( int ); 94 void selectFilter( int );
95 void exportToPhone( int ); 95 void exportToPhone( int );
96 void toggleBeamReceive(); 96 void toggleBeamReceive();
97 void disableBR(bool); 97 void disableBR(bool);
98 signals: 98 signals:
99 void selectWeek ( int ); 99 void selectWeek ( int );
100 private slots: 100 private slots:
101 void showConfigureAgenda(); 101 void showConfigureAgenda();
102 void getFile( bool ); 102 void getFile( bool );
103 void syncFileRequest(); 103 void syncFileRequest();
104 104
105 protected: 105 protected:
106 QString sentSyncFile();
106 void displayText( QString, QString); 107 void displayText( QString, QString);
107 void enableIncidenceActions( bool ); 108 void enableIncidenceActions( bool );
108 109
109 private: 110 private:
110 bool mBRdisabled; 111 bool mBRdisabled;
111#ifndef DESKTOP_VERSION 112#ifndef DESKTOP_VERSION
112 QCopChannel* infrared; 113 QCopChannel* infrared;
113#endif 114#endif
114 QAction* brAction; 115 QAction* brAction;
115 KSyncManager* mSyncManager; 116 KSyncManager* mSyncManager;
116 bool mClosed; 117 bool mClosed;
117 void saveOnClose(); 118 void saveOnClose();
118 bool mFlagKeyPressed; 119 bool mFlagKeyPressed;
119 bool mBlockAtStartup; 120 bool mBlockAtStartup;
120 QPEToolBar *iconToolBar; 121 QPEToolBar *iconToolBar;
121 void initActions(); 122 void initActions();
122 void setDefaultPreferences(); 123 void setDefaultPreferences();
123 void keyPressEvent ( QKeyEvent * ) ; 124 void keyPressEvent ( QKeyEvent * ) ;
124 void keyReleaseEvent ( QKeyEvent * ) ; 125 void keyReleaseEvent ( QKeyEvent * ) ;
125 QPopupMenu *configureToolBarMenu; 126 QPopupMenu *configureToolBarMenu;
126 QPopupMenu *selectFilterMenu; 127 QPopupMenu *selectFilterMenu;
127 QPopupMenu *configureAgendaMenu, *syncMenu; 128 QPopupMenu *configureAgendaMenu, *syncMenu;
128 CalendarLocal *mCalendar; 129 CalendarLocal *mCalendar;
129 CalendarView *mView; 130 CalendarView *mView;
130 QAction *mNewSubTodoAction; 131 QAction *mNewSubTodoAction;
131 QAction *mWeekAction; 132 QAction *mWeekAction;
132 QFont mWeekFont; 133 QFont mWeekFont;
133 QPixmap mWeekPixmap; 134 QPixmap mWeekPixmap;
134 QColor mWeekBgColor; 135 QColor mWeekBgColor;
135 136
136 QAction *mShowAction; 137 QAction *mShowAction;
137 QAction *mEditAction; 138 QAction *mEditAction;
138 QAction *mDeleteAction; 139 QAction *mDeleteAction;
139 QAction *mCloneAction; 140 QAction *mCloneAction;
140 QAction *mMoveAction; 141 QAction *mMoveAction;
141 QAction *mBeamAction; 142 QAction *mBeamAction;
142 QAction *mCancelAction; 143 QAction *mCancelAction;
143 144
144 QAction *mToggleNav; 145 QAction *mToggleNav;
145 QAction *mToggleFilter; 146 QAction *mToggleFilter;
146 QAction *mToggleAllday; 147 QAction *mToggleAllday;
147 148
148 149
149 void closeEvent( QCloseEvent* ce ); 150 void closeEvent( QCloseEvent* ce );
150 SimpleAlarmClient mAlarmClient; 151 SimpleAlarmClient mAlarmClient;
151 QTimer mSaveTimer; 152 QTimer mSaveTimer;
152 //bool mBlockSaveFlag; 153 //bool mBlockSaveFlag;
153 bool mCalendarModifiedFlag; 154 bool mCalendarModifiedFlag;