-rw-r--r-- | korganizer/calendarview.cpp | 14 | ||||
-rw-r--r-- | korganizer/kolistview.cpp | 4 | ||||
-rw-r--r-- | korganizer/koprefs.cpp | 3 | ||||
-rw-r--r-- | korganizer/koprefs.h | 1 | ||||
-rw-r--r-- | korganizer/searchdialog.cpp | 4 |
5 files changed, 24 insertions, 2 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 4b3f806..558fc55 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp @@ -2574,192 +2574,201 @@ void CalendarView::updateConfig() mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); // To make the "fill window" configurations work //mViewManager->raiseCurrentView(); } void CalendarView::eventChanged(Event *event) { changeEventDisplay(event,KOGlobals::EVENTEDITED); //updateUnmanagedViews(); } void CalendarView::eventAdded(Event *event) { changeEventDisplay(event,KOGlobals::EVENTADDED); } void CalendarView::eventToBeDeleted(Event *) { kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl; } void CalendarView::eventDeleted() { changeEventDisplay(0,KOGlobals::EVENTDELETED); } void CalendarView::changeTodoDisplay(Todo *which, int action) { changeIncidenceDisplay((Incidence *)which, action); mDateNavigator->updateView(); //LR //mDialogManager->updateSearchDialog(); if (which) { mViewManager->updateWNview(); //mTodoList->updateView(); } } void CalendarView::changeIncidenceDisplay(Incidence *which, int action) { updateUnmanagedViews(); //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action ); if ( action == KOGlobals::EVENTDELETED ) { //delete mCalendar->checkAlarmForIncidence( 0, true ); if ( mEventViewerDialog ) mEventViewerDialog->hide(); } else mCalendar->checkAlarmForIncidence( which , false ); } // most of the changeEventDisplays() right now just call the view's // total update mode, but they SHOULD be recoded to be more refresh-efficient. void CalendarView::changeEventDisplay(Event *which, int action) { // kdDebug() << "CalendarView::changeEventDisplay" << endl; changeIncidenceDisplay((Incidence *)which, action); mDateNavigator->updateView(); //mDialogManager->updateSearchDialog(); if (which) { // If there is an event view visible update the display mViewManager->currentView()->changeEventDisplay(which,action); // TODO: check, if update needed // if (which->getTodoStatus()) { mTodoList->updateView(); // } } else { mViewManager->currentView()->updateView(); } } void CalendarView::updateTodoViews() { mTodoList->updateView(); mViewManager->currentView()->updateView(); } void CalendarView::clearAllViews() { mTodoList->clearList(); mViewManager->clearAllViews(); SearchDialog * sd = mDialogManager->getSearchDialog(); if ( sd ) { KOListView* kol = sd->listview(); if ( kol ) kol->clearList(); } } void CalendarView::updateView() { + static bool clearallviews = false; + if ( KOPrefs::instance()->mGlobalUpdateDisabled ) { + if ( clearallviews ) { + clearAllViews(); + clearallviews = false; + } + return; + } + clearallviews = true; DateList tmpList = mNavigator->selectedDates(); if ( KOPrefs::instance()->mHideNonStartedTodos ) mTodoList->updateView(); // We assume that the navigator only selects consecutive days. updateView( tmpList.first(), tmpList.last() ); } void CalendarView::updateUnmanagedViews() { mDateNavigator->updateDayMatrix(); } int CalendarView::msgItemDelete(const QString name) { return KMessageBox::warningContinueCancel(this,name +"\n\n"+ i18n("This item will be\npermanently deleted."), i18n("KO/Pi Confirmation"),i18n("Delete")); } void CalendarView::edit_cut() { Event *anEvent=0; Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); if (mViewManager->currentView()->isEventView()) { if ( incidence && incidence->typeID() == eventID ) { anEvent = static_cast<Event *>(incidence); } } if (!anEvent) { KNotifyClient::beep(); return; } DndFactory factory( mCalendar ); factory.cutIncidence(anEvent); changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); } void CalendarView::edit_copy() { Event *anEvent=0; Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); if (mViewManager->currentView()->isEventView()) { if ( incidence && incidence->typeID() == eventID ) { anEvent = static_cast<Event *>(incidence); } } if (!anEvent) { KNotifyClient::beep(); return; } DndFactory factory( mCalendar ); factory.copyIncidence(anEvent); } void CalendarView::edit_paste() { QDate date = mNavigator->selectedDates().first(); DndFactory factory( mCalendar ); Event *pastedEvent = (Event *)factory.pasteIncidence( date ); changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED ); } void CalendarView::edit_global_options() { QString tz = KPimGlobalPrefs::instance()->mTimeZoneId; emit save(); emit saveStopTimer(); mDialogManager->showGlobalOptionsDialog(); if ( tz != KPimGlobalPrefs::instance()->mTimeZoneId) { emit saveStopTimer(); if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, i18n("The timezone has changed!\nShould the calendar be reloaded\nto shift the time of the events?\nPlease read Menu: Help->FAQ:\n\"How do I change the timezone?\"\nas well!"), i18n("Timezone settings"),i18n("Reload"))) { qDebug("KO: TZ reload cancelled "); mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); return; } qDebug("KO: Timezone change "); loadCalendars(); setModified(true); } else qDebug("KO: No tz change "); } void CalendarView::edit_options() { mDialogManager->showOptionsDialog(); } @@ -4318,192 +4327,197 @@ void CalendarView::toggleExpand() globalFlagBlockAgenda = 1; emit calendarViewExpanded( !mLeftFrame->isHidden() ); globalFlagBlockAgenda = 5; mViewManager->raiseCurrentView( !mLeftFrame->isHidden() ); //mViewManager->showView( 0, true ); } void CalendarView::calendarModified( bool modified, Calendar * ) { setModified( modified ); } Todo *CalendarView::selectedTodo() { Incidence *incidence = currentSelection(); if ( incidence && incidence->typeID() == todoID ) { return static_cast<Todo *>( incidence ); } incidence = mTodoList->selectedIncidences().first(); if ( incidence && incidence->typeID() == todoID ) { return static_cast<Todo *>( incidence ); } return 0; } void CalendarView::showIncidence() { mViewerCallerIsSearchDialog = false; Incidence *incidence = currentSelection(); if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); if ( incidence ) { ShowIncidenceVisitor v; v.act( incidence, this ); } } void CalendarView::editIncidenceDescription() { mFlagEditDescription = true; editIncidence(); mFlagEditDescription = false; } void CalendarView::editIncidence() { // qDebug("editIncidence() "); Incidence *incidence = currentSelection(); if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); if ( incidence ) { EditIncidenceVisitor v; v.act( incidence, this ); } } void CalendarView::deleteIncidence() { Incidence *incidence = currentSelection(); if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); if ( incidence ) { deleteIncidence(incidence); } } void CalendarView::showIncidence(QString uid) { Incidence *inc = mCalendar->incidence( uid ); if ( inc ) showIncidence( inc ); } void CalendarView::showIncidence(Incidence *incidence) { mViewerCallerIsSearchDialog = false; //qDebug("%x %x ",sender (), mDialogManager->getSearchDialog() ); if ( sender() && mDialogManager->getSearchDialog() ) { if ( sender () == mDialogManager->getSearchDialog()->listview() ) { mViewerCallerIsSearchDialog = true; } } if ( incidence ) { ShowIncidenceVisitor v; v.act( incidence, this ); } } void CalendarView::editIncidence(Incidence *incidence) { if ( incidence ) { EditIncidenceVisitor v; v.act( incidence, this ); } } void CalendarView::deleteIncidence(Incidence *incidence) { //qDebug(" CalendarView::deleteIncidence "); + if ( incidence == 0 ) { + updateView(); + emit updateSearchDialog(); + return; + } if ( incidence ) { DeleteIncidenceVisitor v; v.act( incidence, this ); } } void CalendarView::lookForOutgoingMessages() { OutgoingDialog *ogd = mDialogManager->outgoingDialog(); ogd->loadMessages(); } void CalendarView::lookForIncomingMessages() { IncomingDialog *icd = mDialogManager->incomingDialog(); icd->retrieve(); } bool CalendarView::removeCompletedSubTodos( Todo* t ) { bool deleteTodo = true; QPtrList<Incidence> subTodos; Incidence *aTodo; subTodos = t->relations(); for (aTodo = subTodos.first(); aTodo; aTodo = subTodos.next()) { if (! removeCompletedSubTodos( (Todo*) aTodo )) deleteTodo = false; } if ( deleteTodo ) { if ( t->isCompleted() && !t->doesRecur()) { checkExternalId( t ); mCalendar->deleteTodo( t ); changeTodoDisplay( t,KOGlobals::EVENTDELETED ); } else deleteTodo = false; } return deleteTodo; } void CalendarView::purgeCompleted() { int result = KMessageBox::warningContinueCancel(this, i18n("Delete all completed todos?\n(Completed recurring todos\nwill not be deleted!)"),i18n("Purge Todos"),i18n("Purge")); if (result == KMessageBox::Continue) { QPtrList<Todo> todoCal; QPtrList<Todo> rootTodos; //QPtrList<Incidence> rel; Todo *aTodo; todoCal = calendar()->todos(); for (aTodo = todoCal.first(); aTodo; aTodo = todoCal.next()) { if ( !aTodo->relatedTo() ) rootTodos.append( aTodo ); } for (aTodo = rootTodos.first(); aTodo; aTodo = rootTodos.next()) { removeCompletedSubTodos( aTodo ); } updateView(); } } void CalendarView::slotCalendarChanged() { ; } void CalendarView::keyPressEvent ( QKeyEvent *e) { //qDebug(" alendarView::keyPressEvent "); e->ignore(); } bool CalendarView::sync(KSyncManager* manager, QString filename, int mode) { if ( manager != mSyncManager) qDebug("KO: Internal error-1. SyncManager mismatch "); if ( filename == QDir::homeDirPath ()+"/.kdecalendardump.ics" ) { qDebug("KO: SyncKDE request detected!"); } mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); mCurrentSyncName = mSyncManager->getCurrentSyncName(); return syncCalendar( filename, mode ); } bool CalendarView::syncExternal(KSyncManager* manager, QString resource) { //mSyncManager = manager; if ( manager != mSyncManager) qDebug("KO: Internal error-2. SyncManager mismatch "); mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); mCurrentSyncName = mSyncManager->getCurrentSyncName(); diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp index 25e599d..5690bdb 100644 --- a/korganizer/kolistview.cpp +++ b/korganizer/kolistview.cpp @@ -772,205 +772,207 @@ void KOListView::writeToFile( bool iCal ) } } else { if ( fn.right( 4 ).lower() == ".ics" ) { fn = fn.left( fn.length() -3) + "vcs"; } } fn = KFileDialog::getSaveFileName( fn, i18n("Save filename"), this ); if ( fn == "" ) return; QFileInfo info; info.setFile( fn ); QString mes; bool createbup = true; if ( info. exists() ) { mes = i18n("File already exists!\nOld file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, i18n("Overwrite!"), i18n("Cancel"), 0, 0, 1 ); if ( result != 0 ) { createbup = false; } } if ( createbup ) { CalendarLocal cal; cal.setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); Incidence *incidence = delSel.first(); while ( incidence ) { cal.addIncidence( incidence->clone() ); incidence = delSel.next(); } if ( iCal ) { ICalFormat format; format.save( &cal, fn ); } else { VCalFormat format; format.save( &cal, fn ); } mes = i18n("KO/Pi:Saved %1").arg(fn ); KOPrefs::instance()->mLastSaveFile = fn; topLevelWidget()->setCaption(mes); } } QTimer::singleShot( 1, this, SLOT ( resetFocus() ) ); } void KOListView::hideAll() { QPtrList<QListViewItem> delSel ; QListViewItem *item = mListView->firstChild (); while ( item ) { if ( item->isSelected() ) { delSel.append(item); } item = item->nextSibling(); } item = delSel.first() ; while ( item ) { QListViewItem * del = item; item = delSel.next(); delete del; } } void KOListView::printList() { mListView->printList(); } void KOListView::deleteAll() { QPtrList<Incidence> delSel = getSelectedIncidences(); // all inc allowed;; if ( delSel.count() ) { int icount = delSel.count(); Incidence *incidence = delSel.first(); Incidence *toDelete; KOPrefs *p = KOPrefs::instance(); bool confirm = p->mConfirm; QString mess; mess = mess.sprintf( i18n("You have %d item(s) selected.\n"), icount ); if ( KMessageBox::Continue == KMessageBox::warningContinueCancel(this, mess + i18n("All selected items will be\npermanently deleted.\n(Deleting items will take\nsome time on a PDA)\n"), i18n("KO/Pi Confirmation"),i18n("Delete")) ) { p->mConfirm = false; int delCounter = 0; QDialog dia ( this, "p-dialog", true ); QLabel lab (i18n("Close dialog to abort deletion!"), &dia ); QVBoxLayout lay( &dia ); lay.setMargin(7); lay.setSpacing(7); lay.addWidget( &lab); QProgressBar bar( icount, &dia ); lay.addWidget( &bar); int w = 220; int h = 50; int dw = QApplication::desktop()->width(); int dh = QApplication::desktop()->height(); dia.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); //dia.resize( 240,50 ); dia.show(); - + KOPrefs::instance()->mGlobalUpdateDisabled = true; while ( incidence ) { bar.setProgress( delCounter ); mess = mess.sprintf( i18n("Deleting item %d ..."), ++delCounter ); dia.setCaption( mess ); qApp->processEvents(); toDelete = (incidence); incidence = delSel.next(); emit deleteIncidenceSignal(toDelete ); if ( dia.result() != 0 ) break; } + KOPrefs::instance()->mGlobalUpdateDisabled = false; + emit deleteIncidenceSignal( 0 ); mess = mess.sprintf( i18n("%d items remaining in list."), count() ); topLevelWidget ()->setCaption( mess ); p->mConfirm = confirm; } } } int KOListView::maxDatesHint() { return 0; } int KOListView::currentDateCount() { return 0; } QPtrList<Incidence> KOListView::selectedIncidences() { QPtrList<Incidence> eventList; QListViewItem *item = mListView->firstChild (); while ( item ) { if ( item->isSelected() ) { eventList.append(((KOListViewItem *)item)->data()); } item = item->nextSibling(); } // // QListViewItem *item = mListView->selectedItem(); //if (item) eventList.append(((KOListViewItem *)item)->data()); return eventList; } DateList KOListView::selectedDates() { DateList eventList; return eventList; } void KOListView::showDates(bool show) { // Shouldn't we set it to a value greater 0? When showDates is called with // show == true at first, then the columnwidths are set to zero. static int oldColWidth1 = 0; static int oldColWidth3 = 0; if (!show) { oldColWidth1 = mListView->columnWidth(1); oldColWidth3 = mListView->columnWidth(3); mListView->setColumnWidth(1, 0); mListView->setColumnWidth(3, 0); } else { mListView->setColumnWidth(1, oldColWidth1); mListView->setColumnWidth(3, oldColWidth3); } mListView->repaint(); } void KOListView::printPreview(CalPrinter *calPrinter, const QDate &fd, const QDate &td) { #ifndef KORG_NOPRINTER calPrinter->preview(CalPrinter::Day, fd, td); #endif } void KOListView::showDates() { showDates(true); } void KOListView::hideDates() { showDates(false); } void KOListView::resetFocus() { topLevelWidget()->setActiveWindow(); topLevelWidget()->raise(); mListView->setFocus(); } void KOListView::updateView() { mListView->setFocus(); if ( mListView->firstChild () ) mListView->setCurrentItem( mListView->firstChild () ); } void KOListView::updateConfig() { mListView->setFont ( KOPrefs::instance()->mListViewFont ); updateView(); diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp index 138028d..a63297e 100644 --- a/korganizer/koprefs.cpp +++ b/korganizer/koprefs.cpp @@ -1,151 +1,152 @@ /* This file is part of KOrganizer. Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. As a special exception, permission is given to link this program with any edition of Qt, and distribute the resulting executable, without including the source code for Qt in the source distribution. */ #include <time.h> #ifndef _WIN32_ #include <unistd.h> #endif #include <qdir.h> #include <qtextstream.h> #include <qtextcodec.h> #include <qstring.h> #include <qregexp.h> #include <qfont.h> #include <qcolor.h> #include <qstringlist.h> #include <stdlib.h> #include <kglobal.h> #include <kglobalsettings.h> #include <kconfig.h> #include <klocale.h> #include <kdebug.h> #include <kemailsettings.h> #include <kstaticdeleter.h> #include <libkdepim/kpimglobalprefs.h> #include "koprefs.h" #include "mainwindow.h" KOPrefs *KOPrefs::mInstance = 0; static KStaticDeleter<KOPrefs> insd; KOPrefs::KOPrefs() : KPimPrefs("korganizerrc") { + mGlobalUpdateDisabled = false; mCategoryColors.setAutoDelete(true); fillMailDefaults(); mDefaultCategoryColor = QColor(175,210,255);//196,196,196); QColor defaultHolidayColor = QColor(255,0,0); QColor defaultHighlightColor = QColor(129,112,255);//64,64,255); QColor defaultAgendaBgColor = QColor(239,241,169);//128,128,128); QColor defaultWorkingHoursColor = QColor(170,223,150);//160,160,160); QColor defaultTodoDueTodayColor = QColor(255,220,100); QColor defaultTodoOverdueColor = QColor(255,153,125); QColor defaultTodoRunColor = QColor(99,194,30); KPrefs::setCurrentGroup("General"); addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false); addItemBool("ShowIconNewTodo",&mShowIconNewTodo,true); addItemBool("ShowIconNewEvent",&mShowIconNewEvent,true); addItemBool("ShowIconSearch",&mShowIconSearch,true); addItemBool("ShowIconList",&mShowIconList,true); addItemBool("ShowIconDay1",&mShowIconDay1,true); addItemBool("ShowIconDay5",&mShowIconDay5,true); addItemBool("ShowIconDay6",&mShowIconDay6,true); addItemBool("ShowIconDay7",&mShowIconDay7,true); addItemBool("ShowIconMonth",&mShowIconMonth,true); addItemBool("ShowIconTodoview",&mShowIconTodoview,true); addItemBool("ShowIconBackFast",&mShowIconBackFast,true); addItemBool("ShowIconBack",&mShowIconBack,true); addItemBool("ShowIconToday",&mShowIconToday,true); addItemBool("ShowIconForward",&mShowIconForward,true); addItemBool("ShowIconForwardFast",&mShowIconForwardFast,true); addItemBool("ShowIconWhatsThis",&mShowIconWhatsThis,true); addItemBool("ShowIconWeekNum",&mShowIconWeekNum,true); addItemBool("ShowIconNextDays",&mShowIconNextDays,true); addItemBool("ShowIconNext",&mShowIconNext,true); addItemBool("ShowIconJournal",&mShowIconJournal,true); addItemBool("ShowIconStretch",&mShowIconStretch,true); addItemBool("ShowIconFilter",&mShowIconFilter,false); addItemBool("ShowIconOnetoolbar",&mShowIconOnetoolbar,true); bool addIcons = false; #ifdef DESKTOP_VERSION addIcons = true; #endif addItemBool("ShowIconNavigator",&mShowIconNavigator,addIcons); addItemBool("ShowIconAllday",&mShowIconAllday,addIcons); addItemBool("ShowIconFilterview",&mShowIconFilterview,addIcons); addItemBool("ShowIconToggleFull",&mShowIconToggleFull,addIcons); addItemInt("LastLoadedLanguage",&mOldLanguage,0); addItemBool("AskForQuit",&mAskForQuit,false); #ifndef DESKTOP_VERSION addItemBool("ShowFullMenu",&mShowFullMenu,false); #else addItemBool("ShowFullMenu",&mShowFullMenu,true); #endif addItemBool("ToolBarHor",&mToolBarHor, true ); addItemBool("ToolBarUp",&mToolBarUp, false ); addItemBool("ToolBarHorV",&mToolBarHorV, true ); addItemBool("ToolBarUpV",&mToolBarUpV, false ); addItemBool("ToolBarHorN",&mToolBarHorN, true ); addItemBool("ToolBarUpN",&mToolBarUpN, false ); addItemBool("ToolBarHorF",&mToolBarHorF, true ); addItemBool("ToolBarUpF",&mToolBarUpF, false ); addItemBool("ToolBarMiniIcons",&mToolBarMiniIcons, false ); addItemInt("Whats Next Days",&mWhatsNextDays,3); addItemInt("Whats Next Prios",&mWhatsNextPrios,1); addItemBool("ShowTodoInAgenda",&mShowTodoInAgenda,true); addItemBool("ShowCompletedTodoInAgenda",&mShowCompletedTodoInAgenda,true); addItemBool("ShowTimeInAgenda",&mShowTimeInAgenda,true); addItemBool("HideNonStartedTodos",&mHideNonStartedTodos,false); addItemBool("ShowCompletedTodo",&mShowCompletedTodo,true); addItemInt("AllDay Size",&mAllDaySize,28); QString defAlarm = KGlobal::iconLoader()->iconPath()+"koalarm.wav"; addItemString("DefaultAlarmFile",&mDefaultAlarmFile,defAlarm ); addItemStringList("LocationDefaults",&mLocationDefaults ); addItemStringList("EventSummary User",&mEventSummaryUser); addItemStringList("TodoSummary User",&mTodoSummaryUser); addItemStringList("JournalSummary User",&mJournalSummaryUser); addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false); addItemBool("Enable Project View",&mEnableProjectView,false); addItemBool("Auto Save",&mAutoSave,false); addItemInt("Auto Save Interval",&mAutoSaveInterval,3); addItemBool("Confirm Deletes",&mConfirm,true); addItemString("Archive File",&mArchiveFile); addItemString("Html Export File",&mHtmlExportFile, QDir::homeDirPath() + "/" + i18n("Default export file", "calendar.html")); addItemBool("Html With Save",&mHtmlWithSave,false); KPrefs::setCurrentGroup("Personal Settings"); addItemInt("Mail Client",&mMailClient,MailClientKMail); addItemBool("Use Control Center Email",&mEmailControlCenter,false); addItemBool("Bcc",&mBcc,false); @@ -226,193 +227,193 @@ KOPrefs::KOPrefs() : addItemColor("AppColor1",&mAppColor1,QColor( 130,170,255 )); addItemColor("AppColor2",&mAppColor2,QColor( 174,216,255 )); addItemBool("UseAppColors",&mUseAppColors,false); KPrefs::setCurrentGroup("Views"); addItemBool("Block Popup Menu",&mBlockPopupMenu,false); addItemBool("Show Date Navigator",&mShowDateNavigator,true); addItemInt("Hour Size",&mHourSize,8); addItemBool("Show Daily Recurrences",&mDailyRecur,true); addItemBool("Show Weekly Recurrences",&mWeeklyRecur,true); addItemBool("Show Month Daily Recurrences",&mMonthDailyRecur,true); addItemBool("Show Month Weekly Recurrences",&mMonthWeeklyRecur,true); addItemBool("ShowShortMonthName",&mMonthShowShort,false); addItemBool("ShowIconsInMonthCell",&mMonthShowIcons,true); addItemBool("ShowTimesInMonthCell",&mMonthShowTimes,true); #ifdef DESKTOP_VERION addItemBool("Enable ToolTips",&mEnableToolTips,true); #else addItemBool("Enable ToolTips",&mEnableToolTips,false); #endif addItemBool("Enable MonthView ScrollBars",&mEnableMonthScroll,false); addItemBool("Marcus Bains shows seconds",&mMarcusBainsShowSeconds,false); addItemBool("Show Marcus Bains",&mMarcusBainsEnabled,true); addItemBool("EditOnDoubleClick",&mEditOnDoubleClick,true); addItemBool("ViewChangeHoldFullscreen",&mViewChangeHoldFullscreen,true); addItemBool("ViewChangeHoldNonFullscreen",&mViewChangeHoldNonFullscreen,false); addItemBool("CenterOnCurrentTime",&mCenterOnCurrentTime,false); addItemBool("SetTimeToDayStartAt",&mSetTimeToDayStartAt,true); addItemBool("HighlightCurrentDay",&mHighlightCurrentDay,true); addItemBool("WNViewShowsParents",&mWNViewShowsParents,true);; addItemBool("WNViewShowsPast",&mWNViewShowsPast,true); addItemBool("WNViewShowLocation",&mWNViewShowLocation,false); addItemBool("UseHighlightLightColor",&mUseHighlightLightColor,false); addItemBool("ListViewMonthTimespan",&mListViewMonthTimespan,true); addItemBool("TodoViewUsesCatColors",&mTodoViewUsesCatColors,false); addItemBool("TodoViewShowsPercentage",&mTodoViewShowsPercentage,false); addItemBool("TodoViewUsesSmallFont",&mTodoViewUsesSmallFont,true); addItemBool("MonthViewUsesBigFont",&mMonthViewUsesBigFont,true); addItemBool("TodoViewUsesForegroundColor",&mTodoViewUsesForegroundColor,false); addItemBool("MonthViewUsesForegroundColor",&mMonthViewUsesForegroundColor,false); #ifdef DESKTOP_VERSION addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,true); #else addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,false); #endif addItemInt("Day Begins",&mDayBegins,7); addItemInt("Working Hours Start",&mWorkingHoursStart,8); addItemInt("Working Hours End",&mWorkingHoursEnd,17); addItemBool("Exclude Holidays",&mExcludeHolidays,true); addItemBool("Exclude Saturdays",&mExcludeSaturdays,true); addItemBool("Month View Uses Category Color",&mMonthViewUsesCategoryColor,false); addItemBool("Full View Month",&mFullViewMonth,true); addItemBool("Full View Todo",&mFullViewTodo,true); addItemBool("Quick Todo",&mEnableQuickTodo,false); addItemInt("Next X Days",&mNextXDays,3); KPrefs::setCurrentGroup("Printer"); KPrefs::setCurrentGroup("Layout"); addItemBool("CompactDialogs",&mCompactDialogs,false); addItemBool("VerticalScreen",&mVerticalScreen,true); KPrefs::setCurrentGroup("KOrganizer Plugins"); addItemStringList("SelectedPlugins",&mSelectedPlugins,"holidays"); KPrefs::setCurrentGroup("Group Scheduling"); addItemInt("IMIPScheduler",&mIMIPScheduler,IMIPKMail); addItemInt("IMIPSend",&mIMIPSend,IMIPdirectsend); addItemStringList("AdditionalMails",&mAdditionalMails,""); addItemInt("IMIP auto refresh",&mIMIPAutoRefresh,neverAuto); addItemInt("IMIP auto insert request",&mIMIPAutoInsertRequest,neverAuto); addItemInt("IMIP auto insert reply",&mIMIPAutoInsertReply,neverAuto); addItemInt("IMIP auto FreeBusy",&mIMIPAutoFreeBusy,neverAuto); addItemInt("IMIP auto save FreeBusy",&mIMIPAutoFreeBusyReply,neverAuto); KPrefs::setCurrentGroup( "Editors" ); addItemStringList( "EventTemplates", &mEventTemplates ); addItemStringList( "TodoTemplates", &mTodoTemplates ); addItemInt("DestinationPolicy",&mDestination,standardDestination); KPrefs::setCurrentGroup( "ViewOptions" ); addItemBool("EVshowDetails",&mEVshowDetails,true); addItemBool("EVshowCreated",&mEVshowCreated,true); addItemBool("EVshowChanged",&mEVshowChanged,true); addItemBool("WTshowDetails",&mWTshowDetails,false); addItemBool("WTshowCreated",&mWTshowCreated,false); addItemBool("WTshowChanged",&mWTshowChanged,false); - mCalendars.setAutoDelete( true ); + mCalendars.setAutoDelete( true ); } KOPrefs::~KOPrefs() { if (mInstance == this) mInstance = insd.setObject(0); mCalendars.setAutoDelete( true ); mCalendars.clear(); //qDebug("KOPrefs::~KOPrefs() "); } KOPrefs *KOPrefs::instance() { if (!mInstance) { mInstance = insd.setObject(new KOPrefs()); mInstance->readConfig(); } return mInstance; } void KOPrefs::usrSetDefaults() { } void KOPrefs::fillMailDefaults() { if (mName.isEmpty()) mName = i18n("Anonymous"); if (mEmail.isEmpty()) mEmail = i18n("nobody@nowhere"); } void KOPrefs::setTimeZoneIdDefault() { ; } void KOPrefs::setAllDefaults() { setCategoryDefaults(); mEventSummaryUser = getDefaultList() ; mTodoSummaryUser = getDefaultList() ; mJournalSummaryUser = getDefaultList() ; mLocationDefaults = getLocationDefaultList(); } void KOPrefs::setCategoryDefaults() { mCustomCategories.clear(); mCustomCategories = getDefaultList(); QStringList::Iterator it; for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { setCategoryColor(*it,mDefaultCategoryColor); } } QStringList KOPrefs::getLocationDefaultList() { QStringList retval ; retval << i18n("Home") << i18n("Office") << i18n("Library") << i18n("School") << i18n("Doctor") << i18n("Beach") << i18n("University") << i18n("Restaurant") << i18n("Bar") << i18n("Conference room") << i18n("Cinema") << i18n("Lake") << i18n("Kindergarten") << i18n("Germany") << i18n("Sweden") << i18n("Forest") << i18n("Desert") << i18n("Kitchen") ; // << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") retval.sort(); return retval; } QStringList KOPrefs::getDefaultList() { QStringList retval ; retval << i18n("Anniversary") << i18n("Appointment") << i18n("Birthday") << i18n("Business") << i18n("Customer") << i18n("Break") << i18n("Family") << i18n("Favorites") << i18n("Fishing") << i18n("Gifts") << i18n("Holiday") << i18n("Holiday Cards")<< i18n("Hot Contacts") << i18n("Meeting") << i18n("Miscellaneous") << i18n("Partner") << i18n("Personal") << i18n("PHB") << i18n("Phone Calls") << i18n("Shopping") << i18n("Sports") << i18n("Talk") << i18n("Travel") << i18n("TV") << i18n("Vacation") ; retval.sort(); //qDebug("cat %s ", retval.join("-").latin1()); return retval; } // << i18n("Business Travel") << i18n("Education") << i18n("Hiking") << i18n("Hunting") << i18n("Recurring") << i18n("Personal Travel") << i18n("Speach") << i18n("Festival") << i18n("Competition")<< i18n("Party")<< i18n("Projects")<< i18n("Kids") << i18n("Special Occasion")<< i18n("Breakfast")<< i18n("Dinner") << i18n("Lunch")<< i18n("University")<< i18n("School")<< i18n("Flight")<< i18n("Key Customer") << i18n("VIP") << i18n("SyncEvent") << i18n("Cinema") void KOPrefs::usrReadConfig() { config()->setGroup("General"); //qDebug("KOPrefs::usrReadConfig() "); mCustomCategories = config()->readListEntry("Custom Categories"); mOldLoadedLanguage = mOldLanguage ; mOldLanguage = KPimGlobalPrefs::instance()->mPreferredLanguage; if (mLocationDefaults.isEmpty()) { mLocationDefaults = getLocationDefaultList(); diff --git a/korganizer/koprefs.h b/korganizer/koprefs.h index 0779e27..392360d 100644 --- a/korganizer/koprefs.h +++ b/korganizer/koprefs.h @@ -252,111 +252,112 @@ class KOPrefs : public KPimPrefs bool mToolBarUpF; bool mToolBarMiniIcons; bool mAskForQuit; bool mUsePassWd; bool mShowSyncEvents; bool mShowTodoInAgenda; bool mShowCompletedTodoInAgenda; bool mShowTimeInAgenda; bool mHideNonStartedTodos; bool mBlockPopupMenu; int mLastSyncTime; void setCategoryColor(QString cat,const QColor & color); QColor *categoryColor(QString cat); QString mArchiveFile; QString mHtmlExportFile; bool mHtmlWithSave; QStringList mSelectedPlugins; QString mLastImportFile; QString mLastVcalFile; QString mLastSaveFile; QString mLastLoadFile; QString mDefaultAlarmFile; int mIMIPScheduler; int mIMIPSend; QStringList mAdditionalMails; int mIMIPAutoRefresh; int mIMIPAutoInsertReply; int mIMIPAutoInsertRequest; int mIMIPAutoFreeBusy; int mIMIPAutoFreeBusyReply; QStringList mTodoTemplates; QStringList mEventTemplates; int mDestination; bool mEditOnDoubleClick; bool mViewChangeHoldFullscreen; bool mViewChangeHoldNonFullscreen; bool mCenterOnCurrentTime; bool mSetTimeToDayStartAt; bool mHighlightCurrentDay; bool mUseHighlightLightColor; bool mListViewMonthTimespan; bool mWNViewShowsParents; bool mWNViewShowsPast; bool mWNViewShowLocation; bool mTodoViewShowsPercentage; bool mTodoViewUsesCatColors; bool mMonthViewUsesBigFont; bool mTodoViewUsesSmallFont; bool mTodoViewUsesForegroundColor; bool mMonthViewUsesForegroundColor; bool mHightlightDateTimeEdit; bool mShortDateInViewer; bool mShowDateNavigator; QStringList mLocationDefaults; QStringList mEventSummaryUser; QStringList mTodoSummaryUser; QStringList mJournalSummaryUser; bool mUseInternalAlarmNotification; int mAlarmPlayBeeps; int mAlarmSuspendTime; int mAlarmSuspendCount; int mAlarmBeepInterval; int mOldLanguage; int mOldLoadedLanguage; QString mActiveSyncPort; QString mActiveSyncIP; // settings for eventviewer bool mEVshowDetails; bool mEVshowCreated; bool mEVshowChanged; bool mWTshowDetails; bool mWTshowCreated; bool mWTshowChanged; int mCurrentDisplayedView; QPtrList<KopiCalendarFile> mCalendars; int mNextAvailableCalendar; + bool mGlobalUpdateDisabled; private: QDict<QColor> mCategoryColors; QArray<KopiCalendarFile*> mDefCalColors; QColor mDefaultCategoryColor; QFont mDefaultTimeBarFont; QFont mDefaultViewFont; QFont mDefaultMonthViewFont; QString mName; QString mEmail; }; #endif diff --git a/korganizer/searchdialog.cpp b/korganizer/searchdialog.cpp index 2e32ac2..9cfdc35 100644 --- a/korganizer/searchdialog.cpp +++ b/korganizer/searchdialog.cpp @@ -161,192 +161,196 @@ SearchDialog::~SearchDialog() } void SearchDialog::slot_add( bool b ) { if ( b ) { if ( mSubItems->isOn() ) mSubItems->toggle(); if ( mRefineItems->isOn() ) mRefineItems->toggle(); setCaption( i18n("Matching items will be added to list")); } else setCaption( i18n("List will be cleared before search")); } void SearchDialog::slot_sub( bool b) { if ( b ) { if ( mRefineItems->isOn() ) mRefineItems->toggle(); if ( mAddItems->isOn() ) mAddItems->toggle(); setCaption( i18n("Matching items will be removed from list")); } else setCaption( i18n("List will be cleared before search")); } void SearchDialog::slot_refine( bool b) { if ( b ) { if ( mSubItems->isOn() ) mSubItems->toggle(); if ( mAddItems->isOn() ) mAddItems->toggle(); setCaption( i18n("Search on displayed list only")); } else setCaption( i18n("List will be cleared before search")); } void SearchDialog::toggleCheckboxes() { if ( incidenceGroup->isVisible() ) { incidenceGroup->hide() ; subjectGroup->hide() ; attendeeGroup->hide() ; } else { incidenceGroup->show() ; subjectGroup->show() ; attendeeGroup->show() ; } } void SearchDialog::raiseAndSelect() { static int currentState = 0; if ( !mSearchJournal->isChecked() && !mSearchTodo->isChecked() && !mSearchEvent->isChecked() ) currentState = 0; int newState = 0; if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_J_VIEW ) { newState = VIEW_J_VIEW; } else if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_T_VIEW ) { newState = VIEW_T_VIEW; } else { newState = VIEW_A_VIEW; } if ( newState != currentState ) { if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_J_VIEW ) { if ( ! mSearchJournal->isChecked() ) { mSearchJournal->setChecked( true ); mSearchTodo->setChecked( false ); mSearchEvent->setChecked( false ); mSummaryCheck->setChecked( true ); mDescriptionCheck->setChecked( true ); } } else if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_T_VIEW ) { if ( ! mSearchTodo->isChecked() ) { mSearchTodo->setChecked( true ); mSearchJournal->setChecked( false ); mSearchEvent->setChecked( false ); } } else { if ( ! mSearchEvent->isChecked() ) { mSearchEvent->setChecked( true ); mSearchJournal->setChecked( false ); mSearchTodo->setChecked( false ); } } } currentState = newState; raise(); } void SearchDialog::setFocusToList() { listView->resetFocus(); } void SearchDialog::accept() { doSearch(); } void SearchDialog::updateList() { + if ( KOPrefs::instance()->mGlobalUpdateDisabled ) { + listView->clear(); + return; + } //listView->updateList(); if ( isVisible() ) { updateView(); //qDebug("SearchDialog::updated "); } else { listView->clear(); //qDebug("SearchDialog::cleared "); } } void SearchDialog::searchTextChanged( const QString &_text ) { #if 0 enableButton( KDialogBase::User1, !_text.isEmpty() ); #endif } void SearchDialog::doSearch() { QRegExp re; re.setWildcard(true); // most people understand these better. re.setCaseSensitive(false); QString st = searchEdit->text(); if ( st.right(1) != "*") st += "*"; re.setPattern(st); if (!mSearchEvent->isChecked() && !mSearchTodo->isChecked() && !mSearchJournal->isChecked() ) { KMessageBox::sorry(this, i18n("Please select at least one\nof the types to search for:\n\nEvents\nTodos\nJournals")); return; } if (!re.isValid() ) { KMessageBox::sorry(this, i18n("Invalid search expression,\ncannot perform " "the search.\nPlease enter a search expression\n" "using the wildcard characters\n '*' and '?'" "where needed.")); return; } search(re); listView->setStartDate( mStartDate->date() ); listView->showEvents(mMatchedEvents); listView->addTodos(mMatchedTodos); listView->addJournals(mMatchedJournals); if (mMatchedEvents.count() + mMatchedJournals.count() + mMatchedTodos.count() == 0) { setCaption(i18n("No items found. Use '*' and '?' where needed.")); } else { QString mess; mess = mess.sprintf( i18n("%d item(s) found."), mMatchedEvents.count()+ mMatchedJournals.count() + mMatchedTodos.count() ); setCaption( i18n("KO/Pi Find: ") + mess); } searchEdit->setFocus(); } void SearchDialog::updateConfig() { listView->updateConfig(); } void SearchDialog::updateView() { //qDebug("SearchDialog::updateView() %d ", isVisible()); QRegExp re; re.setWildcard(true); // most people understand these better. re.setCaseSensitive(false); QString st = searchEdit->text(); if ( st.right(1) != "*") st += "*"; re.setPattern(st); mMatchedEvents.clear(); mMatchedTodos.clear(); mMatchedJournals.clear(); if (re.isValid()) { search(re); } listView->setStartDate( mStartDate->date() ); listView->showEvents(mMatchedEvents); listView->addTodos(mMatchedTodos); listView->addJournals(mMatchedJournals); } void SearchDialog::search(const QRegExp &re) { QPtrList<Event> events; if ( !mAddItems->isChecked() && !mSubItems->isChecked() ) { if ( mRefineItems->isChecked() ) events = mMatchedEvents; mMatchedEvents.clear(); } if ( mSearchEvent->isChecked() ) { if ( !mRefineItems->isChecked() ) events = mCalendar->events( mStartDate->date(), mEndDate->date(), false /*mInclusiveCheck->isChecked()*/ ); Event *ev; |