summaryrefslogtreecommitdiff
authoralwin <alwin>2004-01-02 23:58:44 (UTC)
committer alwin <alwin>2004-01-02 23:58:44 (UTC)
commit86cac2c819dd683ac3f13be2c3bf1f28e0b83dab (patch) (unidiff)
tree3ee125def2a60097d19c22bbd155ef1353f68f85
parent9dbd01bcb23a56171d7ec24a9ca3fcd6f62bc6ab (diff)
downloadopie-86cac2c819dd683ac3f13be2c3bf1f28e0b83dab.zip
opie-86cac2c819dd683ac3f13be2c3bf1f28e0b83dab.tar.gz
opie-86cac2c819dd683ac3f13be2c3bf1f28e0b83dab.tar.bz2
settings dialog will show when clicked.
slots are all virtual so always the right one is called! Note: It is better to make all slots declared virtual - or do not make any child-classes!
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/mainwindow.cpp8
-rw-r--r--noncore/net/mail/mainwindow.h2
-rw-r--r--noncore/net/mail/opiemail.cpp6
-rw-r--r--noncore/net/mail/opiemail.h14
4 files changed, 14 insertions, 16 deletions
diff --git a/noncore/net/mail/mainwindow.cpp b/noncore/net/mail/mainwindow.cpp
index cf4cbe8..2a74286 100644
--- a/noncore/net/mail/mainwindow.cpp
+++ b/noncore/net/mail/mainwindow.cpp
@@ -2,25 +2,24 @@
2#include <qvbox.h> 2#include <qvbox.h>
3#include <qheader.h> 3#include <qheader.h>
4#include <qtimer.h> 4#include <qtimer.h>
5#include <qlayout.h> 5#include <qlayout.h>
6#include <qmessagebox.h> 6#include <qmessagebox.h>
7#include <qtextstream.h> 7#include <qtextstream.h>
8 8
9#include <qpe/qpeapplication.h> 9#include <qpe/qpeapplication.h>
10#include <qpe/resource.h> 10#include <qpe/resource.h>
11 11
12#include "defines.h" 12#include "defines.h"
13#include "mainwindow.h" 13#include "mainwindow.h"
14#include "settingsdialog.h"
15#include "viewmail.h" 14#include "viewmail.h"
16#include "mailtypes.h" 15#include "mailtypes.h"
17#include "mailistviewitem.h" 16#include "mailistviewitem.h"
18 17
19 18
20MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) 19MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags )
21 : QMainWindow( parent, name, flags ) 20 : QMainWindow( parent, name, flags )
22{ 21{
23 setCaption( tr( "Mail" ) ); 22 setCaption( tr( "Mail" ) );
24 setToolBarsMovable( false ); 23 setToolBarsMovable( false );
25 24
26 toolBar = new QToolBar( this ); 25 toolBar = new QToolBar( this );
@@ -71,25 +70,24 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags )
71 70
72 deleteMails = new QAction(tr("Delete Mail"), QIconSet(Resource::loadPixmap("mail/delete")), 0, 0, this); 71 deleteMails = new QAction(tr("Delete Mail"), QIconSet(Resource::loadPixmap("mail/delete")), 0, 0, this);
73 deleteMails->addTo( toolBar ); 72 deleteMails->addTo( toolBar );
74 deleteMails->addTo( mailMenu ); 73 deleteMails->addTo( mailMenu );
75 connect( deleteMails, SIGNAL( activated() ), 74 connect( deleteMails, SIGNAL( activated() ),
76 SLOT( slotDeleteMail() ) ); 75 SLOT( slotDeleteMail() ) );
77 76
78 editSettings = new QAction( tr( "Edit settings" ), ICON_EDITSETTINGS, 77 editSettings = new QAction( tr( "Edit settings" ), ICON_EDITSETTINGS,
79 0, 0, this ); 78 0, 0, this );
80 editSettings->addTo( settingsMenu ); 79 editSettings->addTo( settingsMenu );
81 connect( editSettings, SIGNAL( activated() ), 80 connect( editSettings, SIGNAL( activated() ),
82 SLOT( slotEditSettings() ) ); 81 SLOT( slotEditSettings() ) );
83
84 editAccounts = new QAction( tr( "Configure accounts" ), ICON_EDITACCOUNTS, 82 editAccounts = new QAction( tr( "Configure accounts" ), ICON_EDITACCOUNTS,
85 0, 0, this ); 83 0, 0, this );
86 editAccounts->addTo( settingsMenu ); 84 editAccounts->addTo( settingsMenu );
87 85
88 //setCentralWidget( view ); 86 //setCentralWidget( view );
89 87
90 QVBox* wrapperBox = new QVBox( this ); 88 QVBox* wrapperBox = new QVBox( this );
91 setCentralWidget( wrapperBox ); 89 setCentralWidget( wrapperBox );
92 90
93 QWidget *view = new QWidget( wrapperBox ); 91 QWidget *view = new QWidget( wrapperBox );
94 92
95 layout = new QBoxLayout ( view, QBoxLayout::LeftToRight ); 93 layout = new QBoxLayout ( view, QBoxLayout::LeftToRight );
@@ -148,28 +146,26 @@ void MainWindow::slotAdjustColumns()
148 bool hidden = folderView->isHidden(); 146 bool hidden = folderView->isHidden();
149 if ( hidden ) folderView->show(); 147 if ( hidden ) folderView->show();
150 folderView->setColumnWidth( 0, folderView->visibleWidth() ); 148 folderView->setColumnWidth( 0, folderView->visibleWidth() );
151 if ( hidden ) folderView->hide(); 149 if ( hidden ) folderView->hide();
152 150
153 mailView->setColumnWidth( 0, 10 ); 151 mailView->setColumnWidth( 0, 10 );
154 mailView->setColumnWidth( 1, mailView->visibleWidth() - 130 ); 152 mailView->setColumnWidth( 1, mailView->visibleWidth() - 130 );
155 mailView->setColumnWidth( 2, 80 ); 153 mailView->setColumnWidth( 2, 80 );
156 mailView->setColumnWidth( 3, 50 ); 154 mailView->setColumnWidth( 3, 50 );
157 mailView->setColumnWidth( 4, 50 ); 155 mailView->setColumnWidth( 4, 50 );
158} 156}
159 157
160void MainWindow::slotEditSettings() { 158void MainWindow::slotEditSettings()
161 SettingsDialog settingsDialog( this, 0, true ); 159{
162 settingsDialog.showMaximized();
163 settingsDialog.exec();
164} 160}
165 161
166void MainWindow::slotShowFolders( bool show ) 162void MainWindow::slotShowFolders( bool show )
167{ 163{
168 qDebug( "Show Folders" ); 164 qDebug( "Show Folders" );
169 if ( show && folderView->isHidden() ) { 165 if ( show && folderView->isHidden() ) {
170 qDebug( "-> showing" ); 166 qDebug( "-> showing" );
171 folderView->show(); 167 folderView->show();
172 } else if ( !show && !folderView->isHidden() ) { 168 } else if ( !show && !folderView->isHidden() ) {
173 qDebug( "-> hiding" ); 169 qDebug( "-> hiding" );
174 folderView->hide(); 170 folderView->hide();
175 } 171 }
diff --git a/noncore/net/mail/mainwindow.h b/noncore/net/mail/mainwindow.h
index 638232a..0e077f6 100644
--- a/noncore/net/mail/mainwindow.h
+++ b/noncore/net/mail/mainwindow.h
@@ -12,25 +12,25 @@
12#include "statuswidget.h" 12#include "statuswidget.h"
13 13
14class RecMail; 14class RecMail;
15 15
16class MainWindow : public QMainWindow 16class MainWindow : public QMainWindow
17{ 17{
18 Q_OBJECT 18 Q_OBJECT
19 19
20public: 20public:
21 MainWindow( QWidget *parent = 0, const char *name = 0, WFlags flags = 0 ); 21 MainWindow( QWidget *parent = 0, const char *name = 0, WFlags flags = 0 );
22 22
23public slots: 23public slots:
24 void slotAdjustColumns(); 24 virtual void slotAdjustColumns();
25 25
26protected slots: 26protected slots:
27 virtual void slotShowFolders( bool show ); 27 virtual void slotShowFolders( bool show );
28 virtual void refreshMailView(QList<RecMail>*); 28 virtual void refreshMailView(QList<RecMail>*);
29 virtual void displayMail(); 29 virtual void displayMail();
30 virtual void slotDeleteMail(); 30 virtual void slotDeleteMail();
31 virtual void mailHold(int, QListViewItem *,const QPoint&,int); 31 virtual void mailHold(int, QListViewItem *,const QPoint&,int);
32 virtual void slotAdjustLayout(); 32 virtual void slotAdjustLayout();
33 virtual void slotEditSettings(); 33 virtual void slotEditSettings();
34 virtual void mailLeftClicked( int, QListViewItem *,const QPoint&,int ); 34 virtual void mailLeftClicked( int, QListViewItem *,const QPoint&,int );
35 35
36protected: 36protected:
diff --git a/noncore/net/mail/opiemail.cpp b/noncore/net/mail/opiemail.cpp
index 2909893..e35f5b6 100644
--- a/noncore/net/mail/opiemail.cpp
+++ b/noncore/net/mail/opiemail.cpp
@@ -1,32 +1,32 @@
1#include <qmessagebox.h> 1#include <qmessagebox.h>
2#include "settingsdialog.h"
2#include "opiemail.h" 3#include "opiemail.h"
3#include "editaccounts.h" 4#include "editaccounts.h"
4#include "composemail.h" 5#include "composemail.h"
5#include "smtpwrapper.h" 6#include "smtpwrapper.h"
6#include <qpe/qcopenvelope_qws.h> 7#include <qpe/qcopenvelope_qws.h>
7#include <qaction.h> 8#include <qaction.h>
8#include <qapplication.h> 9#include <qapplication.h>
9 10
10OpieMail::OpieMail( QWidget *parent, const char *name, WFlags flags ) 11OpieMail::OpieMail( QWidget *parent, const char *name, WFlags flags )
11 : MainWindow( parent, name, flags ) 12 : MainWindow( parent, name, flags )
12{ 13{
13 settings = new Settings(); 14 settings = new Settings();
14 15
15 folderView->populate( settings->getAccounts() ); 16 folderView->populate( settings->getAccounts() );
16 17
17 connect( composeMail, SIGNAL( activated() ), SLOT( slotComposeMail() ) ); 18 connect( composeMail, SIGNAL( activated() ), SLOT( slotComposeMail() ) );
18 connect( sendQueued, SIGNAL( activated() ), SLOT( slotSendQueued() ) ); 19 connect( sendQueued, SIGNAL( activated() ), SLOT( slotSendQueued() ) );
19// connect( searchMails, SIGNAL( activated() ), SLOT( slotSearchMails() ) ); 20// connect( searchMails, SIGNAL( activated() ), SLOT( slotSearchMails() ) );
20 connect( editSettings, SIGNAL( activated() ), SLOT( slotEditSettings() ) );
21 connect( editAccounts, SIGNAL( activated() ), SLOT( slotEditAccounts() ) ); 21 connect( editAccounts, SIGNAL( activated() ), SLOT( slotEditAccounts() ) );
22 // Added by Stefan Eilers to allow starting by addressbook.. 22 // Added by Stefan Eilers to allow starting by addressbook..
23 // copied from old mail2 23 // copied from old mail2
24#if !defined(QT_NO_COP) 24#if !defined(QT_NO_COP)
25 connect( qApp, SIGNAL( appMessage( const QCString&, const QByteArray& ) ), 25 connect( qApp, SIGNAL( appMessage( const QCString&, const QByteArray& ) ),
26 this, SLOT( appMessage( const QCString&, const QByteArray& ) ) ); 26 this, SLOT( appMessage( const QCString&, const QByteArray& ) ) );
27#endif 27#endif
28} 28}
29 29
30void OpieMail::appMessage(const QCString &msg, const QByteArray &data) 30void OpieMail::appMessage(const QCString &msg, const QByteArray &data)
31{ 31{
32 // copied from old mail2 32 // copied from old mail2
@@ -83,25 +83,27 @@ void OpieMail::slotSendQueued()
83 QMessageBox::information(0,tr("Info"),tr("Mail queue flushed")); 83 QMessageBox::information(0,tr("Info"),tr("Mail queue flushed"));
84 } 84 }
85 } 85 }
86} 86}
87 87
88void OpieMail::slotSearchMails() 88void OpieMail::slotSearchMails()
89{ 89{
90 qDebug( "Search Mails" ); 90 qDebug( "Search Mails" );
91} 91}
92 92
93void OpieMail::slotEditSettings() 93void OpieMail::slotEditSettings()
94{ 94{
95 qDebug( "Edit Settings" ); 95 SettingsDialog settingsDialog( this, 0, true );
96 settingsDialog.showMaximized();
97 settingsDialog.exec();
96} 98}
97 99
98void OpieMail::slotEditAccounts() 100void OpieMail::slotEditAccounts()
99{ 101{
100 qDebug( "Edit Accounts" ); 102 qDebug( "Edit Accounts" );
101 EditAccounts eaDialog( settings, this, 0, true ); 103 EditAccounts eaDialog( settings, this, 0, true );
102 eaDialog.showMaximized(); 104 eaDialog.showMaximized();
103 eaDialog.slotAdjustColumns(); 105 eaDialog.slotAdjustColumns();
104 eaDialog.exec(); 106 eaDialog.exec();
105 if ( settings ) delete settings; 107 if ( settings ) delete settings;
106 settings = new Settings(); 108 settings = new Settings();
107 109
diff --git a/noncore/net/mail/opiemail.h b/noncore/net/mail/opiemail.h
index 8cbcaa4..4e3c974 100644
--- a/noncore/net/mail/opiemail.h
+++ b/noncore/net/mail/opiemail.h
@@ -4,26 +4,26 @@
4#include "mainwindow.h" 4#include "mainwindow.h"
5#include "settings.h" 5#include "settings.h"
6 6
7class OpieMail : public MainWindow 7class OpieMail : public MainWindow
8{ 8{
9 Q_OBJECT 9 Q_OBJECT
10 10
11public: 11public:
12 OpieMail( QWidget *parent = 0, const char *name = 0, WFlags flags = 0 ); 12 OpieMail( QWidget *parent = 0, const char *name = 0, WFlags flags = 0 );
13 static QString appName() { return QString::fromLatin1("opiemail"); } 13 static QString appName() { return QString::fromLatin1("opiemail"); }
14 14
15public slots: 15public slots:
16 void slotwriteMail(const QString&name,const QString&email); 16 virtual void slotwriteMail(const QString&name,const QString&email);
17 void slotComposeMail(); 17 virtual void slotComposeMail();
18 void appMessage(const QCString &msg, const QByteArray &data); 18 virtual void appMessage(const QCString &msg, const QByteArray &data);
19protected slots: 19protected slots:
20 void slotSendQueued(); 20 virtual void slotSendQueued();
21 void slotSearchMails(); 21 virtual void slotSearchMails();
22 void slotEditSettings(); 22 virtual void slotEditSettings();
23 void slotEditAccounts(); 23 virtual void slotEditAccounts();
24private: 24private:
25 Settings *settings; 25 Settings *settings;
26 26
27}; 27};
28 28
29#endif 29#endif