summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koeventpopupmenu.cpp27
-rw-r--r--korganizer/koeventpopupmenu.h3
-rw-r--r--korganizer/kolistview.cpp12
-rw-r--r--korganizer/kolistview.h1
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
@@ -33,13 +33,14 @@
33 33
34KOEventPopupMenu::KOEventPopupMenu() 34KOEventPopupMenu::KOEventPopupMenu()
35{ 35{
36 mCurrentIncidence = 0; 36 mCurrentIncidence = 0;
37 mHasAdditionalItems = false; 37 mHasAdditionalItems = false;
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())));
41 mEditOnlyItems.append(insertItem (i18n("&Delete"), 42 mEditOnlyItems.append(insertItem (i18n("&Delete"),
42 this,SLOT(popupDelete()))); 43 this,SLOT(popupDelete())));
43 mEditOnlyItems.append(insertItem (i18n("&Clone..."), 44 mEditOnlyItems.append(insertItem (i18n("&Clone..."),
44 this,SLOT(popupClone()))); 45 this,SLOT(popupClone())));
45 mEditOnlyItems.append(insertItem (i18n("&Move..."), 46 mEditOnlyItems.append(insertItem (i18n("&Move..."),
@@ -47,24 +48,40 @@ KOEventPopupMenu::KOEventPopupMenu()
47#ifndef DESKTOP_VERSION 48#ifndef DESKTOP_VERSION
48 mEditOnlyItems.append(insertItem (i18n("&Beam..."), 49 mEditOnlyItems.append(insertItem (i18n("&Beam..."),
49 this,SLOT(popupBeam()))); 50 this,SLOT(popupBeam())));
50#endif 51#endif
51 mEditOnlyItems.append(insertItem (i18n("&Toggle Cancel"), 52 mEditOnlyItems.append(insertItem (i18n("&Toggle Cancel"),
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}
60void 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}
54 69
55void KOEventPopupMenu::showIncidencePopup(Incidence *incidence) 70void KOEventPopupMenu::showIncidencePopup(Incidence *incidence)
56{ 71{
57 mCurrentIncidence = incidence; 72 mCurrentIncidence = incidence;
58 73
59 if (mCurrentIncidence) { 74 if (mCurrentIncidence) {
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());
66 } else { 83 } else {
67 kdDebug() << "KOEventPopupMenu::showEventPopup(): No event selected" << endl; 84 kdDebug() << "KOEventPopupMenu::showEventPopup(): No event selected" << endl;
68 } 85 }
69} 86}
70 87
diff --git a/korganizer/koeventpopupmenu.h b/korganizer/koeventpopupmenu.h
index 6993899..8fb51fa 100644
--- a/korganizer/koeventpopupmenu.h
+++ b/korganizer/koeventpopupmenu.h
@@ -41,12 +41,13 @@ class KOEventPopupMenu : public QPopupMenu {
41 const QObject *receiver, const char *member, 41 const QObject *receiver, const char *member,
42 bool editOnly=false); 42 bool editOnly=false);
43 43
44 44
45 public slots: 45 public slots:
46 void showIncidencePopup(Incidence *); 46 void showIncidencePopup(Incidence *);
47 void enableDefault( bool );
47 48
48 protected slots: 49 protected slots:
49 void popupShow(); 50 void popupShow();
50 void popupEdit(); 51 void popupEdit();
51 void popupDelete(); 52 void popupDelete();
52 void popupClone(); 53 void popupClone();
@@ -65,9 +66,11 @@ class KOEventPopupMenu : public QPopupMenu {
65 66
66 private: 67 private:
67 Incidence *mCurrentIncidence; 68 Incidence *mCurrentIncidence;
68 69
69 bool mHasAdditionalItems; 70 bool mHasAdditionalItems;
70 QValueList<int> mEditOnlyItems; 71 QValueList<int> mEditOnlyItems;
72 QValueList<int> mSingleOnlyItems;
73 bool isDisabled;
71}; 74};
72 75
73#endif 76#endif
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp
index b94916a..02247c8 100644
--- a/korganizer/kolistview.cpp
+++ b/korganizer/kolistview.cpp
@@ -1000,12 +1000,13 @@ void KOListView::defaultItemAction(QListViewItem *i)
1000 1000
1001void KOListView::popupMenu(QListViewItem *item,const QPoint &,int) 1001void KOListView::popupMenu(QListViewItem *item,const QPoint &,int)
1002{ 1002{
1003 mActiveItem = (KOListViewItem *)item; 1003 mActiveItem = (KOListViewItem *)item;
1004 if (mActiveItem) { 1004 if (mActiveItem) {
1005 Incidence *incidence = mActiveItem->data(); 1005 Incidence *incidence = mActiveItem->data();
1006 mPopupMenu->enableDefault( !mListView->hasMultiSelection( item ) );
1006 mPopupMenu->showIncidencePopup(incidence); 1007 mPopupMenu->showIncidencePopup(incidence);
1007 1008
1008 /* 1009 /*
1009 if ( incidence && incidence->type() == "Event" ) { 1010 if ( incidence && incidence->type() == "Event" ) {
1010 Event *event = static_cast<Event *>( incidence ); 1011 Event *event = static_cast<Event *>( incidence );
1011 mPopupMenu->showEventPopup(event); 1012 mPopupMenu->showEventPopup(event);
@@ -1192,12 +1193,23 @@ KOListViewListView::KOListViewListView(KOListView * lv )
1192#ifndef DESKTOP_VERSION 1193#ifndef DESKTOP_VERSION
1193 //QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold ); 1194 //QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold );
1194#endif 1195#endif
1195 setSelectionMode( QListView::Multi ); 1196 setSelectionMode( QListView::Multi );
1196 setMultiSelection( true); 1197 setMultiSelection( true);
1197} 1198}
1199bool 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}
1198void KOListViewListView::contentsMouseDoubleClickEvent(QMouseEvent *e) 1210void KOListViewListView::contentsMouseDoubleClickEvent(QMouseEvent *e)
1199{ 1211{
1200 if (!e) return; 1212 if (!e) return;
1201 QPoint vp = contentsToViewport(e->pos()); 1213 QPoint vp = contentsToViewport(e->pos());
1202 QListViewItem *item = itemAt(vp); 1214 QListViewItem *item = itemAt(vp);
1203 if (!item) { 1215 if (!item) {
diff --git a/korganizer/kolistview.h b/korganizer/kolistview.h
index 2051d60..dee69f6 100644
--- a/korganizer/kolistview.h
+++ b/korganizer/kolistview.h
@@ -212,12 +212,13 @@ class KOListView;
212 212
213class KOListViewListView : public KListView 213class KOListViewListView : public KListView
214{ 214{
215 Q_OBJECT 215 Q_OBJECT
216 public: 216 public:
217 KOListViewListView(KOListView * lv ); 217 KOListViewListView(KOListView * lv );
218 bool hasMultiSelection(QListViewItem*);
218 signals: 219 signals:
219 void newEvent(); 220 void newEvent();
220 void showIncidence( Incidence* ); 221 void showIncidence( Incidence* );
221 public slots: 222 public slots:
222 void popupMenu(); 223 void popupMenu();
223 private: 224 private: