summaryrefslogtreecommitdiffabout
path: root/korganizer
Side-by-side diff
Diffstat (limited to 'korganizer') (more/less context) (show whitespace changes)
-rw-r--r--korganizer/calendarview.cpp14
-rw-r--r--korganizer/kolistview.cpp4
-rw-r--r--korganizer/koprefs.cpp1
-rw-r--r--korganizer/koprefs.h1
-rw-r--r--korganizer/searchdialog.cpp4
5 files changed, 23 insertions, 1 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 4b3f806..558fc55 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -2622,96 +2622,105 @@ void CalendarView::changeIncidenceDisplay(Incidence *which, int action)
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();
@@ -4366,96 +4375,101 @@ void CalendarView::editIncidence()
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) {
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp
index 25e599d..5690bdb 100644
--- a/korganizer/kolistview.cpp
+++ b/korganizer/kolistview.cpp
@@ -820,109 +820,111 @@ 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;
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp
index 138028d..a63297e 100644
--- a/korganizer/koprefs.cpp
+++ b/korganizer/koprefs.cpp
@@ -8,96 +8,97 @@
(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);
diff --git a/korganizer/koprefs.h b/korganizer/koprefs.h
index 0779e27..392360d 100644
--- a/korganizer/koprefs.h
+++ b/korganizer/koprefs.h
@@ -300,63 +300,64 @@ class KOPrefs : public KPimPrefs
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
@@ -209,96 +209,100 @@ void SearchDialog::raiseAndSelect()
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 {