summaryrefslogtreecommitdiff
Unidiff
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
@@ -1,30 +1,29 @@
1#include <qlabel.h> 1#include <qlabel.h>
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 );
27 menuBar = new QMenuBar( toolBar ); 26 menuBar = new QMenuBar( toolBar );
28 mailMenu = new QPopupMenu( menuBar ); 27 mailMenu = new QPopupMenu( menuBar );
29 menuBar->insertItem( tr( "Mail" ), mailMenu ); 28 menuBar->insertItem( tr( "Mail" ), mailMenu );
30 settingsMenu = new QPopupMenu( menuBar ); 29 settingsMenu = new QPopupMenu( menuBar );
@@ -67,33 +66,32 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags )
67 0, 0, this ); 66 0, 0, this );
68 searchMails->addTo( toolBar ); 67 searchMails->addTo( toolBar );
69 searchMails->addTo( mailMenu ); 68 searchMails->addTo( mailMenu );
70 */ 69 */
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 );
96 94
97 folderView = new AccountView( view ); 95 folderView = new AccountView( view );
98 folderView->header()->hide(); 96 folderView->header()->hide();
99 folderView->setRootIsDecorated( true ); 97 folderView->setRootIsDecorated( true );
@@ -144,36 +142,34 @@ void MainWindow::slotAdjustLayout() {
144} 142}
145 143
146void MainWindow::slotAdjustColumns() 144void MainWindow::slotAdjustColumns()
147{ 145{
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 }
176} 172}
177 173
178void MainWindow::refreshMailView(QList<RecMail>*list) 174void MainWindow::refreshMailView(QList<RecMail>*list)
179{ 175{
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
@@ -8,33 +8,33 @@
8#include <qtoolbar.h> 8#include <qtoolbar.h>
9#include <qmenubar.h> 9#include <qmenubar.h>
10 10
11#include "accountview.h" 11#include "accountview.h"
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:
37 QToolBar *toolBar; 37 QToolBar *toolBar;
38 StatusWidget *statusWidget; 38 StatusWidget *statusWidget;
39 QMenuBar *menuBar; 39 QMenuBar *menuBar;
40 QPopupMenu *mailMenu, *settingsMenu; 40 QPopupMenu *mailMenu, *settingsMenu;
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,36 +1,36 @@
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
33 if (msg == "writeMail(QString,QString)") { 33 if (msg == "writeMail(QString,QString)") {
34 QDataStream stream(data,IO_ReadOnly); 34 QDataStream stream(data,IO_ReadOnly);
35 QString name, email; 35 QString name, email;
36 stream >> name >> email; 36 stream >> name >> email;
@@ -79,32 +79,34 @@ void OpieMail::slotSendQueued()
79// } 79// }
80 if (smtp) { 80 if (smtp) {
81 SMTPwrapper * wrap = new SMTPwrapper(settings); 81 SMTPwrapper * wrap = new SMTPwrapper(settings);
82 if ( wrap->flushOutbox(smtp) ) { 82 if ( wrap->flushOutbox(smtp) ) {
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
108 folderView->populate( settings->getAccounts() ); 110 folderView->populate( settings->getAccounts() );
109} 111}
110 112
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
@@ -1,29 +1,29 @@
1#ifndef OPIEMAIL_H 1#ifndef OPIEMAIL_H
2#define OPIEMAIL_H 2#define OPIEMAIL_H
3 3
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