summaryrefslogtreecommitdiffabout
path: root/kmicromail
Unidiff
Diffstat (limited to 'kmicromail') (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/main.cpp3
-rw-r--r--kmicromail/mainwindow.cpp48
-rw-r--r--kmicromail/opiemail.cpp41
3 files changed, 47 insertions, 45 deletions
diff --git a/kmicromail/main.cpp b/kmicromail/main.cpp
index 5362f08..8947ff8 100644
--- a/kmicromail/main.cpp
+++ b/kmicromail/main.cpp
@@ -1,62 +1,63 @@
1// CHANGED 2004-08-06 Lutz Rogowski 1// CHANGED 2004-08-06 Lutz Rogowski
2 2
3 3
4#ifndef DESKTOP_VERSION 4#ifndef DESKTOP_VERSION
5#include <qpe/qpeapplication.h> 5#include <qpe/qpeapplication.h>
6#include <libkdepim/externalapphandler.h> 6#include <libkdepim/externalapphandler.h>
7#include <stdlib.h> 7#include <stdlib.h>
8#else 8#else
9#include <qapplication.h> 9#include <qapplication.h>
10#include <qstring.h> 10#include <qstring.h>
11#include <qwindowsstyle.h> 11#include <qwindowsstyle.h>
12#include <qplatinumstyle.h> 12#include <qplatinumstyle.h>
13#include <qsgistyle.h> 13#include <qsgistyle.h>
14#endif 14#endif
15#include "opiemail.h" 15#include "opiemail.h"
16#include <qdir.h> 16#include <qdir.h>
17#include <kstandarddirs.h> 17#include <kstandarddirs.h>
18#include <kglobal.h> 18#include <kglobal.h>
19#include <stdio.h> 19#include <stdio.h>
20#include "mainwindow.h" 20#include "mainwindow.h"
21#include "koprefs.h" 21#include "koprefs.h"
22 22void dumpMissing();
23//using namespace Opie::Core; 23//using namespace Opie::Core;
24int main( int argc, char **argv ) { 24int main( int argc, char **argv ) {
25 25
26#ifndef DESKTOP_VERSION 26#ifndef DESKTOP_VERSION
27 QPEApplication a( argc, argv ); 27 QPEApplication a( argc, argv );
28 a.setKeepRunning (); 28 a.setKeepRunning ();
29#else 29#else
30 QApplication a( argc, argv ); 30 QApplication a( argc, argv );
31 QApplication::setStyle( new QPlatinumStyle ()); 31 QApplication::setStyle( new QPlatinumStyle ());
32#endif 32#endif
33 a.setFont( KOPrefs::instance()->mAppFont ); 33 a.setFont( KOPrefs::instance()->mAppFont );
34 KGlobal::setAppName( "kopiemail" ); 34 KGlobal::setAppName( "kopiemail" );
35 QString fileName ; 35 QString fileName ;
36#ifndef DESKTOP_VERSION 36#ifndef DESKTOP_VERSION
37 fileName = getenv("QPEDIR"); 37 fileName = getenv("QPEDIR");
38 if ( QApplication::desktop()->width() > 320 ) 38 if ( QApplication::desktop()->width() > 320 )
39 KGlobal::iconLoader()->setIconPath( fileName +"/pics/kdepim/kopiemail/icons22/"); 39 KGlobal::iconLoader()->setIconPath( fileName +"/pics/kdepim/kopiemail/icons22/");
40 else 40 else
41 KGlobal::iconLoader()->setIconPath( fileName +"/pics/kdepim/kopiemail/"); 41 KGlobal::iconLoader()->setIconPath( fileName +"/pics/kdepim/kopiemail/");
42#else 42#else
43 fileName = qApp->applicationDirPath () + "/kdepim/kopiemail/"; 43 fileName = qApp->applicationDirPath () + "/kdepim/kopiemail/";
44 KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName)); 44 KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName));
45#endif 45#endif
46 KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "kopiemail"))); 46 KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "kopiemail")));
47 OpieMail mw; 47 OpieMail mw;
48#ifndef DESKTOP_VERSION 48#ifndef DESKTOP_VERSION
49 //qDebug("CONNECT "); 49 //qDebug("CONNECT ");
50 QObject::connect( &a, SIGNAL (appMessage ( const QCString &, const QByteArray & )),&mw, SLOT(message( const QCString&, const QByteArray& ))); 50 QObject::connect( &a, SIGNAL (appMessage ( const QCString &, const QByteArray & )),&mw, SLOT(message( const QCString&, const QByteArray& )));
51 // QObject::connect(&a, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); 51 // QObject::connect(&a, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & )));
52 a.showMainWidget(&mw ); 52 a.showMainWidget(&mw );
53#else 53#else
54 a.setMainWidget(&mw ); 54 a.setMainWidget(&mw );
55 mw.show(); 55 mw.show();
56 //m.resize( 800, 600 ); 56 //m.resize( 800, 600 );
57 QObject::connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit())); 57 QObject::connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()));
58#endif 58#endif
59 int rv = a.exec(); 59 int rv = a.exec();
60 dumpMissing();
60 return rv; 61 return rv;
61 62
62} 63}
diff --git a/kmicromail/mainwindow.cpp b/kmicromail/mainwindow.cpp
index ddded2a..c77345b 100644
--- a/kmicromail/mainwindow.cpp
+++ b/kmicromail/mainwindow.cpp
@@ -1,273 +1,273 @@
1 1
2// CHANGED 2004-08-06 Lutz Rogowski 2// CHANGED 2004-08-06 Lutz Rogowski
3#include <qlabel.h> 3#include <qlabel.h>
4#include <qvbox.h> 4#include <qvbox.h>
5#include <qheader.h> 5#include <qheader.h>
6#include <qtimer.h> 6#include <qtimer.h>
7#include <qlayout.h> 7#include <qlayout.h>
8#include <kdialog.h> 8#include <kdialog.h>
9#include <kiconloader.h> 9#include <kiconloader.h>
10#include <kapplication.h> 10#include <kapplication.h>
11 11
12#ifndef DESKTOP_VERSION 12#ifndef DESKTOP_VERSION
13#include <qpe/qpeapplication.h> 13#include <qpe/qpeapplication.h>
14#endif 14#endif
15#include "defines.h" 15#include "defines.h"
16#include "mainwindow.h" 16#include "mainwindow.h"
17#include <KDGanttMinimizeSplitter.h> 17#include <KDGanttMinimizeSplitter.h>
18 18
19 19
20#include <kabc/stdaddressbook.h> 20#include <kabc/stdaddressbook.h>
21 21
22MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) 22MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags )
23 : QMainWindow( parent, name ) //, flags ) 23 : QMainWindow( parent, name ) //, flags )
24{ 24{
25 setCaption( tr( "KOpieMail/Pi" ) ); 25 setCaption( i18n( "KOpieMail/Pi" ) );
26 setToolBarsMovable( false ); 26 setToolBarsMovable( false );
27 //KABC::StdAddressBook::self(); 27 //KABC::StdAddressBook::self();
28 toolBar = new QToolBar( this ); 28 toolBar = new QToolBar( this );
29 menuBar = new QPEMenuBar( toolBar ); 29 menuBar = new QPEMenuBar( toolBar );
30 mailMenu = new QPopupMenu( menuBar ); 30 mailMenu = new QPopupMenu( menuBar );
31 menuBar->insertItem( tr( "Mail" ), mailMenu ); 31 menuBar->insertItem( i18n( "Mail" ), mailMenu );
32 settingsMenu = new QPopupMenu( menuBar ); 32 settingsMenu = new QPopupMenu( menuBar );
33 menuBar->insertItem( tr( "Settings" ), settingsMenu ); 33 menuBar->insertItem( i18n( "Settings" ), settingsMenu );
34 34
35 addToolBar( toolBar ); 35 addToolBar( toolBar );
36 toolBar->setHorizontalStretchable( true ); 36 toolBar->setHorizontalStretchable( true );
37 QAction* getMail = new QAction( tr( "Get all new mails" ), SmallIcon("enter"), 37 QAction* getMail = new QAction( i18n( "Get all new mails" ), SmallIcon("enter"),
38 0, 0, this ); 38 0, 0, this );
39 connect(getMail, SIGNAL( activated() ), 39 connect(getMail, SIGNAL( activated() ),
40 SLOT( slotGetAllMail() ) ); 40 SLOT( slotGetAllMail() ) );
41 getMail->addTo( mailMenu ); 41 getMail->addTo( mailMenu );
42 42
43 getMail = new QAction( tr( "Get new messages" ), SmallIcon("add"), 43 getMail = new QAction( i18n( "Get new messages" ), SmallIcon("add"),
44 0, 0, this ); 44 0, 0, this );
45 getMail->addTo( toolBar ); 45 getMail->addTo( toolBar );
46 getMail->addTo( mailMenu ); 46 getMail->addTo( mailMenu );
47 connect(getMail, SIGNAL( activated() ), 47 connect(getMail, SIGNAL( activated() ),
48 SLOT( slotGetMail() ) ); 48 SLOT( slotGetMail() ) );
49 49
50 composeMail = new QAction( tr( "Compose new mail" ), SmallIcon("composemail"), 50 composeMail = new QAction( i18n( "Compose new mail" ), SmallIcon("composemail"),
51 0, 0, this ); 51 0, 0, this );
52 composeMail->addTo( toolBar ); 52 composeMail->addTo( toolBar );
53 composeMail->addTo( mailMenu ); 53 composeMail->addTo( mailMenu );
54 54
55 sendQueued = new QAction( tr( "Send queued mails" ), SmallIcon("sendqueued") , 55 sendQueued = new QAction( i18n( "Send queued mails" ), SmallIcon("sendqueued") ,
56 0, 0, this ); 56 0, 0, this );
57 sendQueued->addTo( toolBar ); 57 sendQueued->addTo( toolBar );
58 sendQueued->addTo( mailMenu ); 58 sendQueued->addTo( mailMenu );
59 59
60 /* 60 /*
61 syncFolders = new QAction( tr( "Sync mailfolders" ), ICON_SYNC, 61 syncFolders = new QAction( i18n( "Sync mailfolders" ), ICON_SYNC,
62 0, 0, this ); 62 0, 0, this );
63 syncFolders->addTo( toolBar ); 63 syncFolders->addTo( toolBar );
64 syncFolders->addTo( mailMenu ); 64 syncFolders->addTo( mailMenu );
65 */ 65 */
66 66
67 showFolders = new QAction( tr( "Show/Hide folders" ), SmallIcon("showfolders") , 67 showFolders = new QAction( i18n( "Show/Hide folders" ), SmallIcon("showfolders") ,
68 0, 0, this, 0, true ); 68 0, 0, this, 0, true );
69 showFolders->addTo( toolBar ); 69 showFolders->addTo( toolBar );
70 showFolders->addTo( mailMenu ); 70 showFolders->addTo( mailMenu );
71 showFolders->setOn( true ); 71 showFolders->setOn( true );
72 connect(showFolders, SIGNAL( toggled(bool) ), 72 connect(showFolders, SIGNAL( toggled(bool) ),
73 SLOT( slotShowFolders(bool) ) ); 73 SLOT( slotShowFolders(bool) ) );
74 74
75 /* 75 /*
76 searchMails = new QAction( tr( "Search mails" ), SmallIcon("find") ), 76 searchMails = new QAction( i18n( "Search mails" ), SmallIcon("find") ),
77 0, 0, this ); 77 0, 0, this );
78 searchMails->addTo( toolBar ); 78 searchMails->addTo( toolBar );
79 searchMails->addTo( mailMenu ); 79 searchMails->addTo( mailMenu );
80 */ 80 */
81 81
82 deleteMails = new QAction(tr("Delete Mail"), SmallIcon("trash"), 0, 0, this); 82 deleteMails = new QAction(i18n("Delete Mail"), SmallIcon("trash"), 0, 0, this);
83 deleteMails->addTo( toolBar ); 83 deleteMails->addTo( toolBar );
84 deleteMails->addTo( mailMenu ); 84 deleteMails->addTo( mailMenu );
85 connect( deleteMails, SIGNAL( activated() ), 85 connect( deleteMails, SIGNAL( activated() ),
86 SLOT( slotDeleteMail() ) ); 86 SLOT( slotDeleteMail() ) );
87 87
88 editSettings = new QAction( tr( "Edit settings" ), SmallIcon("SettingsIcon") , 88 editSettings = new QAction( i18n( "Edit settings" ), SmallIcon("SettingsIcon") ,
89 0, 0, this ); 89 0, 0, this );
90 editSettings->addTo( settingsMenu ); 90 editSettings->addTo( settingsMenu );
91 connect( editSettings, SIGNAL( activated() ), 91 connect( editSettings, SIGNAL( activated() ),
92 SLOT( slotEditSettings() ) ); 92 SLOT( slotEditSettings() ) );
93 editAccounts = new QAction( tr( "Configure accounts" ), SmallIcon("editaccounts") , 93 editAccounts = new QAction( i18n( "Configure accounts" ), SmallIcon("editaccounts") ,
94 0, 0, this ); 94 0, 0, this );
95 editAccounts->addTo( settingsMenu ); 95 editAccounts->addTo( settingsMenu );
96 96
97 //setCentralWidget( view ); 97 //setCentralWidget( view );
98 98
99 QVBox* wrapperBox = new QVBox( this ); 99 QVBox* wrapperBox = new QVBox( this );
100 setCentralWidget( wrapperBox ); 100 setCentralWidget( wrapperBox );
101 101
102 // QWidget *view = new QWidget( wrapperBox ); 102 // QWidget *view = new QWidget( wrapperBox );
103 KDGanttMinimizeSplitter* split = new KDGanttMinimizeSplitter( Qt::Horizontal, wrapperBox); 103 KDGanttMinimizeSplitter* split = new KDGanttMinimizeSplitter( Qt::Horizontal, wrapperBox);
104 split->setMinimizeDirection( KDGanttMinimizeSplitter::Left); 104 split->setMinimizeDirection( KDGanttMinimizeSplitter::Left);
105 //layout = new QBoxLayout ( split, QBoxLayout::LeftToRight ); 105 //layout = new QBoxLayout ( split, QBoxLayout::LeftToRight );
106 106
107 folderView = new AccountView( split ); 107 folderView = new AccountView( split );
108 folderView->header()->hide(); 108 folderView->header()->hide();
109 folderView->setRootIsDecorated( false ); 109 folderView->setRootIsDecorated( false );
110 folderView->addColumn( tr( "Mailbox" ) ); 110 folderView->addColumn( i18n( "Mailbox" ) );
111 111
112 //layout->addWidget( folderView ); 112 //layout->addWidget( folderView );
113 113
114 mailView = new QListView( split ); 114 mailView = new QListView( split );
115 mailView->addColumn( tr( " " ) ); 115 mailView->addColumn( i18n( " " ) );
116 mailView->addColumn( tr( "Subject" ),QListView::Manual ); 116 mailView->addColumn( i18n( "Subject" ),QListView::Manual );
117 mailView->addColumn( tr( "Sender" ),QListView::Manual ); 117 mailView->addColumn( i18n( "Sender" ),QListView::Manual );
118 mailView->addColumn( tr( "Size" ),QListView::Manual); 118 mailView->addColumn( i18n( "Size" ),QListView::Manual);
119 mailView->addColumn( tr( "Date" ),QListView::Manual); 119 mailView->addColumn( i18n( "Date" ),QListView::Manual);
120 mailView->setAllColumnsShowFocus(true); 120 mailView->setAllColumnsShowFocus(true);
121 //mailView->setSorting(-1); 121 //mailView->setSorting(-1);
122 mailView->setRootIsDecorated( false ); 122 mailView->setRootIsDecorated( false );
123 statusWidget = new StatusWidget( wrapperBox ); 123 statusWidget = new StatusWidget( wrapperBox );
124 statusWidget->hide(); 124 statusWidget->hide();
125 125
126 //layout->addWidget( mailView ); 126 //layout->addWidget( mailView );
127 //layout->setStretchFactor( folderView, 1 ); 127 //layout->setStretchFactor( folderView, 1 );
128 //layout->setStretchFactor( mailView, 2 ); 128 //layout->setStretchFactor( mailView, 2 );
129 129
130 slotAdjustLayout(); 130 slotAdjustLayout();
131#ifndef DESKTOP_VERSION 131#ifndef DESKTOP_VERSION
132 QPEApplication::setStylusOperation( mailView->viewport(),QPEApplication::RightOnHold); 132 QPEApplication::setStylusOperation( mailView->viewport(),QPEApplication::RightOnHold);
133 QPEApplication::setStylusOperation( folderView->viewport(),QPEApplication::RightOnHold); 133 QPEApplication::setStylusOperation( folderView->viewport(),QPEApplication::RightOnHold);
134#endif 134#endif
135 connect( mailView, SIGNAL( doubleClicked (QListViewItem* )),this, 135 connect( mailView, SIGNAL( doubleClicked (QListViewItem* )),this,
136 SLOT( mailLeftClicked(QListViewItem*) ) ); 136 SLOT( mailLeftClicked(QListViewItem*) ) );
137 connect( mailView, SIGNAL( returnPressed (QListViewItem* )),this, 137 connect( mailView, SIGNAL( returnPressed (QListViewItem* )),this,
138 SLOT( mailLeftClicked(QListViewItem*) ) ); 138 SLOT( mailLeftClicked(QListViewItem*) ) );
139 connect( mailView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),this, 139 connect( mailView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),this,
140 SLOT( mailHold(int,QListViewItem*,const QPoint&,int) ) ); 140 SLOT( mailHold(int,QListViewItem*,const QPoint&,int) ) );
141 connect(folderView, SIGNAL(refreshMailview(const QValueList<RecMailP>&)), 141 connect(folderView, SIGNAL(refreshMailview(const QValueList<RecMailP>&)),
142 this,SLOT(refreshMailView(const QValueList<RecMailP>&))); 142 this,SLOT(refreshMailView(const QValueList<RecMailP>&)));
143 connect( composeMail, SIGNAL( activated() ), SLOT( slotComposeMail() ) ); 143 connect( composeMail, SIGNAL( activated() ), SLOT( slotComposeMail() ) );
144 connect( sendQueued, SIGNAL( activated() ), SLOT( slotSendQueued() ) ); 144 connect( sendQueued, SIGNAL( activated() ), SLOT( slotSendQueued() ) );
145// connect( searchMails, SIGNAL( activated() ), SLOT( slotSearchMails() ) ); 145// connect( searchMails, SIGNAL( activated() ), SLOT( slotSearchMails() ) );
146 connect( editAccounts, SIGNAL( activated() ), SLOT( slotEditAccounts() ) ); 146 connect( editAccounts, SIGNAL( activated() ), SLOT( slotEditAccounts() ) );
147 //mailView->setMultiSelection ( true ); 147 //mailView->setMultiSelection ( true );
148 mailView->setSelectionMode( QListView::Extended ); 148 mailView->setSelectionMode( QListView::Extended );
149 QValueList<int> list; 149 QValueList<int> list;
150 int fw = 100; 150 int fw = 100;
151 if ( QApplication::desktop()->width() > 320 ) 151 if ( QApplication::desktop()->width() > 320 )
152 fw = 50; 152 fw = 50;
153 list.append( fw ); 153 list.append( fw );
154 list.append( 100 ); 154 list.append( 100 );
155 split->setSizes( list ); 155 split->setSizes( list );
156 QTimer::singleShot( 1000, this, SLOT( slotAdjustColumns() ) ); 156 QTimer::singleShot( 1000, this, SLOT( slotAdjustColumns() ) );
157 mailView->setShowSortIndicator ( true ); 157 mailView->setShowSortIndicator ( true );
158 QLabel *spacer = new QLabel( toolBar ); 158 QLabel *spacer = new QLabel( toolBar );
159 spacer->setBackgroundMode( QWidget::PaletteButton ); 159 spacer->setBackgroundMode( QWidget::PaletteButton );
160 toolBar->setStretchableWidget( spacer ); 160 toolBar->setStretchableWidget( spacer );
161 161
162 QAction* closeMail = new QAction(tr("Close"),SmallIcon("exit"), 0, 0, this); 162 QAction* closeMail = new QAction(i18n("Close"),SmallIcon("exit"), 0, 0, this);
163 connect( closeMail, SIGNAL( activated() ), SLOT( close() ) ); 163 connect( closeMail, SIGNAL( activated() ), SLOT( close() ) );
164 if ( QApplication::desktop()->width() > 320 ) 164 if ( QApplication::desktop()->width() > 320 )
165 closeMail->addTo(toolBar); 165 closeMail->addTo(toolBar);
166 closeMail->addTo(mailMenu); 166 closeMail->addTo(mailMenu);
167 167
168 168
169 QPopupMenu* helpMenu = new QPopupMenu( menuBar ); 169 QPopupMenu* helpMenu = new QPopupMenu( menuBar );
170 menuBar->insertItem( tr( "Help" ), helpMenu ); 170 menuBar->insertItem( i18n( "Help" ), helpMenu );
171 QAction* li = new QAction(tr("About"), QPixmap(), 0, 0, this); 171 QAction* li = new QAction(i18n("About"), QPixmap(), 0, 0, this);
172 connect( li, SIGNAL( activated() ), SLOT( showAbout()) ); 172 connect( li, SIGNAL( activated() ), SLOT( showAbout()) );
173 li->addTo(helpMenu); 173 li->addTo(helpMenu);
174 li = new QAction(tr("Licence"),QPixmap(), 0, 0, this); 174 li = new QAction(i18n("Licence"),QPixmap(), 0, 0, this);
175 connect( li, SIGNAL( activated() ), SLOT( showLicence()) ); 175 connect( li, SIGNAL( activated() ), SLOT( showLicence()) );
176 li->addTo(helpMenu); 176 li->addTo(helpMenu);
177 li = new QAction(tr("LibEtPan Licence"), QPixmap(), 0, 0, this); 177 li = new QAction(i18n("LibEtPan Licence"), QPixmap(), 0, 0, this);
178 connect( li, SIGNAL( activated() ), SLOT( showEtpanLicence()) ); 178 connect( li, SIGNAL( activated() ), SLOT( showEtpanLicence()) );
179 li->addTo(helpMenu); 179 li->addTo(helpMenu);
180} 180}
181 181
182MainWindow::~MainWindow() 182MainWindow::~MainWindow()
183{ 183{
184} 184}
185 185
186void MainWindow::showLicence() 186void MainWindow::showLicence()
187{ 187{
188 KApplication::showLicence(); 188 KApplication::showLicence();
189} 189}
190void MainWindow::showAbout() 190void MainWindow::showAbout()
191{ 191{
192 QString version; 192 QString version;
193#include <../version> 193#include <../version>
194 194
195 QString cap = "About KOpieMail/Pi"; 195 QString cap = "About KOpieMail/Pi";
196 QString text =i18n("KOpieMail/Platform-independent\n") + 196 QString text =i18n("KOpieMail/Platform-independent\n") +
197 "(OM/Pi) " + version + " - " 197 "(OM/Pi) " + version + " - "
198 198
199#ifdef DESKTOP_VERSION 199#ifdef DESKTOP_VERSION
200 "Desktop Edition\n" 200 "Desktop Edition\n"
201#else 201#else
202 "PDA-Edition\nfor: Zaurus 5x00 / 7x0 / 8x0\n" 202 "PDA-Edition\nfor: Zaurus 5x00 / 7x0 / 8x0\n"
203#endif 203#endif
204 "www.pi-sync.net\n\n" 204 "www.pi-sync.net\n\n"
205 205
206 206
207 207
208"Copyright (c) 2004 Lutz Rogowski <lutz@pi-sync.net>\n" 208"Copyright (c) 2004 Lutz Rogowski <lutz@pi-sync.net>\n"
209 "KOpieMail/Pi is based on Opie Mail\n" 209 "KOpieMail/Pi is based on Opie Mail\n"
210 "Copyright (c) Rajko Albrecht and the Opie team\n" 210 "Copyright (c) Rajko Albrecht and the Opie team\n"
211 "KOpieMail/Pi is licensed under the GPL\n" 211 "KOpieMail/Pi is licensed under the GPL\n"
212 "\n" 212 "\n"
213 "KOpieMail/Pi uses LibEtPan - a mail stuff library\n" 213 "KOpieMail/Pi uses LibEtPan - a mail stuff library\n"
214 "Copyright (C) 2001, 2002 - DINH Viet Hoa\n" 214 "Copyright (C) 2001, 2002 - DINH Viet Hoa\n"
215 "libEtPan has its own licence - see LibEtPan licence\n"; 215 "libEtPan has its own licence - see LibEtPan licence\n";
216 216
217 KApplication::showText( cap, text ); 217 KApplication::showText( cap, text );
218} 218}
219void MainWindow::showEtpanLicence() 219void MainWindow::showEtpanLicence()
220{ 220{
221 KApplication::showFile( "LibEtPan licence", "kdepim/kopiemail/COPYRIGHTlibetpan" ); 221 KApplication::showFile( "LibEtPan licence", "kdepim/kopiemail/COPYRIGHTlibetpan" );
222 222
223} 223}
224void MainWindow::appMessage(const QCString &, const QByteArray &) 224void MainWindow::appMessage(const QCString &, const QByteArray &)
225{ 225{
226 qDebug("appMessage implemented by subclass"); 226 qDebug("appMessage implemented by subclass");
227} 227}
228 228
229void MainWindow::slotAdjustLayout() { 229void MainWindow::slotAdjustLayout() {
230 230
231 /* 231 /*
232 QWidget *d = QApplication::desktop(); 232 QWidget *d = QApplication::desktop();
233 233
234 if ( d->width() < d->height() ) { 234 if ( d->width() < d->height() ) {
235 layout->setDirection( QBoxLayout::TopToBottom ); 235 layout->setDirection( QBoxLayout::TopToBottom );
236 } else { 236 } else {
237 layout->setDirection( QBoxLayout::LeftToRight ); 237 layout->setDirection( QBoxLayout::LeftToRight );
238 } 238 }
239 */ 239 */
240} 240}
241 241
242void MainWindow::slotAdjustColumns() 242void MainWindow::slotAdjustColumns()
243{ 243{
244 bool hidden = folderView->isHidden(); 244 bool hidden = folderView->isHidden();
245 if ( hidden ) folderView->show(); 245 if ( hidden ) folderView->show();
246 folderView->setColumnWidth( 0, folderView->visibleWidth() ); 246 folderView->setColumnWidth( 0, folderView->visibleWidth() );
247 if ( hidden ) folderView->hide(); 247 if ( hidden ) folderView->hide();
248 248
249 mailView->setColumnWidth( 0, 10 ); 249 mailView->setColumnWidth( 0, 10 );
250 mailView->setColumnWidth( 1, 100 ); 250 mailView->setColumnWidth( 1, 100 );
251 mailView->setColumnWidth( 2, 100 ); 251 mailView->setColumnWidth( 2, 100 );
252 mailView->setColumnWidth( 3, 50 ); 252 mailView->setColumnWidth( 3, 50 );
253 mailView->setColumnWidth( 4, 120 ); 253 mailView->setColumnWidth( 4, 120 );
254} 254}
255 255
256void MainWindow::slotEditSettings() 256void MainWindow::slotEditSettings()
257{ 257{
258} 258}
259 259
260void MainWindow::slotShowFolders( bool ) 260void MainWindow::slotShowFolders( bool )
261{ 261{
262 qDebug("not implemented: "); 262 qDebug("not implemented: ");
263} 263}
264 264
265void MainWindow::refreshMailView(const QValueList<RecMailP>&) 265void MainWindow::refreshMailView(const QValueList<RecMailP>&)
266{ 266{
267 qDebug("not implemented: "); 267 qDebug("not implemented: ");
268} 268}
269 269
270void MainWindow::mailLeftClicked(QListViewItem * ) 270void MainWindow::mailLeftClicked(QListViewItem * )
271{ 271{
272 qDebug("not implemented: "); 272 qDebug("not implemented: ");
273} 273}
diff --git a/kmicromail/opiemail.cpp b/kmicromail/opiemail.cpp
index 164988c..3aa7905 100644
--- a/kmicromail/opiemail.cpp
+++ b/kmicromail/opiemail.cpp
@@ -1,468 +1,469 @@
1// CHANGED 2004-09-31 Lutz Rogowski 1// CHANGED 2004-09-31 Lutz Rogowski
2// CHANGED 2004-08-06 Lutz Rogowski 2// CHANGED 2004-08-06 Lutz Rogowski
3 3
4#include "settingsdialog.h" 4#include "settingsdialog.h"
5#include "opiemail.h" 5#include "opiemail.h"
6#include "editaccounts.h" 6#include "editaccounts.h"
7#include "composemail.h" 7#include "composemail.h"
8#include "mailistviewitem.h" 8#include "mailistviewitem.h"
9#include "viewmail.h" 9#include "viewmail.h"
10#include "selectstore.h" 10#include "selectstore.h"
11#include "selectsmtp.h" 11#include "selectsmtp.h"
12#include "accountitem.h" 12#include "accountitem.h"
13#include "koprefsdialog.h" 13#include "koprefsdialog.h"
14#include "klocale.h"
14 15
15#include <qmessagebox.h> 16#include <qmessagebox.h>
16#include <qtimer.h> 17#include <qtimer.h>
17#include <libkdepim/externalapphandler.h> 18#include <libkdepim/externalapphandler.h>
18#include <libkdepim/kpimglobalprefs.h> 19#include <libkdepim/kpimglobalprefs.h>
19 20
20#include <qpe/qpeapplication.h> 21#include <qpe/qpeapplication.h>
21#include <libmailwrapper/smtpwrapper.h> 22#include <libmailwrapper/smtpwrapper.h>
22#include <libmailwrapper/mailtypes.h> 23#include <libmailwrapper/mailtypes.h>
23#include <libmailwrapper/abstractmail.h> 24#include <libmailwrapper/abstractmail.h>
24/* OPIE */ 25/* OPIE */
25//#include <qpe/resource.h> 26//#include <qpe/resource.h>
26//#include <qpe/qpeapplication.h> 27//#include <qpe/qpeapplication.h>
27 28
28/* QT */ 29/* QT */
29 30
30//using namespace Opie::Core; 31//using namespace Opie::Core;
31 32
32OpieMail::OpieMail( QWidget *parent, const char *name ) 33OpieMail::OpieMail( QWidget *parent, const char *name )
33 : MainWindow( parent, name) //, WStyle_ContextHelp ) 34 : MainWindow( parent, name) //, WStyle_ContextHelp )
34{ 35{
35 settings = new Settings(); 36 settings = new Settings();
36 KPimGlobalPrefs::instance()->setGlobalConfig(); 37 KPimGlobalPrefs::instance()->setGlobalConfig();
37 38
38 folderView->populate( settings->getAccounts() ); 39 folderView->populate( settings->getAccounts() );
39 40
40} 41}
41 42
42OpieMail::~OpieMail() 43OpieMail::~OpieMail()
43{ 44{
44 if (settings) delete settings; 45 if (settings) delete settings;
45} 46}
46 47
47void OpieMail::appMessage(const QCString &msg, const QByteArray &data) 48void OpieMail::appMessage(const QCString &msg, const QByteArray &data)
48{ 49{
49 50
50} 51}
51#include <stdlib.h> 52#include <stdlib.h>
52void OpieMail::message(const QCString &msg, const QByteArray &data) 53void OpieMail::message(const QCString &msg, const QByteArray &data)
53{ 54{
54 // copied from old mail2 55 // copied from old mail2
55 static int ii = 0; 56 static int ii = 0;
56 //qDebug("QCOP CALL ############################# %d ", ii); 57 //qDebug("QCOP CALL ############################# %d ", ii);
57 //QString mess ( msg ); 58 //QString mess ( msg );
58 //qDebug("Message = %s ",mess.latin1()); 59 //qDebug("Message = %s ",mess.latin1());
59 ++ii; 60 ++ii;
60 //qDebug("KM:appMessage %d *%s* %x", ii, msg.data(), this); 61 //qDebug("KM:appMessage %d *%s* %x", ii, msg.data(), this);
61 62
62 mPendingEmail = QString::null; 63 mPendingEmail = QString::null;
63 mPendingName = QString::null; 64 mPendingName = QString::null;
64 if (msg == "writeMail(QString,QString)") 65 if (msg == "writeMail(QString,QString)")
65 { 66 {
66 //qDebug("writeMail(QString,QString) "); 67 //qDebug("writeMail(QString,QString) ");
67 QDataStream stream(data,IO_ReadOnly); 68 QDataStream stream(data,IO_ReadOnly);
68 stream >> mPendingName >> mPendingEmail; 69 stream >> mPendingName >> mPendingEmail;
69 // removing the whitespaces at beginning and end is needed! 70 // removing the whitespaces at beginning and end is needed!
70 QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) ); 71 QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) );
71 } 72 }
72 else if (msg == "newMail()") 73 else if (msg == "newMail()")
73 { 74 {
74 //qDebug("slotComposeMail() "); 75 //qDebug("slotComposeMail() ");
75 // we cannot call slotComposeMail(); directly, because may be executing a QCOP call 76 // we cannot call slotComposeMail(); directly, because may be executing a QCOP call
76 // and a QCOP call does not like a processevents in his execution 77 // and a QCOP call does not like a processevents in his execution
77 // with the Qtimer we call slotComposeMail() after we reached the main event loop 78 // with the Qtimer we call slotComposeMail() after we reached the main event loop
78 QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) ); 79 QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) );
79 // slotComposeMail(); 80 // slotComposeMail();
80 } 81 }
81 else if (msg == "newMail(QString)") 82 else if (msg == "newMail(QString)")
82 { 83 {
83 //qDebug(" newMail(QString)"); 84 //qDebug(" newMail(QString)");
84 QDataStream stream(data,IO_ReadOnly); 85 QDataStream stream(data,IO_ReadOnly);
85 stream >> mPendingName; 86 stream >> mPendingName;
86 // the format is 87 // the format is
87 // NAME <EMAIL>:SUBJECT 88 // NAME <EMAIL>:SUBJECT
88 QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) ); 89 QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) );
89 } else { 90 } else {
90 mPendingData = data; 91 mPendingData = data;
91 mPendingMessage = msg; 92 mPendingMessage = msg;
92 QTimer::singleShot ( 50, this, SLOT(slotExtAppHandler() ) ); 93 QTimer::singleShot ( 50, this, SLOT(slotExtAppHandler() ) );
93 } 94 }
94 95
95 //qDebug("END OpieMail::message "); 96 //qDebug("END OpieMail::message ");
96} 97}
97void OpieMail::slotExtAppHandler() 98void OpieMail::slotExtAppHandler()
98{ 99{
99 ExternalAppHandler::instance()->appMessage ( mPendingMessage, mPendingData ); 100 ExternalAppHandler::instance()->appMessage ( mPendingMessage, mPendingData );
100} 101}
101void OpieMail::slotwriteMail2(const QString& namemail ) 102void OpieMail::slotwriteMail2(const QString& namemail )
102{ 103{
103 //qDebug("OpieMail::slotwriteMail2 "); 104 //qDebug("OpieMail::slotwriteMail2 ");
104 //qApp->processEvents(); 105 //qApp->processEvents();
105 ComposeMail compose( settings, this, 0, true ); 106 ComposeMail compose( settings, this, 0, true );
106 if ( !namemail.isEmpty() ) { 107 if ( !namemail.isEmpty() ) {
107 QString to = namemail; 108 QString to = namemail;
108 if ( namemail.find( " <") > 1 ) { 109 if ( namemail.find( " <") > 1 ) {
109 to = "\"" +to.replace( QRegExp( " <"), "\" <") ; 110 to = "\"" +to.replace( QRegExp( " <"), "\" <") ;
110 } else 111 } else
111 if ( namemail.find( "<") > 1 ) { 112 if ( namemail.find( "<") > 1 ) {
112 to = "\"" +to.replace( QRegExp( "<"), "\" <") ; 113 to = "\"" +to.replace( QRegExp( "<"), "\" <") ;
113 } 114 }
114 int sub = to.find( ">:"); 115 int sub = to.find( ">:");
115 if ( sub > 0 ) { 116 if ( sub > 0 ) {
116 compose.setTo( to.left(sub+1) ); 117 compose.setTo( to.left(sub+1) );
117 compose.setSubject( to.mid(sub+2) ); 118 compose.setSubject( to.mid(sub+2) );
118 } else 119 } else
119 compose.setTo( to ); 120 compose.setTo( to );
120 } 121 }
121 compose.slotAdjustColumns(); 122 compose.slotAdjustColumns();
122 compose.showMaximized(); 123 compose.showMaximized();
123 compose.exec(); 124 compose.exec();
124 raise(); 125 raise();
125 //qDebug("retttich "); 126 //qDebug("retttich ");
126} 127}
127void OpieMail::slotwriteMail(const QString&name,const QString&email) 128void OpieMail::slotwriteMail(const QString&name,const QString&email)
128{ 129{
129 // qDebug("OpieMail::slotwriteMail "); 130 // qDebug("OpieMail::slotwriteMail ");
130 ComposeMail compose( settings, this, 0, true ); 131 ComposeMail compose( settings, this, 0, true );
131 if (!email.isEmpty()) 132 if (!email.isEmpty())
132 { 133 {
133 if (!name.isEmpty()) 134 if (!name.isEmpty())
134 { 135 {
135 compose.setTo("\"" + name + "\"" + " " + "<"+ email + ">"); 136 compose.setTo("\"" + name + "\"" + " " + "<"+ email + ">");
136 } 137 }
137 else 138 else
138 { 139 {
139 compose.setTo(email); 140 compose.setTo(email);
140 } 141 }
141 } 142 }
142 compose.slotAdjustColumns(); 143 compose.slotAdjustColumns();
143 compose.showMaximized(); 144 compose.showMaximized();
144 compose.exec(); 145 compose.exec();
145 raise(); 146 raise();
146} 147}
147 148
148void OpieMail::slotComposeMail() 149void OpieMail::slotComposeMail()
149{ 150{
150 if ( mPendingEmail == QString::null && mPendingName == QString::null) 151 if ( mPendingEmail == QString::null && mPendingName == QString::null)
151 slotwriteMail2( QString () ); 152 slotwriteMail2( QString () );
152 else { 153 else {
153 if ( mPendingEmail == QString::null ) 154 if ( mPendingEmail == QString::null )
154 slotwriteMail2( mPendingName ); 155 slotwriteMail2( mPendingName );
155 else 156 else
156 slotwriteMail( mPendingName, mPendingEmail ); 157 slotwriteMail( mPendingName, mPendingEmail );
157 } 158 }
158 //slotwriteMail(0l,0l); 159 //slotwriteMail(0l,0l);
159} 160}
160 161
161void OpieMail::slotSendQueued() 162void OpieMail::slotSendQueued()
162{ 163{
163 SMTPaccount *smtp = 0; 164 SMTPaccount *smtp = 0;
164 165
165 QList<Account> list = settings->getAccounts(); 166 QList<Account> list = settings->getAccounts();
166 QList<SMTPaccount> smtpList; 167 QList<SMTPaccount> smtpList;
167 smtpList.setAutoDelete(false); 168 smtpList.setAutoDelete(false);
168 Account *it; 169 Account *it;
169 for ( it = list.first(); it; it = list.next() ) 170 for ( it = list.first(); it; it = list.next() )
170 { 171 {
171 if ( it->getType() == MAILLIB::A_SMTP ) 172 if ( it->getType() == MAILLIB::A_SMTP )
172 { 173 {
173 smtp = static_cast<SMTPaccount *>(it); 174 smtp = static_cast<SMTPaccount *>(it);
174 smtpList.append(smtp); 175 smtpList.append(smtp);
175 } 176 }
176 } 177 }
177 if (smtpList.count()==0) 178 if (smtpList.count()==0)
178 { 179 {
179 QMessageBox::information(0,tr("Info"),tr("Define a smtp account first!\n")); 180 QMessageBox::information(0,i18n("Info"),i18n("Define a smtp account first!\n"));
180 return; 181 return;
181 } 182 }
182 if (smtpList.count()==1) 183 if (smtpList.count()==1)
183 { 184 {
184 smtp = smtpList.at(0); 185 smtp = smtpList.at(0);
185 } 186 }
186 else 187 else
187 { 188 {
188 smtp = 0; 189 smtp = 0;
189 selectsmtp selsmtp; 190 selectsmtp selsmtp;
190 selsmtp.setSelectionlist(&smtpList); 191 selsmtp.setSelectionlist(&smtpList);
191 selsmtp.showMaximized(); 192 selsmtp.showMaximized();
192 if ( selsmtp.exec() == QDialog::Accepted ) 193 if ( selsmtp.exec() == QDialog::Accepted )
193 { 194 {
194 smtp = selsmtp.selected_smtp(); 195 smtp = selsmtp.selected_smtp();
195 } 196 }
196 } 197 }
197 if (smtp) 198 if (smtp)
198 { 199 {
199 SMTPwrapper * wrap = new SMTPwrapper(smtp); 200 SMTPwrapper * wrap = new SMTPwrapper(smtp);
200 if ( wrap->flushOutbox() ) 201 if ( wrap->flushOutbox() )
201 { 202 {
202 QMessageBox::information(0,tr("Info"),tr("Mail queue flushed")); 203 QMessageBox::information(0,i18n("Info"),i18n("Mail queue flushed"));
203 } 204 }
204 delete wrap; 205 delete wrap;
205 } 206 }
206} 207}
207 208
208void OpieMail::slotSearchMails() 209void OpieMail::slotSearchMails()
209{ 210{
210 qDebug("OpieMail::slotSearchMails():not implemented "); 211 qDebug("OpieMail::slotSearchMails():not implemented ");
211} 212}
212 213
213void OpieMail::slotEditSettings() 214void OpieMail::slotEditSettings()
214{ 215{
215#if 0 216#if 0
216 SettingsDialog settingsDialog( this, 0, true, WStyle_ContextHelp ); 217 SettingsDialog settingsDialog( this, 0, true, WStyle_ContextHelp );
217 settingsDialog.showMaximized(); 218 settingsDialog.showMaximized();
218 settingsDialog.exec(); 219 settingsDialog.exec();
219#endif 220#endif
220 KOPrefsDialog settingsDialog( this, "koprefs", true ); 221 KOPrefsDialog settingsDialog( this, "koprefs", true );
221 settingsDialog.showMaximized(); 222 settingsDialog.showMaximized();
222 settingsDialog.exec(); 223 settingsDialog.exec();
223} 224}
224 225
225void OpieMail::slotEditAccounts() 226void OpieMail::slotEditAccounts()
226{ 227{
227 EditAccounts eaDialog( settings, this, 0, true ); 228 EditAccounts eaDialog( settings, this, 0, true );
228 eaDialog.slotAdjustColumns(); 229 eaDialog.slotAdjustColumns();
229 eaDialog.showMaximized(); 230 eaDialog.showMaximized();
230 eaDialog.exec(); 231 eaDialog.exec();
231 if ( settings ) delete settings; 232 if ( settings ) delete settings;
232 settings = new Settings(); 233 settings = new Settings();
233 234
234 folderView->populate( settings->getAccounts() ); 235 folderView->populate( settings->getAccounts() );
235} 236}
236 237
237void OpieMail::displayMail() 238void OpieMail::displayMail()
238{ 239{
239 QListViewItem*item = mailView->currentItem(); 240 QListViewItem*item = mailView->currentItem();
240 if (!item) return; 241 if (!item) return;
241 RecMailP mail = ((MailListViewItem*)item)->data(); 242 RecMailP mail = ((MailListViewItem*)item)->data();
242 RecBodyP body = folderView->fetchBody(mail); 243 RecBodyP body = folderView->fetchBody(mail);
243 ViewMail readMail( this,"", Qt::WType_Modal ); 244 ViewMail readMail( this,"", Qt::WType_Modal );
244 readMail.setBody( body ); 245 readMail.setBody( body );
245 readMail.setMail( mail ); 246 readMail.setMail( mail );
246 readMail.showMaximized(); 247 readMail.showMaximized();
247 readMail.exec(); 248 readMail.exec();
248 249
249 if ( readMail.deleted ) 250 if ( readMail.deleted )
250 { 251 {
251 folderView->refreshCurrent(); 252 folderView->refreshCurrent();
252 } 253 }
253 else 254 else
254 { 255 {
255 ( (MailListViewItem*)item )->setPixmap( 0, QPixmap() ); 256 ( (MailListViewItem*)item )->setPixmap( 0, QPixmap() );
256 } 257 }
257} 258}
258void OpieMail::slotGetAllMail() 259void OpieMail::slotGetAllMail()
259{ 260{
260 QListViewItem * item = folderView->firstChild(); 261 QListViewItem * item = folderView->firstChild();
261 while ( item ){ 262 while ( item ){
262 ((AccountViewItem *)item)->contextMenuSelected( 101 ); 263 ((AccountViewItem *)item)->contextMenuSelected( 101 );
263 item = item->nextSibling (); 264 item = item->nextSibling ();
264 } 265 }
265} 266}
266void OpieMail::slotGetMail() 267void OpieMail::slotGetMail()
267{ 268{
268 QListViewItem * item = folderView->currentItem(); 269 QListViewItem * item = folderView->currentItem();
269 if ( ! item ) return; 270 if ( ! item ) return;
270 ((AccountViewItem *)item)->contextMenuSelected( 101 ); 271 ((AccountViewItem *)item)->contextMenuSelected( 101 );
271} 272}
272void OpieMail::slotDeleteMail() 273void OpieMail::slotDeleteMail()
273{ 274{
274 if (!mailView->currentItem()) return; 275 if (!mailView->currentItem()) return;
275 RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data(); 276 RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data();
276 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 ) 277 if ( QMessageBox::warning(this, i18n("Delete Mail"), QString( i18n("<p>Do you really want to delete this mail? <br><br>" ) + mail->getFrom() + " - " + mail->getSubject() ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes )
277 { 278 {
278 mail->Wrapper()->deleteMail( mail ); 279 mail->Wrapper()->deleteMail( mail );
279 folderView->refreshCurrent(); 280 folderView->refreshCurrent();
280 } 281 }
281} 282}
282void OpieMail::slotDeleteAllMail() 283void OpieMail::slotDeleteAllMail()
283{ 284{
284 285
285 QValueList<RecMailP> t; 286 QValueList<RecMailP> t;
286 if ( QMessageBox::warning(this, tr("Delete All Mails"), tr("Do you really want to delete\nall selected mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) 287 if ( QMessageBox::warning(this, i18n("Delete All Mails"), i18n("Do you really want to delete\nall selected mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes )
287 { 288 {
288 MailListViewItem* item = (MailListViewItem*)mailView->firstChild (); 289 MailListViewItem* item = (MailListViewItem*)mailView->firstChild ();
289 while ( item ) { 290 while ( item ) {
290 if ( item->isSelected() ) { 291 if ( item->isSelected() ) {
291 t.append( item->data() ); 292 t.append( item->data() );
292 } 293 }
293 item = (MailListViewItem*)item->nextSibling(); 294 item = (MailListViewItem*)item->nextSibling();
294 } 295 }
295 } 296 }
296 else 297 else
297 return; 298 return;
298 if ( t.count() == 0 ) 299 if ( t.count() == 0 )
299 return; 300 return;
300 RecMailP mail = t.first(); 301 RecMailP mail = t.first();
301 mail->Wrapper()->deleteMailList(t); 302 mail->Wrapper()->deleteMailList(t);
302 folderView->refreshCurrent(); 303 folderView->refreshCurrent();
303 304
304 305
305} 306}
306void OpieMail::clearSelection() 307void OpieMail::clearSelection()
307{ 308{
308 mailView->clearSelection(); 309 mailView->clearSelection();
309 310
310} 311}
311 312
312void OpieMail::mailHold(int button, QListViewItem *item,const QPoint&,int ) 313void OpieMail::mailHold(int button, QListViewItem *item,const QPoint&,int )
313{ 314{
314 if (!mailView->currentItem()) return; 315 if (!mailView->currentItem()) return;
315 MAILLIB::ATYPE mailtype = ((MailListViewItem*)mailView->currentItem() )->wrapperType(); 316 MAILLIB::ATYPE mailtype = ((MailListViewItem*)mailView->currentItem() )->wrapperType();
316 /* just the RIGHT button - or hold on pda */ 317 /* just the RIGHT button - or hold on pda */
317 if (button!=2) {return;} 318 if (button!=2) {return;}
318 if (!item) return; 319 if (!item) return;
319 QPopupMenu *m = new QPopupMenu(0); 320 QPopupMenu *m = new QPopupMenu(0);
320 if (m) 321 if (m)
321 { 322 {
322 if (mailtype==MAILLIB::A_NNTP) { 323 if (mailtype==MAILLIB::A_NNTP) {
323 m->insertItem(tr("Read this posting"),this,SLOT(displayMail())); 324 m->insertItem(i18n("Read this posting"),this,SLOT(displayMail()));
324 m->insertItem(tr("Copy this posting"),this,SLOT(slotMoveCopyMail())); 325 m->insertItem(i18n("Copy this posting"),this,SLOT(slotMoveCopyMail()));
325 m->insertSeparator(); 326 m->insertSeparator();
326 m->insertItem(tr("Copy all selected postings"),this,SLOT(slotMoveCopyAllMail())); 327 m->insertItem(i18n("Copy all selected postings"),this,SLOT(slotMoveCopyAllMail()));
327 m->insertItem(tr("Clear selection"),this,SLOT(clearSelection())); 328 m->insertItem(i18n("Clear selection"),this,SLOT(clearSelection()));
328 } else { 329 } else {
329 if (folderView->currentisDraft()) { 330 if (folderView->currentisDraft()) {
330 m->insertItem(tr("Edit this mail"),this,SLOT(reEditMail())); 331 m->insertItem(i18n("Edit this mail"),this,SLOT(reEditMail()));
331 } 332 }
332 m->insertItem(tr("Read this mail"),this,SLOT(displayMail())); 333 m->insertItem(i18n("Read this mail"),this,SLOT(displayMail()));
333 m->insertItem(tr("Move/Copy this mail"),this,SLOT(slotMoveCopyMail())); 334 m->insertItem(i18n("Move/Copy this mail"),this,SLOT(slotMoveCopyMail()));
334 m->insertItem(tr("Delete this mail"),this,SLOT(slotDeleteMail())); 335 m->insertItem(i18n("Delete this mail"),this,SLOT(slotDeleteMail()));
335 m->insertSeparator(); 336 m->insertSeparator();
336 m->insertItem(tr("Move/Copy all selected mail"),this,SLOT(slotMoveCopyAllMail())); 337 m->insertItem(i18n("Move/Copy all selected mail"),this,SLOT(slotMoveCopyAllMail()));
337 m->insertItem(tr("Delete all selected mails"),this,SLOT(slotDeleteAllMail())); 338 m->insertItem(i18n("Delete all selected mails"),this,SLOT(slotDeleteAllMail()));
338 m->insertItem(tr("Clear selection"),this,SLOT(clearSelection())); 339 m->insertItem(i18n("Clear selection"),this,SLOT(clearSelection()));
339 } 340 }
340 m->setFocus(); 341 m->setFocus();
341 m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); 342 m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) );
342 delete m; 343 delete m;
343 } 344 }
344} 345}
345 346
346void OpieMail::slotShowFolders( bool show ) 347void OpieMail::slotShowFolders( bool show )
347{ 348{
348 if ( show && folderView->isHidden() ) 349 if ( show && folderView->isHidden() )
349 { 350 {
350 folderView->show(); 351 folderView->show();
351 } 352 }
352 else if ( !show && !folderView->isHidden() ) 353 else if ( !show && !folderView->isHidden() )
353 { 354 {
354 folderView->hide(); 355 folderView->hide();
355 } 356 }
356} 357}
357 358
358void OpieMail::refreshMailView(const QValueList<RecMailP>&list) 359void OpieMail::refreshMailView(const QValueList<RecMailP>&list)
359{ 360{
360 MailListViewItem*item = 0; 361 MailListViewItem*item = 0;
361 mailView->clear(); 362 mailView->clear();
362 363
363 QValueList<RecMailP>::ConstIterator it; 364 QValueList<RecMailP>::ConstIterator it;
364 for (it = list.begin(); it != list.end();++it) 365 for (it = list.begin(); it != list.end();++it)
365 { 366 {
366 item = new MailListViewItem(mailView,item); 367 item = new MailListViewItem(mailView,item);
367 item->storeData((*it)); 368 item->storeData((*it));
368 item->showEntry(); 369 item->showEntry();
369 } 370 }
370} 371}
371 372
372void OpieMail::mailLeftClicked( QListViewItem *item ) 373void OpieMail::mailLeftClicked( QListViewItem *item )
373{ 374{
374 mailView->clearSelection(); 375 mailView->clearSelection();
375 /* just LEFT button - or tap with stylus on pda */ 376 /* just LEFT button - or tap with stylus on pda */
376 //if (button!=1) return; 377 //if (button!=1) return;
377 if (!item) return; 378 if (!item) return;
378 if (folderView->currentisDraft()) { 379 if (folderView->currentisDraft()) {
379 reEditMail(); 380 reEditMail();
380 } else { 381 } else {
381 displayMail(); 382 displayMail();
382 } 383 }
383} 384}
384 385
385void OpieMail::slotMoveCopyMail() 386void OpieMail::slotMoveCopyMail()
386{ 387{
387 if (!mailView->currentItem()) return; 388 if (!mailView->currentItem()) return;
388 RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data(); 389 RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data();
389 AbstractMail*targetMail = 0; 390 AbstractMail*targetMail = 0;
390 QString targetFolder = ""; 391 QString targetFolder = "";
391 Selectstore sels; 392 Selectstore sels;
392 folderView->setupFolderselect(&sels); 393 folderView->setupFolderselect(&sels);
393 if (!sels.exec()) return; 394 if (!sels.exec()) return;
394 targetMail = sels.currentMail(); 395 targetMail = sels.currentMail();
395 targetFolder = sels.currentFolder(); 396 targetFolder = sels.currentFolder();
396 if ( (mail->Wrapper()==targetMail && mail->getMbox()==targetFolder) || 397 if ( (mail->Wrapper()==targetMail && mail->getMbox()==targetFolder) ||
397 targetFolder.isEmpty()) 398 targetFolder.isEmpty())
398 { 399 {
399 return; 400 return;
400 } 401 }
401 if (sels.newFolder() && !targetMail->createMbox(targetFolder)) 402 if (sels.newFolder() && !targetMail->createMbox(targetFolder))
402 { 403 {
403 QMessageBox::critical(0,tr("Error creating new Folder"), 404 QMessageBox::critical(0,i18n("Error creating new Folder"),
404 tr("<center>Error while creating<br>new folder - breaking.</center>")); 405 i18n("<center>Error while creating<br>new folder - breaking.</center>"));
405 return; 406 return;
406 } 407 }
407 sels.hide(); 408 sels.hide();
408 qApp->processEvents(); 409 qApp->processEvents();
409 // qDebug("hiding sels "); 410 // qDebug("hiding sels ");
410 mail->Wrapper()->mvcpMail(mail,targetFolder,targetMail,sels.moveMails()); 411 mail->Wrapper()->mvcpMail(mail,targetFolder,targetMail,sels.moveMails());
411 folderView->refreshCurrent(); 412 folderView->refreshCurrent();
412} 413}
413 414
414void OpieMail::slotMoveCopyAllMail() 415void OpieMail::slotMoveCopyAllMail()
415{ 416{
416 417
417 if (!mailView->currentItem()) return; 418 if (!mailView->currentItem()) return;
418 QValueList<RecMailP> t; 419 QValueList<RecMailP> t;
419 // if ( QMessageBox::warning(this, tr("Move/Copy all selected mails"), tr("Do you really want to copy/move\nall selected mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) 420 // if ( QMessageBox::warning(this, i18n("Move/Copy all selected mails"), i18n("Do you really want to copy/move\nall selected mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes )
420 { 421 {
421 MailListViewItem* item = (MailListViewItem*)mailView->firstChild (); 422 MailListViewItem* item = (MailListViewItem*)mailView->firstChild ();
422 while ( item ) { 423 while ( item ) {
423 if ( item->isSelected() ) { 424 if ( item->isSelected() ) {
424 t.append( item->data() ); 425 t.append( item->data() );
425 } 426 }
426 item = (MailListViewItem*)item->nextSibling(); 427 item = (MailListViewItem*)item->nextSibling();
427 } 428 }
428 } 429 }
429 // else 430 // else
430 // return; 431 // return;
431 if ( t.count() == 0 ) 432 if ( t.count() == 0 )
432 return; 433 return;
433 RecMailP mail = t.first(); 434 RecMailP mail = t.first();
434 AbstractMail*targetMail = 0; 435 AbstractMail*targetMail = 0;
435 QString targetFolder = ""; 436 QString targetFolder = "";
436 Selectstore sels; 437 Selectstore sels;
437 folderView->setupFolderselect(&sels); 438 folderView->setupFolderselect(&sels);
438 if (!sels.exec()) return; 439 if (!sels.exec()) return;
439 targetMail = sels.currentMail(); 440 targetMail = sels.currentMail();
440 targetFolder = sels.currentFolder(); 441 targetFolder = sels.currentFolder();
441 if ( (mail->Wrapper()==targetMail && mail->getMbox()==targetFolder) || 442 if ( (mail->Wrapper()==targetMail && mail->getMbox()==targetFolder) ||
442 targetFolder.isEmpty()) 443 targetFolder.isEmpty())
443 { 444 {
444 return; 445 return;
445 } 446 }
446 if (sels.newFolder() && !targetMail->createMbox(targetFolder)) 447 if (sels.newFolder() && !targetMail->createMbox(targetFolder))
447 { 448 {
448 QMessageBox::critical(0,tr("Error creating new Folder"), 449 QMessageBox::critical(0,i18n("Error creating new Folder"),
449 tr("<center>Error while creating<br>new folder - breaking.</center>")); 450 i18n("<center>Error while creating<br>new folder - breaking.</center>"));
450 return; 451 return;
451 } 452 }
452 sels.hide(); 453 sels.hide();
453 qApp->processEvents(); 454 qApp->processEvents();
454 //qDebug("hiding sels "); 455 //qDebug("hiding sels ");
455 mail->Wrapper()->mvcpMailList(t,targetFolder,targetMail,sels.moveMails()); 456 mail->Wrapper()->mvcpMailList(t,targetFolder,targetMail,sels.moveMails());
456 folderView->refreshCurrent(); 457 folderView->refreshCurrent();
457} 458}
458 459
459void OpieMail::reEditMail() 460void OpieMail::reEditMail()
460{ 461{
461 if (!mailView->currentItem()) return; 462 if (!mailView->currentItem()) return;
462 463
463 ComposeMail compose( settings, this, 0, true ); 464 ComposeMail compose( settings, this, 0, true );
464 compose.reEditMail(((MailListViewItem*)mailView->currentItem() )->data()); 465 compose.reEditMail(((MailListViewItem*)mailView->currentItem() )->data());
465 compose.slotAdjustColumns(); 466 compose.slotAdjustColumns();
466 compose.showMaximized(); 467 compose.showMaximized();
467 compose.exec(); 468 compose.exec();
468} 469}