author | zautrix <zautrix> | 2005-04-18 10:41:31 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-04-18 10:41:31 (UTC) |
commit | 409e329447a7d00a93a56855fcddadbb0f793163 (patch) (side-by-side diff) | |
tree | 1c92498d2dfb4c89358c64a6944aca1300a27d11 | |
parent | 0ff0dca7ccb94ebb1381351e4e4081fe0bac500a (diff) | |
download | kdepimpi-409e329447a7d00a93a56855fcddadbb0f793163.zip kdepimpi-409e329447a7d00a93a56855fcddadbb0f793163.tar.gz kdepimpi-409e329447a7d00a93a56855fcddadbb0f793163.tar.bz2 |
morefixes
-rw-r--r-- | bin/kdepim/korganizer/germantranslation.txt | 2 | ||||
-rw-r--r-- | korganizer/koeditorgeneraltodo.cpp | 20 | ||||
-rw-r--r-- | korganizer/kolistview.cpp | 53 | ||||
-rw-r--r-- | korganizer/kotodoeditor.cpp | 53 | ||||
-rw-r--r-- | korganizer/kotodoview.cpp | 11 | ||||
-rw-r--r-- | libkcal/incidence.cpp | 28 | ||||
-rw-r--r-- | libkcal/incidence.h | 3 |
7 files changed, 103 insertions, 67 deletions
diff --git a/bin/kdepim/korganizer/germantranslation.txt b/bin/kdepim/korganizer/germantranslation.txt index 2981762..7fa92bf 100644 --- a/bin/kdepim/korganizer/germantranslation.txt +++ b/bin/kdepim/korganizer/germantranslation.txt @@ -1307,54 +1307,54 @@ { "1 minute\n","1 Minute\n" }, { "Only one toolbar","Nur eine Toolbar" }, { "Print","Drucke" }, { "Print selected event / todo...","Drucke ausgewählten Termin / Todo..." }, { "There is nothing selected!","Es ist nichts ausgewählt!" }, { "\n\nDo you really want to print this item?","\n\nMöchten Sie wirklich diesen Eintrag ausdrucken? " }, { "KO/Pi Print Confirmation","KO/Pi Druckbestätigung" }, { "This prints the view as you see it.\n(With the complete content, of course.)\nYou may change the print layout by resizing the view.\nPrint unscaled may print several pages\ndepending on the amount of data.\nPrint scaled down will print all on one page.\nPrint scaled up/down will print all on one page,\nbut will scale up the text to page boundaries,\nif the text is smaller than the page.\nYou can select page geometry setup in the next dialog.\n","Dies druckt die Ansicht wie man sie sieht.\n(Mit dem kompletten Inhalt natürlich.)\nMan kann das Layout ändern durch ändern der Fenstergröße.\nDrucke unskaliert druckt ggf. mehrere Seiten\nabhängig von der Menge der Daten.\nDrucke runterskaliert um auf eine Seite zu passen\ndruckt alles auf eine Seite.\nDrucke hoch/runterskaliert um genau auf eine Seite zu passen\nvergrößert den Text gegebenenfalls.\nDas Seitenlayout kann im nächsten Dialog gewählt werden.\n" }, { "KO/Pi Printout","KO/Pi Ausdruck" }, { "Print unscaled","Drucke unskaliert" }, { "Print scaled down to fit one page","Drucke runterskaliert um auf eine Seite zu passen." }, { "Print scaled up/down to fit one page","Drucke hoch/runterskaliert um genau auf eine Seite zu passen." }, { "Printout Mode","Druck Modus" }, { "Filter menu icon","Filtermenu Icon" }, { "<p><b>A+(shift or ctrl)</b>: Show occurence of next alarm</p>\n","<p><b>A+(shift oder ctrl)</b>: Zeige Zeit bis zum nächsten Alarm</p>\n" }, { "<p><b>N</b>: Switch to next view which has a toolbar icon</p>\n","<p><b>N</b>: Wechsle zur nächsten Ansicht, die ein Icon in der Toolbar hat</p>\n" }, { "%1d","%1t" }, { "%1h","%1std" }, { "%1min","%1min" }, { "( %1 before )","( %1 vorher )" }, { "The next alarm is in\nless than one minute!","Der nächste Alarm kommt in\nweniger als einer Minute!" }, { "\nThe internal alarm notification is disabled!\n","\nDie interne Alarmbenachrichtigung ist ausgeschaltet!\n" }, { "Enable it in the settings menu, TAB alarm.","Schalten Sie sie an im Menu Einstellungen, TAB Alarm." }, { "Show Sync Events in WN+Agenda","Zeige Sync-Ereignisse in WN+Agenda" }, { "Use short date in WN+Event view","Zeige Kurzdatum in WN+Terminanzeige" }, { "Number of max.displayed todo prios:","Anzahl max.angezeigter Todo-Prios:" }, { " on "," am " }, { "On: ","Am: " }, { "<i>The recurrence is computed from the start datetime!</i>","<i>Die Wiederholung wird vom Startwert aus berechnet!</i>" }, { "Start/Stop todo...","Starte/Stoppe Todo..." }, { "Color for running todos:","Farbe für laufende Todos:" }, { "The todo\n%1\nis started.\nDo you want to set\nthe state to stopped?","Das Todo\n%1\nist gestartet.\nWollen Sie es\nauf gestoppt setzen?" }, { "Todo is started","Todo is gestarted" }, { "Stop todo","Stoppe Todo" }, { "Todo is stopped","Todo ist gestoppt" }, { "Start todo","Starte Todo" }, { "The todo\n%1\nis stopped.\nDo you want to set\nthe state to started?","Das Todo\n%1\nist gestoppt.\nWollen Sie es auf\ngestartet setzen?" }, { "The todo\n%1\nwill be cloned!\nIt has subtodos!\nDo you want to clone\nall subtodos as well?","Das Todo\n%1\nwird geklont!\nEs hat Untertodos!\nMöchten Sie alle\nUntertodos auch klonen?" }, { "Todo has subtodos","Todo hat Untertodos" }, { "Block popup until mouse button release","Sperre Popup bis Mausknopf losgelassen" }, { "Colors","Farben" }, { "Click on new parent item","Klicke auf neues Übertodo" }, { "Reparenting aborted!","Übertodo setzen abgebrochen" }, { "Cannot move Todo to itself\nor a child of itself","Kann nicht Todo auf\nsich selbst oder\nein Untertodo verschieben" }, { "Recursive reparenting not possible!","Rekursives Verschieben nicht möglich" }, { "Delete all completed todos?\n(Completed recurring todos\nwill not be deleted!)","Entferne alle erledigten Todos?\n(Erledigte wiederholende Todos\nwerden nicht gelöscht!)" }, { "Alternating background of list views","Abwechselnder Hintergrund für Listen" }, { "times","Zeiten" }, -{ "","" }, +{ "The todo\n%1\nhas subtodos!\nDo you want to set\nthe categories for\nall subtodos as well?","Das Todo\n%1\nhat Untertodos!\nMöchten Sie die Kategorien\nauch für alle Untertodos setzen?" }, { "","" }, { "","" }, { "","" }, { "","" }, { "","" }, diff --git a/korganizer/koeditorgeneraltodo.cpp b/korganizer/koeditorgeneraltodo.cpp index 4a1576a..e86b4d0 100644 --- a/korganizer/koeditorgeneraltodo.cpp +++ b/korganizer/koeditorgeneraltodo.cpp @@ -1,168 +1,169 @@ /* This file is part of KOrganizer. Copyright (c) 2000,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 <qtooltip.h> #include <qfiledialog.h> #include <qlayout.h> #include <qvbox.h> #include <qbuttongroup.h> #include <qvgroupbox.h> #include <qwidgetstack.h> #include <qdatetime.h> #include <qapplication.h> #include <kglobal.h> #include <klocale.h> #include <kiconloader.h> #include <kmessagebox.h> #include <kdebug.h> #include <krestrictedline.h> #include <kstandarddirs.h> #include <kfiledialog.h> +#include <kdialog.h> #include <libkcal/todo.h> #include <libkdepim/kdateedit.h> #include "koprefs.h" #include "ktimeedit.h" #include "koeditorgeneraltodo.h" #include "kolocationbox.h" KOEditorGeneralTodo::KOEditorGeneralTodo(QObject* parent, const char* name) : KOEditorGeneral( parent, name) { } KOEditorGeneralTodo::~KOEditorGeneralTodo() { } void KOEditorGeneralTodo::finishSetup() { // QWidget::setTabOrder(mSummaryEdit, mLocationEdit); // QWidget::setTabOrder(mLocationEdit, mDueCheck); // QWidget::setTabOrder(mDueCheck, mDueDateEdit); // QWidget::setTabOrder(mDueDateEdit, mDueTimeEdit); // QWidget::setTabOrder(mDueTimeEdit, mStartCheck); // QWidget::setTabOrder(mStartCheck, mStartDateEdit); // QWidget::setTabOrder(mStartDateEdit, mStartTimeEdit); // QWidget::setTabOrder(mStartTimeEdit, mTimeButton); // QWidget::setTabOrder(mTimeButton, mCompletedCombo); // QWidget::setTabOrder(mCompletedCombo, mPriorityCombo); // QWidget::setTabOrder(mPriorityCombo, mAlarmButton); // QWidget::setTabOrder(mAlarmButton, mCategoriesButton); // QWidget::setTabOrder(mCategoriesButton, mSecrecyCombo); // QWidget::setTabOrder(mSecrecyCombo, mDescriptionEdit); mSummaryEdit->load(KOLocationBox::SUMMARYTODO); mSummaryEdit->setFocus(); } void KOEditorGeneralTodo::initTime(QWidget *parent,QBoxLayout *topLayout) { QBoxLayout *timeLayout = new QVBoxLayout(topLayout); QGroupBox *timeGroupBox = new QGroupBox(1,QGroupBox::Horizontal, i18n("Date && Time"),parent); timeLayout->addWidget(timeGroupBox); - timeGroupBox->layout()->setSpacing( 0 ); - timeGroupBox->layout()->setMargin( 5 ); + timeGroupBox->layout()->setSpacing( KDialog::spacingHintSmall() ); + timeGroupBox->layout()->setMargin( KDialog::marginHint() ); QFrame *timeBoxFrame = new QFrame(timeGroupBox); QGridLayout *layoutTimeBox = new QGridLayout(timeBoxFrame,3,3); - layoutTimeBox->setSpacing(topLayout->spacing()); + layoutTimeBox->setSpacing(KDialog::spacingHintSmall()); layoutTimeBox->setColStretch( 1, 1 ); mDueCheck = new QCheckBox(i18n("Due:"),timeBoxFrame); - layoutTimeBox->addWidget(mDueCheck,0,0); + layoutTimeBox->addWidget(mDueCheck,1,0); connect(mDueCheck,SIGNAL(toggled(bool)),SLOT(enableDueEdit(bool))); connect(mDueCheck,SIGNAL(toggled(bool)),SLOT(showAlarm())); mDueDateEdit = new KDateEdit(timeBoxFrame); - layoutTimeBox->addWidget(mDueDateEdit,0,1); + layoutTimeBox->addWidget(mDueDateEdit,1,1); mDueTimeEdit = new KOTimeEdit(timeBoxFrame); - layoutTimeBox->addWidget(mDueTimeEdit,0,2); + layoutTimeBox->addWidget(mDueTimeEdit,1,2); mStartCheck = new QCheckBox(i18n("Start:"),timeBoxFrame); - layoutTimeBox->addWidget(mStartCheck,1,0); + layoutTimeBox->addWidget(mStartCheck,0,0); connect(mStartCheck,SIGNAL(toggled(bool)),SLOT(enableStartEdit(bool))); mStartDateEdit = new KDateEdit(timeBoxFrame); - layoutTimeBox->addWidget(mStartDateEdit,1,1); + layoutTimeBox->addWidget(mStartDateEdit,0,1); mStartTimeEdit = new KOTimeEdit(timeBoxFrame); - layoutTimeBox->addWidget(mStartTimeEdit,1,2); + layoutTimeBox->addWidget(mStartTimeEdit,0,2); mTimeButton = new QCheckBox(i18n("Time associated"),timeBoxFrame); layoutTimeBox->addMultiCellWidget(mTimeButton,2,2,0,1); connect(mTimeButton,SIGNAL(toggled(bool)),SLOT(enableTimeEdits(bool))); connect(mDueDateEdit,SIGNAL(setTimeTo(QTime)),mDueTimeEdit,SLOT(setTime(QTime))); connect(mStartDateEdit,SIGNAL(setTimeTo(QTime)),mStartTimeEdit,SLOT(setTime(QTime))); // some more layouting //layoutTimeBox->setColStretch(3,1); } void KOEditorGeneralTodo::initCompletion(QWidget *parent, QBoxLayout *topLayout) { mCompletedCombo = new QComboBox(parent); // xgettext:no-c-format mCompletedCombo->insertItem(i18n(" 0 %")); // xgettext:no-c-format mCompletedCombo->insertItem(i18n(" 20 %")); // xgettext:no-c-format mCompletedCombo->insertItem(i18n(" 40 %")); // xgettext:no-c-format mCompletedCombo->insertItem(i18n(" 60 %")); // xgettext:no-c-format mCompletedCombo->insertItem(i18n(" 80 %")); // xgettext:no-c-format mCompletedCombo->insertItem(i18n("100 %")); connect(mCompletedCombo,SIGNAL(activated(int)),SLOT(completedChanged(int))); topLayout->addWidget(mCompletedCombo); mCompletedLabel = new QLabel(i18n("completed"),parent); topLayout->addWidget(mCompletedLabel); mCompleteDateEdit = new KDateEdit(parent); topLayout->addWidget(mCompleteDateEdit ); mCompleteTimeEdit = new KOTimeEdit(parent); topLayout->addWidget( mCompleteTimeEdit); mCompletedCombo->setSizePolicy( QSizePolicy( QSizePolicy::Preferred,QSizePolicy::Preferred) ); mCompletedLabel->setSizePolicy( QSizePolicy( QSizePolicy::Expanding,QSizePolicy::Preferred) ); connect(mCompleteDateEdit,SIGNAL(setTimeTo(QTime)),mCompleteTimeEdit,SLOT(setTime(QTime))); if ( QApplication::desktop()->width() <= 480 ) { if ( QApplication::desktop()->width() < 320 ) mCompleteDateEdit->setMaximumWidth( 85 ); @@ -296,97 +297,96 @@ void KOEditorGeneralTodo::writeTodo(Todo *todo) // temp. until something better happens. QString tmpStr; todo->setHasDueDate(mDueCheck->isChecked()); todo->setHasStartDate(mStartCheck->isChecked()); QDate tmpDate; QTime tmpTime; QDateTime tmpDT; if ( mTimeButton->isChecked() ) { todo->setFloats(false); // set due date/time tmpDate = mDueDateEdit->date(); tmpTime = mDueTimeEdit->getTime(); tmpDT.setDate(tmpDate); tmpDT.setTime(tmpTime); todo->setDtDue(tmpDT); // set start date/time tmpDate = mStartDateEdit->date(); tmpTime = mStartTimeEdit->getTime(); tmpDT.setDate(tmpDate); tmpDT.setTime(tmpTime); todo->setDtStart(tmpDT); } else { todo->setFloats(true); // need to change this. tmpDate = mDueDateEdit->date(); tmpTime.setHMS(0,0,0); tmpDT.setDate(tmpDate); tmpDT.setTime(tmpTime); todo->setDtDue(tmpDT); tmpDate = mStartDateEdit->date(); tmpTime.setHMS(0,0,0); tmpDT.setDate(tmpDate); tmpDT.setTime(tmpTime); todo->setDtStart(tmpDT); } todo->setPriority(mPriorityCombo->currentItem()+1); // set completion state if ( mCompletedCombo->currentItem() == 5 ) { QDateTime comp ( mCompleteDateEdit->date(), mCompleteTimeEdit->getTime() ); if ( comp.isValid () ) { - todo->setPercentComplete(0); todo->setPercentComplete(100); todo->setCompleted(comp); } else { todo->setPercentComplete( 100 ); if ( mCompleted.isValid() ) todo->setCompleted(mCompleted); } } else { todo->setPercentComplete(mCompletedCombo->currentItem() * 20); } mSummaryEdit->save(KOLocationBox::SUMMARYTODO); } void KOEditorGeneralTodo::enableDueEdit(bool enable) { mDueDateEdit->setEnabled( enable ); if(mDueCheck->isChecked() || mStartCheck->isChecked()) { mTimeButton->setEnabled(true); } else { mTimeButton->setEnabled(false); mTimeButton->setChecked(false); } if (enable) { mDueTimeEdit->setEnabled( mTimeButton->isChecked() ); } else { mDueTimeEdit->setEnabled( false ); } emit datesChecked(); } void KOEditorGeneralTodo::enableStartEdit( bool enable ) { mStartDateEdit->setEnabled( enable ); if(mDueCheck->isChecked() || mStartCheck->isChecked()) { mTimeButton->setEnabled(true); } else { mTimeButton->setEnabled(false); mTimeButton->setChecked(false); } if (enable) { mStartTimeEdit->setEnabled( mTimeButton->isChecked() ); diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp index bbf83d9..fd86095 100644 --- a/korganizer/kolistview.cpp +++ b/korganizer/kolistview.cpp @@ -326,209 +326,210 @@ KOListView::KOListView(Calendar *calendar, QWidget *parent, this,SLOT(defaultItemAction(QListViewItem *))); QObject::connect(mListView,SIGNAL(rightButtonPressed( QListViewItem *, const QPoint &, int )), this,SLOT(popupMenu(QListViewItem *,const QPoint &,int))); QObject::connect(mListView,SIGNAL(currentChanged(QListViewItem *)), SLOT(processSelectionChange(QListViewItem *))); QObject::connect(mListView,SIGNAL(showIncidence(Incidence *)), SIGNAL(showIncidenceSignal(Incidence *)) ); readSettings(KOGlobals::config(),"KOListView Layout"); } KOListView::~KOListView() { delete mPopupMenu; } QString KOListView::getWhatsThisText(QPoint p) { KOListViewItem* item = ( KOListViewItem* ) mListView->itemAt( p ); if ( item ) return KIncidenceFormatter::instance()->getFormattedText( item->data(), KOPrefs::instance()->mWTshowDetails, KOPrefs::instance()->mWTshowCreated, KOPrefs::instance()->mWTshowChanged); return i18n("That is the list view" ); } void KOListView::updateList() { // qDebug(" KOListView::updateList() "); } void KOListView::addCat( ) { setCategories( false ); } void KOListView::setCat() { setCategories( true ); } void KOListView::setAlarm() { KOAlarmPrefs kap( this); if ( !kap.exec() ) return; - - QStringList itemList; QPtrList<KOListViewItem> sel ; QListViewItem *qitem = mListView->firstChild (); while ( qitem ) { if ( qitem->isSelected() ) { Incidence* inc = ((KOListViewItem *) qitem)->data(); if ( inc->type() != "Journal" ) { if ( inc->type() == "Todo" ) { if ( ((Todo*)inc)->hasDueDate() ) sel.append(((KOListViewItem *)qitem)); } else sel.append(((KOListViewItem *)qitem)); } } qitem = qitem->nextSibling(); } int count = 0; KOListViewItem * item, *temp; item = sel.first(); Incidence* inc; while ( item ) { inc = item->data(); ++count; if (kap.mAlarmButton->isChecked()) { if (inc->alarms().count() == 0) inc->newAlarm(); QPtrList<Alarm> alarms = inc->alarms(); Alarm *alarm; for (alarm = alarms.first(); alarm; alarm = alarms.next() ) { alarm->setEnabled(true); int j = kap.mAlarmTimeEdit->value()* -60; if (kap.mAlarmIncrCombo->currentItem() == 1) j = j * 60; else if (kap.mAlarmIncrCombo->currentItem() == 2) j = j * (60 * 24); alarm->setStartOffset( j ); if (!kap.mAlarmProgram.isEmpty() && kap.mAlarmProgramButton->isOn()) { alarm->setProcedureAlarm(kap.mAlarmProgram); } else if (!kap.mAlarmSound.isEmpty() && kap.mAlarmSoundButton->isOn()) alarm->setAudioAlarm(kap.mAlarmSound); else alarm->setType(Alarm::Invalid); //alarm->setAudioAlarm("default"); // TODO: Deal with multiple alarms break; // For now, stop after the first alarm } } else { Alarm* alarm = inc->alarms().first(); if ( alarm ) { alarm->setEnabled(false); alarm->setType(Alarm::Invalid); } } - temp = item; - item = sel.next(); - mUidDict.remove( inc->uid() ); - delete temp;; - addIncidence( inc ); + ListItemVisitor v(item, mStartDate ); + inc->accept(v); + item = sel.next(); } topLevelWidget()->setCaption( i18n("Canged alarm for %1 items").arg( count ) ); qDebug("KO: Set alarm for %d items", count); calendar()->reInitAlarmSettings(); QTimer::singleShot( 1, this, SLOT ( resetFocus() ) ); } void KOListView::setCategories( bool removeOld ) { KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 ); + csd->setColorEnabled(); if (! csd->exec()) { delete csd; return; } QStringList catList = csd->selectedCategories(); delete csd; // if ( catList.count() == 0 ) // return; - catList.sort(); + //catList.sort(); QString categoriesStr = catList.join(","); int i; QStringList itemList; QPtrList<KOListViewItem> sel ; QListViewItem *qitem = mListView->firstChild (); while ( qitem ) { if ( qitem->isSelected() ) { sel.append(((KOListViewItem *)qitem)); } qitem = qitem->nextSibling(); } KOListViewItem * item, *temp; item = sel.first(); - Incidence* inc; - while ( item ) { - inc = item->data(); - if ( removeOld ) { - inc->setCategories( categoriesStr ); - } else { - itemList = QStringList::split (",", inc->categoriesStr() ); - for( i = 0; i< catList.count(); ++i ) { - if ( !itemList.contains (catList[i])) - itemList.append( catList[i] ); - } - itemList.sort(); - inc->setCategories( itemList.join(",") ); + if( item ) { + Incidence* inc = item->data() ; + bool setSub = false; + if( inc->type() == "Todo" && sel.count() == 1 && inc->relations().count() > 0 ) { + int result = KMessageBox::warningYesNoCancel(this, + i18n("The todo\n%1\nhas subtodos!\nDo you want to set\nthe categories for\nall subtodos as well?").arg( inc->summary().left ( 25 ) ), + i18n("Todo has subtodos"), + i18n("Yes"), + i18n("No")); + if (result == KMessageBox::Cancel) item = 0; + if (result == KMessageBox::Yes) setSub = true; + } + while ( item ) { + inc = item->data(); + if ( removeOld ) { + inc->setCategories( catList, setSub ); + } else { + inc->addCategories( catList, setSub ); + } + ListItemVisitor v(item, mStartDate ); + inc->accept(v); + item = sel.next(); } - temp = item; - item = sel.next(); - mUidDict.remove( inc->uid() ); - delete temp;; - addIncidence( inc ); } QTimer::singleShot( 1, this, SLOT ( resetFocus() ) ); } void KOListView::beamSelected() { int icount = 0; QPtrList<Incidence> delSel ; QListViewItem *item = mListView->firstChild (); while ( item ) { if ( item->isSelected() ) { delSel.append(((KOListViewItem *)item)->data()); ++icount; } item = item->nextSibling(); } if ( icount ) { emit beamIncidenceList( delSel ); return; QString fn ; fn = QDir::homeDirPath()+"/kopitempbeamfile.vcs"; QString mes; bool createbup = true; if ( createbup ) { QString description = "\n"; CalendarLocal* cal = new CalendarLocal(); cal->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); Incidence *incidence = delSel.first(); while ( incidence ) { Incidence *in = incidence->clone(); description += in->summary() + "\n"; cal->addIncidence( in ); incidence = delSel.next(); } FileStorage storage( cal, fn, new VCalFormat ); storage.save(); delete cal; mes = i18n("KO/Pi: Ready for beaming"); topLevelWidget()->setCaption(mes); #ifndef DESKTOP_VERSION Ir *ir = new Ir( this ); connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); ir->send( fn, description, "text/x-vCalendar" ); #endif } } diff --git a/korganizer/kotodoeditor.cpp b/korganizer/kotodoeditor.cpp index 6a05cc8..5513e8b 100644 --- a/korganizer/kotodoeditor.cpp +++ b/korganizer/kotodoeditor.cpp @@ -65,101 +65,101 @@ KOTodoEditor::~KOTodoEditor() { emit dialogClose( mTodo ); } void KOTodoEditor::init() { setupGeneral(); setupAttendeesTab(); setupRecurrence(); connect(mGeneral,SIGNAL(datesChecked()),this ,SLOT(checkRecurrence())); mRecurrence->setDateTimeStr( i18n("<i>The recurrence is computed from the start datetime!</i>") ); } void KOTodoEditor::setupRecurrence() { QFrame *topFrame = addPage( i18n("Recurrence") ); QBoxLayout *topLayout = new QVBoxLayout( topFrame ); mRecurrence = new KOEditorRecurrence( topFrame ); topLayout->addWidget( mRecurrence ); } void KOTodoEditor::setCategories( QString s ) { mGeneral->setCategories(s); } void KOTodoEditor::setSecrecy( int sec ) { mGeneral->setSecrecy( sec ); } void KOTodoEditor::reload() { if ( mTodo ) readTodo( mTodo ); } void KOTodoEditor::setupGeneral() { mGeneral = new KOEditorGeneralTodo(this); connect ( mGeneral, SIGNAL ( allAccepted() ), this, SLOT ( slotOk () ) ); // connect(mGeneral,SIGNAL(openCategoryDialog()),mCategoryDialog,SLOT(show())); //connect(mCategoryDialog, SIGNAL(categoriesSelected(const QString &)), // mGeneral,SLOT(setCategories(const QString &))); if (KOPrefs::instance()->mCompactDialogs) { QFrame *topFrame = addPage(i18n("General")); QBoxLayout *topLayout = new QVBoxLayout(topFrame); if ( QApplication::desktop()->width() < 480 ) { - topLayout->setMargin(1); - topLayout->setSpacing(1); + topLayout->setMargin(marginHintSmall()); + topLayout->setSpacing(spacingHintSmall()); } else { - topLayout->setMargin(marginHint()-1); - topLayout->setSpacing(spacingHint()-1); + topLayout->setMargin(marginHint()); + topLayout->setSpacing(spacingHint()); } mGeneral->initHeader(topFrame,topLayout); mGeneral->initTime(topFrame,topLayout); mGeneral->initAlarm(topFrame,topLayout); mGeneral->enableAlarm( false ); QBoxLayout *priorityLayout; if ( QApplication::desktop()->width() < 500 ) priorityLayout = new QVBoxLayout( topLayout ); else priorityLayout = new QHBoxLayout( topLayout ); QWidget* prioWidget = new QWidget (topFrame); priorityLayout->addWidget( prioWidget ); QHBoxLayout* priorityLayout2 = new QHBoxLayout( prioWidget); QIconSet icon; if ( QApplication::desktop()->width() < 321 ) icon = SmallIcon("fileimport16"); else icon = SmallIcon("fileimport"); QPushButton * loadTemplate = new QPushButton( prioWidget); loadTemplate->setIconSet (icon ) ; int size = loadTemplate->sizeHint().height(); loadTemplate->setFixedSize( size, size ); if ( QApplication::desktop()->width() < 321 ) icon = SmallIcon("fileexport16"); else icon = SmallIcon("fileexport"); QPushButton * saveTemplate = new QPushButton( prioWidget); saveTemplate->setIconSet (icon ) ; saveTemplate->setFixedSize( size, size ); priorityLayout2->addWidget(loadTemplate); priorityLayout2->addWidget(saveTemplate); mGeneral->initPriority(prioWidget,priorityLayout2); mGeneral->initCategories( topFrame, priorityLayout ); topLayout->addStretch(1); QFrame *topFrame2 = addPage(i18n("Details")); QBoxLayout *topLayout2 = new QVBoxLayout(topFrame2); topLayout2->setMargin(marginHint()); topLayout2->setSpacing(spacingHint()); QHBoxLayout *completionLayout = new QHBoxLayout( topLayout2 ); mGeneral->initCompletion(topFrame2,completionLayout); @@ -299,115 +299,122 @@ void KOTodoEditor::setDefaults(QDateTime due,Todo *relatedEvent,bool allDay) mGeneral->mSummaryEdit->lineEdit()->setFocus(); mGeneral->mSummaryEdit->lineEdit()->setCursorPosition ( len+2 ); mGeneral->mSummaryEdit->lineEdit()->setSelection ( 0, len+2 ); } else mGeneral->setFocusOn( 2 ); tabWidget()->setTabEnabled ( mRecurrence->parentWidget(), false ); mRecurrence->setDefaults(QDateTime::currentDateTime(),QDateTime::currentDateTime().addSecs( 3600 ),true); } void KOTodoEditor::checkRecurrence() { if ( mGeneral->mDueCheck->isChecked() && mGeneral->mStartCheck->isChecked()) { tabWidget()->setTabEnabled ( mRecurrence->parentWidget(), true ); if ( mTodo ) mRecurrence->readEvent( mTodo ); else { bool time = mGeneral->mTimeButton->isChecked(); QDateTime from,to; if ( time ) { to = QDateTime( mGeneral->mDueDateEdit->date(), mGeneral->mDueTimeEdit->getTime() ) ; from = QDateTime( mGeneral->mStartDateEdit->date(),mGeneral->mStartTimeEdit->getTime( )) ; } else { to = QDateTime( mGeneral->mDueDateEdit->date(), QTime( 0,0,0) ) ; from = QDateTime( mGeneral->mStartDateEdit->date(),QTime( 0,0,0) ) ; } if ( to < from ) to = from; mRecurrence->setDefaults(from,to,!time); } } else { tabWidget()->setTabEnabled ( mRecurrence->parentWidget(), false ); mRecurrence->setDefaults(QDateTime::currentDateTime(),QDateTime::currentDateTime().addSecs( 3600 ),true); } } void KOTodoEditor::readTodo(Todo *todo) { mGeneral->readTodo(todo); mDetails->readEvent(todo); mRelatedTodo = 0;//todo->relatedTo(); // categories // mCategoryDialog->setSelected(todo->categories()); // We should handle read-only events here. } void KOTodoEditor::writeTodo(Todo *event) { - mGeneral->writeTodo(event); - mDetails->writeEvent(event); - - // set related event, i.e. parent to-do in this case. - if (mRelatedTodo) { - event->setRelatedTo(mRelatedTodo); - } - if ( mGeneral->mDueCheck->isChecked() && mGeneral->mStartCheck->isChecked()) { - mRecurrence->writeEvent(event); - if ( event->doesRecur() ) { - event->setRecurrenceID( event->dtStart().addSecs(-1) ); - event->setRecurDates(); - } else { - event->setHasRecurrenceID( false ); - } - } else { - event->setHasRecurrenceID( false ); - event->recurrence()->unsetRecurs(); - } + bool maybeComputeRecurrenceTime = false; + if( event->hasRecurrenceID() && event->percentComplete() < 100) + maybeComputeRecurrenceTime = true; + event->setHasRecurrenceID( false ); + mGeneral->writeTodo(event); + mDetails->writeEvent(event); + + // set related event, i.e. parent to-do in this case. + if (mRelatedTodo) { + event->setRelatedTo(mRelatedTodo); + } + if ( mGeneral->mDueCheck->isChecked() && mGeneral->mStartCheck->isChecked()) { + mRecurrence->writeEvent(event); + if ( event->doesRecur() ) { + int addSec = -1 ; + if ( maybeComputeRecurrenceTime && event->percentComplete() == 100 ) + addSec = 1; + event->setRecurrenceID( event->dtStart().addSecs( addSec ) ); + event->setRecurDates(); + } else { + event->setHasRecurrenceID( false ); + } + } else { + event->setHasRecurrenceID( false ); + event->recurrence()->unsetRecurs(); + } } bool KOTodoEditor::validateInput() { if (!mGeneral->validateInput()) return false; if (!mDetails->validateInput()) return false; return true; } int KOTodoEditor::msgItemDelete() { return KMessageBox::warningContinueCancel(this, i18n("This item will be permanently deleted."), i18n("KOrganizer Confirmation"),i18n("Delete")); } void KOTodoEditor::modified (int modification) { if (modification == KOGlobals::CATEGORY_MODIFIED || KOGlobals::UNKNOWN_MODIFIED == modification ) // mCategoryDialog->setSelected (mTodo->categories ()); mGeneral->modified (mTodo, modification); } void KOTodoEditor::slotLoadTemplate() { QString fileName =locateLocal( "templates", "todos" ); QDir t_dir; if ( !t_dir.exists(fileName) ) t_dir.mkdir ( fileName ); fileName += "/todo"; fileName = KFileDialog::getSaveFileName( fileName , "Load Todo template", this ); if ( fileName.length() == 0 ) return; CalendarLocal cal; ICalFormat format; if ( !format.load( &cal, fileName ) ) { KMessageBox::error( this, i18n("Error loading template file\n '%1'.") .arg( fileName ) ); return ; } QPtrList<Todo> todos = cal.todos(); Todo * todo = todos.first(); if ( !todo ) { KMessageBox::error( this, i18n("Template does not\ncontain a valid Todo.")); diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp index 25be63a..f26d16d 100644 --- a/korganizer/kotodoview.cpp +++ b/korganizer/kotodoview.cpp @@ -420,153 +420,154 @@ KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) : mTodoListView->setColumnAlignment(4,AlignHCenter); mTodoListView->addColumn(i18n("Start Date")); mTodoListView->setColumnAlignment(5,AlignLeft); mTodoListView->addColumn(i18n("Start Time")); mTodoListView->setColumnAlignment(6,AlignHCenter); mTodoListView->addColumn(i18n("Cancelled")); mTodoListView->addColumn(i18n("Categories")); #if 0 mTodoListView->addColumn(i18n("Sort Id")); mTodoListView->setColumnAlignment(4,AlignHCenter); #endif mTodoListView->setMinimumHeight( 60 ); mTodoListView->setItemsRenameable( true ); mTodoListView->setRenameable( 0 ); mTodoListView->setColumnWidth( 0, 120 ); mTodoListView->setColumnWidthMode(0, QListView::Manual); mTodoListView->setColumnWidthMode(1, QListView::Manual); mTodoListView->setColumnWidthMode(2, QListView::Manual); mTodoListView->setColumnWidthMode(3, QListView::Manual); mTodoListView->setColumnWidthMode(4, QListView::Manual); mTodoListView->setColumnWidthMode(5, QListView::Manual); mTodoListView->setColumnWidthMode(6, QListView::Manual); mTodoListView->setColumnWidthMode(7, QListView::Manual); mTodoListView->setColumnWidthMode(8, QListView::Manual); mKOTodoViewWhatsThis = new KOTodoViewWhatsThis(mTodoListView->viewport(),this); mPriorityPopupMenu = new QPopupMenu(this); for (int i = 1; i <= 5; i++) { QString label = QString ("%1").arg (i); mPriority[mPriorityPopupMenu->insertItem (label)] = i; } connect (mPriorityPopupMenu, SIGNAL(activated (int)), SLOT (setNewPriority(int))); mPercentageCompletedPopupMenu = new QPopupMenu(this); for (int i = 0; i <= 100; i+=20) { QString label = QString ("%1 %").arg (i); mPercentage[mPercentageCompletedPopupMenu->insertItem (label)] = i; } connect (mPercentageCompletedPopupMenu, SIGNAL (activated (int)), SLOT (setNewPercentage (int))); mItemPopupMenu = new QPopupMenu(this); - mItemPopupMenu->insertItem( i18n("Start/Stop todo..."), this, - SLOT (toggleRunningItem())); - mItemPopupMenu->insertSeparator(); mItemPopupMenu->insertItem(i18n("Show..."), this, SLOT (showTodo())); mItemPopupMenu->insertItem(i18n("Edit..."), this, SLOT (editTodo())); mItemPopupMenu->insertItem( i18n("Delete"), this, SLOT (deleteTodo())); mItemPopupMenu->insertItem( i18n("Clone..."), this, SLOT (cloneTodo())); mItemPopupMenu->insertItem( i18n("Move..."), this, SLOT (moveTodo())); mItemPopupMenu->insertItem( i18n("Beam..."), this, SLOT (beamTodo())); mItemPopupMenu->insertItem( i18n("Toggle Cancel"), this, SLOT (cancelTodo())); mItemPopupMenu->insertSeparator(); + mItemPopupMenu->insertItem( i18n("Start/Stop todo..."), this, + SLOT (toggleRunningItem())); + mItemPopupMenu->insertSeparator(); /* mItemPopupMenu->insertItem( i18n("New Todo..."), this, SLOT (newTodo())); */ mItemPopupMenu->insertItem(i18n("New Sub-Todo..."), this, SLOT (newSubTodo())); mItemPopupMenu->insertItem(i18n("Unparent Todo"), this, SLOT (unparentTodo()),0,21); mItemPopupMenu->insertItem(i18n("Reparent Todo"), this, SLOT (reparentTodo()),0,22); mItemPopupMenu->insertSeparator(); #if 0 mItemPopupMenu->insertItem(i18n("Delete completed To-Dos","Purge Completed"), this, SLOT( purgeCompleted() ) ); mItemPopupMenu->insertItem(i18n("toggle completed To-Dos","Show Completed"), this, SLOT( toggleCompleted() ),0, 33 ); mItemPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), this, SLOT( toggleQuickTodo() ),0, 34 ); mItemPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"), this, SLOT( toggleRunning() ),0, 35 ); #endif mPopupMenu = new QPopupMenu(this); mPopupMenu->insertItem(SmallIconSet("todo"), i18n("New Todo..."), this, SLOT (newTodo()),0,1); mPopupMenu->insertItem(i18n("delete completed To-Dos","Purge Completed"), this, SLOT(purgeCompleted()),0,2); mPopupMenu->insertItem(i18n("Show Completed"), this, SLOT( toggleCompleted() ),0,3 ); - mPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), - this, SLOT( toggleQuickTodo() ),0,4 ); mPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"), this, SLOT( toggleRunning() ),0,5 ); mPopupMenu->insertItem(i18n(" set all open","Display all opened"), this, SLOT( setAllOpen() ),0,6 ); mPopupMenu->insertItem(i18n(" set all close","Display all closed"), this, SLOT( setAllClose() ),0,7 ); mPopupMenu->insertItem(i18n(" set all flat","Display all flat"), this, SLOT( setAllFlat() ),0,8 ); + mPopupMenu->insertSeparator(); + mPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), + this, SLOT( toggleQuickTodo() ),0,4 ); mDocPrefs = new DocPrefs( name ); mItemPopupMenu->insertItem(i18n("Todo View"),mPopupMenu ); mPopupMenu->setCheckable( true ); mItemPopupMenu->setCheckable( true ); mPopupMenu->setItemChecked( 3,KOPrefs::instance()->mShowCompletedTodo ); mItemPopupMenu->setItemChecked( 33 , KOPrefs::instance()->mShowCompletedTodo ); mPopupMenu->setItemChecked(4,KOPrefs::instance()->mEnableQuickTodo); mItemPopupMenu->setItemChecked( 34 , KOPrefs::instance()->mEnableQuickTodo ); mPopupMenu->setItemChecked(5,KOPrefs::instance()->mHideNonStartedTodos); mItemPopupMenu->setItemChecked( 35 , KOPrefs::instance()->mHideNonStartedTodos ); // Double clicking conflicts with opening/closing the subtree connect( mTodoListView, SIGNAL( doubleClicked( QListViewItem *) ), SLOT( editItem( QListViewItem *) ) ); /* connect( mTodoListView, SIGNAL( rightButtonClicked ( QListViewItem *, const QPoint &,int ) ), SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); */ connect( mTodoListView, SIGNAL( contextRequest ( QListViewItem *, const QPoint &,int ) ), SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); connect( mTodoListView, SIGNAL( clicked( QListViewItem * ) ), SLOT( itemClicked( QListViewItem * ) ) ); connect( mTodoListView, SIGNAL( double_Clicked( QListViewItem * ) ), SLOT( itemDoubleClicked( QListViewItem * ) ) ); connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ), SLOT( updateView() ) ); connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ), SLOT( todoModified(Todo *, int) ) ); connect( mTodoListView, SIGNAL( expanded( QListViewItem * ) ), SLOT( itemStateChanged( QListViewItem * ) ) ); connect( mTodoListView, SIGNAL( collapsed( QListViewItem * ) ), SLOT( itemStateChanged( QListViewItem * ) ) ); connect( mTodoListView, SIGNAL( paintNeeded() ), SLOT( paintNeeded()) ); #if 0 connect(mTodoListView,SIGNAL(selectionChanged(QListViewItem *)), SLOT(selectionChanged(QListViewItem *))); connect(mTodoListView,SIGNAL(clicked(QListViewItem *)), SLOT(selectionChanged(QListViewItem *))); diff --git a/libkcal/incidence.cpp b/libkcal/incidence.cpp index 9c35b1d..762103f 100644 --- a/libkcal/incidence.cpp +++ b/libkcal/incidence.cpp @@ -300,102 +300,128 @@ void Incidence::setRevision(int rev) updated(); } int Incidence::revision() const { return mRevision; } void Incidence::setDtStart(const QDateTime &dtStart) { QDateTime dt = getEvenTime(dtStart); recurrence()->setRecurStart( dt); IncidenceBase::setDtStart( dt ); } void Incidence::setDescription(const QString &description) { if (mReadOnly) return; mDescription = description; updated(); } QString Incidence::description() const { return mDescription; } void Incidence::setSummary(const QString &summary) { if (mReadOnly) return; mSummary = summary; updated(); } QString Incidence::summary() const { return mSummary; } void Incidence::checkCategories() { mHoliday = mCategories.contains("Holiday") || mCategories.contains(i18n("Holiday")); mBirthday = mCategories.contains("Birthday") || mCategories.contains(i18n("Birthday")); mAnniversary = mCategories.contains("Anniversary") || mCategories.contains(i18n("Anniversary")); } -void Incidence::setCategories(const QStringList &categories) +void Incidence::addCategories(const QStringList &categories, bool addToRelations ) //addToRelations = false +{ + if (mReadOnly) return; + int i; + for( i = 0; i < categories.count(); ++i ) { + if ( !mCategories.contains (categories[i])) + mCategories.append( categories[i] ); + } + checkCategories(); + updated(); + if ( addToRelations ) { + Incidence * inc; + QPtrList<Incidence> Relations = relations(); + for (inc=Relations.first();inc;inc=Relations.next()) { + inc->addCategories( categories, true ); + } + } +} + +void Incidence::setCategories(const QStringList &categories, bool setForRelations ) //setForRelations = false { if (mReadOnly) return; mCategories = categories; checkCategories(); updated(); + if ( setForRelations ) { + Incidence * inc; + QPtrList<Incidence> Relations = relations(); + for (inc=Relations.first();inc;inc=Relations.next()) { + inc->setCategories( categories, true ); + } + } } // TODO: remove setCategories(QString) function void Incidence::setCategories(const QString &catStr) { if (mReadOnly) return; mCategories.clear(); if (catStr.isEmpty()) return; mCategories = QStringList::split(",",catStr); QStringList::Iterator it; for(it = mCategories.begin();it != mCategories.end(); ++it) { *it = (*it).stripWhiteSpace(); } checkCategories(); updated(); } QStringList Incidence::categories() const { return mCategories; } QString Incidence::categoriesStr() { return mCategories.join(","); } QString Incidence::categoriesStrWithSpace() { return mCategories.join(", "); } void Incidence::setRelatedToUid(const QString &relatedToUid) { if (mReadOnly) return; mRelatedToUid = relatedToUid; } QString Incidence::relatedToUid() const { return mRelatedToUid; } void Incidence::setRelatedTo(Incidence *relatedTo) { //qDebug("Incidence::setRelatedTo %d ", relatedTo); diff --git a/libkcal/incidence.h b/libkcal/incidence.h index 327e7dd..ebd50d0 100644 --- a/libkcal/incidence.h +++ b/libkcal/incidence.h @@ -106,97 +106,98 @@ class Incidence : public IncidenceBase Accept IncidenceVisitor. A class taking part in the visitor mechanism has to provide this implementation: <pre> bool accept(Visitor &v) { return v.visit(this); } </pre> */ virtual bool accept(Visitor &) { return false; } virtual Incidence *clone() = 0; virtual void cloneRelations( Incidence * ); virtual QDateTime getNextAlarmDateTime( bool * ok, int * offset ) const = 0; void setReadOnly( bool ); /** Recreate event. The event is made a new unique event, but already stored event information is preserved. Sets uniquie id, creation date, last modification date and revision number. */ void recreate(); Incidence* recreateCloneException(QDate); /** set creation date */ void setCreated(QDateTime); /** return time and date of creation. */ QDateTime created() const; /** set the number of revisions this event has seen */ void setRevision(int rev); /** return the number of revisions this event has seen */ int revision() const; /** Set starting date/time. */ virtual void setDtStart(const QDateTime &dtStart); /** Return the incidence's ending date/time as a QDateTime. */ virtual QDateTime dtEnd() const { return QDateTime(); } /** sets the event's lengthy description. */ void setDescription(const QString &description); /** returns a reference to the event's description. */ QString description() const; /** sets the event's short summary. */ void setSummary(const QString &summary); /** returns a reference to the event's summary. */ QString summary() const; /** set event's applicable categories */ - void setCategories(const QStringList &categories); + void setCategories(const QStringList &categories, bool setForRelations = false); + void addCategories(const QStringList &categories, bool addToRelations = false); /** set event's categories based on a comma delimited string */ void setCategories(const QString &catStr); /** return categories in a list */ QStringList categories() const; /** return categories as a comma separated string */ QString categoriesStr(); QString categoriesStrWithSpace(); /** point at some other event to which the event relates. This function should * only be used when constructing a calendar before the related Event * exists. */ void setRelatedToUid(const QString &); /** what event does this one relate to? This function should * only be used when constructing a calendar before the related Event * exists. */ QString relatedToUid() const; /** point at some other event to which the event relates */ void setRelatedTo(Incidence *relatedTo); /** what event does this one relate to? */ Incidence *relatedTo() const; /** All events that are related to this event */ QPtrList<Incidence> relations() const; /** Add an event which is related to this event */ void addRelation(Incidence *); /** Remove event that is related to this event */ void removeRelation(Incidence *); /** returns the list of dates which are exceptions to the recurrence rule */ DateList exDates() const; /** sets the list of dates which are exceptions to the recurrence rule */ void setExDates(const DateList &_exDates); void setExDates(const char *dates); /** Add a date to the list of exceptions of the recurrence rule. */ void addExDate(const QDate &date); /** returns true if there is an exception for this date in the recurrence rule set, or false otherwise. */ bool isException(const QDate &qd) const; /** add attachment to this event */ void addAttachment(Attachment *attachment); /** remove and delete a specific attachment */ void deleteAttachment(Attachment *attachment); /** remove and delete all attachments with this mime type */ void deleteAttachments(const QString& mime); /** return list of all associated attachments */ QPtrList<Attachment> attachments() const; /** find a list of attachments with this mime type */ |