author | zautrix <zautrix> | 2005-06-08 12:35:38 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-06-08 12:35:38 (UTC) |
commit | d9e240cf1a88f4213c9169e9168d01b669613312 (patch) (side-by-side diff) | |
tree | ed22cb872cc0f38625afe0f01036a48eb9b3edfa | |
parent | 2448916479b456ca7c880427a80e8e32e95b2fba (diff) | |
download | kdepimpi-d9e240cf1a88f4213c9169e9168d01b669613312.zip kdepimpi-d9e240cf1a88f4213c9169e9168d01b669613312.tar.gz kdepimpi-d9e240cf1a88f4213c9169e9168d01b669613312.tar.bz2 |
better export
-rw-r--r-- | bin/kdepim/korganizer/germantranslation.txt | 2 | ||||
-rw-r--r-- | korganizer/kolistview.cpp | 35 | ||||
-rw-r--r-- | korganizer/searchdialog.cpp | 25 | ||||
-rw-r--r-- | korganizer/searchdialog.h | 1 | ||||
-rw-r--r-- | libkcal/incidence.cpp | 11 | ||||
-rw-r--r-- | libkcal/incidence.h | 2 |
6 files changed, 61 insertions, 15 deletions
diff --git a/bin/kdepim/korganizer/germantranslation.txt b/bin/kdepim/korganizer/germantranslation.txt index 8f28234..7fa63f4 100644 --- a/bin/kdepim/korganizer/germantranslation.txt +++ b/bin/kdepim/korganizer/germantranslation.txt @@ -1369,13 +1369,13 @@ { "Choose action","Wähle Aktion" }, { "Comment for todo:","Kommentar zum Todo:" }, { "Stop+note","Stop+Notiz" }, { "Agenda view shows completed todos","Agenda Ansicht zeigt erledigte Todos" }, { "KO/Pi: Missing alarms!","KO/Pi: Verpasste Alarme!" }, { "You missed the alarms for the following events or todos:","Sie verpassten die Alarme für folgende Termine oder Todos:" }, { "Print complete list","Drucke komplette Liste" }, { "Hide all selected","Verstecke Selektierte" }, -{ "","" }, +{ "Add items","hinzufügen" }, { "","" }, { "","" }, { "","" }, { "","" },
\ No newline at end of file diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp index be51694..5797d1b 100644 --- a/korganizer/kolistview.cpp +++ b/korganizer/kolistview.cpp @@ -278,21 +278,21 @@ KOListView::KOListView(Calendar *calendar, QWidget *parent, i18n("Select all"),this, SLOT(allSelection()),true); mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), i18n("Deselect all"),this, SLOT(clearSelection()),true); mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), i18n("Delete all selected"),this, SLOT(deleteAll()),true); -#ifdef DESKTOP_VERSION + mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), i18n("Hide all selected"),this, SLOT(hideAll()),true); -#endif + mPopupMenu->insertSeparator(); #ifdef DESKTOP_VERSION mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), i18n("Print complete list"),this, SLOT(printList()),true); mPopupMenu->insertSeparator(); #endif QPopupMenu * exportPO = new QPopupMenu ( this ); @@ -661,25 +661,52 @@ void KOListView::saveToFile() } void KOListView::writeToFile( bool iCal ) { int icount = 0; QPtrList<Incidence> delSel ; QListViewItem *item = mListView->firstChild (); bool journal = iCal; // warn only for vCal + bool addSubTodos = false; + bool askSubTodos = true; while ( item ) { if ( item->isSelected() ) { if ( !journal ) if ( ((KOListViewItem *)item)->data()->typeID() == journalID ) journal = true; - delSel.append(((KOListViewItem *)item)->data()); + Incidence* inc = ((KOListViewItem *)item)->data(); + if ( addSubTodos ) { + if ( delSel.findRef( inc ) == -1 ) + delSel.append( inc ); + } else + delSel.append(inc); + if ( inc->typeID() == todoID ) { + Todo * todo = (Todo*) inc; + if ( todo->relations().count() ) { + if ( askSubTodos ) { + int result = KMessageBox::warningYesNoCancel(this, + i18n("A selected todo has subtodos!\nDo you want to export\nall subtodos of all\nselected todos as well?"), + i18n("Todo has subtodos"), + i18n("Yes"), + i18n("No")); + if ( result == KMessageBox::Cancel ) { + return; + } + if (result == KMessageBox::Yes) + addSubTodos = true; + askSubTodos = false; + } + if ( addSubTodos ) { + inc->addRelationsToList( &delSel ); + } + } + } ++icount; } - item = item->nextSibling(); } if ( !iCal && journal ) { int result = KMessageBox::warningContinueCancel(this, i18n("The journal entries can not be\nexported to a vCalendar file."), i18n("Data Loss Warning"),i18n("Proceed"),i18n("Cancel"), true); if (result != KMessageBox::Continue) return; diff --git a/korganizer/searchdialog.cpp b/korganizer/searchdialog.cpp index 59bf1a2..ef2fc1c 100644 --- a/korganizer/searchdialog.cpp +++ b/korganizer/searchdialog.cpp @@ -50,26 +50,31 @@ SearchDialog::SearchDialog(Calendar *calendar,CalendarView *parent) { mCalendar = calendar; QFrame *topFrame = new QFrame( this ) ;//plainPage(); QVBoxLayout *layout = new QVBoxLayout(topFrame,KDialog::marginHint(),KDialog::spacingHint()); // Search expression QHBoxLayout *subLayout = new QHBoxLayout(); layout->addLayout(subLayout); + /* searchLabel = new QLabel(topFrame); searchLabel->setText(i18n("Search for:")); subLayout->addWidget(searchLabel); - - searchEdit = new KLineEdit(topFrame); - subLayout->addWidget(searchEdit); - QPushButton *OkButton = new QPushButton( i18n("&Find"), topFrame ); + */ + QPushButton *OkButton = new QPushButton( i18n("Search for:"), topFrame ); //OkButton->setDefault( true ); connect(OkButton,SIGNAL(clicked()),SLOT(doSearch())); subLayout->addWidget(OkButton); + searchEdit = new KLineEdit(topFrame); + subLayout->addWidget(searchEdit); + + mAddItems = new QCheckBox(i18n("Add items"),topFrame); + subLayout->addWidget(mAddItems); + searchEdit->setText("*"); // Find all events by default searchEdit->setFocus(); connect(searchEdit, SIGNAL(textChanged ( const QString & )),this,SLOT(searchTextChanged( const QString & ))); connect(searchEdit, SIGNAL( returnPressed () ),this,SLOT(doSearch())); // Subjects to search // QGroupBox *subjectGroup = new QGroupBox(1,Vertical,i18n("Search In"), // topFrame); @@ -267,18 +272,18 @@ void SearchDialog::updateView() listView->addJournals(mMatchedJournals); } void SearchDialog::search(const QRegExp &re) { QPtrList<Event> events = mCalendar->events( mStartDate->date(), mEndDate->date(), false /*mInclusiveCheck->isChecked()*/ ); - - mMatchedEvents.clear(); + if ( !mAddItems->isChecked() ) + mMatchedEvents.clear(); if ( mSearchEvent->isChecked() ) { Event *ev; for(ev=events.first();ev;ev=events.next()) { if (mSummaryCheck->isChecked()) { #if QT_VERSION >= 0x030000 if (re.search(ev->summary()) != -1) #else if (re.match(ev->summary()) != -1) @@ -344,18 +349,19 @@ void SearchDialog::search(const QRegExp &re) mMatchedEvents.append(ev); break; } } } } } } - QPtrList<Todo> todos = mCalendar->todos( ); - mMatchedTodos.clear(); + QPtrList<Todo> todos = mCalendar->todos( ); + if ( !mAddItems->isChecked() ) + mMatchedTodos.clear(); if ( mSearchTodo->isChecked() ) { Todo *tod; for(tod=todos.first();tod;tod=todos.next()) { if (mSummaryCheck->isChecked()) { #if QT_VERSION >= 0x030000 if (re.search(tod->summary()) != -1) #else if (re.match(tod->summary()) != -1) @@ -412,17 +418,18 @@ void SearchDialog::search(const QRegExp &re) mMatchedTodos.append(tod); break; } } } } } } - mMatchedJournals.clear(); + if ( !mAddItems->isChecked() ) + mMatchedJournals.clear(); if (mSearchJournal->isChecked() ) { QPtrList<Journal> journals = mCalendar->journals( ); Journal* journ; for(journ=journals.first();journ;journ=journals.next()) { if ( journ->dtStart().date() <= mEndDate->date() &&journ->dtStart().date() >= mStartDate->date()) { #if QT_VERSION >= 0x030000 diff --git a/korganizer/searchdialog.h b/korganizer/searchdialog.h index 4559d20..11ad2f0 100644 --- a/korganizer/searchdialog.h +++ b/korganizer/searchdialog.h @@ -84,12 +84,13 @@ class SearchDialog : public QVBox QCheckBox *mSummaryCheck; QCheckBox *mDescriptionCheck; QCheckBox *mCategoryCheck; QCheckBox *mSearchEvent; QCheckBox *mSearchTodo; QCheckBox *mSearchJournal; QCheckBox *mSearchAName; QCheckBox *mSearchAEmail; + QCheckBox *mAddItems; void keyPressEvent ( QKeyEvent *e) ; }; #endif diff --git a/libkcal/incidence.cpp b/libkcal/incidence.cpp index f446197..4382416 100644 --- a/libkcal/incidence.cpp +++ b/libkcal/incidence.cpp @@ -445,16 +445,27 @@ Incidence *Incidence::relatedTo() const return mRelatedTo; } QPtrList<Incidence> Incidence::relations() const { return mRelations; } +void Incidence::addRelationsToList(QPtrList<Incidence> *rel) +{ + Incidence* inc; + QPtrList<Incidence> Relations = relations(); + for (inc=Relations.first();inc;inc=Relations.next()) { + inc->addRelationsToList( rel ); + } + if ( rel->findRef( this ) == -1 ) + rel->append( this ); +} + void Incidence::addRelation(Incidence *event) { if( mRelations.findRef( event ) == -1 ) { mRelations.append(event); //updated(); } } diff --git a/libkcal/incidence.h b/libkcal/incidence.h index aa51e84..fc97ce9 100644 --- a/libkcal/incidence.h +++ b/libkcal/incidence.h @@ -108,17 +108,17 @@ class Incidence : public IncidenceBase <pre> bool accept(Visitor &v) { return v.visit(this); } </pre> */ virtual bool accept(Visitor &) { return false; } virtual Incidence *clone() = 0; virtual void cloneRelations( Incidence * ); - + void addRelationsToList(QPtrList<Incidence> *rel); virtual QDateTime getNextAlarmDateTime( bool * ok, int * offset, QDateTime start_dt ) 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. */ |