summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-06-09 08:27:24 (UTC)
committer zautrix <zautrix>2005-06-09 08:27:24 (UTC)
commit12b4828ddfa8ac2fabbaf7c8841b8d68d16a0262 (patch) (side-by-side diff)
treeac59de32cdf3ae5b8430b9039232f596a8a6a063
parentb0eb8251185b7c9d664af23da94480c7fcfcf8be (diff)
downloadkdepimpi-12b4828ddfa8ac2fabbaf7c8841b8d68d16a0262.zip
kdepimpi-12b4828ddfa8ac2fabbaf7c8841b8d68d16a0262.tar.gz
kdepimpi-12b4828ddfa8ac2fabbaf7c8841b8d68d16a0262.tar.bz2
select lisz view fixes
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--korganizer/kolistview.cpp90
-rw-r--r--korganizer/kolistview.h1
2 files changed, 42 insertions, 49 deletions
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp
index 5797d1b..1f3b4c6 100644
--- a/korganizer/kolistview.cpp
+++ b/korganizer/kolistview.cpp
@@ -390,4 +390,5 @@ void KOListView::setCat()
setCategories( true );
}
+
void KOListView::setAlarm()
{
@@ -515,15 +516,6 @@ void KOListView::setCategories( bool removeOld )
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();
- }
+ QPtrList<Incidence> delSel = getSelectedIncidences() ;
+ int icount = delSel.count();
if ( icount ) {
emit beamIncidenceList( delSel );
@@ -576,15 +568,6 @@ void KOListView::saveDescriptionToFile()
return;
}
- int icount = 0;
- QPtrList<Incidence> delSel ;
- QListViewItem *item = mListView->firstChild ();
- while ( item ) {
- if ( item->isSelected() ) {
- delSel.append(((KOListViewItem *)item)->data());
- ++icount;
- }
-
- item = item->nextSibling();
- }
+ QPtrList<Incidence> delSel = getSelectedIncidences() ;
+ int icount = delSel.count();
if ( icount ) {
QString fn = KOPrefs::instance()->mLastSaveFile;
@@ -660,24 +643,25 @@ void KOListView::saveToFile()
writeToFile( true );
}
-void KOListView::writeToFile( bool iCal )
+QPtrList<Incidence> KOListView::getSelectedIncidences( bool includeEvents, bool includeTodos, bool includeJournals, bool onlyDueTodos )
{
-
- int icount = 0;
QPtrList<Incidence> delSel ;
- QListViewItem *item = mListView->firstChild ();
- bool journal = iCal; // warn only for vCal
bool addSubTodos = false;
bool askSubTodos = true;
+ QListViewItem *item = mListView->firstChild ();
while ( item ) {
if ( item->isSelected() ) {
- if ( !journal )
- if ( ((KOListViewItem *)item)->data()->typeID() == journalID )
- journal = true;
Incidence* inc = ((KOListViewItem *)item)->data();
- if ( addSubTodos ) {
- if ( delSel.findRef( inc ) == -1 )
+ if ( ( addSubTodos && delSel.findRef( inc ) == -1) || !addSubTodos ) {
+ if ( (inc->typeID() == todoID && includeTodos) ||
+ (inc->typeID() == eventID && includeEvents) ||
+ (inc->typeID() == journalID && includeJournals) ) {
+ if ( inc->typeID() == todoID && onlyDueTodos ) {
+ if ( ((Todo*)inc)->hasDueDate() )
delSel.append( inc );
} else
delSel.append(inc);
+
+ }
+ }
if ( inc->typeID() == todoID ) {
Todo * todo = (Todo*) inc;
@@ -685,10 +669,11 @@ void KOListView::writeToFile( bool iCal )
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("One (or more) selected\ntodo has subtodos!\nDo you want to select\nall subtodos of all\nselected todos as well?"),
i18n("Todo has subtodos"),
i18n("Yes"),
i18n("No"));
if ( result == KMessageBox::Cancel ) {
- return;
+ delSel.clear();
+ return delSel;
}
if (result == KMessageBox::Yes)
@@ -701,9 +686,24 @@ void KOListView::writeToFile( bool iCal )
}
}
- ++icount;
}
item = item->nextSibling();
}
- if ( !iCal && journal ) {
+ return delSel;
+}
+
+void KOListView::writeToFile( bool iCal )
+{
+ QPtrList<Incidence> delSel = getSelectedIncidences(); // all inc allowed;
+ if ( !iCal ) {
+ bool journal = false;
+ Incidence *incidence = delSel.first();
+ while ( incidence ) {
+ if ( incidence->typeID() == journalID ) {
+ journal = true;
+ break;
+ }
+ incidence = delSel.next();
+ }
+ if ( journal ) {
int result = KMessageBox::warningContinueCancel(this,
i18n("The journal entries can not be\nexported to a vCalendar file."),
@@ -712,5 +712,6 @@ void KOListView::writeToFile( bool iCal )
if (result != KMessageBox::Continue) return;
}
- if ( icount ) {
+ }
+ if ( delSel.count() ) {
QString fn = KOPrefs::instance()->mLastSaveFile;
QString extension;
@@ -787,16 +788,7 @@ void KOListView::printList()
void KOListView::deleteAll()
{
- 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 ) {
+ QPtrList<Incidence> delSel = getSelectedIncidences(); // all inc allowed;;
+ if ( delSel.count() ) {
+ int icount = delSel.count();
Incidence *incidence = delSel.first();
Incidence *toDelete;
diff --git a/korganizer/kolistview.h b/korganizer/kolistview.h
index c25592d..9da5497 100644
--- a/korganizer/kolistview.h
+++ b/korganizer/kolistview.h
@@ -263,4 +263,5 @@ class KOListView : public KOEventView
int count();
QString getWhatsThisText(QPoint p);
+ QPtrList<Incidence> KOListView::getSelectedIncidences( bool includeEvents = true, bool includeTodos = true , bool includeJournals = true, bool onlyDueTodos = false );
signals:
void signalNewEvent();