-rw-r--r-- | noncore/net/mail/mainwindow.cpp | 5 | ||||
-rw-r--r-- | noncore/net/mail/mainwindow.h | 1 | ||||
-rw-r--r-- | noncore/net/mail/opiemail.cpp | 5 | ||||
-rw-r--r-- | noncore/net/mail/opiemail.h | 1 |
4 files changed, 11 insertions, 1 deletions
diff --git a/noncore/net/mail/mainwindow.cpp b/noncore/net/mail/mainwindow.cpp index d2e887b..e16f853 100644 --- a/noncore/net/mail/mainwindow.cpp +++ b/noncore/net/mail/mainwindow.cpp | |||
@@ -20,178 +20,181 @@ | |||
20 | MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) | 20 | MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) |
21 | : QMainWindow( parent, name, flags ) | 21 | : QMainWindow( parent, name, flags ) |
22 | { | 22 | { |
23 | 23 | ||
24 | setCaption( tr( "Mail" ) ); | 24 | setCaption( tr( "Mail" ) ); |
25 | setToolBarsMovable( false ); | 25 | setToolBarsMovable( false ); |
26 | 26 | ||
27 | toolBar = new QToolBar( this ); | 27 | toolBar = new QToolBar( this ); |
28 | menuBar = new QMenuBar( toolBar ); | 28 | menuBar = new QMenuBar( toolBar ); |
29 | mailMenu = new QPopupMenu( menuBar ); | 29 | mailMenu = new QPopupMenu( menuBar ); |
30 | menuBar->insertItem( tr( "Mail" ), mailMenu ); | 30 | menuBar->insertItem( tr( "Mail" ), mailMenu ); |
31 | settingsMenu = new QPopupMenu( menuBar ); | 31 | settingsMenu = new QPopupMenu( menuBar ); |
32 | menuBar->insertItem( tr( "Settings" ), settingsMenu ); | 32 | menuBar->insertItem( tr( "Settings" ), settingsMenu ); |
33 | 33 | ||
34 | addToolBar( toolBar ); | 34 | addToolBar( toolBar ); |
35 | toolBar->setHorizontalStretchable( true ); | 35 | toolBar->setHorizontalStretchable( true ); |
36 | 36 | ||
37 | QLabel *spacer = new QLabel( toolBar ); | 37 | QLabel *spacer = new QLabel( toolBar ); |
38 | spacer->setBackgroundMode( QWidget::PaletteButton ); | 38 | spacer->setBackgroundMode( QWidget::PaletteButton ); |
39 | toolBar->setStretchableWidget( spacer ); | 39 | toolBar->setStretchableWidget( spacer ); |
40 | 40 | ||
41 | composeMail = new QAction( tr( "Compose new mail" ), ICON_COMPOSEMAIL, | 41 | composeMail = new QAction( tr( "Compose new mail" ), ICON_COMPOSEMAIL, |
42 | 0, 0, this ); | 42 | 0, 0, this ); |
43 | composeMail->addTo( toolBar ); | 43 | composeMail->addTo( toolBar ); |
44 | composeMail->addTo( mailMenu ); | 44 | composeMail->addTo( mailMenu ); |
45 | 45 | ||
46 | sendQueued = new QAction( tr( "Send queued mails" ), ICON_SENDQUEUED, | 46 | sendQueued = new QAction( tr( "Send queued mails" ), ICON_SENDQUEUED, |
47 | 0, 0, this ); | 47 | 0, 0, this ); |
48 | sendQueued->addTo( toolBar ); | 48 | sendQueued->addTo( toolBar ); |
49 | sendQueued->addTo( mailMenu ); | 49 | sendQueued->addTo( mailMenu ); |
50 | 50 | ||
51 | /* | 51 | /* |
52 | syncFolders = new QAction( tr( "Sync mailfolders" ), ICON_SYNC, | 52 | syncFolders = new QAction( tr( "Sync mailfolders" ), ICON_SYNC, |
53 | 0, 0, this ); | 53 | 0, 0, this ); |
54 | syncFolders->addTo( toolBar ); | 54 | syncFolders->addTo( toolBar ); |
55 | syncFolders->addTo( mailMenu ); | 55 | syncFolders->addTo( mailMenu ); |
56 | */ | 56 | */ |
57 | 57 | ||
58 | showFolders = new QAction( tr( "Show/Hide folders" ), ICON_SHOWFOLDERS, | 58 | showFolders = new QAction( tr( "Show/Hide folders" ), ICON_SHOWFOLDERS, |
59 | 0, 0, this, 0, true ); | 59 | 0, 0, this, 0, true ); |
60 | showFolders->addTo( toolBar ); | 60 | showFolders->addTo( toolBar ); |
61 | showFolders->addTo( mailMenu ); | 61 | showFolders->addTo( mailMenu ); |
62 | showFolders->setOn( true ); | 62 | showFolders->setOn( true ); |
63 | connect(showFolders, SIGNAL( toggled( bool ) ), | 63 | connect(showFolders, SIGNAL( toggled( bool ) ), |
64 | SLOT( slotShowFolders( bool ) ) ); | 64 | SLOT( slotShowFolders( bool ) ) ); |
65 | 65 | ||
66 | /* | 66 | /* |
67 | searchMails = new QAction( tr( "Search mails" ), QIconSet( Resource::loadPixmap("find") ), | 67 | searchMails = new QAction( tr( "Search mails" ), QIconSet( Resource::loadPixmap("find") ), |
68 | 0, 0, this ); | 68 | 0, 0, this ); |
69 | searchMails->addTo( toolBar ); | 69 | searchMails->addTo( toolBar ); |
70 | searchMails->addTo( mailMenu ); | 70 | searchMails->addTo( mailMenu ); |
71 | */ | 71 | */ |
72 | 72 | ||
73 | deleteMails = new QAction(tr("Delete Mail"), QIconSet( Resource::loadPixmap("trash")), 0, 0, this); | 73 | deleteMails = new QAction(tr("Delete Mail"), QIconSet( Resource::loadPixmap("trash")), 0, 0, this); |
74 | deleteMails->addTo( toolBar ); | 74 | deleteMails->addTo( toolBar ); |
75 | deleteMails->addTo( mailMenu ); | 75 | deleteMails->addTo( mailMenu ); |
76 | connect( deleteMails, SIGNAL( activated() ), | 76 | connect( deleteMails, SIGNAL( activated() ), |
77 | SLOT( slotDeleteMail() ) ); | 77 | SLOT( slotDeleteMail() ) ); |
78 | 78 | ||
79 | editSettings = new QAction( tr( "Edit settings" ), QIconSet( Resource::loadPixmap("SettingsIcon") ) , | 79 | editSettings = new QAction( tr( "Edit settings" ), QIconSet( Resource::loadPixmap("SettingsIcon") ) , |
80 | 0, 0, this ); | 80 | 0, 0, this ); |
81 | editSettings->addTo( settingsMenu ); | 81 | editSettings->addTo( settingsMenu ); |
82 | connect( editSettings, SIGNAL( activated() ), | 82 | connect( editSettings, SIGNAL( activated() ), |
83 | SLOT( slotEditSettings() ) ); | 83 | SLOT( slotEditSettings() ) ); |
84 | editAccounts = new QAction( tr( "Configure accounts" ), QIconSet( Resource::loadPixmap("SettingsIcon") ) , | 84 | editAccounts = new QAction( tr( "Configure accounts" ), QIconSet( Resource::loadPixmap("mail/editaccounts") ) , |
85 | 0, 0, this ); | 85 | 0, 0, this ); |
86 | editAccounts->addTo( settingsMenu ); | 86 | editAccounts->addTo( settingsMenu ); |
87 | 87 | ||
88 | //setCentralWidget( view ); | 88 | //setCentralWidget( view ); |
89 | 89 | ||
90 | QVBox* wrapperBox = new QVBox( this ); | 90 | QVBox* wrapperBox = new QVBox( this ); |
91 | setCentralWidget( wrapperBox ); | 91 | setCentralWidget( wrapperBox ); |
92 | 92 | ||
93 | QWidget *view = new QWidget( wrapperBox ); | 93 | QWidget *view = new QWidget( wrapperBox ); |
94 | 94 | ||
95 | layout = new QBoxLayout ( view, QBoxLayout::LeftToRight ); | 95 | layout = new QBoxLayout ( view, QBoxLayout::LeftToRight ); |
96 | 96 | ||
97 | folderView = new AccountView( view ); | 97 | folderView = new AccountView( view ); |
98 | folderView->header()->hide(); | 98 | folderView->header()->hide(); |
99 | folderView->setRootIsDecorated( true ); | 99 | folderView->setRootIsDecorated( true ); |
100 | folderView->addColumn( tr( "Mailbox" ) ); | 100 | folderView->addColumn( tr( "Mailbox" ) ); |
101 | 101 | ||
102 | layout->addWidget( folderView ); | 102 | layout->addWidget( folderView ); |
103 | 103 | ||
104 | mailView = new QListView( view ); | 104 | mailView = new QListView( view ); |
105 | mailView->addColumn( tr( "" ) ); | 105 | mailView->addColumn( tr( "" ) ); |
106 | mailView->addColumn( tr( "Subject" ),QListView::Manual ); | 106 | mailView->addColumn( tr( "Subject" ),QListView::Manual ); |
107 | mailView->addColumn( tr( "Sender" ),QListView::Manual ); | 107 | mailView->addColumn( tr( "Sender" ),QListView::Manual ); |
108 | mailView->addColumn( tr( "Size" ),QListView::Manual); | 108 | mailView->addColumn( tr( "Size" ),QListView::Manual); |
109 | mailView->addColumn( tr( "Date" )); | 109 | mailView->addColumn( tr( "Date" )); |
110 | mailView->setAllColumnsShowFocus(true); | 110 | mailView->setAllColumnsShowFocus(true); |
111 | mailView->setSorting(-1); | 111 | mailView->setSorting(-1); |
112 | 112 | ||
113 | statusWidget = new StatusWidget( wrapperBox ); | 113 | statusWidget = new StatusWidget( wrapperBox ); |
114 | statusWidget->hide(); | 114 | statusWidget->hide(); |
115 | 115 | ||
116 | layout->addWidget( mailView ); | 116 | layout->addWidget( mailView ); |
117 | layout->setStretchFactor( folderView, 1 ); | 117 | layout->setStretchFactor( folderView, 1 ); |
118 | layout->setStretchFactor( mailView, 2 ); | 118 | layout->setStretchFactor( mailView, 2 ); |
119 | 119 | ||
120 | slotAdjustLayout(); | 120 | slotAdjustLayout(); |
121 | 121 | ||
122 | QPEApplication::setStylusOperation( mailView->viewport(),QPEApplication::RightOnHold); | 122 | QPEApplication::setStylusOperation( mailView->viewport(),QPEApplication::RightOnHold); |
123 | QPEApplication::setStylusOperation( folderView->viewport(),QPEApplication::RightOnHold); | 123 | QPEApplication::setStylusOperation( folderView->viewport(),QPEApplication::RightOnHold); |
124 | 124 | ||
125 | connect( mailView, SIGNAL( mouseButtonClicked(int, QListViewItem *,const QPoint&,int ) ),this, | 125 | connect( mailView, SIGNAL( mouseButtonClicked(int, QListViewItem *,const QPoint&,int ) ),this, |
126 | SLOT( mailLeftClicked( int, QListViewItem *,const QPoint&,int ) ) ); | 126 | SLOT( mailLeftClicked( int, QListViewItem *,const QPoint&,int ) ) ); |
127 | connect( mailView, SIGNAL( mouseButtonPressed(int, QListViewItem *,const QPoint&,int ) ),this, | 127 | connect( mailView, SIGNAL( mouseButtonPressed(int, QListViewItem *,const QPoint&,int ) ),this, |
128 | SLOT( mailHold( int, QListViewItem *,const QPoint&,int ) ) ); | 128 | SLOT( mailHold( int, QListViewItem *,const QPoint&,int ) ) ); |
129 | connect(folderView, SIGNAL(refreshMailview(QList<RecMail>*)),this,SLOT(refreshMailView(QList<RecMail>*))); | 129 | connect(folderView, SIGNAL(refreshMailview(QList<RecMail>*)),this,SLOT(refreshMailView(QList<RecMail>*))); |
130 | 130 | ||
131 | QTimer::singleShot( 1000, this, SLOT( slotAdjustColumns() ) ); | 131 | QTimer::singleShot( 1000, this, SLOT( slotAdjustColumns() ) ); |
132 | } | 132 | } |
133 | 133 | ||
134 | MainWindow::~MainWindow() | ||
135 | { | ||
136 | } | ||
134 | 137 | ||
135 | void MainWindow::slotAdjustLayout() { | 138 | void MainWindow::slotAdjustLayout() { |
136 | 139 | ||
137 | QWidget *d = QApplication::desktop(); | 140 | QWidget *d = QApplication::desktop(); |
138 | 141 | ||
139 | if ( d->width() < d->height() ) { | 142 | if ( d->width() < d->height() ) { |
140 | layout->setDirection( QBoxLayout::TopToBottom ); | 143 | layout->setDirection( QBoxLayout::TopToBottom ); |
141 | } else { | 144 | } else { |
142 | layout->setDirection( QBoxLayout::LeftToRight ); | 145 | layout->setDirection( QBoxLayout::LeftToRight ); |
143 | } | 146 | } |
144 | } | 147 | } |
145 | 148 | ||
146 | void MainWindow::slotAdjustColumns() | 149 | void MainWindow::slotAdjustColumns() |
147 | { | 150 | { |
148 | bool hidden = folderView->isHidden(); | 151 | bool hidden = folderView->isHidden(); |
149 | if ( hidden ) folderView->show(); | 152 | if ( hidden ) folderView->show(); |
150 | folderView->setColumnWidth( 0, folderView->visibleWidth() ); | 153 | folderView->setColumnWidth( 0, folderView->visibleWidth() ); |
151 | if ( hidden ) folderView->hide(); | 154 | if ( hidden ) folderView->hide(); |
152 | 155 | ||
153 | mailView->setColumnWidth( 0, 10 ); | 156 | mailView->setColumnWidth( 0, 10 ); |
154 | mailView->setColumnWidth( 1, mailView->visibleWidth() - 130 ); | 157 | mailView->setColumnWidth( 1, mailView->visibleWidth() - 130 ); |
155 | mailView->setColumnWidth( 2, 80 ); | 158 | mailView->setColumnWidth( 2, 80 ); |
156 | mailView->setColumnWidth( 3, 50 ); | 159 | mailView->setColumnWidth( 3, 50 ); |
157 | mailView->setColumnWidth( 4, 50 ); | 160 | mailView->setColumnWidth( 4, 50 ); |
158 | } | 161 | } |
159 | 162 | ||
160 | void MainWindow::slotEditSettings() | 163 | void MainWindow::slotEditSettings() |
161 | { | 164 | { |
162 | } | 165 | } |
163 | 166 | ||
164 | void MainWindow::slotShowFolders( bool show ) | 167 | void MainWindow::slotShowFolders( bool show ) |
165 | { | 168 | { |
166 | qDebug( "Show Folders" ); | 169 | qDebug( "Show Folders" ); |
167 | if ( show && folderView->isHidden() ) { | 170 | if ( show && folderView->isHidden() ) { |
168 | qDebug( "-> showing" ); | 171 | qDebug( "-> showing" ); |
169 | folderView->show(); | 172 | folderView->show(); |
170 | } else if ( !show && !folderView->isHidden() ) { | 173 | } else if ( !show && !folderView->isHidden() ) { |
171 | qDebug( "-> hiding" ); | 174 | qDebug( "-> hiding" ); |
172 | folderView->hide(); | 175 | folderView->hide(); |
173 | } | 176 | } |
174 | } | 177 | } |
175 | 178 | ||
176 | void MainWindow::refreshMailView(QList<RecMail>*list) | 179 | void MainWindow::refreshMailView(QList<RecMail>*list) |
177 | { | 180 | { |
178 | MailListViewItem*item = 0; | 181 | MailListViewItem*item = 0; |
179 | mailView->clear(); | 182 | mailView->clear(); |
180 | for (unsigned int i = 0; i < list->count();++i) { | 183 | for (unsigned int i = 0; i < list->count();++i) { |
181 | item = new MailListViewItem(mailView,item); | 184 | item = new MailListViewItem(mailView,item); |
182 | item->storeData(*(list->at(i))); | 185 | item->storeData(*(list->at(i))); |
183 | item->showEntry(); | 186 | item->showEntry(); |
184 | } | 187 | } |
185 | } | 188 | } |
186 | void MainWindow::mailLeftClicked(int button, QListViewItem *item,const QPoint&,int ) | 189 | void MainWindow::mailLeftClicked(int button, QListViewItem *item,const QPoint&,int ) |
187 | { | 190 | { |
188 | /* just LEFT button - or tap with stylus on pda */ | 191 | /* just LEFT button - or tap with stylus on pda */ |
189 | if (button!=1) return; | 192 | if (button!=1) return; |
190 | if (!item) return; | 193 | if (!item) return; |
191 | displayMail(); | 194 | displayMail(); |
192 | } | 195 | } |
193 | 196 | ||
194 | void MainWindow::displayMail() | 197 | void MainWindow::displayMail() |
195 | { | 198 | { |
196 | QListViewItem*item = mailView->currentItem(); | 199 | QListViewItem*item = mailView->currentItem(); |
197 | if (!item) return; | 200 | if (!item) return; |
diff --git a/noncore/net/mail/mainwindow.h b/noncore/net/mail/mainwindow.h index 0e077f6..15d216a 100644 --- a/noncore/net/mail/mainwindow.h +++ b/noncore/net/mail/mainwindow.h | |||
@@ -1,48 +1,49 @@ | |||
1 | #ifndef MAINWINDOW_H | 1 | #ifndef MAINWINDOW_H |
2 | #define MAINWINDOW_H | 2 | #define MAINWINDOW_H |
3 | 3 | ||
4 | #include <qmainwindow.h> | 4 | #include <qmainwindow.h> |
5 | #include <qlistview.h> | 5 | #include <qlistview.h> |
6 | #include <qaction.h> | 6 | #include <qaction.h> |
7 | 7 | ||
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 | ||
14 | class RecMail; | 14 | class RecMail; |
15 | 15 | ||
16 | class MainWindow : public QMainWindow | 16 | class MainWindow : public QMainWindow |
17 | { | 17 | { |
18 | Q_OBJECT | 18 | Q_OBJECT |
19 | 19 | ||
20 | public: | 20 | public: |
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 | virtual ~MainWindow(); | ||
22 | 23 | ||
23 | public slots: | 24 | public slots: |
24 | virtual void slotAdjustColumns(); | 25 | virtual void slotAdjustColumns(); |
25 | 26 | ||
26 | protected slots: | 27 | protected slots: |
27 | virtual void slotShowFolders( bool show ); | 28 | virtual void slotShowFolders( bool show ); |
28 | virtual void refreshMailView(QList<RecMail>*); | 29 | virtual void refreshMailView(QList<RecMail>*); |
29 | virtual void displayMail(); | 30 | virtual void displayMail(); |
30 | virtual void slotDeleteMail(); | 31 | virtual void slotDeleteMail(); |
31 | virtual void mailHold(int, QListViewItem *,const QPoint&,int); | 32 | virtual void mailHold(int, QListViewItem *,const QPoint&,int); |
32 | virtual void slotAdjustLayout(); | 33 | virtual void slotAdjustLayout(); |
33 | virtual void slotEditSettings(); | 34 | virtual void slotEditSettings(); |
34 | virtual void mailLeftClicked( int, QListViewItem *,const QPoint&,int ); | 35 | virtual void mailLeftClicked( int, QListViewItem *,const QPoint&,int ); |
35 | 36 | ||
36 | protected: | 37 | protected: |
37 | QToolBar *toolBar; | 38 | QToolBar *toolBar; |
38 | StatusWidget *statusWidget; | 39 | StatusWidget *statusWidget; |
39 | QMenuBar *menuBar; | 40 | QMenuBar *menuBar; |
40 | QPopupMenu *mailMenu, *settingsMenu; | 41 | QPopupMenu *mailMenu, *settingsMenu; |
41 | QAction *composeMail, *sendQueued, *showFolders, *searchMails, *deleteMails, | 42 | QAction *composeMail, *sendQueued, *showFolders, *searchMails, *deleteMails, |
42 | *editSettings, *editAccounts, *syncFolders; | 43 | *editSettings, *editAccounts, *syncFolders; |
43 | AccountView *folderView; | 44 | AccountView *folderView; |
44 | QListView *mailView; | 45 | QListView *mailView; |
45 | QBoxLayout *layout; | 46 | QBoxLayout *layout; |
46 | }; | 47 | }; |
47 | 48 | ||
48 | #endif | 49 | #endif |
diff --git a/noncore/net/mail/opiemail.cpp b/noncore/net/mail/opiemail.cpp index fcd48e2..c888708 100644 --- a/noncore/net/mail/opiemail.cpp +++ b/noncore/net/mail/opiemail.cpp | |||
@@ -1,96 +1,101 @@ | |||
1 | #include <qmessagebox.h> | 1 | #include <qmessagebox.h> |
2 | #include "settingsdialog.h" | 2 | #include "settingsdialog.h" |
3 | #include "opiemail.h" | 3 | #include "opiemail.h" |
4 | #include "editaccounts.h" | 4 | #include "editaccounts.h" |
5 | #include "composemail.h" | 5 | #include "composemail.h" |
6 | #include <libmailwrapper/smtpwrapper.h> | 6 | #include <libmailwrapper/smtpwrapper.h> |
7 | #include <qpe/qcopenvelope_qws.h> | 7 | #include <qpe/qcopenvelope_qws.h> |
8 | #include <qaction.h> | 8 | #include <qaction.h> |
9 | #include <qapplication.h> | 9 | #include <qapplication.h> |
10 | 10 | ||
11 | OpieMail::OpieMail( QWidget *parent, const char *name, WFlags flags ) | 11 | OpieMail::OpieMail( QWidget *parent, const char *name, WFlags flags ) |
12 | : MainWindow( parent, name, flags ) | 12 | : MainWindow( parent, name, flags ) |
13 | { | 13 | { |
14 | settings = new Settings(); | 14 | settings = new Settings(); |
15 | 15 | ||
16 | folderView->populate( settings->getAccounts() ); | 16 | folderView->populate( settings->getAccounts() ); |
17 | 17 | ||
18 | connect( composeMail, SIGNAL( activated() ), SLOT( slotComposeMail() ) ); | 18 | connect( composeMail, SIGNAL( activated() ), SLOT( slotComposeMail() ) ); |
19 | connect( sendQueued, SIGNAL( activated() ), SLOT( slotSendQueued() ) ); | 19 | connect( sendQueued, SIGNAL( activated() ), SLOT( slotSendQueued() ) ); |
20 | // connect( searchMails, SIGNAL( activated() ), SLOT( slotSearchMails() ) ); | 20 | // connect( searchMails, SIGNAL( activated() ), SLOT( slotSearchMails() ) ); |
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 | ||
30 | 30 | ||
31 | } | 31 | } |
32 | 32 | ||
33 | OpieMail::~OpieMail() | ||
34 | { | ||
35 | if (settings) delete settings; | ||
36 | } | ||
37 | |||
33 | void OpieMail::appMessage(const QCString &msg, const QByteArray &data) | 38 | void OpieMail::appMessage(const QCString &msg, const QByteArray &data) |
34 | { | 39 | { |
35 | // copied from old mail2 | 40 | // copied from old mail2 |
36 | if (msg == "writeMail(QString,QString)") { | 41 | if (msg == "writeMail(QString,QString)") { |
37 | QDataStream stream(data,IO_ReadOnly); | 42 | QDataStream stream(data,IO_ReadOnly); |
38 | QString name, email; | 43 | QString name, email; |
39 | stream >> name >> email; | 44 | stream >> name >> email; |
40 | // removing the whitespaces at beginning and end is needed! | 45 | // removing the whitespaces at beginning and end is needed! |
41 | slotwriteMail(name.stripWhiteSpace(),email.stripWhiteSpace()); | 46 | slotwriteMail(name.stripWhiteSpace(),email.stripWhiteSpace()); |
42 | } else if (msg == "newMail()") { | 47 | } else if (msg == "newMail()") { |
43 | slotComposeMail(); | 48 | slotComposeMail(); |
44 | } | 49 | } |
45 | } | 50 | } |
46 | 51 | ||
47 | void OpieMail::slotwriteMail(const QString&name,const QString&email) | 52 | void OpieMail::slotwriteMail(const QString&name,const QString&email) |
48 | { | 53 | { |
49 | ComposeMail compose( settings, this, 0 , true ); | 54 | ComposeMail compose( settings, this, 0 , true ); |
50 | if (!email.isEmpty()) { | 55 | if (!email.isEmpty()) { |
51 | if (!name.isEmpty()) { | 56 | if (!name.isEmpty()) { |
52 | compose.setTo("\"" + name + "\"" + " " + "<"+ email + ">"); | 57 | compose.setTo("\"" + name + "\"" + " " + "<"+ email + ">"); |
53 | } else { | 58 | } else { |
54 | compose.setTo(email); | 59 | compose.setTo(email); |
55 | } | 60 | } |
56 | } | 61 | } |
57 | compose.showMaximized(); | 62 | compose.showMaximized(); |
58 | compose.slotAdjustColumns(); | 63 | compose.slotAdjustColumns(); |
59 | compose.exec(); | 64 | compose.exec(); |
60 | } | 65 | } |
61 | 66 | ||
62 | void OpieMail::slotComposeMail() | 67 | void OpieMail::slotComposeMail() |
63 | { | 68 | { |
64 | qDebug( "Compose Mail" ); | 69 | qDebug( "Compose Mail" ); |
65 | slotwriteMail(0l,0l); | 70 | slotwriteMail(0l,0l); |
66 | } | 71 | } |
67 | 72 | ||
68 | void OpieMail::slotSendQueued() | 73 | void OpieMail::slotSendQueued() |
69 | { | 74 | { |
70 | qDebug( "Send Queued" ); | 75 | qDebug( "Send Queued" ); |
71 | SMTPaccount *smtp = 0; | 76 | SMTPaccount *smtp = 0; |
72 | 77 | ||
73 | QList<Account> list = settings->getAccounts(); | 78 | QList<Account> list = settings->getAccounts(); |
74 | Account *it; | 79 | Account *it; |
75 | // if (list.count()==1) { | 80 | // if (list.count()==1) { |
76 | for ( it = list.first(); it; it = list.next() ) { | 81 | for ( it = list.first(); it; it = list.next() ) { |
77 | if ( it->getType().compare( "SMTP" ) == 0 ) { | 82 | if ( it->getType().compare( "SMTP" ) == 0 ) { |
78 | smtp = static_cast<SMTPaccount *>(it); | 83 | smtp = static_cast<SMTPaccount *>(it); |
79 | break; | 84 | break; |
80 | } | 85 | } |
81 | } | 86 | } |
82 | // } | 87 | // } |
83 | if (smtp) { | 88 | if (smtp) { |
84 | SMTPwrapper * wrap = new SMTPwrapper(settings); | 89 | SMTPwrapper * wrap = new SMTPwrapper(settings); |
85 | if ( wrap->flushOutbox(smtp) ) { | 90 | if ( wrap->flushOutbox(smtp) ) { |
86 | QMessageBox::information(0,tr("Info"),tr("Mail queue flushed")); | 91 | QMessageBox::information(0,tr("Info"),tr("Mail queue flushed")); |
87 | } | 92 | } |
88 | } | 93 | } |
89 | } | 94 | } |
90 | 95 | ||
91 | void OpieMail::slotSearchMails() | 96 | void OpieMail::slotSearchMails() |
92 | { | 97 | { |
93 | qDebug( "Search Mails" ); | 98 | qDebug( "Search Mails" ); |
94 | } | 99 | } |
95 | 100 | ||
96 | void OpieMail::slotEditSettings() | 101 | void OpieMail::slotEditSettings() |
diff --git a/noncore/net/mail/opiemail.h b/noncore/net/mail/opiemail.h index ebed5d8..69b8d43 100644 --- a/noncore/net/mail/opiemail.h +++ b/noncore/net/mail/opiemail.h | |||
@@ -1,30 +1,31 @@ | |||
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 <libmailwrapper/settings.h> | 5 | #include <libmailwrapper/settings.h> |
6 | 6 | ||
7 | 7 | ||
8 | class OpieMail : public MainWindow | 8 | class OpieMail : public MainWindow |
9 | { | 9 | { |
10 | Q_OBJECT | 10 | Q_OBJECT |
11 | 11 | ||
12 | public: | 12 | public: |
13 | OpieMail( QWidget *parent = 0, const char *name = 0, WFlags flags = 0 ); | 13 | OpieMail( QWidget *parent = 0, const char *name = 0, WFlags flags = 0 ); |
14 | virtual ~OpieMail(); | ||
14 | static QString appName() { return QString::fromLatin1("opiemail"); } | 15 | static QString appName() { return QString::fromLatin1("opiemail"); } |
15 | 16 | ||
16 | public slots: | 17 | public slots: |
17 | virtual void slotwriteMail(const QString&name,const QString&email); | 18 | virtual void slotwriteMail(const QString&name,const QString&email); |
18 | virtual void slotComposeMail(); | 19 | virtual void slotComposeMail(); |
19 | virtual void appMessage(const QCString &msg, const QByteArray &data); | 20 | virtual void appMessage(const QCString &msg, const QByteArray &data); |
20 | protected slots: | 21 | protected slots: |
21 | virtual void slotSendQueued(); | 22 | virtual void slotSendQueued(); |
22 | virtual void slotSearchMails(); | 23 | virtual void slotSearchMails(); |
23 | virtual void slotEditSettings(); | 24 | virtual void slotEditSettings(); |
24 | virtual void slotEditAccounts(); | 25 | virtual void slotEditAccounts(); |
25 | private: | 26 | private: |
26 | Settings *settings; | 27 | Settings *settings; |
27 | 28 | ||
28 | }; | 29 | }; |
29 | 30 | ||
30 | #endif | 31 | #endif |