author | zautrix <zautrix> | 2005-06-03 09:53:26 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-06-03 09:53:26 (UTC) |
commit | ab0f6af57ebf5b5a6fa2f7e6209fe04aafbfb14f (patch) (unidiff) | |
tree | fd37448d3cf5d7e5a193a8d4cc8e5421d5e7297a /korganizer | |
parent | ce9b826d7c0d9249751f8fb7b791c3757aff3c39 (diff) | |
download | kdepimpi-ab0f6af57ebf5b5a6fa2f7e6209fe04aafbfb14f.zip kdepimpi-ab0f6af57ebf5b5a6fa2f7e6209fe04aafbfb14f.tar.gz kdepimpi-ab0f6af57ebf5b5a6fa2f7e6209fe04aafbfb14f.tar.bz2 |
popup selection fix
-rw-r--r-- | korganizer/koeventpopupmenu.cpp | 27 | ||||
-rw-r--r-- | korganizer/koeventpopupmenu.h | 3 | ||||
-rw-r--r-- | korganizer/kolistview.cpp | 12 | ||||
-rw-r--r-- | korganizer/kolistview.h | 1 |
4 files changed, 38 insertions, 5 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() | |||
38 | 38 | ||
39 | insertItem (i18n("&Show"),this,SLOT(popupShow())); | 39 | |
40 | mSingleOnlyItems.append( insertItem (i18n("&Show"),this,SLOT(popupShow()))); | ||
40 | mEditOnlyItems.append(insertItem (i18n("&Edit..."),this,SLOT(popupEdit()))); | 41 | mEditOnlyItems.append(insertItem (i18n("&Edit..."),this,SLOT(popupEdit()))); |
@@ -52,2 +53,16 @@ KOEventPopupMenu::KOEventPopupMenu() | |||
52 | this,SLOT(popupCancel()))); | 53 | this,SLOT(popupCancel()))); |
54 | isDisabled = false; | ||
55 | QValueList<int>::Iterator it; | ||
56 | for( it = mEditOnlyItems.begin(); it != mEditOnlyItems.end(); ++it ) { | ||
57 | mSingleOnlyItems.append(*it); | ||
58 | } | ||
59 | } | ||
60 | void KOEventPopupMenu::enableDefault( bool enable ) | ||
61 | { | ||
62 | isDisabled = !enable; | ||
63 | QValueList<int>::Iterator it; | ||
64 | for( it = mSingleOnlyItems.begin(); it != mSingleOnlyItems.end(); ++it ) { | ||
65 | setItemEnabled(*it,enable); | ||
66 | } | ||
67 | |||
53 | } | 68 | } |
@@ -60,6 +75,8 @@ void KOEventPopupMenu::showIncidencePopup(Incidence *incidence) | |||
60 | // Enable/Disabled menu items only valid for editable events. | 75 | // Enable/Disabled menu items only valid for editable events. |
61 | QValueList<int>::Iterator it; | 76 | if ( !isDisabled ) { |
62 | for( it = mEditOnlyItems.begin(); it != mEditOnlyItems.end(); ++it ) { | 77 | QValueList<int>::Iterator it; |
63 | setItemEnabled(*it,!mCurrentIncidence->isReadOnly()); | 78 | for( it = mEditOnlyItems.begin(); it != mEditOnlyItems.end(); ++it ) { |
64 | } | 79 | setItemEnabled(*it,!mCurrentIncidence->isReadOnly()); |
80 | } | ||
81 | } | ||
65 | popup(QCursor::pos()); | 82 | 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 { | |||
46 | void showIncidencePopup(Incidence *); | 46 | void showIncidencePopup(Incidence *); |
47 | void enableDefault( bool ); | ||
47 | 48 | ||
@@ -70,2 +71,4 @@ class KOEventPopupMenu : public QPopupMenu { | |||
70 | QValueList<int> mEditOnlyItems; | 71 | QValueList<int> mEditOnlyItems; |
72 | QValueList<int> mSingleOnlyItems; | ||
73 | bool isDisabled; | ||
71 | }; | 74 | }; |
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) | |||
1005 | Incidence *incidence = mActiveItem->data(); | 1005 | Incidence *incidence = mActiveItem->data(); |
1006 | mPopupMenu->enableDefault( !mListView->hasMultiSelection( item ) ); | ||
1006 | mPopupMenu->showIncidencePopup(incidence); | 1007 | mPopupMenu->showIncidencePopup(incidence); |
@@ -1197,2 +1198,13 @@ KOListViewListView::KOListViewListView(KOListView * lv ) | |||
1197 | } | 1198 | } |
1199 | bool KOListViewListView::hasMultiSelection(QListViewItem* item) | ||
1200 | { | ||
1201 | int selCount = 0; | ||
1202 | QListViewItem *qitem = firstChild (); | ||
1203 | while ( qitem ) { | ||
1204 | if ( qitem->isSelected() && item != qitem ) | ||
1205 | return true; | ||
1206 | qitem = qitem->nextSibling(); | ||
1207 | } | ||
1208 | return false; | ||
1209 | } | ||
1198 | void KOListViewListView::contentsMouseDoubleClickEvent(QMouseEvent *e) | 1210 | 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 | |||
217 | KOListViewListView(KOListView * lv ); | 217 | KOListViewListView(KOListView * lv ); |
218 | bool hasMultiSelection(QListViewItem*); | ||
218 | signals: | 219 | signals: |