summaryrefslogtreecommitdiffabout
path: root/korganizer
Side-by-side diff
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/kolistview.cpp35
-rw-r--r--korganizer/searchdialog.cpp25
-rw-r--r--korganizer/searchdialog.h1
3 files changed, 48 insertions, 13 deletions
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp
index be51694..5797d1b 100644
--- a/korganizer/kolistview.cpp
+++ b/korganizer/kolistview.cpp
@@ -280,17 +280,17 @@ KOListView::KOListView(Calendar *calendar, QWidget *parent,
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();
@@ -663,21 +663,48 @@ 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"),
diff --git a/korganizer/searchdialog.cpp b/korganizer/searchdialog.cpp
index 59bf1a2..ef2fc1c 100644
--- a/korganizer/searchdialog.cpp
+++ b/korganizer/searchdialog.cpp
@@ -52,22 +52,27 @@ SearchDialog::SearchDialog(Calendar *calendar,CalendarView *parent)
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"),
@@ -269,14 +274,14 @@ void SearchDialog::updateView()
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)
@@ -346,14 +351,15 @@ void SearchDialog::search(const QRegExp &re)
}
}
}
}
}
}
- 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)
@@ -414,13 +420,14 @@ void SearchDialog::search(const QRegExp &re)
}
}
}
}
}
}
- 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()
diff --git a/korganizer/searchdialog.h b/korganizer/searchdialog.h
index 4559d20..11ad2f0 100644
--- a/korganizer/searchdialog.h
+++ b/korganizer/searchdialog.h
@@ -86,10 +86,11 @@ class SearchDialog : public QVBox
QCheckBox *mCategoryCheck;
QCheckBox *mSearchEvent;
QCheckBox *mSearchTodo;
QCheckBox *mSearchJournal;
QCheckBox *mSearchAName;
QCheckBox *mSearchAEmail;
+ QCheckBox *mAddItems;
void keyPressEvent ( QKeyEvent *e) ;
};
#endif