summaryrefslogtreecommitdiff
path: root/core/pim/todo/tableview.cpp
Unidiff
Diffstat (limited to 'core/pim/todo/tableview.cpp') (more/less context) (show whitespace changes)
-rw-r--r--core/pim/todo/tableview.cpp84
1 files changed, 32 insertions, 52 deletions
diff --git a/core/pim/todo/tableview.cpp b/core/pim/todo/tableview.cpp
index 221faca..c64ad46 100644
--- a/core/pim/todo/tableview.cpp
+++ b/core/pim/todo/tableview.cpp
@@ -1,24 +1,24 @@
1/* 1/*
2               =. This file is part of the OPIE Project 2 =. This file is part of the OPIE Project
3             .=l. Copyright (c) 2002 <zecke> 3 .=l. Copyright (c) 2002 <zecke>
4           .>+-= 4 .>+-=
5 _;:,     .>    :=|. This program is free software; you can 5_;:, .> :=|. This program is free software; you can
6.> <`_,   >  .   <= redistribute it and/or modify it under 6.> <`_, > . <= redistribute it and/or modify it under
7:`=1 )Y*s>-.--   : the terms of the GNU General Public 7:`=1 )Y*s>-.-- : the terms of the GNU General Public
8.="- .-=="i,     .._ License as published by the Free Software 8.="- .-=="i, .._ License as published by the Free Software
9 - .   .-<_>     .<> Foundation; either version 2 of the License, 9- . .-<_> .<> Foundation; either version 2 of the License,
10     ._= =}       : or (at your option) any later version. 10 ._= =} : or (at your option) any later version.
11    .%`+i>       _;_. 11 .%`+i> _;_.
12    .i_,=:_.      -<s. This program is distributed in the hope that 12 .i_,=:_. -<s. This program is distributed in the hope that
13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 13 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
14    : ..    .:,     . . . without even the implied warranty of 14 : .. .:, . . . without even the implied warranty of
15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 15 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 16 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
17..}^=.=       =       ; Library General Public License for more 17..}^=.= = ; Library General Public License for more
18++=   -.     .`     .: details. 18++= -. .` .: details.
19 :     =  ...= . :.=- 19: = ...= . :.=-
20 -.   .:....=;==+<; You should have received a copy of the GNU 20-. .:....=;==+<; You should have received a copy of the GNU
21  -_. . .   )=.  = Library General Public License along with 21 -_. . . )=. = Library General Public License along with
22    --        :-=` this library; see the file COPYING.LIB. 22 -- :-=` this library; see the file COPYING.LIB.
23 If not, write to the Free Software Foundation, 23 If not, write to the Free Software Foundation,
24 Inc., 59 Temple Place - Suite 330, 24 Inc., 59 Temple Place - Suite 330,
@@ -34,9 +34,9 @@
34 34
35#include <qpe/config.h> 35#include <qpe/config.h>
36#include <qpe/qpeapplication.h>
36#include <qpe/resource.h> 37#include <qpe/resource.h>
37 38
38#include <qcombobox.h> 39#include <qcombobox.h>
39#include <qlineedit.h> 40#include <qlineedit.h>
40#include <qtimer.h>
41#include <qpopupmenu.h> 41#include <qpopupmenu.h>
42 42
@@ -118,8 +118,7 @@ TableView::TableView( MainWindow* window, QWidget* wid )
118 verticalHeader()->hide(); 118 verticalHeader()->hide();
119 119
120 QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold );
120 connect((QTable*)this, SIGNAL( clicked(int,int,int,const QPoint&) ), 121 connect((QTable*)this, SIGNAL( clicked(int,int,int,const QPoint&) ),
121 this, SLOT( slotClicked(int,int,int,const QPoint&) ) ); 122 this, SLOT( slotClicked(int,int,int,const QPoint&) ) );
122 connect((QTable*)this, SIGNAL( pressed(int,int,int,const QPoint&) ),
123 this, SLOT( slotPressed(int,int,int,const QPoint&) ) );
124 connect((QTable*)this, SIGNAL(valueChanged(int,int) ), 123 connect((QTable*)this, SIGNAL(valueChanged(int,int) ),
125 this, SLOT( slotValueChanged(int,int) ) ); 124 this, SLOT( slotValueChanged(int,int) ) );
@@ -127,8 +126,4 @@ TableView::TableView( MainWindow* window, QWidget* wid )
127 this, SLOT( slotCurrentChanged(int,int) ) ); 126 this, SLOT( slotCurrentChanged(int,int) ) );
128 127
129 m_menuTimer = new QTimer( this );
130 connect( m_menuTimer, SIGNAL(timeout()),
131 this, SLOT(slotShowMenu()) );
132
133 /* now let's init the config */ 128 /* now let's init the config */
134 initConfig(); 129 initConfig();
@@ -158,9 +153,4 @@ TableView::~TableView() {
158 config.writeEntry("Width"+QString::number(i), columnWidth(i) ); 153 config.writeEntry("Width"+QString::number(i), columnWidth(i) );
159} 154}
160void TableView::slotShowMenu() {
161 QPopupMenu *menu = todoWindow()->contextMenu( current(), sorted()[currentRow()].recurrence().doesRecur() );
162 menu->exec(QCursor::pos() );
163 delete menu;
164}
165QString TableView::type() const { 155QString TableView::type() const {
166 return QString::fromLatin1( tr("Table View") ); 156 return QString::fromLatin1( tr("Table View") );
@@ -284,5 +274,4 @@ void TableView::setShowCategory( const QString& str) {
284 m_oleCat = str; 274 m_oleCat = str;
285 m_first = false; 275 m_first = false;
286
287} 276}
288void TableView::clear() { 277void TableView::clear() {
@@ -327,10 +316,8 @@ void TableView::slotClicked(int row, int col, int,
327 316
328 case 2: { 317 case 2: {
329 m_menuTimer->stop();
330 showTodo( ui ); 318 showTodo( ui );
331 break; 319 break;
332 } 320 }
333 case 3: { 321 case 3: {
334 m_menuTimer->stop();
335 TodoView::edit( ui ); 322 TodoView::edit( ui );
336 break; 323 break;
@@ -340,17 +327,4 @@ void TableView::slotClicked(int row, int col, int,
340 327
341} 328}
342void TableView::slotPressed(int row, int col, int,
343 const QPoint& point) {
344
345 m_prevP = point;
346 /* TextColumn column */
347 if ( col == 2 && cellGeometry( row, col ).contains( point ) )
348 m_menuTimer->start( 750, TRUE );
349}
350void TableView::slotValueChanged( int, int ) {
351}
352void TableView::slotCurrentChanged(int, int ) {
353 m_menuTimer->stop();
354}
355QWidget* TableView::widget() { 329QWidget* TableView::widget() {
356 return this; 330 return this;
@@ -591,7 +565,13 @@ void TableView::contentsMouseReleaseEvent( QMouseEvent* e) {
591 QTable::contentsMouseReleaseEvent( e ); 565 QTable::contentsMouseReleaseEvent( e );
592} 566}
593void TableView::contentsMouseMoveEvent( QMouseEvent* e ) { 567void TableView::contentsMousePressEvent( QMouseEvent *e ) {
594 m_menuTimer->stop(); 568 if ( e->button() == RightButton ) {
595 QTable::contentsMouseMoveEvent( e ); 569 QPopupMenu *menu = todoWindow()->contextMenu( current(), sorted()[currentRow()].recurrence().doesRecur() );
570 menu->exec( QCursor::pos() );
571 }
572 else {
573 m_prevP = e->pos();
574 QTable::contentsMousePressEvent( e );
575 }
596} 576}
597void TableView::keyPressEvent( QKeyEvent* event) { 577void TableView::keyPressEvent( QKeyEvent* event) {