summaryrefslogtreecommitdiffabout
path: root/korganizer
authorzautrix <zautrix>2005-01-22 10:18:16 (UTC)
committer zautrix <zautrix>2005-01-22 10:18:16 (UTC)
commit6946f6ab0ee6eeafee0c8ff5d33fffc0826c7452 (patch) (unidiff)
tree006248579ca44ad2e0c1a67db55b1a8013180ed7 /korganizer
parentb715b109b70b8cd24a2d9da1d4863c44d79fb2a4 (diff)
downloadkdepimpi-6946f6ab0ee6eeafee0c8ff5d33fffc0826c7452.zip
kdepimpi-6946f6ab0ee6eeafee0c8ff5d33fffc0826c7452.tar.gz
kdepimpi-6946f6ab0ee6eeafee0c8ff5d33fffc0826c7452.tar.bz2
some small fixes
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp52
-rw-r--r--korganizer/calendarview.h2
-rw-r--r--korganizer/koeditorgeneral.cpp20
-rw-r--r--korganizer/koeditorgeneral.h1
-rw-r--r--korganizer/kotodoview.cpp5
-rw-r--r--korganizer/mainwindow.cpp11
6 files changed, 65 insertions, 26 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 8f05276..038da54 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -2176,27 +2176,27 @@ void CalendarView::updateView()
2176 2176
2177 if ( KOPrefs::instance()->mHideNonStartedTodos ) 2177 if ( KOPrefs::instance()->mHideNonStartedTodos )
2178 mTodoList->updateView(); 2178 mTodoList->updateView();
2179 // We assume that the navigator only selects consecutive days. 2179 // We assume that the navigator only selects consecutive days.
2180 updateView( tmpList.first(), tmpList.last() ); 2180 updateView( tmpList.first(), tmpList.last() );
2181} 2181}
2182 2182
2183void CalendarView::updateUnmanagedViews() 2183void CalendarView::updateUnmanagedViews()
2184{ 2184{
2185 mDateNavigator->updateDayMatrix(); 2185 mDateNavigator->updateDayMatrix();
2186} 2186}
2187 2187
2188int CalendarView::msgItemDelete() 2188int CalendarView::msgItemDelete(const QString name)
2189{ 2189{
2190 return KMessageBox::warningContinueCancel(this, 2190 return KMessageBox::warningContinueCancel(this,name +"\n\n"+
2191 i18n("This item will be\npermanently deleted."), 2191 i18n("This item will be\npermanently deleted."),
2192 i18n("KO/Pi Confirmation"),i18n("Delete")); 2192 i18n("KO/Pi Confirmation"),i18n("Delete"));
2193} 2193}
2194 2194
2195 2195
2196void CalendarView::edit_cut() 2196void CalendarView::edit_cut()
2197{ 2197{
2198 Event *anEvent=0; 2198 Event *anEvent=0;
2199 2199
2200 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); 2200 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
2201 2201
2202 if (mViewManager->currentView()->isEventView()) { 2202 if (mViewManager->currentView()->isEventView()) {
@@ -2879,58 +2879,61 @@ void CalendarView::todo_unsub(Todo *anTodo )
2879 anTodo->setRelatedToUid(""); 2879 anTodo->setRelatedToUid("");
2880 setModified(true); 2880 setModified(true);
2881 updateView(); 2881 updateView();
2882} 2882}
2883 2883
2884void CalendarView::deleteTodo(Todo *todo) 2884void CalendarView::deleteTodo(Todo *todo)
2885{ 2885{
2886 if (!todo) { 2886 if (!todo) {
2887 KNotifyClient::beep(); 2887 KNotifyClient::beep();
2888 return; 2888 return;
2889 } 2889 }
2890 if (KOPrefs::instance()->mConfirm) { 2890 if (KOPrefs::instance()->mConfirm) {
2891 switch (msgItemDelete()) { 2891 QString text = todo->summary().left(20);
2892 if (!todo->relations().isEmpty()) {
2893 text += i18n("\nhas sub-todos.\nAll completed sub-todos\nwill be deleted as well!");
2894
2895 }
2896 switch (msgItemDelete(text)) {
2892 case KMessageBox::Continue: // OK 2897 case KMessageBox::Continue: // OK
2898 bool deleteT = false;
2893 if (!todo->relations().isEmpty()) { 2899 if (!todo->relations().isEmpty()) {
2894 KMessageBox::sorry(this,i18n("Cannot delete To-Do\nwhich has children."), 2900 deleteT = removeCompletedSubTodos( todo );
2895 i18n("Delete To-Do")); 2901 }
2896 } else { 2902 // deleteT == true: todo already deleted in removeCompletedSubTodos
2903 if ( !deleteT ) {
2897 checkExternalId( todo ); 2904 checkExternalId( todo );
2898 calendar()->deleteTodo(todo); 2905 calendar()->deleteTodo(todo);
2899 changeTodoDisplay( todo,KOGlobals::EVENTDELETED ); 2906 changeTodoDisplay( todo,KOGlobals::EVENTDELETED );
2900 updateView(); 2907 updateView();
2901 } 2908 }
2902 break; 2909 break;
2903 } // switch 2910 } // switch
2904 } else { 2911 } else {
2905 if (!todo->relations().isEmpty()) { 2912 checkExternalId( todo );
2906 KMessageBox::sorry(this,i18n("Cannot delete To-Do\nwhich has children."), 2913 mCalendar->deleteTodo(todo);
2907 i18n("Delete To-Do")); 2914 changeTodoDisplay( todo,KOGlobals::EVENTDELETED );
2908 } else { 2915 updateView();
2909 checkExternalId( todo );
2910 mCalendar->deleteTodo(todo);
2911 changeTodoDisplay( todo,KOGlobals::EVENTDELETED );
2912 updateView();
2913 }
2914 } 2916 }
2917
2915 emit updateSearchDialog(); 2918 emit updateSearchDialog();
2916} 2919}
2917void CalendarView::deleteJournal(Journal *jour) 2920void CalendarView::deleteJournal(Journal *jour)
2918{ 2921{
2919 if (!jour) { 2922 if (!jour) {
2920 KNotifyClient::beep(); 2923 KNotifyClient::beep();
2921 return; 2924 return;
2922 } 2925 }
2923 if (KOPrefs::instance()->mConfirm) { 2926 if (KOPrefs::instance()->mConfirm) {
2924 switch (msgItemDelete()) { 2927 switch (msgItemDelete( jour->description().left(20))) {
2925 case KMessageBox::Continue: // OK 2928 case KMessageBox::Continue: // OK
2926 calendar()->deleteJournal(jour); 2929 calendar()->deleteJournal(jour);
2927 updateView(); 2930 updateView();
2928 break; 2931 break;
2929 } // switch 2932 } // switch
2930 } else { 2933 } else {
2931 calendar()->deleteJournal(jour);; 2934 calendar()->deleteJournal(jour);;
2932 updateView(); 2935 updateView();
2933 } 2936 }
2934 emit updateSearchDialog(); 2937 emit updateSearchDialog();
2935} 2938}
2936 2939
@@ -3474,24 +3477,41 @@ void CalendarView::showDates(const DateList &selectedDates)
3474 if ( !mBlockShowDates ) { 3477 if ( !mBlockShowDates ) {
3475 if ( mViewManager->currentView() ) { 3478 if ( mViewManager->currentView() ) {
3476 updateView( selectedDates.first(), selectedDates.last() ); 3479 updateView( selectedDates.first(), selectedDates.last() );
3477 } else { 3480 } else {
3478 mViewManager->showAgendaView(); 3481 mViewManager->showAgendaView();
3479 } 3482 }
3480 } 3483 }
3481 3484
3482 QString selDates; 3485 QString selDates;
3483 selDates = KGlobal::locale()->formatDate( selectedDates.first(), true); 3486 selDates = KGlobal::locale()->formatDate( selectedDates.first(), true);
3484 if (selectedDates.first() < selectedDates.last() ) 3487 if (selectedDates.first() < selectedDates.last() )
3485 selDates += " - " + KGlobal::locale()->formatDate( selectedDates.last(),true); 3488 selDates += " - " + KGlobal::locale()->formatDate( selectedDates.last(),true);
3489 else {
3490 QString addString;
3491 if ( selectedDates.first() == QDateTime::currentDateTime().date() )
3492 addString = i18n("Today");
3493 else if ( selectedDates.first() == QDateTime::currentDateTime().date().addDays(1) )
3494 addString = i18n("Tomorrow");
3495 else if ( selectedDates.first() == QDateTime::currentDateTime().date().addDays(-1) )
3496 addString = i18n("Yesterday");
3497 else if ( selectedDates.first() == QDateTime::currentDateTime().date().addDays(-2) )
3498 addString = i18n("Day before yesterday");
3499 else if ( selectedDates.first() == QDateTime::currentDateTime().date().addDays(2) )
3500 addString = i18n("Day after tomorrow");
3501 if ( !addString.isEmpty() ) {
3502 topLevelWidget()->setCaption( addString+", " + selDates );
3503 return;
3504 }
3505 }
3486 topLevelWidget()->setCaption( i18n("Dates: ") + selDates ); 3506 topLevelWidget()->setCaption( i18n("Dates: ") + selDates );
3487 3507
3488} 3508}
3489 3509
3490QPtrList<CalFilter> CalendarView::filters() 3510QPtrList<CalFilter> CalendarView::filters()
3491{ 3511{
3492 return mFilters; 3512 return mFilters;
3493 3513
3494} 3514}
3495void CalendarView::editFilters() 3515void CalendarView::editFilters()
3496{ 3516{
3497 // kdDebug() << "CalendarView::editFilters()" << endl; 3517 // kdDebug() << "CalendarView::editFilters()" << endl;
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h
index e27da9a..c8d6bdd 100644
--- a/korganizer/calendarview.h
+++ b/korganizer/calendarview.h
@@ -476,25 +476,25 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
476 /** Adapt navigation units correpsonding to step size of navigation of the 476 /** Adapt navigation units correpsonding to step size of navigation of the
477 * current view. 477 * current view.
478 */ 478 */
479 void adaptNavigationUnits(); 479 void adaptNavigationUnits();
480 bool synchronizeCalendar( Calendar* local, Calendar* remote, int mode ); 480 bool synchronizeCalendar( Calendar* local, Calendar* remote, int mode );
481 int takeEvent( Incidence* local, Incidence* remote, int mode, bool full = false ); 481 int takeEvent( Incidence* local, Incidence* remote, int mode, bool full = false );
482 //Attendee* getYourAttendee(Event *event); 482 //Attendee* getYourAttendee(Event *event);
483 void setBlockShowDates( bool b ) { mBlockShowDates = b ;} 483 void setBlockShowDates( bool b ) { mBlockShowDates = b ;}
484 protected: 484 protected:
485 void schedule(Scheduler::Method, Incidence *incidence = 0); 485 void schedule(Scheduler::Method, Incidence *incidence = 0);
486 486
487 // returns KMsgBox::OKCandel() 487 // returns KMsgBox::OKCandel()
488 int msgItemDelete(); 488 int msgItemDelete(const QString name);
489 void showEventEditor(); 489 void showEventEditor();
490 void showTodoEditor(); 490 void showTodoEditor();
491 void writeLocale(); 491 void writeLocale();
492 Todo *selectedTodo(); 492 Todo *selectedTodo();
493 493
494 private: 494 private:
495 bool mBlockShowDates; 495 bool mBlockShowDates;
496 KSyncManager* mSyncManager; 496 KSyncManager* mSyncManager;
497 AlarmDialog * mAlarmDialog; 497 AlarmDialog * mAlarmDialog;
498 QString mAlarmNotification; 498 QString mAlarmNotification;
499 QString mSuspendAlarmNotification; 499 QString mSuspendAlarmNotification;
500 QTimer* mSuspendTimer; 500 QTimer* mSuspendTimer;
diff --git a/korganizer/koeditorgeneral.cpp b/korganizer/koeditorgeneral.cpp
index 94e1f4c..b4fe965 100644
--- a/korganizer/koeditorgeneral.cpp
+++ b/korganizer/koeditorgeneral.cpp
@@ -274,44 +274,58 @@ void KOEditorGeneral::pickAlarmProgram()
274 } else { 274 } else {
275 mAlarmProgramButton->setOn(false); 275 mAlarmProgramButton->setOn(false);
276 mAlarmSoundButton->setOn(true); 276 mAlarmSoundButton->setOn(true);
277 } 277 }
278 } 278 }
279 if (mAlarmProgramButton->isOn()) 279 if (mAlarmProgramButton->isOn())
280 ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Proc.Al.: ") + mAlarmProgram ); 280 ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Proc.Al.: ") + mAlarmProgram );
281 if ( mAlarmSoundButton->isOn()) 281 if ( mAlarmSoundButton->isOn())
282 ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Sound.Al.: ") + mAlarmSound ); 282 ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Sound.Al.: ") + mAlarmSound );
283} 283}
284 284
285 285
286QString KOEditorGeneral::getFittingPath( const QString s )
287{
288 int maxlen = 50;
289 if ( QApplication::desktop()->width() < 640 ) {
290 if ( QApplication::desktop()->width() < 320 )
291 maxlen = 22;
292 else
293 maxlen = 35;
294 }
295 if ( s.length() > maxlen ) {
296 return "..."+s.right(maxlen -3);
297 }
298 return s;
299}
286 300
287void KOEditorGeneral::enableAlarmEdit(bool enable) 301void KOEditorGeneral::enableAlarmEdit(bool enable)
288{ 302{
289 if ( enable ) { 303 if ( enable ) {
290 if (!mAlarmProgramButton->isOn() && !mAlarmSoundButton->isOn()) { 304 if (!mAlarmProgramButton->isOn() && !mAlarmSoundButton->isOn()) {
291 mAlarmSoundButton->setOn( true ); 305 mAlarmSoundButton->setOn( true );
292 if ( mAlarmSound.isEmpty() ) 306 if ( mAlarmSound.isEmpty() )
293 mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile; 307 mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile;
294 else { 308 else {
295 if ( ! QFile::exists( mAlarmSound ) ) 309 if ( ! QFile::exists( mAlarmSound ) )
296 mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile; 310 mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile;
297 } 311 }
298 } 312 }
299 if (mAlarmProgramButton->isOn()) 313 if (mAlarmProgramButton->isOn())
300 ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Proc.Al.: ") + mAlarmProgram ); 314 ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Proc.Al.: ") + getFittingPath(mAlarmProgram) );
301 if (!mAlarmSound.isEmpty() && mAlarmSoundButton->isOn()) 315 if (!mAlarmSound.isEmpty() && mAlarmSoundButton->isOn())
302 ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Sound.Al.: ") + mAlarmSound ); 316 ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Audio Al.: ") + getFittingPath(mAlarmSound) );
303 } 317 }
304 else { 318 else {
305 ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Alarm disabled")); 319 ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Alarm disabled for this item"));
306 320
307 } 321 }
308 mAlarmTimeEdit->setEnabled(enable); 322 mAlarmTimeEdit->setEnabled(enable);
309 mAlarmSoundButton->setEnabled(enable); 323 mAlarmSoundButton->setEnabled(enable);
310 mAlarmProgramButton->setEnabled(enable); 324 mAlarmProgramButton->setEnabled(enable);
311 mAlarmIncrCombo->setEnabled(enable); 325 mAlarmIncrCombo->setEnabled(enable);
312} 326}
313 327
314void KOEditorGeneral::disableAlarmEdit(bool disable) 328void KOEditorGeneral::disableAlarmEdit(bool disable)
315{ 329{
316 enableAlarmEdit( !disable ); 330 enableAlarmEdit( !disable );
317} 331}
diff --git a/korganizer/koeditorgeneral.h b/korganizer/koeditorgeneral.h
index c58335e..de8edaf 100644
--- a/korganizer/koeditorgeneral.h
+++ b/korganizer/koeditorgeneral.h
@@ -96,17 +96,18 @@ class KOEditorGeneral : public QObject
96 QSpinBox *mAlarmTimeEdit; 96 QSpinBox *mAlarmTimeEdit;
97 QPushButton *mAlarmSoundButton; 97 QPushButton *mAlarmSoundButton;
98 QPushButton *mAlarmProgramButton; 98 QPushButton *mAlarmProgramButton;
99 QComboBox *mAlarmIncrCombo; 99 QComboBox *mAlarmIncrCombo;
100 KTextEdit *mDescriptionEdit; 100 KTextEdit *mDescriptionEdit;
101 QLabel *mOwnerLabel; 101 QLabel *mOwnerLabel;
102 QComboBox *mSecrecyCombo; 102 QComboBox *mSecrecyCombo;
103 QCheckBox *mCancelBox; 103 QCheckBox *mCancelBox;
104 QPushButton *mCategoriesButton; 104 QPushButton *mCategoriesButton;
105 QLabel *mCategoriesLabel; 105 QLabel *mCategoriesLabel;
106 106
107 private: 107 private:
108 QString getFittingPath( const QString ) ;
108 QString mAlarmSound; 109 QString mAlarmSound;
109 QString mAlarmProgram; 110 QString mAlarmProgram;
110}; 111};
111 112
112#endif 113#endif
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp
index 97b4a03..30adb06 100644
--- a/korganizer/kotodoview.cpp
+++ b/korganizer/kotodoview.cpp
@@ -809,30 +809,25 @@ void KOTodoView::beamTodo()
809 809
810 810
811void KOTodoView::showTodo() 811void KOTodoView::showTodo()
812{ 812{
813 if (mActiveItem) { 813 if (mActiveItem) {
814 emit showTodoSignal(mActiveItem->todo()); 814 emit showTodoSignal(mActiveItem->todo());
815 } 815 }
816} 816}
817 817
818void KOTodoView::deleteTodo() 818void KOTodoView::deleteTodo()
819{ 819{
820 if (mActiveItem) { 820 if (mActiveItem) {
821 if (mActiveItem->childCount()) {
822 KMessageBox::sorry(this,i18n("Cannot delete To-Do which has children."),
823 i18n("Delete To-Do"));
824 } else {
825 emit deleteTodoSignal(mActiveItem->todo()); 821 emit deleteTodoSignal(mActiveItem->todo());
826 }
827 } 822 }
828} 823}
829 824
830void KOTodoView::setNewPriority(int index) 825void KOTodoView::setNewPriority(int index)
831{ 826{
832 if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { 827 if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) {
833 mActiveItem->todo()->setPriority(mPriority[index]); 828 mActiveItem->todo()->setPriority(mPriority[index]);
834 mActiveItem->construct(); 829 mActiveItem->construct();
835 todoModified (mActiveItem->todo(), KOGlobals::PRIORITY_MODIFIED); 830 todoModified (mActiveItem->todo(), KOGlobals::PRIORITY_MODIFIED);
836 mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); 831 mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 );
837 } 832 }
838} 833}
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 151b55b..7b07a2e 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -1695,25 +1695,34 @@ void MainWindow::configureToolBar( int item )
1695 p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 ); 1695 p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 );
1696 p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 ); 1696 p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 );
1697 p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 ); 1697 p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 );
1698 p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 ); 1698 p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 );
1699 // initActions(); 1699 // initActions();
1700} 1700}
1701 1701
1702void MainWindow::setCaptionToDates() 1702void MainWindow::setCaptionToDates()
1703{ 1703{
1704 QString selDates; 1704 QString selDates;
1705 selDates = KGlobal::locale()->formatDate(mView->startDate(), true); 1705 selDates = KGlobal::locale()->formatDate(mView->startDate(), true);
1706 if (mView->startDate() < mView->endDate() ) 1706 if (mView->startDate() < mView->endDate() )
1707 selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true); 1707 selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true);
1708 else {
1709 QString addString;
1710 if ( mView->startDate() == QDateTime::currentDateTime().date() )
1711 addString = i18n("Today");
1712 else if ( mView->startDate() == QDateTime::currentDateTime().date().addDays(1) )
1713 addString = i18n("Tomorrow");
1714 if ( !addString.isEmpty() )
1715 selDates = addString+", "+selDates ;
1716 }
1708 setCaption( i18n("Dates: ") + selDates ); 1717 setCaption( i18n("Dates: ") + selDates );
1709 1718
1710} 1719}
1711// parameter item == 0: reinit 1720// parameter item == 0: reinit
1712void MainWindow::configureAgenda( int item ) 1721void MainWindow::configureAgenda( int item )
1713{ 1722{
1714 1723
1715 KOPrefs *p = KOPrefs::instance(); 1724 KOPrefs *p = KOPrefs::instance();
1716 1725
1717 int i; 1726 int i;
1718 // do not allow 4 for widgets higher than 480 1727 // do not allow 4 for widgets higher than 480
1719 // if ( QApplication::desktop()->height() > 480 ) { 1728 // if ( QApplication::desktop()->height() > 480 ) {