[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: branches/koffice/2.1/koffice/kplato/libs
From: Dag Andersen <danders () get2net ! dk>
Date: 2009-11-30 8:03:53
Message-ID: 1259568233.625822.14301.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 1056436 by danders:
Backport: SVN commit 1056433 by danders:
Add context menu, to correspond with other similar views.
M +7 -0 models/kptresourceappointmentsmodel.cpp
M +3 -0 models/kptresourceappointmentsmodel.h
M +18 -0 ui/kptganttview.cpp
M +2 -0 ui/kptganttview.h
--- branches/koffice/2.1/koffice/kplato/libs/models/kptresourceappointmentsmodel.cpp #1056435:1056436
@@ -1945,6 +1945,13 @@
return 0;
}
+Node *ResourceAppointmentsRowModel::node( const QModelIndex &idx ) const
+{
+ Appointment *a = appointment( idx );
+ return ( a && a->node() ? a->node()->node() : 0 );
+}
+
+
//---------------------------------------------
ResourceAppointmentsGanttModel::ResourceAppointmentsGanttModel( QObject *parent )
: ResourceAppointmentsRowModel( parent )
--- branches/koffice/2.1/koffice/kplato/libs/models/kptresourceappointmentsmodel.h #1056435:1056436
@@ -209,6 +209,9 @@
QModelIndex index( Resource *r ) const;
QModelIndex index( Appointment *a ) const;
+ /// If @p idx is an appointment, return the node, else 0
+ Node *node( const QModelIndex &idx ) const;
+
class Private;
protected slots:
--- branches/koffice/2.1/koffice/kplato/libs/ui/kptganttview.cpp #1056435:1056436
@@ -924,9 +924,27 @@
createOptionAction();
}
+Node *ResourceAppointmentsGanttView::currentNode() const
+{
+ QModelIndex idx = treeView()->selectionModel()->currentIndex();
+ return m_model->node( idx );
+}
+
void ResourceAppointmentsGanttView::slotContextMenuRequested( QModelIndex idx, const QPoint &pos )
{
kDebug();
+ QString name;
+ if ( idx.isValid() ) {
+ Node *n = m_model->node( idx );
+ if ( n ) {
+ name = "taskview_popup";
+ }
+ }
+ if ( name.isEmpty() ) {
+ slotHeaderContextMenuRequested( pos );
+ return;
+ }
+ emit requestPopupMenu( name, pos );
}
void ResourceAppointmentsGanttView::slotOptions()
--- branches/koffice/2.1/koffice/kplato/libs/ui/kptganttview.h #1056435:1056436
@@ -344,6 +344,8 @@
GanttTreeView *treeView() const { return static_cast<GanttTreeView*>( m_gantt->leftView() ); }
+ Node *currentNode() const;
+
signals:
void itemDoubleClicked();
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic