author | alwin <alwin> | 2003-12-25 20:35:46 (UTC) |
---|---|---|
committer | alwin <alwin> | 2003-12-25 20:35:46 (UTC) |
commit | 34a7e0451c95e8a19735610553dba064b68823d9 (patch) (side-by-side diff) | |
tree | d6f763a9571f65743ee45f9cee998fa74babe41a /noncore | |
parent | bde1302aed8a0e2506684eaae7c2d2d823de42c6 (diff) | |
download | opie-34a7e0451c95e8a19735610553dba064b68823d9.zip opie-34a7e0451c95e8a19735610553dba064b68823d9.tar.gz opie-34a7e0451c95e8a19735610553dba064b68823d9.tar.bz2 |
context menues for single mails when holding the stylus or left mouse button
-rw-r--r-- | noncore/net/mail/mainwindow.cpp | 43 | ||||
-rw-r--r-- | noncore/net/mail/mainwindow.h | 8 |
2 files changed, 41 insertions, 10 deletions
diff --git a/noncore/net/mail/mainwindow.cpp b/noncore/net/mail/mainwindow.cpp index a57fb0d..dc8c188 100644 --- a/noncore/net/mail/mainwindow.cpp +++ b/noncore/net/mail/mainwindow.cpp @@ -121,6 +121,14 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) slotAdjustLayout(); - - connect( mailView, SIGNAL( clicked( QListViewItem * ) ),this, - SLOT( displayMail( QListViewItem * ) ) ); - + + QPEApplication::setStylusOperation( mailView->viewport(),QPEApplication::RightOnHold); + + connect( mailView, SIGNAL( mouseButtonClicked(int, QListViewItem *,const QPoint&,int ) ),this, + SLOT( mailLeftClicked( int, QListViewItem *,const QPoint&,int ) ) ); + + connect( mailView, SIGNAL( mouseButtonPressed(int, QListViewItem *,const QPoint&,int ) ),this, + SLOT( mailHold( int, QListViewItem *,const QPoint&,int ) ) ); +#if 0 + connect( mailView, SIGNAL( rightButtonClicked( QListViewItem *,const QPoint&,int ) ),this, + SLOT( mailHold(QListViewItem *,const QPoint&,int) )); +#endif connect(folderView, SIGNAL(refreshMailview(QList<RecMail>*)),this,SLOT(refreshMailView(QList<RecMail>*))); @@ -185,5 +193,13 @@ void MainWindow::refreshMailView(QList<RecMail>*list) } -void MainWindow::displayMail(QListViewItem*item) +void MainWindow::mailLeftClicked(int button, QListViewItem *item,const QPoint&,int ) { + /* just LEFT button - or tap with stylus on pda */ + if (button!=1) return; + if (!item) return; + displayMail(); +} +void MainWindow::displayMail() +{ + QListViewItem*item = mailView->currentItem(); if (!item) return; @@ -191,3 +207,2 @@ void MainWindow::displayMail(QListViewItem*item) RecBody body = folderView->fetchBody(mail); - ViewMail readMail( this ); @@ -215,3 +230,17 @@ void MainWindow::slotDeleteMail() - +void MainWindow::mailHold(int button, QListViewItem *item,const QPoint&,int ) +{ + /* just the RIGHT button - or hold on pda */ + if (button!=2) {return;} + qDebug("Event right/hold"); + if (!item) return; + QPopupMenu *m = new QPopupMenu(0); + if (m) { + m->insertItem(tr("Read this mail"),this,SLOT(displayMail())); + m->insertItem(tr("Delete this mail"),this,SLOT(slotDeleteMail())); + m->setFocus(); + m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); + delete m; + } +} diff --git a/noncore/net/mail/mainwindow.h b/noncore/net/mail/mainwindow.h index 4e4f4bb..638232a 100644 --- a/noncore/net/mail/mainwindow.h +++ b/noncore/net/mail/mainwindow.h @@ -28,6 +28,8 @@ protected slots: virtual void refreshMailView(QList<RecMail>*); - virtual void displayMail(QListViewItem*); + virtual void displayMail(); virtual void slotDeleteMail(); - void slotAdjustLayout(); - void slotEditSettings(); + virtual void mailHold(int, QListViewItem *,const QPoint&,int); + virtual void slotAdjustLayout(); + virtual void slotEditSettings(); + virtual void mailLeftClicked( int, QListViewItem *,const QPoint&,int ); |