summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/accountview.cpp11
-rw-r--r--noncore/net/mail/accountview.h2
-rw-r--r--noncore/net/mail/defines.h2
-rw-r--r--noncore/net/mail/mainwindow.cpp7
-rw-r--r--noncore/net/mail/mainwindow.h4
-rw-r--r--noncore/net/mail/opiemail.cpp13
-rw-r--r--noncore/net/mail/opiemail.h3
-rw-r--r--noncore/net/mail/settingsdialog.cpp4
-rw-r--r--noncore/net/mail/settingsdialogui.ui30
9 files changed, 69 insertions, 7 deletions
diff --git a/noncore/net/mail/accountview.cpp b/noncore/net/mail/accountview.cpp
index 1183704..0e739e2 100644
--- a/noncore/net/mail/accountview.cpp
+++ b/noncore/net/mail/accountview.cpp
@@ -1,57 +1,66 @@
#include "accountview.h"
#include "accountitem.h"
#include "selectstore.h"
#include <libmailwrapper/settings.h>
#include <libmailwrapper/mailwrapper.h>
#include <libmailwrapper/mailtypes.h>
#include <libmailwrapper/abstractmail.h>
/* OPIE */
#include <opie2/odebug.h>
#include <qpe/qpeapplication.h>
+#include <qpe/config.h>
/* QT */
#include <qmessagebox.h>
#include <qpopupmenu.h>
using namespace Opie::Core;
AccountView::AccountView( QWidget *parent, const char *name, WFlags flags )
: QListView( parent, name, flags )
{
setSorting(0);
setSelectionMode(Single);
m_rightPressed = false;
connect( this, SIGNAL( selectionChanged(QListViewItem*) ),
SLOT( slotSelectionChanged(QListViewItem*) ) );
connect( this, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),this,
SLOT( slotMouseButton(int,QListViewItem*,const QPoint&,int) ) );
connect( this, SIGNAL(clicked(QListViewItem*) ),this,
SLOT( slotMouseClicked(QListViewItem*) ) );
m_currentItem = 0;
+ readSettings();
}
AccountView::~AccountView()
{
imapAccounts.clear();
mhAccounts.clear();
}
+void AccountView::readSettings()
+{
+ Config cfg("mail");
+ cfg.setGroup( "Settings" );
+ m_clickopens = cfg.readBoolEntry("clickOpensFolder",true);
+}
+
void AccountView::slotSelectionChanged(QListViewItem*item)
{
if (!item) {
emit serverSelected(0);
return;
}
AccountViewItem *view = static_cast<AccountViewItem *>(item);
emit serverSelected(view->isServer());
}
QMap<int,QString> AccountView::currentServerMenu()const
{
QMap<int,QString> smap;
AccountViewItem *view = static_cast<AccountViewItem *>(currentItem());
if (!view)return smap;
smap = view->serverMenu();
@@ -85,33 +94,33 @@ void AccountView::slotRightButton(int, QListViewItem * item,const QPoint&,int)
QPopupMenu*m = view->getContextMenu();
if (!m) return;
connect(m,SIGNAL(activated(int)),this,SLOT(slotContextMenu(int)));
m->setFocus();
m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) );
delete m;
}
void AccountView::slotLeftButton(int, QListViewItem *,const QPoint&,int)
{
m_rightPressed = false;
}
void AccountView::slotMouseClicked(QListViewItem*item)
{
if (m_rightPressed) return;
- if (!item || m_currentItem == item) return;
+ if (!item || m_currentItem == item||!m_clickopens) return;
/* ### ToDo check settings if on single tab it should open */
m_currentItem = item;
refresh(m_currentItem);
}
void AccountView::slotMouseButton(int button, QListViewItem * item,const QPoint&pos,int column)
{
if (button==1) {
slotLeftButton(button,item,pos,column);
} else if (button==2) {
slotRightButton(button,item,pos,column);
}
}
void AccountView::populate( QList<Account> list )
{
diff --git a/noncore/net/mail/accountview.h b/noncore/net/mail/accountview.h
index 5c4b559..418f4f3 100644
--- a/noncore/net/mail/accountview.h
+++ b/noncore/net/mail/accountview.h
@@ -20,39 +20,41 @@ class AccountView : public QListView
public:
AccountView( QWidget *parent = 0, const char *name = 0, WFlags flags = 0 );
virtual ~AccountView();
virtual void populate( QList<Account> list );
virtual RecBodyP fetchBody(const Opie::Core::OSmartPointer<RecMail>&aMail);
virtual void downloadMails(const Opie::Core::OSmartPointer<Folder>&fromFolder,AbstractMail*fromWrapper);
virtual bool currentisDraft();
QMap<int,QString> currentServerMenu()const;
QMap<int,QString> currentFolderMenu()const;
public slots:
virtual void refreshAll();
virtual void refresh(QListViewItem *item);
virtual void refreshCurrent();
virtual void slotContextMenu(int id);
+ virtual void readSettings();
void setupFolderselect(Selectstore*sels);
signals:
void refreshMailview(const QValueList<RecMailP>& );
void serverSelected(int);
void refreshMenues(int);
protected:
QListViewItem* m_currentItem;
QValueList<IMAPviewItem*> imapAccounts;
QValueList<MHviewItem*> mhAccounts;
bool m_rightPressed:1;
+ bool m_clickopens:1;
protected slots:
virtual void slotRightButton(int, QListViewItem *,const QPoint&,int);
virtual void slotLeftButton(int, QListViewItem *,const QPoint&,int);
virtual void slotMouseButton(int, QListViewItem *,const QPoint&,int);
virtual void slotMouseClicked(QListViewItem*);
virtual void slotSelectionChanged(QListViewItem*);
};
#endif
diff --git a/noncore/net/mail/defines.h b/noncore/net/mail/defines.h
index 5fcbf0f..50d63dd 100644
--- a/noncore/net/mail/defines.h
+++ b/noncore/net/mail/defines.h
@@ -4,40 +4,42 @@
#include <qpe/resource.h>
#define USER_AGENT "OpieMail v0.3"
#define PIC_COMPOSEMAIL "mail/composemail"
#define PIC_SENDQUEUED "mail/sendqueued"
#define PIC_SHOWFOLDERS "mail/showfolders"
#define PIC_SYNC "mail/sync"
#define PIC_IMAPFOLDER "mail/imapfolder"
#define PIC_MBOXFOLDER "mail/mboxfolder"
#define PIC_POP3FOLDER "mail/pop3folder"
#define PIC_INBOXFOLDER "mail/inbox"
#define PIC_OUTBOXFOLDER "mail/outbox"
#define PIC_LOCALFOLDER "mail/localfolder"
#define PIC_OFFLINE "mail/notconnected"
+#define PIC_DOCUMENT "DocsIcon"
#define ICON_COMPOSEMAIL QIconSet( Resource::loadPixmap( PIC_COMPOSEMAIL ) )
#define ICON_SENDQUEUED QIconSet( Resource::loadPixmap( PIC_SENDQUEUED ) )
#define ICON_SHOWFOLDERS QIconSet( Resource::loadPixmap( PIC_SHOWFOLDERS ) )
#define ICON_SEARCHMAILS QIconSet( Resource::loadPixmap( PIC_SEARCHMAILS ) )
#define ICON_EDITSETTINGS QIconSet( Resource::loadPixmap( PIC_EDITSETTINGS ) )
#define ICON_EDITACCOUNTS QIconSet( Resource::loadPixmap( PIC_EDITACCOUNTS ) )
#define ICON_SYNC QIconSet( Resource::loadPixmap( PIC_SYNC ) )
+#define ICON_READMAIL QIconSet( Resource::loadPixmap( PIC_DOCUMENT))
#define PIXMAP_IMAPFOLDER QPixmap( Resource::loadPixmap( PIC_IMAPFOLDER ) )
#define PIXMAP_POP3FOLDER QPixmap( Resource::loadPixmap( PIC_POP3FOLDER ) )
#define PIXMAP_INBOXFOLDER QPixmap( Resource::loadPixmap( PIC_INBOXFOLDER) )
#define PIXMAP_MBOXFOLDER QPixmap( Resource::loadPixmap( PIC_MBOXFOLDER ) )
#define PIXMAP_OUTBOXFOLDER QPixmap( Resource::loadPixmap( PIC_OUTBOXFOLDER) )
#define PIXMAP_LOCALFOLDER QPixmap( Resource::loadPixmap( PIC_LOCALFOLDER) )
#define PIXMAP_OFFLINE QPixmap( Resource::loadPixmap( PIC_OFFLINE) )
#define IMAP_PORT "143"
#define IMAP_SSL_PORT "993"
#define SMTP_PORT "25"
#define SMTP_SSL_PORT "465"
#define POP3_PORT "110"
#define POP3_SSL_PORT "995"
#define NNTP_PORT "119"
diff --git a/noncore/net/mail/mainwindow.cpp b/noncore/net/mail/mainwindow.cpp
index 3689352..b587424 100644
--- a/noncore/net/mail/mainwindow.cpp
+++ b/noncore/net/mail/mainwindow.cpp
@@ -50,37 +50,43 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags )
folderMenu->insertItem(tr("Refresh headerlist"),FOLDER_MENU_REFRESH_HEADER);
folderMenu->insertItem(tr("Delete all mails"),FOLDER_MENU_DELETE_ALL_MAILS);
folderMenu->insertItem(tr("New subfolder"),FOLDER_MENU_NEW_SUBFOLDER);
folderMenu->insertItem(tr("Delete folder"),FOLDER_MENU_DELETE_FOLDER);
folderMenu->insertItem(tr("Move/Copie all mails"),FOLDER_MENU_MOVE_MAILS);
menuBar->setItemEnabled(m_ServerMenuId,false);
menuBar->setItemEnabled(m_FolderMenuId,false);
addToolBar( toolBar );
toolBar->setHorizontalStretchable( true );
QLabel *spacer = new QLabel( toolBar );
spacer->setBackgroundMode( QWidget::PaletteButton );
toolBar->setStretchableWidget( spacer );
+ readMail = new QAction(tr("Read current mail"),ICON_READMAIL,0,0,this);
+ readMail->addTo(toolBar);
+ readMail->addTo(mailMenu);
+ connect(readMail,SIGNAL(activated()),this,SLOT(displayMail()));
+
composeMail = new QAction( tr( "Compose new mail" ), ICON_COMPOSEMAIL,
0, 0, this );
composeMail->addTo( toolBar );
composeMail->addTo( mailMenu );
+
sendQueued = new QAction( tr( "Send queued mails" ), ICON_SENDQUEUED,
0, 0, this );
sendQueued->addTo( toolBar );
sendQueued->addTo( mailMenu );
/*
syncFolders = new QAction( tr( "Sync mailfolders" ), ICON_SYNC,
0, 0, this );
syncFolders->addTo( toolBar );
syncFolders->addTo( mailMenu );
*/
showFolders = new QAction( tr( "Show/Hide folders" ), ICON_SHOWFOLDERS,
0, 0, this, 0, true );
showFolders->addTo( toolBar );
showFolders->addTo( mailMenu );
@@ -109,32 +115,33 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags )
editAccounts = new QAction( tr( "Configure accounts" ), QIconSet( Resource::loadPixmap("mail/editaccounts") ) ,
0, 0, this );
editAccounts->addTo( settingsMenu );
QWidget *view = new QWidget( this );
setCentralWidget( view );
layout = new QBoxLayout ( view, QBoxLayout::LeftToRight );
folderView = new AccountView( view );
folderView->header()->hide();
folderView->setRootIsDecorated( true );
folderView->addColumn( tr( "Mailbox" ) );
connect(folderView,SIGNAL(serverSelected(int)),this,SLOT(serverSelected(int)));
connect(serverMenu,SIGNAL(activated(int)),folderView,SLOT(slotContextMenu(int)));
connect(folderMenu,SIGNAL(activated(int)),folderView,SLOT(slotContextMenu(int)));
+ connect(this,SIGNAL(settingsChanged()),folderView,SLOT(readSettings()));
layout->addWidget( folderView );
mailView = new QListView( view );
mailView->addColumn( "" );
mailView->addColumn( tr( "Subject" ),QListView::Manual );
mailView->addColumn( tr( "Sender" ),QListView::Manual );
mailView->addColumn( tr( "Size" ),QListView::Manual);
mailView->addColumn( tr( "Date" ));
mailView->setAllColumnsShowFocus(true);
mailView->setShowSortIndicator(true);
mailView->setSorting(4,false);
layout->addWidget( mailView );
layout->setStretchFactor( folderView, 1 );
diff --git a/noncore/net/mail/mainwindow.h b/noncore/net/mail/mainwindow.h
index b781d62..6449ce8 100644
--- a/noncore/net/mail/mainwindow.h
+++ b/noncore/net/mail/mainwindow.h
@@ -36,26 +36,28 @@ protected slots:
virtual void slotShowFolders( bool show );
virtual void refreshMailView(const QValueList<RecMailP>&);
virtual void displayMail();
virtual void slotDeleteMail();
virtual void mailHold(int, QListViewItem *,const QPoint&,int);
virtual void slotAdjustLayout();
virtual void slotEditSettings();
virtual void mailLeftClicked( int, QListViewItem *,const QPoint&,int );
virtual void serverSelected(int);
protected:
QToolBar *toolBar;
QMenuBar *menuBar;
QPopupMenu *mailMenu, *settingsMenu,*serverMenu,*folderMenu;
QAction *composeMail, *sendQueued, *showFolders, *searchMails, *deleteMails,
- *editSettings, *editAccounts, *syncFolders;
+ *editSettings, *editAccounts, *syncFolders,*readMail;
AccountView *folderView;
QListView *mailView;
QBoxLayout *layout;
int m_Rotate;
QCopChannel* m_sysChannel;
int m_ServerMenuId,m_FolderMenuId;
+signals:
+ void settingsChanged();
};
#endif
diff --git a/noncore/net/mail/opiemail.cpp b/noncore/net/mail/opiemail.cpp
index 1bc81e4..fb8877a 100644
--- a/noncore/net/mail/opiemail.cpp
+++ b/noncore/net/mail/opiemail.cpp
@@ -2,32 +2,33 @@
#include "settingsdialog.h"
#include "opiemail.h"
#include "editaccounts.h"
#include "composemail.h"
#include "mailistviewitem.h"
#include "viewmail.h"
#include "selectstore.h"
#include "selectsmtp.h"
#include <libmailwrapper/smtpwrapper.h>
#include <libmailwrapper/mailtypes.h>
#include <libmailwrapper/abstractmail.h>
/* OPIE */
#include <opie2/odebug.h>
#include <qpe/resource.h>
#include <qpe/qpeapplication.h>
+#include <qpe/config.h>
/* QT */
#include <qmap.h>
#include <qvaluelist.h>
/* UNIX */
#include <signal.h>
using namespace Opie::Core;
typedef QMapNode<QString,QString> tkeyvalues;
typedef QValueList<tkeyvalues> tvaluelist;
class ValueExplode
{
protected:
@@ -93,32 +94,36 @@ void ValueExplode::splitit()
startpos = pos+1;
}
if (startpos<iLine.length()) {
pos2 = iLine.find(m2Delemiter,startpos);
if (pos2==-1) {
m_LastParsed.append(tkeyvalues(iLine.mid(startpos),""));
} else {
m_LastParsed.append(tkeyvalues(iLine.mid(startpos,pos2-startpos),iLine.mid(pos2+1)));
}
}
}
OpieMail::OpieMail( QWidget *parent, const char *name, WFlags )
: MainWindow( parent, name, WStyle_ContextHelp )
{
setup_signalblocking();
+ Config cfg("mail");
+ cfg.setGroup( "Settings" );
+ m_clickopens = cfg.readBoolEntry("clickOpensMail",true);
+
settings = new Settings();
folderView->populate( settings->getAccounts() );
connect(folderView,SIGNAL(refreshMenues(int)),this,SLOT(refreshMenu(int)));
}
OpieMail::~OpieMail()
{
if (settings) delete settings;
}
void OpieMail::setup_signalblocking()
{
/* for networking we must block SIGPIPE and Co. */
struct sigaction blocking_action,temp_action;
blocking_action.sa_handler = SIG_IGN;
sigemptyset(&(blocking_action.sa_mask));
@@ -221,33 +226,38 @@ void OpieMail::slotSendQueued()
if ( wrap->flushOutbox() )
{
QMessageBox::information(0,tr("Info"),tr("Mail queue flushed"));
}
delete wrap;
}
}
void OpieMail::slotSearchMails()
{
odebug << "Search Mails" << oendl;
}
void OpieMail::slotEditSettings()
{
SettingsDialog settingsDialog( this, 0, true, WStyle_ContextHelp );
- QPEApplication::execDialog( &settingsDialog );
+ if (QPEApplication::execDialog( &settingsDialog )) {
+ Config cfg("mail");
+ cfg.setGroup( "Settings" );
+ m_clickopens = cfg.readBoolEntry("clickOpensMail",true);
+ emit settingsChanged();
+ }
}
void OpieMail::slotEditAccounts()
{
odebug << "Edit Accounts" << oendl;
EditAccounts eaDialog( settings, this, 0, true, WStyle_ContextHelp );
eaDialog.slotAdjustColumns();
if (QPEApplication::execDialog( &eaDialog )==QDialog::Rejected);// return;
if ( settings ) delete settings;
settings = new Settings();
mailView->clear();
folderView->populate( settings->getAccounts() );
}
void OpieMail::displayMail()
@@ -329,32 +339,33 @@ void OpieMail::slotShowFolders( bool show )
void OpieMail::refreshMailView(const QValueList<RecMailP>&list)
{
MailListViewItem*item = 0;
mailView->clear();
QValueList<RecMailP>::ConstIterator it;
for (it = list.begin(); it != list.end();++it)
{
item = new MailListViewItem(mailView,item);
item->storeData((*it));
item->showEntry();
}
}
void OpieMail::mailLeftClicked(int button, QListViewItem *item,const QPoint&,int )
{
+ if (!m_clickopens) return;
/* just LEFT button - or tap with stylus on pda */
if (button!=1) return;
if (!item) return;
if (folderView->currentisDraft()) {
reEditMail();
} else {
displayMail();
}
}
void OpieMail::slotMoveCopyMail()
{
if (!mailView->currentItem()) return;
RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data();
AbstractMail*targetMail = 0;
QString targetFolder = "";
diff --git a/noncore/net/mail/opiemail.h b/noncore/net/mail/opiemail.h
index 75a0b2d..327bef7 100644
--- a/noncore/net/mail/opiemail.h
+++ b/noncore/net/mail/opiemail.h
@@ -30,22 +30,25 @@ protected slots:
virtual void slotEditSettings();
virtual void slotEditAccounts();
virtual void displayMail();
virtual void slotDeleteMail();
virtual void mailHold(int, QListViewItem *,const QPoint&,int);
virtual void slotShowFolders( bool show );
virtual void refreshMailView(const QValueList<RecMailP>&);
virtual void mailLeftClicked( int, QListViewItem *,const QPoint&,int );
virtual void slotMoveCopyMail();
virtual void reEditMail();
virtual void serverSelected(int);
virtual void refreshMenu(int);
protected:
void setup_signalblocking();
+ bool m_clickopens:1;
+
private:
Settings *settings;
+signals:
};
#endif
diff --git a/noncore/net/mail/settingsdialog.cpp b/noncore/net/mail/settingsdialog.cpp
index 6441948..74b8b12 100644
--- a/noncore/net/mail/settingsdialog.cpp
+++ b/noncore/net/mail/settingsdialog.cpp
@@ -7,45 +7,49 @@
SettingsDialog::SettingsDialog( QWidget* parent, const char* name, bool modal, WFlags fl )
: SettingsDialogUI( parent, name, modal, fl ) {
readConfig();
}
SettingsDialog::~SettingsDialog() {
}
void SettingsDialog::readConfig() {
Config cfg("mail");
cfg.setGroup( "Settings" );
showHtmlButton->setChecked( cfg.readBoolEntry( "showHtml", false ) );
+ clickOpenMailButton->setChecked(cfg.readBoolEntry("clickOpensMail",true));
+ clickOpenFolderButton->setChecked(cfg.readBoolEntry("clickOpensFolder",true));
cfg.setGroup( "Compose" );
checkBoxLater->setChecked( cfg.readBoolEntry( "sendLater", false ) );
cfg.setGroup( "Applet" );
cbEnableTaskbarApplet->setChecked( cfg.readBoolEntry( "Disabled", false ) );
spCheckOften->setValue( cfg.readNumEntry( "CheckEvery", 5 ) );
cbBlinkLed->setChecked( cfg.readBoolEntry( "BlinkLed", true ) );
cbPlaySound->setChecked( cfg.readBoolEntry( "PlaySound", false ) );
}
void SettingsDialog::writeConfig() {
Config cfg( "mail" );
cfg.setGroup( "Settings" );
+ cfg.writeEntry("clickOpensMail",clickOpenMailButton->isChecked());
+ cfg.writeEntry("clickOpensFolder",clickOpenFolderButton->isChecked());
cfg.writeEntry( "showHtml", showHtmlButton->isChecked() );
cfg.setGroup( "Compose" );
cfg.writeEntry( "sendLater", checkBoxLater->isChecked() );
cfg.setGroup( "Applet" );
cfg.writeEntry( "Disabled", cbEnableTaskbarApplet->isChecked() );
int check = spCheckOften->value();
if (check<1)check=1;if (check>99)check=99;
cfg.writeEntry( "CheckEvery", check);
cfg.writeEntry( "BlinkLed", cbBlinkLed->isChecked() );
cfg.writeEntry( "PlaySound", cbPlaySound->isChecked() );
}
void SettingsDialog::accept() {
writeConfig();
QDialog::accept();
}
diff --git a/noncore/net/mail/settingsdialogui.ui b/noncore/net/mail/settingsdialogui.ui
index 4acd84a..0a97da0 100644
--- a/noncore/net/mail/settingsdialogui.ui
+++ b/noncore/net/mail/settingsdialogui.ui
@@ -1,31 +1,31 @@
<!DOCTYPE UI><UI>
<class>SettingsDialogUI</class>
<widget>
<class>QDialog</class>
<property stdset="1">
<name>name</name>
<cstring>SettingsDialogUI</cstring>
</property>
<property stdset="1">
<name>geometry</name>
<rect>
<x>0</x>
<y>0</y>
- <width>312</width>
- <height>379</height>
+ <width>304</width>
+ <height>378</height>
</rect>
</property>
<property stdset="1">
<name>caption</name>
<string>Settings Dialog</string>
</property>
<property>
<name>layoutMargin</name>
</property>
<property>
<name>layoutSpacing</name>
</property>
<vbox>
<property stdset="1">
<name>margin</name>
<number>3</number>
@@ -46,49 +46,71 @@
<property>
<name>layoutSpacing</name>
</property>
<widget>
<class>QWidget</class>
<property stdset="1">
<name>name</name>
<cstring>tab</cstring>
</property>
<attribute>
<name>title</name>
<string>View Mail</string>
</attribute>
<vbox>
<property stdset="1">
<name>margin</name>
- <number>3</number>
+ <number>11</number>
</property>
<property stdset="1">
<name>spacing</name>
- <number>3</number>
+ <number>6</number>
</property>
<widget>
<class>QCheckBox</class>
<property stdset="1">
<name>name</name>
<cstring>showHtmlButton</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>View mail as Html</string>
</property>
</widget>
+ <widget>
+ <class>QCheckBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>clickOpenMailButton</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Click opens mail</string>
+ </property>
+ </widget>
+ <widget>
+ <class>QCheckBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>clickOpenFolderButton</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Click activate server/folder</string>
+ </property>
+ </widget>
<spacer>
<property>
<name>name</name>
<cstring>Spacer1</cstring>
</property>
<property stdset="1">
<name>orientation</name>
<enum>Vertical</enum>
</property>
<property stdset="1">
<name>sizeType</name>
<enum>Expanding</enum>
</property>
<property>
<name>sizeHint</name>
<size>