author | zautrix <zautrix> | 2004-07-05 18:01:38 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-07-05 18:01:38 (UTC) |
commit | 6a826e654102e78abb6d14f80a3679575e5d3c9a (patch) (unidiff) | |
tree | 0dbc28b69c3b7614bd7c528034e8c1ef4b815de0 /kmicromail | |
parent | 9a90061115ee2cac8adc5b2d21e607b6c5c9b890 (diff) | |
download | kdepimpi-6a826e654102e78abb6d14f80a3679575e5d3c9a.zip kdepimpi-6a826e654102e78abb6d14f80a3679575e5d3c9a.tar.gz kdepimpi-6a826e654102e78abb6d14f80a3679575e5d3c9a.tar.bz2 |
WSTYLE changes in mail
-rw-r--r-- | kmicromail/main.cpp | 13 | ||||
-rw-r--r-- | kmicromail/mainwindow.cpp | 2 | ||||
-rw-r--r-- | kmicromail/opiemail.cpp | 2 |
3 files changed, 8 insertions, 9 deletions
diff --git a/kmicromail/main.cpp b/kmicromail/main.cpp index a4f6a06..8a093c6 100644 --- a/kmicromail/main.cpp +++ b/kmicromail/main.cpp | |||
@@ -1,58 +1,57 @@ | |||
1 | 1 | ||
2 | #ifndef DESKTOP_VERSION | 2 | #ifndef DESKTOP_VERSION |
3 | #include <qpe/qpeapplication.h> | 3 | #include <qpe/qpeapplication.h> |
4 | #include <stdlib.h> | 4 | #include <stdlib.h> |
5 | #else | 5 | #else |
6 | #include <qapplication.h> | 6 | #include <qapplication.h> |
7 | #include <qstring.h> | 7 | #include <qstring.h> |
8 | #include <qwindowsstyle.h> | 8 | #include <qwindowsstyle.h> |
9 | #include <qplatinumstyle.h> | 9 | #include <qplatinumstyle.h> |
10 | #include <qsgistyle.h> | 10 | #include <qsgistyle.h> |
11 | #endif | 11 | #endif |
12 | #include "opiemail.h" | 12 | #include "opiemail.h" |
13 | #include <qdir.h> | 13 | #include <qdir.h> |
14 | #include <kstandarddirs.h> | 14 | #include <kstandarddirs.h> |
15 | #include <kglobal.h> | 15 | #include <kglobal.h> |
16 | #include <stdio.h> | 16 | #include <stdio.h> |
17 | #include "mainwindow.h" | 17 | #include "mainwindow.h" |
18 | 18 | ||
19 | using namespace Opie::Core; | 19 | using namespace Opie::Core; |
20 | int main( int argc, char **argv ) { | 20 | int main( int argc, char **argv ) { |
21 | 21 | ||
22 | #ifndef DESKTOP_VERSION | 22 | #ifndef DESKTOP_VERSION |
23 | QPEApplication a( argc, argv ); | 23 | QPEApplication a( argc, argv ); |
24 | a.setKeepRunning (); | 24 | a.setKeepRunning (); |
25 | #else | 25 | #else |
26 | QApplication a( argc, argv ); | 26 | QApplication a( argc, argv ); |
27 | QApplication::setStyle( new QPlatinumStyle ()); | 27 | QApplication::setStyle( new QPlatinumStyle ()); |
28 | #endif | 28 | #endif |
29 | 29 | ||
30 | KGlobal::setAppName( "kmicromail" ); | 30 | KGlobal::setAppName( "kmicromail" ); |
31 | QString fileName ; | 31 | QString fileName ; |
32 | #ifndef DESKTOP_VERSION | 32 | #ifndef DESKTOP_VERSION |
33 | fileName = getenv("QPEDIR"); | 33 | fileName = getenv("QPEDIR"); |
34 | if ( QApplication::desktop()->width() > 320 ) | 34 | if ( QApplication::desktop()->width() > 320 ) |
35 | KGlobal::iconLoader()->setIconPath( fileName +"/pics/kdepim/kmicromail/icons22/"); | 35 | KGlobal::iconLoader()->setIconPath( fileName +"/pics/kdepim/kmicromail/icons22/"); |
36 | else | 36 | else |
37 | KGlobal::iconLoader()->setIconPath( fileName +"/pics/kdepim/kmicromail/"); | 37 | KGlobal::iconLoader()->setIconPath( fileName +"/pics/kdepim/kmicromail/"); |
38 | #else | 38 | #else |
39 | fileName = qApp->applicationDirPath () + "/kdepim/kmicromail/"; | 39 | fileName = qApp->applicationDirPath () + "/kdepim/kmicromail/"; |
40 | KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName)); | 40 | KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName)); |
41 | #endif | 41 | #endif |
42 | KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "kmicromail"))); | 42 | KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "kmicromail"))); |
43 | OpieMail* mw = new OpieMail(); | 43 | OpieMail mw; |
44 | #ifndef DESKTOP_VERSION | 44 | #ifndef DESKTOP_VERSION |
45 | //qDebug("CONNECT "); | 45 | //qDebug("CONNECT "); |
46 | QObject::connect( &a, SIGNAL (appMessage ( const QCString &, const QByteArray & )),mw, SLOT(message( const QCString&, const QByteArray& ))); | 46 | QObject::connect( &a, SIGNAL (appMessage ( const QCString &, const QByteArray & )),&mw, SLOT(message( const QCString&, const QByteArray& ))); |
47 | a.showMainWidget(mw ); | 47 | a.showMainWidget(&mw ); |
48 | #else | 48 | #else |
49 | a.setMainWidget(mw ); | 49 | a.setMainWidget(&mw ); |
50 | m.show(); | 50 | mw.show(); |
51 | //m.resize( 800, 600 ); | 51 | //m.resize( 800, 600 ); |
52 | #endif | ||
53 | QObject::connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit())); | 52 | QObject::connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit())); |
53 | #endif | ||
54 | int rv = a.exec(); | 54 | int rv = a.exec(); |
55 | delete mw; | ||
56 | return rv; | 55 | return rv; |
57 | 56 | ||
58 | } | 57 | } |
diff --git a/kmicromail/mainwindow.cpp b/kmicromail/mainwindow.cpp index a500dec..cd32c72 100644 --- a/kmicromail/mainwindow.cpp +++ b/kmicromail/mainwindow.cpp | |||
@@ -1,238 +1,238 @@ | |||
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 <kdialog.h> | 6 | #include <kdialog.h> |
7 | #include <kiconloader.h> | 7 | #include <kiconloader.h> |
8 | 8 | ||
9 | #ifndef DESKTOP_VERSION | 9 | #ifndef DESKTOP_VERSION |
10 | #include <qpe/qpeapplication.h> | 10 | #include <qpe/qpeapplication.h> |
11 | #endif | 11 | #endif |
12 | #include "defines.h" | 12 | #include "defines.h" |
13 | #include "mainwindow.h" | 13 | #include "mainwindow.h" |
14 | #include <KDGanttMinimizeSplitter.h> | 14 | #include <KDGanttMinimizeSplitter.h> |
15 | 15 | ||
16 | 16 | ||
17 | #include <kabc/stdaddressbook.h> | 17 | #include <kabc/stdaddressbook.h> |
18 | 18 | ||
19 | MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) | 19 | MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) |
20 | : QMainWindow( parent, name, flags ) | 20 | : QMainWindow( parent, name ) //, flags ) |
21 | { | 21 | { |
22 | setCaption( tr( "KMicroMail" ) ); | 22 | setCaption( tr( "KMicroMail" ) ); |
23 | setToolBarsMovable( false ); | 23 | setToolBarsMovable( false ); |
24 | KABC::StdAddressBook::self(); | 24 | KABC::StdAddressBook::self(); |
25 | toolBar = new QToolBar( this ); | 25 | toolBar = new QToolBar( this ); |
26 | menuBar = new QMenuBar( toolBar ); | 26 | menuBar = new QMenuBar( toolBar ); |
27 | mailMenu = new QPopupMenu( menuBar ); | 27 | mailMenu = new QPopupMenu( menuBar ); |
28 | menuBar->insertItem( tr( "Mail" ), mailMenu ); | 28 | menuBar->insertItem( tr( "Mail" ), mailMenu ); |
29 | settingsMenu = new QPopupMenu( menuBar ); | 29 | settingsMenu = new QPopupMenu( menuBar ); |
30 | menuBar->insertItem( tr( "Settings" ), settingsMenu ); | 30 | menuBar->insertItem( tr( "Settings" ), settingsMenu ); |
31 | 31 | ||
32 | addToolBar( toolBar ); | 32 | addToolBar( toolBar ); |
33 | toolBar->setHorizontalStretchable( true ); | 33 | toolBar->setHorizontalStretchable( true ); |
34 | 34 | ||
35 | 35 | ||
36 | 36 | ||
37 | composeMail = new QAction( tr( "Compose new mail" ), SmallIcon("composemail"), | 37 | composeMail = new QAction( tr( "Compose new mail" ), SmallIcon("composemail"), |
38 | 0, 0, this ); | 38 | 0, 0, this ); |
39 | composeMail->addTo( toolBar ); | 39 | composeMail->addTo( toolBar ); |
40 | composeMail->addTo( mailMenu ); | 40 | composeMail->addTo( mailMenu ); |
41 | 41 | ||
42 | sendQueued = new QAction( tr( "Send queued mails" ), SmallIcon("sendqueued") , | 42 | sendQueued = new QAction( tr( "Send queued mails" ), SmallIcon("sendqueued") , |
43 | 0, 0, this ); | 43 | 0, 0, this ); |
44 | sendQueued->addTo( toolBar ); | 44 | sendQueued->addTo( toolBar ); |
45 | sendQueued->addTo( mailMenu ); | 45 | sendQueued->addTo( mailMenu ); |
46 | 46 | ||
47 | /* | 47 | /* |
48 | syncFolders = new QAction( tr( "Sync mailfolders" ), ICON_SYNC, | 48 | syncFolders = new QAction( tr( "Sync mailfolders" ), ICON_SYNC, |
49 | 0, 0, this ); | 49 | 0, 0, this ); |
50 | syncFolders->addTo( toolBar ); | 50 | syncFolders->addTo( toolBar ); |
51 | syncFolders->addTo( mailMenu ); | 51 | syncFolders->addTo( mailMenu ); |
52 | */ | 52 | */ |
53 | 53 | ||
54 | showFolders = new QAction( tr( "Show/Hide folders" ), SmallIcon("showfolders") , | 54 | showFolders = new QAction( tr( "Show/Hide folders" ), SmallIcon("showfolders") , |
55 | 0, 0, this, 0, true ); | 55 | 0, 0, this, 0, true ); |
56 | showFolders->addTo( toolBar ); | 56 | showFolders->addTo( toolBar ); |
57 | showFolders->addTo( mailMenu ); | 57 | showFolders->addTo( mailMenu ); |
58 | showFolders->setOn( true ); | 58 | showFolders->setOn( true ); |
59 | connect(showFolders, SIGNAL( toggled(bool) ), | 59 | connect(showFolders, SIGNAL( toggled(bool) ), |
60 | SLOT( slotShowFolders(bool) ) ); | 60 | SLOT( slotShowFolders(bool) ) ); |
61 | 61 | ||
62 | /* | 62 | /* |
63 | searchMails = new QAction( tr( "Search mails" ), SmallIcon("find") ), | 63 | searchMails = new QAction( tr( "Search mails" ), SmallIcon("find") ), |
64 | 0, 0, this ); | 64 | 0, 0, this ); |
65 | searchMails->addTo( toolBar ); | 65 | searchMails->addTo( toolBar ); |
66 | searchMails->addTo( mailMenu ); | 66 | searchMails->addTo( mailMenu ); |
67 | */ | 67 | */ |
68 | 68 | ||
69 | deleteMails = new QAction(tr("Delete Mail"), SmallIcon("trash"), 0, 0, this); | 69 | deleteMails = new QAction(tr("Delete Mail"), SmallIcon("trash"), 0, 0, this); |
70 | deleteMails->addTo( toolBar ); | 70 | deleteMails->addTo( toolBar ); |
71 | deleteMails->addTo( mailMenu ); | 71 | deleteMails->addTo( mailMenu ); |
72 | connect( deleteMails, SIGNAL( activated() ), | 72 | connect( deleteMails, SIGNAL( activated() ), |
73 | SLOT( slotDeleteMail() ) ); | 73 | SLOT( slotDeleteMail() ) ); |
74 | 74 | ||
75 | editSettings = new QAction( tr( "Edit settings" ), SmallIcon("SettingsIcon") , | 75 | editSettings = new QAction( tr( "Edit settings" ), SmallIcon("SettingsIcon") , |
76 | 0, 0, this ); | 76 | 0, 0, this ); |
77 | editSettings->addTo( settingsMenu ); | 77 | editSettings->addTo( settingsMenu ); |
78 | connect( editSettings, SIGNAL( activated() ), | 78 | connect( editSettings, SIGNAL( activated() ), |
79 | SLOT( slotEditSettings() ) ); | 79 | SLOT( slotEditSettings() ) ); |
80 | editAccounts = new QAction( tr( "Configure accounts" ), SmallIcon("editaccounts") , | 80 | editAccounts = new QAction( tr( "Configure accounts" ), SmallIcon("editaccounts") , |
81 | 0, 0, this ); | 81 | 0, 0, this ); |
82 | editAccounts->addTo( settingsMenu ); | 82 | editAccounts->addTo( settingsMenu ); |
83 | 83 | ||
84 | //setCentralWidget( view ); | 84 | //setCentralWidget( view ); |
85 | 85 | ||
86 | QVBox* wrapperBox = new QVBox( this ); | 86 | QVBox* wrapperBox = new QVBox( this ); |
87 | setCentralWidget( wrapperBox ); | 87 | setCentralWidget( wrapperBox ); |
88 | 88 | ||
89 | // QWidget *view = new QWidget( wrapperBox ); | 89 | // QWidget *view = new QWidget( wrapperBox ); |
90 | KDGanttMinimizeSplitter* split = new KDGanttMinimizeSplitter( Qt::Horizontal, wrapperBox); | 90 | KDGanttMinimizeSplitter* split = new KDGanttMinimizeSplitter( Qt::Horizontal, wrapperBox); |
91 | split->setMinimizeDirection( KDGanttMinimizeSplitter::Left); | 91 | split->setMinimizeDirection( KDGanttMinimizeSplitter::Left); |
92 | //layout = new QBoxLayout ( split, QBoxLayout::LeftToRight ); | 92 | //layout = new QBoxLayout ( split, QBoxLayout::LeftToRight ); |
93 | 93 | ||
94 | folderView = new AccountView( split ); | 94 | folderView = new AccountView( split ); |
95 | folderView->header()->hide(); | 95 | folderView->header()->hide(); |
96 | folderView->setRootIsDecorated( false ); | 96 | folderView->setRootIsDecorated( false ); |
97 | folderView->addColumn( tr( "Mailbox" ) ); | 97 | folderView->addColumn( tr( "Mailbox" ) ); |
98 | 98 | ||
99 | //layout->addWidget( folderView ); | 99 | //layout->addWidget( folderView ); |
100 | 100 | ||
101 | mailView = new QListView( split ); | 101 | mailView = new QListView( split ); |
102 | mailView->addColumn( tr( " " ) ); | 102 | mailView->addColumn( tr( " " ) ); |
103 | mailView->addColumn( tr( "Subject" ),QListView::Manual ); | 103 | mailView->addColumn( tr( "Subject" ),QListView::Manual ); |
104 | mailView->addColumn( tr( "Sender" ),QListView::Manual ); | 104 | mailView->addColumn( tr( "Sender" ),QListView::Manual ); |
105 | mailView->addColumn( tr( "Size" ),QListView::Manual); | 105 | mailView->addColumn( tr( "Size" ),QListView::Manual); |
106 | mailView->addColumn( tr( "Date" ),QListView::Manual); | 106 | mailView->addColumn( tr( "Date" ),QListView::Manual); |
107 | mailView->setAllColumnsShowFocus(true); | 107 | mailView->setAllColumnsShowFocus(true); |
108 | //mailView->setSorting(-1); | 108 | //mailView->setSorting(-1); |
109 | mailView->setRootIsDecorated( false ); | 109 | mailView->setRootIsDecorated( false ); |
110 | statusWidget = new StatusWidget( wrapperBox ); | 110 | statusWidget = new StatusWidget( wrapperBox ); |
111 | statusWidget->hide(); | 111 | statusWidget->hide(); |
112 | 112 | ||
113 | //layout->addWidget( mailView ); | 113 | //layout->addWidget( mailView ); |
114 | //layout->setStretchFactor( folderView, 1 ); | 114 | //layout->setStretchFactor( folderView, 1 ); |
115 | //layout->setStretchFactor( mailView, 2 ); | 115 | //layout->setStretchFactor( mailView, 2 ); |
116 | 116 | ||
117 | slotAdjustLayout(); | 117 | slotAdjustLayout(); |
118 | #ifndef DESKTOP_VERSION | 118 | #ifndef DESKTOP_VERSION |
119 | QPEApplication::setStylusOperation( mailView->viewport(),QPEApplication::RightOnHold); | 119 | QPEApplication::setStylusOperation( mailView->viewport(),QPEApplication::RightOnHold); |
120 | QPEApplication::setStylusOperation( folderView->viewport(),QPEApplication::RightOnHold); | 120 | QPEApplication::setStylusOperation( folderView->viewport(),QPEApplication::RightOnHold); |
121 | #endif | 121 | #endif |
122 | connect( mailView, SIGNAL( doubleClicked (QListViewItem* )),this, | 122 | connect( mailView, SIGNAL( doubleClicked (QListViewItem* )),this, |
123 | SLOT( mailLeftClicked(QListViewItem*) ) ); | 123 | SLOT( mailLeftClicked(QListViewItem*) ) ); |
124 | connect( mailView, SIGNAL( returnPressed (QListViewItem* )),this, | 124 | connect( mailView, SIGNAL( returnPressed (QListViewItem* )),this, |
125 | SLOT( mailLeftClicked(QListViewItem*) ) ); | 125 | SLOT( mailLeftClicked(QListViewItem*) ) ); |
126 | connect( mailView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),this, | 126 | connect( mailView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),this, |
127 | SLOT( mailHold(int,QListViewItem*,const QPoint&,int) ) ); | 127 | SLOT( mailHold(int,QListViewItem*,const QPoint&,int) ) ); |
128 | connect(folderView, SIGNAL(refreshMailview(const QValueList<RecMailP>&)), | 128 | connect(folderView, SIGNAL(refreshMailview(const QValueList<RecMailP>&)), |
129 | this,SLOT(refreshMailView(const QValueList<RecMailP>&))); | 129 | this,SLOT(refreshMailView(const QValueList<RecMailP>&))); |
130 | connect( composeMail, SIGNAL( activated() ), SLOT( slotComposeMail() ) ); | 130 | connect( composeMail, SIGNAL( activated() ), SLOT( slotComposeMail() ) ); |
131 | connect( sendQueued, SIGNAL( activated() ), SLOT( slotSendQueued() ) ); | 131 | connect( sendQueued, SIGNAL( activated() ), SLOT( slotSendQueued() ) ); |
132 | // connect( searchMails, SIGNAL( activated() ), SLOT( slotSearchMails() ) ); | 132 | // connect( searchMails, SIGNAL( activated() ), SLOT( slotSearchMails() ) ); |
133 | connect( editAccounts, SIGNAL( activated() ), SLOT( slotEditAccounts() ) ); | 133 | connect( editAccounts, SIGNAL( activated() ), SLOT( slotEditAccounts() ) ); |
134 | //mailView->setMultiSelection ( true ); | 134 | //mailView->setMultiSelection ( true ); |
135 | mailView->setSelectionMode( QListView::Extended ); | 135 | mailView->setSelectionMode( QListView::Extended ); |
136 | QValueList<int> list; | 136 | QValueList<int> list; |
137 | int fw = 100; | 137 | int fw = 100; |
138 | if ( QApplication::desktop()->width() > 320 ) | 138 | if ( QApplication::desktop()->width() > 320 ) |
139 | fw = 50; | 139 | fw = 50; |
140 | list.append( fw ); | 140 | list.append( fw ); |
141 | list.append( 100 ); | 141 | list.append( 100 ); |
142 | split->setSizes( list ); | 142 | split->setSizes( list ); |
143 | QTimer::singleShot( 1000, this, SLOT( slotAdjustColumns() ) ); | 143 | QTimer::singleShot( 1000, this, SLOT( slotAdjustColumns() ) ); |
144 | mailView->setShowSortIndicator ( true ); | 144 | mailView->setShowSortIndicator ( true ); |
145 | QLabel *spacer = new QLabel( toolBar ); | 145 | QLabel *spacer = new QLabel( toolBar ); |
146 | spacer->setBackgroundMode( QWidget::PaletteButton ); | 146 | spacer->setBackgroundMode( QWidget::PaletteButton ); |
147 | toolBar->setStretchableWidget( spacer ); | 147 | toolBar->setStretchableWidget( spacer ); |
148 | 148 | ||
149 | QAction* closeMail = new QAction(tr("Close"),SmallIcon("exit"), 0, 0, this); | 149 | QAction* closeMail = new QAction(tr("Close"),SmallIcon("exit"), 0, 0, this); |
150 | connect( closeMail, SIGNAL( activated() ), SLOT( close() ) ); | 150 | connect( closeMail, SIGNAL( activated() ), SLOT( close() ) ); |
151 | closeMail->addTo(toolBar); | 151 | closeMail->addTo(toolBar); |
152 | closeMail->addTo(mailMenu); | 152 | closeMail->addTo(mailMenu); |
153 | } | 153 | } |
154 | 154 | ||
155 | MainWindow::~MainWindow() | 155 | MainWindow::~MainWindow() |
156 | { | 156 | { |
157 | } | 157 | } |
158 | 158 | ||
159 | void MainWindow::appMessage(const QCString &, const QByteArray &) | 159 | void MainWindow::appMessage(const QCString &, const QByteArray &) |
160 | { | 160 | { |
161 | qDebug("appMessage implemented by subclass"); | 161 | qDebug("appMessage implemented by subclass"); |
162 | } | 162 | } |
163 | 163 | ||
164 | void MainWindow::slotAdjustLayout() { | 164 | void MainWindow::slotAdjustLayout() { |
165 | 165 | ||
166 | /* | 166 | /* |
167 | QWidget *d = QApplication::desktop(); | 167 | QWidget *d = QApplication::desktop(); |
168 | 168 | ||
169 | if ( d->width() < d->height() ) { | 169 | if ( d->width() < d->height() ) { |
170 | layout->setDirection( QBoxLayout::TopToBottom ); | 170 | layout->setDirection( QBoxLayout::TopToBottom ); |
171 | } else { | 171 | } else { |
172 | layout->setDirection( QBoxLayout::LeftToRight ); | 172 | layout->setDirection( QBoxLayout::LeftToRight ); |
173 | } | 173 | } |
174 | */ | 174 | */ |
175 | } | 175 | } |
176 | 176 | ||
177 | void MainWindow::slotAdjustColumns() | 177 | void MainWindow::slotAdjustColumns() |
178 | { | 178 | { |
179 | bool hidden = folderView->isHidden(); | 179 | bool hidden = folderView->isHidden(); |
180 | if ( hidden ) folderView->show(); | 180 | if ( hidden ) folderView->show(); |
181 | folderView->setColumnWidth( 0, folderView->visibleWidth() ); | 181 | folderView->setColumnWidth( 0, folderView->visibleWidth() ); |
182 | if ( hidden ) folderView->hide(); | 182 | if ( hidden ) folderView->hide(); |
183 | 183 | ||
184 | mailView->setColumnWidth( 0, 10 ); | 184 | mailView->setColumnWidth( 0, 10 ); |
185 | mailView->setColumnWidth( 1, 100 ); | 185 | mailView->setColumnWidth( 1, 100 ); |
186 | mailView->setColumnWidth( 2, 100 ); | 186 | mailView->setColumnWidth( 2, 100 ); |
187 | mailView->setColumnWidth( 3, 50 ); | 187 | mailView->setColumnWidth( 3, 50 ); |
188 | mailView->setColumnWidth( 4, 120 ); | 188 | mailView->setColumnWidth( 4, 120 ); |
189 | } | 189 | } |
190 | 190 | ||
191 | void MainWindow::slotEditSettings() | 191 | void MainWindow::slotEditSettings() |
192 | { | 192 | { |
193 | } | 193 | } |
194 | 194 | ||
195 | void MainWindow::slotShowFolders( bool ) | 195 | void MainWindow::slotShowFolders( bool ) |
196 | { | 196 | { |
197 | qDebug("not implemented: "); | 197 | qDebug("not implemented: "); |
198 | } | 198 | } |
199 | 199 | ||
200 | void MainWindow::refreshMailView(const QValueList<RecMailP>&) | 200 | void MainWindow::refreshMailView(const QValueList<RecMailP>&) |
201 | { | 201 | { |
202 | qDebug("not implemented: "); | 202 | qDebug("not implemented: "); |
203 | } | 203 | } |
204 | 204 | ||
205 | void MainWindow::mailLeftClicked(QListViewItem * ) | 205 | void MainWindow::mailLeftClicked(QListViewItem * ) |
206 | { | 206 | { |
207 | qDebug("not implemented: "); | 207 | qDebug("not implemented: "); |
208 | } | 208 | } |
209 | 209 | ||
210 | void MainWindow::displayMail() | 210 | void MainWindow::displayMail() |
211 | { | 211 | { |
212 | qDebug("not implemented: "); | 212 | qDebug("not implemented: "); |
213 | } | 213 | } |
214 | 214 | ||
215 | void MainWindow::slotDeleteMail() | 215 | void MainWindow::slotDeleteMail() |
216 | { | 216 | { |
217 | qDebug("not implemented: "); | 217 | qDebug("not implemented: "); |
218 | } | 218 | } |
219 | 219 | ||
220 | void MainWindow::mailHold(int, QListViewItem *,const QPoint&,int ) | 220 | void MainWindow::mailHold(int, QListViewItem *,const QPoint&,int ) |
221 | { | 221 | { |
222 | qDebug("not implemented: "); | 222 | qDebug("not implemented: "); |
223 | } | 223 | } |
224 | 224 | ||
225 | void MainWindow::slotSendQueued() | 225 | void MainWindow::slotSendQueued() |
226 | { | 226 | { |
227 | qDebug("not implemented: "); | 227 | qDebug("not implemented: "); |
228 | } | 228 | } |
229 | 229 | ||
230 | void MainWindow::slotEditAccounts() | 230 | void MainWindow::slotEditAccounts() |
231 | { | 231 | { |
232 | qDebug("not implemented: "); | 232 | qDebug("not implemented: "); |
233 | } | 233 | } |
234 | 234 | ||
235 | void MainWindow::slotComposeMail() | 235 | void MainWindow::slotComposeMail() |
236 | { | 236 | { |
237 | qDebug("not implemented: "); | 237 | qDebug("not implemented: "); |
238 | } | 238 | } |
diff --git a/kmicromail/opiemail.cpp b/kmicromail/opiemail.cpp index bdbd93a..70fbcb2 100644 --- a/kmicromail/opiemail.cpp +++ b/kmicromail/opiemail.cpp | |||
@@ -1,363 +1,363 @@ | |||
1 | 1 | ||
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 "mailistviewitem.h" | 6 | #include "mailistviewitem.h" |
7 | #include "viewmail.h" | 7 | #include "viewmail.h" |
8 | #include "selectstore.h" | 8 | #include "selectstore.h" |
9 | #include "selectsmtp.h" | 9 | #include "selectsmtp.h" |
10 | 10 | ||
11 | #include <qmessagebox.h> | 11 | #include <qmessagebox.h> |
12 | 12 | ||
13 | #include <qpe/qpeapplication.h> | 13 | #include <qpe/qpeapplication.h> |
14 | #include <libmailwrapper/smtpwrapper.h> | 14 | #include <libmailwrapper/smtpwrapper.h> |
15 | #include <libmailwrapper/mailtypes.h> | 15 | #include <libmailwrapper/mailtypes.h> |
16 | #include <libmailwrapper/abstractmail.h> | 16 | #include <libmailwrapper/abstractmail.h> |
17 | /* OPIE */ | 17 | /* OPIE */ |
18 | //#include <qpe/resource.h> | 18 | //#include <qpe/resource.h> |
19 | #include <qpe/qpeapplication.h> | 19 | #include <qpe/qpeapplication.h> |
20 | 20 | ||
21 | /* QT */ | 21 | /* QT */ |
22 | 22 | ||
23 | using namespace Opie::Core; | 23 | using namespace Opie::Core; |
24 | 24 | ||
25 | OpieMail::OpieMail( QWidget *parent, const char *name, WFlags flags ) | 25 | OpieMail::OpieMail( QWidget *parent, const char *name, WFlags flags ) |
26 | : MainWindow( parent, name, WStyle_ContextHelp ) | 26 | : MainWindow( parent, name) //, WStyle_ContextHelp ) |
27 | { | 27 | { |
28 | settings = new Settings(); | 28 | settings = new Settings(); |
29 | 29 | ||
30 | folderView->populate( settings->getAccounts() ); | 30 | folderView->populate( settings->getAccounts() ); |
31 | 31 | ||
32 | } | 32 | } |
33 | 33 | ||
34 | OpieMail::~OpieMail() | 34 | OpieMail::~OpieMail() |
35 | { | 35 | { |
36 | if (settings) delete settings; | 36 | if (settings) delete settings; |
37 | } | 37 | } |
38 | 38 | ||
39 | void OpieMail::appMessage(const QCString &msg, const QByteArray &data) | 39 | void OpieMail::appMessage(const QCString &msg, const QByteArray &data) |
40 | { | 40 | { |
41 | 41 | ||
42 | } | 42 | } |
43 | #include <stdlib.h> | 43 | #include <stdlib.h> |
44 | void OpieMail::message(const QCString &msg, const QByteArray &data) | 44 | void OpieMail::message(const QCString &msg, const QByteArray &data) |
45 | { | 45 | { |
46 | // copied from old mail2 | 46 | // copied from old mail2 |
47 | static int ii = 0; | 47 | static int ii = 0; |
48 | 48 | ||
49 | // block second call | 49 | // block second call |
50 | if ( ii < 2 ) { | 50 | if ( ii < 2 ) { |
51 | ++ii; | 51 | ++ii; |
52 | if ( ii > 1 ) { | 52 | if ( ii > 1 ) { |
53 | qDebug("qcop call blocked "); | 53 | qDebug("qcop call blocked "); |
54 | return; | 54 | return; |
55 | } | 55 | } |
56 | } | 56 | } |
57 | //qDebug("KM:appMessage %d *%s* %x", ii, msg.data(), this); | 57 | //qDebug("KM:appMessage %d *%s* %x", ii, msg.data(), this); |
58 | if (msg == "writeMail(QString,QString)") | 58 | if (msg == "writeMail(QString,QString)") |
59 | { | 59 | { |
60 | QDataStream stream(data,IO_ReadOnly); | 60 | QDataStream stream(data,IO_ReadOnly); |
61 | QString name, email; | 61 | QString name, email; |
62 | stream >> name >> email; | 62 | stream >> name >> email; |
63 | // removing the whitespaces at beginning and end is needed! | 63 | // removing the whitespaces at beginning and end is needed! |
64 | slotwriteMail(name.stripWhiteSpace(),email.stripWhiteSpace()); | 64 | slotwriteMail(name.stripWhiteSpace(),email.stripWhiteSpace()); |
65 | } | 65 | } |
66 | else if (msg == "newMail()") | 66 | else if (msg == "newMail()") |
67 | { | 67 | { |
68 | slotComposeMail(); | 68 | slotComposeMail(); |
69 | } | 69 | } |
70 | else if (msg == "newMail(QString)") | 70 | else if (msg == "newMail(QString)") |
71 | { | 71 | { |
72 | QDataStream stream(data,IO_ReadOnly); | 72 | QDataStream stream(data,IO_ReadOnly); |
73 | QString nameemail; | 73 | QString nameemail; |
74 | stream >> nameemail; | 74 | stream >> nameemail; |
75 | // the format is | 75 | // the format is |
76 | // NAME <EMAIL>:SUBJECT | 76 | // NAME <EMAIL>:SUBJECT |
77 | //qDebug("message %s ", nameemail.latin1()); | 77 | //qDebug("message %s ", nameemail.latin1()); |
78 | 78 | ||
79 | slotwriteMail2( nameemail ); | 79 | slotwriteMail2( nameemail ); |
80 | } | 80 | } |
81 | } | 81 | } |
82 | void OpieMail::slotwriteMail2(const QString& namemail ) | 82 | void OpieMail::slotwriteMail2(const QString& namemail ) |
83 | { | 83 | { |
84 | // qDebug("OpieMail::slotwriteMail2 "); | 84 | // qDebug("OpieMail::slotwriteMail2 "); |
85 | qApp->processEvents(); | 85 | qApp->processEvents(); |
86 | ComposeMail compose( settings, this, 0, true ); | 86 | ComposeMail compose( settings, this, 0, true ); |
87 | if ( !namemail.isEmpty() ) { | 87 | if ( !namemail.isEmpty() ) { |
88 | QString to = namemail; | 88 | QString to = namemail; |
89 | if ( namemail.find( " <") > 1 ) { | 89 | if ( namemail.find( " <") > 1 ) { |
90 | to = "\"" +to.replace( QRegExp( " <"), "\" <") ; | 90 | to = "\"" +to.replace( QRegExp( " <"), "\" <") ; |
91 | } else | 91 | } else |
92 | if ( namemail.find( "<") > 1 ) { | 92 | if ( namemail.find( "<") > 1 ) { |
93 | to = "\"" +to.replace( QRegExp( "<"), "\" <") ; | 93 | to = "\"" +to.replace( QRegExp( "<"), "\" <") ; |
94 | } | 94 | } |
95 | int sub = to.find( ">:"); | 95 | int sub = to.find( ">:"); |
96 | if ( sub > 0 ) { | 96 | if ( sub > 0 ) { |
97 | compose.setTo( to.left(sub+1) ); | 97 | compose.setTo( to.left(sub+1) ); |
98 | compose.setSubject( to.mid(sub+2) ); | 98 | compose.setSubject( to.mid(sub+2) ); |
99 | } else | 99 | } else |
100 | compose.setTo( to ); | 100 | compose.setTo( to ); |
101 | } | 101 | } |
102 | compose.slotAdjustColumns(); | 102 | compose.slotAdjustColumns(); |
103 | compose.showMaximized(); | 103 | compose.showMaximized(); |
104 | compose.exec(); | 104 | compose.exec(); |
105 | //qDebug("retttich "); | 105 | //qDebug("retttich "); |
106 | } | 106 | } |
107 | void OpieMail::slotwriteMail(const QString&name,const QString&email) | 107 | void OpieMail::slotwriteMail(const QString&name,const QString&email) |
108 | { | 108 | { |
109 | // qDebug("OpieMail::slotwriteMail "); | 109 | // qDebug("OpieMail::slotwriteMail "); |
110 | ComposeMail compose( settings, this, 0, true , WStyle_ContextHelp ); | 110 | ComposeMail compose( settings, this, 0, true , WStyle_ContextHelp ); |
111 | if (!email.isEmpty()) | 111 | if (!email.isEmpty()) |
112 | { | 112 | { |
113 | if (!name.isEmpty()) | 113 | if (!name.isEmpty()) |
114 | { | 114 | { |
115 | compose.setTo("\"" + name + "\"" + " " + "<"+ email + ">"); | 115 | compose.setTo("\"" + name + "\"" + " " + "<"+ email + ">"); |
116 | } | 116 | } |
117 | else | 117 | else |
118 | { | 118 | { |
119 | compose.setTo(email); | 119 | compose.setTo(email); |
120 | } | 120 | } |
121 | } | 121 | } |
122 | compose.slotAdjustColumns(); | 122 | compose.slotAdjustColumns(); |
123 | compose.showMaximized(); | 123 | compose.showMaximized(); |
124 | compose.exec(); | 124 | compose.exec(); |
125 | } | 125 | } |
126 | 126 | ||
127 | void OpieMail::slotComposeMail() | 127 | void OpieMail::slotComposeMail() |
128 | { | 128 | { |
129 | slotwriteMail2( QString () ); | 129 | slotwriteMail2( QString () ); |
130 | //slotwriteMail(0l,0l); | 130 | //slotwriteMail(0l,0l); |
131 | } | 131 | } |
132 | 132 | ||
133 | void OpieMail::slotSendQueued() | 133 | void OpieMail::slotSendQueued() |
134 | { | 134 | { |
135 | SMTPaccount *smtp = 0; | 135 | SMTPaccount *smtp = 0; |
136 | 136 | ||
137 | QList<Account> list = settings->getAccounts(); | 137 | QList<Account> list = settings->getAccounts(); |
138 | QList<SMTPaccount> smtpList; | 138 | QList<SMTPaccount> smtpList; |
139 | smtpList.setAutoDelete(false); | 139 | smtpList.setAutoDelete(false); |
140 | Account *it; | 140 | Account *it; |
141 | for ( it = list.first(); it; it = list.next() ) | 141 | for ( it = list.first(); it; it = list.next() ) |
142 | { | 142 | { |
143 | if ( it->getType() == MAILLIB::A_SMTP ) | 143 | if ( it->getType() == MAILLIB::A_SMTP ) |
144 | { | 144 | { |
145 | smtp = static_cast<SMTPaccount *>(it); | 145 | smtp = static_cast<SMTPaccount *>(it); |
146 | smtpList.append(smtp); | 146 | smtpList.append(smtp); |
147 | } | 147 | } |
148 | } | 148 | } |
149 | if (smtpList.count()==0) | 149 | if (smtpList.count()==0) |
150 | { | 150 | { |
151 | QMessageBox::information(0,tr("Info"),tr("Define a smtp account first!\n")); | 151 | QMessageBox::information(0,tr("Info"),tr("Define a smtp account first!\n")); |
152 | return; | 152 | return; |
153 | } | 153 | } |
154 | if (smtpList.count()==1) | 154 | if (smtpList.count()==1) |
155 | { | 155 | { |
156 | smtp = smtpList.at(0); | 156 | smtp = smtpList.at(0); |
157 | } | 157 | } |
158 | else | 158 | else |
159 | { | 159 | { |
160 | smtp = 0; | 160 | smtp = 0; |
161 | selectsmtp selsmtp; | 161 | selectsmtp selsmtp; |
162 | selsmtp.setSelectionlist(&smtpList); | 162 | selsmtp.setSelectionlist(&smtpList); |
163 | selsmtp.showMaximized(); | 163 | selsmtp.showMaximized(); |
164 | if ( selsmtp.exec() == QDialog::Accepted ) | 164 | if ( selsmtp.exec() == QDialog::Accepted ) |
165 | { | 165 | { |
166 | smtp = selsmtp.selected_smtp(); | 166 | smtp = selsmtp.selected_smtp(); |
167 | } | 167 | } |
168 | } | 168 | } |
169 | if (smtp) | 169 | if (smtp) |
170 | { | 170 | { |
171 | SMTPwrapper * wrap = new SMTPwrapper(smtp); | 171 | SMTPwrapper * wrap = new SMTPwrapper(smtp); |
172 | if ( wrap->flushOutbox() ) | 172 | if ( wrap->flushOutbox() ) |
173 | { | 173 | { |
174 | QMessageBox::information(0,tr("Info"),tr("Mail queue flushed")); | 174 | QMessageBox::information(0,tr("Info"),tr("Mail queue flushed")); |
175 | } | 175 | } |
176 | delete wrap; | 176 | delete wrap; |
177 | } | 177 | } |
178 | } | 178 | } |
179 | 179 | ||
180 | void OpieMail::slotSearchMails() | 180 | void OpieMail::slotSearchMails() |
181 | { | 181 | { |
182 | qDebug("OpieMail::slotSearchMails():not implemented "); | 182 | qDebug("OpieMail::slotSearchMails():not implemented "); |
183 | } | 183 | } |
184 | 184 | ||
185 | void OpieMail::slotEditSettings() | 185 | void OpieMail::slotEditSettings() |
186 | { | 186 | { |
187 | SettingsDialog settingsDialog( this, 0, true, WStyle_ContextHelp ); | 187 | SettingsDialog settingsDialog( this, 0, true, WStyle_ContextHelp ); |
188 | settingsDialog.showMaximized(); | 188 | settingsDialog.showMaximized(); |
189 | settingsDialog.exec(); | 189 | settingsDialog.exec(); |
190 | } | 190 | } |
191 | 191 | ||
192 | void OpieMail::slotEditAccounts() | 192 | void OpieMail::slotEditAccounts() |
193 | { | 193 | { |
194 | EditAccounts eaDialog( settings, this, 0, true, WStyle_ContextHelp ); | 194 | EditAccounts eaDialog( settings, this, 0, true, WStyle_ContextHelp ); |
195 | eaDialog.slotAdjustColumns(); | 195 | eaDialog.slotAdjustColumns(); |
196 | eaDialog.showMaximized(); | 196 | eaDialog.showMaximized(); |
197 | eaDialog.exec(); | 197 | eaDialog.exec(); |
198 | if ( settings ) delete settings; | 198 | if ( settings ) delete settings; |
199 | settings = new Settings(); | 199 | settings = new Settings(); |
200 | 200 | ||
201 | folderView->populate( settings->getAccounts() ); | 201 | folderView->populate( settings->getAccounts() ); |
202 | } | 202 | } |
203 | 203 | ||
204 | void OpieMail::displayMail() | 204 | void OpieMail::displayMail() |
205 | { | 205 | { |
206 | QListViewItem*item = mailView->currentItem(); | 206 | QListViewItem*item = mailView->currentItem(); |
207 | if (!item) return; | 207 | if (!item) return; |
208 | RecMailP mail = ((MailListViewItem*)item)->data(); | 208 | RecMailP mail = ((MailListViewItem*)item)->data(); |
209 | RecBodyP body = folderView->fetchBody(mail); | 209 | RecBodyP body = folderView->fetchBody(mail); |
210 | ViewMail readMail( this,"", Qt::WType_Modal | WStyle_ContextHelp ); | 210 | ViewMail readMail( this,"", Qt::WType_Modal | WStyle_ContextHelp ); |
211 | readMail.setBody( body ); | 211 | readMail.setBody( body ); |
212 | readMail.setMail( mail ); | 212 | readMail.setMail( mail ); |
213 | readMail.showMaximized(); | 213 | readMail.showMaximized(); |
214 | readMail.exec(); | 214 | readMail.exec(); |
215 | 215 | ||
216 | if ( readMail.deleted ) | 216 | if ( readMail.deleted ) |
217 | { | 217 | { |
218 | folderView->refreshCurrent(); | 218 | folderView->refreshCurrent(); |
219 | } | 219 | } |
220 | else | 220 | else |
221 | { | 221 | { |
222 | ( (MailListViewItem*)item )->setPixmap( 0, QPixmap() ); | 222 | ( (MailListViewItem*)item )->setPixmap( 0, QPixmap() ); |
223 | } | 223 | } |
224 | } | 224 | } |
225 | 225 | ||
226 | void OpieMail::slotDeleteMail() | 226 | void OpieMail::slotDeleteMail() |
227 | { | 227 | { |
228 | if (!mailView->currentItem()) return; | 228 | if (!mailView->currentItem()) return; |
229 | RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data(); | 229 | RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data(); |
230 | if ( QMessageBox::warning(this, tr("Delete Mail"), QString( tr("<p>Do you really want to delete this mail? <br><br>" ) + mail->getFrom() + " - " + mail->getSubject() ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) | 230 | if ( QMessageBox::warning(this, tr("Delete Mail"), QString( tr("<p>Do you really want to delete this mail? <br><br>" ) + mail->getFrom() + " - " + mail->getSubject() ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) |
231 | { | 231 | { |
232 | mail->Wrapper()->deleteMail( mail ); | 232 | mail->Wrapper()->deleteMail( mail ); |
233 | folderView->refreshCurrent(); | 233 | folderView->refreshCurrent(); |
234 | } | 234 | } |
235 | } | 235 | } |
236 | void OpieMail::slotDeleteAllMail() | 236 | void OpieMail::slotDeleteAllMail() |
237 | { | 237 | { |
238 | if (!mailView->currentItem()) return; | 238 | if (!mailView->currentItem()) return; |
239 | RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data(); | 239 | RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data(); |
240 | if ( QMessageBox::warning(this, tr("Delete All Mails"), tr("Do you really want to delete\nall selected mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) | 240 | if ( QMessageBox::warning(this, tr("Delete All Mails"), tr("Do you really want to delete\nall selected mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) |
241 | { | 241 | { |
242 | MailListViewItem* item = (MailListViewItem*)mailView->firstChild (); | 242 | MailListViewItem* item = (MailListViewItem*)mailView->firstChild (); |
243 | while ( item ) { | 243 | while ( item ) { |
244 | if ( item->isSelected() ) { | 244 | if ( item->isSelected() ) { |
245 | RecMailP mail = item->data(); | 245 | RecMailP mail = item->data(); |
246 | mail->Wrapper()->deleteMail( mail ); | 246 | mail->Wrapper()->deleteMail( mail ); |
247 | } | 247 | } |
248 | item = (MailListViewItem*)item->nextSibling(); | 248 | item = (MailListViewItem*)item->nextSibling(); |
249 | } | 249 | } |
250 | folderView->refreshCurrent(); | 250 | folderView->refreshCurrent(); |
251 | } | 251 | } |
252 | } | 252 | } |
253 | void OpieMail::clearSelection() | 253 | void OpieMail::clearSelection() |
254 | { | 254 | { |
255 | mailView->clearSelection(); | 255 | mailView->clearSelection(); |
256 | 256 | ||
257 | } | 257 | } |
258 | 258 | ||
259 | void OpieMail::mailHold(int button, QListViewItem *item,const QPoint&,int ) | 259 | void OpieMail::mailHold(int button, QListViewItem *item,const QPoint&,int ) |
260 | { | 260 | { |
261 | if (!mailView->currentItem()) return; | 261 | if (!mailView->currentItem()) return; |
262 | MAILLIB::ATYPE mailtype = ((MailListViewItem*)mailView->currentItem() )->wrapperType(); | 262 | MAILLIB::ATYPE mailtype = ((MailListViewItem*)mailView->currentItem() )->wrapperType(); |
263 | /* just the RIGHT button - or hold on pda */ | 263 | /* just the RIGHT button - or hold on pda */ |
264 | if (button!=2) {return;} | 264 | if (button!=2) {return;} |
265 | if (!item) return; | 265 | if (!item) return; |
266 | QPopupMenu *m = new QPopupMenu(0); | 266 | QPopupMenu *m = new QPopupMenu(0); |
267 | if (m) | 267 | if (m) |
268 | { | 268 | { |
269 | if (mailtype==MAILLIB::A_NNTP) { | 269 | if (mailtype==MAILLIB::A_NNTP) { |
270 | m->insertItem(tr("Read this posting"),this,SLOT(displayMail())); | 270 | m->insertItem(tr("Read this posting"),this,SLOT(displayMail())); |
271 | // m->insertItem(tr("Copy this posting"),this,SLOT(slotMoveCopyMail())); | 271 | // m->insertItem(tr("Copy this posting"),this,SLOT(slotMoveCopyMail())); |
272 | } else { | 272 | } else { |
273 | if (folderView->currentisDraft()) { | 273 | if (folderView->currentisDraft()) { |
274 | m->insertItem(tr("Edit this mail"),this,SLOT(reEditMail())); | 274 | m->insertItem(tr("Edit this mail"),this,SLOT(reEditMail())); |
275 | } | 275 | } |
276 | m->insertItem(tr("Read this mail"),this,SLOT(displayMail())); | 276 | m->insertItem(tr("Read this mail"),this,SLOT(displayMail())); |
277 | m->insertItem(tr("Copy/Move this mail"),this,SLOT(slotMoveCopyMail())); | 277 | m->insertItem(tr("Copy/Move this mail"),this,SLOT(slotMoveCopyMail())); |
278 | m->insertItem(tr("Delete this mail"),this,SLOT(slotDeleteMail())); | 278 | m->insertItem(tr("Delete this mail"),this,SLOT(slotDeleteMail())); |
279 | m->insertSeparator(); | 279 | m->insertSeparator(); |
280 | m->insertItem(tr("Delete all selected mails"),this,SLOT(slotDeleteAllMail())); | 280 | m->insertItem(tr("Delete all selected mails"),this,SLOT(slotDeleteAllMail())); |
281 | m->insertItem(tr("Clear selection"),this,SLOT(clearSelection())); | 281 | m->insertItem(tr("Clear selection"),this,SLOT(clearSelection())); |
282 | } | 282 | } |
283 | m->setFocus(); | 283 | m->setFocus(); |
284 | m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); | 284 | m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); |
285 | delete m; | 285 | delete m; |
286 | } | 286 | } |
287 | } | 287 | } |
288 | 288 | ||
289 | void OpieMail::slotShowFolders( bool show ) | 289 | void OpieMail::slotShowFolders( bool show ) |
290 | { | 290 | { |
291 | if ( show && folderView->isHidden() ) | 291 | if ( show && folderView->isHidden() ) |
292 | { | 292 | { |
293 | folderView->show(); | 293 | folderView->show(); |
294 | } | 294 | } |
295 | else if ( !show && !folderView->isHidden() ) | 295 | else if ( !show && !folderView->isHidden() ) |
296 | { | 296 | { |
297 | folderView->hide(); | 297 | folderView->hide(); |
298 | } | 298 | } |
299 | } | 299 | } |
300 | 300 | ||
301 | void OpieMail::refreshMailView(const QValueList<RecMailP>&list) | 301 | void OpieMail::refreshMailView(const QValueList<RecMailP>&list) |
302 | { | 302 | { |
303 | MailListViewItem*item = 0; | 303 | MailListViewItem*item = 0; |
304 | mailView->clear(); | 304 | mailView->clear(); |
305 | 305 | ||
306 | QValueList<RecMailP>::ConstIterator it; | 306 | QValueList<RecMailP>::ConstIterator it; |
307 | for (it = list.begin(); it != list.end();++it) | 307 | for (it = list.begin(); it != list.end();++it) |
308 | { | 308 | { |
309 | item = new MailListViewItem(mailView,item); | 309 | item = new MailListViewItem(mailView,item); |
310 | item->storeData((*it)); | 310 | item->storeData((*it)); |
311 | item->showEntry(); | 311 | item->showEntry(); |
312 | } | 312 | } |
313 | } | 313 | } |
314 | 314 | ||
315 | void OpieMail::mailLeftClicked( QListViewItem *item ) | 315 | void OpieMail::mailLeftClicked( QListViewItem *item ) |
316 | { | 316 | { |
317 | mailView->clearSelection(); | 317 | mailView->clearSelection(); |
318 | /* just LEFT button - or tap with stylus on pda */ | 318 | /* just LEFT button - or tap with stylus on pda */ |
319 | //if (button!=1) return; | 319 | //if (button!=1) return; |
320 | if (!item) return; | 320 | if (!item) return; |
321 | if (folderView->currentisDraft()) { | 321 | if (folderView->currentisDraft()) { |
322 | reEditMail(); | 322 | reEditMail(); |
323 | } else { | 323 | } else { |
324 | displayMail(); | 324 | displayMail(); |
325 | } | 325 | } |
326 | } | 326 | } |
327 | 327 | ||
328 | void OpieMail::slotMoveCopyMail() | 328 | void OpieMail::slotMoveCopyMail() |
329 | { | 329 | { |
330 | if (!mailView->currentItem()) return; | 330 | if (!mailView->currentItem()) return; |
331 | RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data(); | 331 | RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data(); |
332 | AbstractMail*targetMail = 0; | 332 | AbstractMail*targetMail = 0; |
333 | QString targetFolder = ""; | 333 | QString targetFolder = ""; |
334 | Selectstore sels; | 334 | Selectstore sels; |
335 | folderView->setupFolderselect(&sels); | 335 | folderView->setupFolderselect(&sels); |
336 | if (!sels.exec()) return; | 336 | if (!sels.exec()) return; |
337 | targetMail = sels.currentMail(); | 337 | targetMail = sels.currentMail(); |
338 | targetFolder = sels.currentFolder(); | 338 | targetFolder = sels.currentFolder(); |
339 | if ( (mail->Wrapper()==targetMail && mail->getMbox()==targetFolder) || | 339 | if ( (mail->Wrapper()==targetMail && mail->getMbox()==targetFolder) || |
340 | targetFolder.isEmpty()) | 340 | targetFolder.isEmpty()) |
341 | { | 341 | { |
342 | return; | 342 | return; |
343 | } | 343 | } |
344 | if (sels.newFolder() && !targetMail->createMbox(targetFolder)) | 344 | if (sels.newFolder() && !targetMail->createMbox(targetFolder)) |
345 | { | 345 | { |
346 | QMessageBox::critical(0,tr("Error creating new Folder"), | 346 | QMessageBox::critical(0,tr("Error creating new Folder"), |
347 | tr("<center>Error while creating<br>new folder - breaking.</center>")); | 347 | tr("<center>Error while creating<br>new folder - breaking.</center>")); |
348 | return; | 348 | return; |
349 | } | 349 | } |
350 | mail->Wrapper()->mvcpMail(mail,targetFolder,targetMail,sels.moveMails()); | 350 | mail->Wrapper()->mvcpMail(mail,targetFolder,targetMail,sels.moveMails()); |
351 | folderView->refreshCurrent(); | 351 | folderView->refreshCurrent(); |
352 | } | 352 | } |
353 | 353 | ||
354 | void OpieMail::reEditMail() | 354 | void OpieMail::reEditMail() |
355 | { | 355 | { |
356 | if (!mailView->currentItem()) return; | 356 | if (!mailView->currentItem()) return; |
357 | 357 | ||
358 | ComposeMail compose( settings, this, 0, true , WStyle_ContextHelp ); | 358 | ComposeMail compose( settings, this, 0, true , WStyle_ContextHelp ); |
359 | compose.reEditMail(((MailListViewItem*)mailView->currentItem() )->data()); | 359 | compose.reEditMail(((MailListViewItem*)mailView->currentItem() )->data()); |
360 | compose.slotAdjustColumns(); | 360 | compose.slotAdjustColumns(); |
361 | compose.showMaximized(); | 361 | compose.showMaximized(); |
362 | compose.exec(); | 362 | compose.exec(); |
363 | } | 363 | } |