summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--korganizer/koeventpopupmenu.cpp19
-rw-r--r--korganizer/koeventpopupmenu.h3
-rw-r--r--korganizer/kolistview.cpp12
-rw-r--r--korganizer/kolistview.h1
4 files changed, 34 insertions, 1 deletions
diff --git a/korganizer/koeventpopupmenu.cpp b/korganizer/koeventpopupmenu.cpp
index b274810..17ef81e 100644
--- a/korganizer/koeventpopupmenu.cpp
+++ b/korganizer/koeventpopupmenu.cpp
@@ -38,3 +38,4 @@ KOEventPopupMenu::KOEventPopupMenu()
- insertItem (i18n("&Show"),this,SLOT(popupShow()));
+
+ mSingleOnlyItems.append( insertItem (i18n("&Show"),this,SLOT(popupShow())));
mEditOnlyItems.append(insertItem (i18n("&Edit..."),this,SLOT(popupEdit())));
@@ -52,2 +53,16 @@ KOEventPopupMenu::KOEventPopupMenu()
this,SLOT(popupCancel())));
+ isDisabled = false;
+ QValueList<int>::Iterator it;
+ for( it = mEditOnlyItems.begin(); it != mEditOnlyItems.end(); ++it ) {
+ mSingleOnlyItems.append(*it);
+ }
+}
+void KOEventPopupMenu::enableDefault( bool enable )
+{
+ isDisabled = !enable;
+ QValueList<int>::Iterator it;
+ for( it = mSingleOnlyItems.begin(); it != mSingleOnlyItems.end(); ++it ) {
+ setItemEnabled(*it,enable);
+ }
+
}
@@ -60,2 +75,3 @@ void KOEventPopupMenu::showIncidencePopup(Incidence *incidence)
// Enable/Disabled menu items only valid for editable events.
+ if ( !isDisabled ) {
QValueList<int>::Iterator it;
@@ -64,2 +80,3 @@ void KOEventPopupMenu::showIncidencePopup(Incidence *incidence)
}
+ }
popup(QCursor::pos());
diff --git a/korganizer/koeventpopupmenu.h b/korganizer/koeventpopupmenu.h
index 6993899..8fb51fa 100644
--- a/korganizer/koeventpopupmenu.h
+++ b/korganizer/koeventpopupmenu.h
@@ -46,2 +46,3 @@ class KOEventPopupMenu : public QPopupMenu {
void showIncidencePopup(Incidence *);
+ void enableDefault( bool );
@@ -70,2 +71,4 @@ class KOEventPopupMenu : public QPopupMenu {
QValueList<int> mEditOnlyItems;
+ QValueList<int> mSingleOnlyItems;
+ bool isDisabled;
};
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp
index b94916a..02247c8 100644
--- a/korganizer/kolistview.cpp
+++ b/korganizer/kolistview.cpp
@@ -1005,2 +1005,3 @@ void KOListView::popupMenu(QListViewItem *item,const QPoint &,int)
Incidence *incidence = mActiveItem->data();
+ mPopupMenu->enableDefault( !mListView->hasMultiSelection( item ) );
mPopupMenu->showIncidencePopup(incidence);
@@ -1197,2 +1198,13 @@ KOListViewListView::KOListViewListView(KOListView * lv )
}
+bool KOListViewListView::hasMultiSelection(QListViewItem* item)
+{
+ int selCount = 0;
+ QListViewItem *qitem = firstChild ();
+ while ( qitem ) {
+ if ( qitem->isSelected() && item != qitem )
+ return true;
+ qitem = qitem->nextSibling();
+ }
+ return false;
+}
void KOListViewListView::contentsMouseDoubleClickEvent(QMouseEvent *e)
diff --git a/korganizer/kolistview.h b/korganizer/kolistview.h
index 2051d60..dee69f6 100644
--- a/korganizer/kolistview.h
+++ b/korganizer/kolistview.h
@@ -217,2 +217,3 @@ class KOListViewListView : public KListView
KOListViewListView(KOListView * lv );
+ bool hasMultiSelection(QListViewItem*);
signals: