summaryrefslogtreecommitdiffabout
path: root/kmicromail
authorzautrix <zautrix>2005-01-28 03:22:17 (UTC)
committer zautrix <zautrix>2005-01-28 03:22:17 (UTC)
commit94f0e8140c07696174dc3774dc2c11efad2ffa68 (patch) (side-by-side diff)
treed95cc80e5c5221e8d9ce1cbf4b01cbf78fdf843a /kmicromail
parent6fb044008531ec883fc25a3ef2b43904930cfff6 (diff)
downloadkdepimpi-94f0e8140c07696174dc3774dc2c11efad2ffa68.zip
kdepimpi-94f0e8140c07696174dc3774dc2c11efad2ffa68.tar.gz
kdepimpi-94f0e8140c07696174dc3774dc2c11efad2ffa68.tar.bz2
missing config
Diffstat (limited to 'kmicromail') (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/koprefs.cpp5
-rw-r--r--kmicromail/koprefs.h1
-rw-r--r--kmicromail/koprefsdialog.cpp19
-rw-r--r--kmicromail/mainwindow.cpp64
-rw-r--r--kmicromail/opiemail.cpp3
5 files changed, 68 insertions, 24 deletions
diff --git a/kmicromail/koprefs.cpp b/kmicromail/koprefs.cpp
index 2bae5f6..7b1e169 100644
--- a/kmicromail/koprefs.cpp
+++ b/kmicromail/koprefs.cpp
@@ -1,126 +1,129 @@
/*
This file is part of KOrganizer.
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#include <time.h>
#ifndef _WIN32_
#include <unistd.h>
#endif
#include <qdir.h>
#include <qtextstream.h>
#include <qtextcodec.h>
#include <qstring.h>
#include <qregexp.h>
#include <qfont.h>
#include <qcolor.h>
#include <qstringlist.h>
#include <stdlib.h>
#include <kglobal.h>
#include <kconfig.h>
#include <klocale.h>
#include <kdebug.h>
#include <kemailsettings.h>
#include <kstaticdeleter.h>
#include "koprefs.h"
#include "mainwindow.h"
KOPrefs *KOPrefs::mInstance = 0;
static KStaticDeleter<KOPrefs> insd;
KOPrefs::KOPrefs() :
KPimPrefs("kopiemailrc")
{
mAppFont = QFont("helvetica",12);
mComposeFont = QFont("helvetica",12);
mReadFont = QFont("helvetica",12);
KPrefs::setCurrentGroup("General");
addItemString("SendCodec",&mSendCodec,i18n ("userdefined") );
addItemString("SenderName",&mName,i18n ("Please set at") );
addItemString("SenderEmail",&mEmail,i18n ("Settings@General TAB") );
addItemBool("ViewMailAsHtml",&mViewAsHtml,false);
addItemBool("SendMailLater",&mSendLater,true);
addItemBool("ShowToField",&mShowToField,false);
addItemBool("UseKapi",&mUseKapi,false);
addItemInt("CurrentCodec",&mCurrentCodec,0);
-
+ addItemBool("ShowInfoSub",&mShowInfoSub,true);
+ addItemBool("ShowInfoFrom",&mShowInfoFrom,true);
+ addItemBool("ShowInfoTo",&mShowInfoTo,true);
+ addItemBool("ShowInfoStart",&mShowInfoStart,true);
KPrefs::setCurrentGroup("Fonts");
addItemFont("Application Font",&mAppFont);
addItemFont("Compose Font",&mComposeFont);
addItemFont("Read Font",&mReadFont);
fillMailDefaults();
isDirty = false;
}
KOPrefs::~KOPrefs()
{
if ( isDirty )
writeConfig();
if (mInstance == this)
mInstance = insd.setObject(0);
}
KOPrefs *KOPrefs::instance()
{
if (!mInstance) {
mInstance = insd.setObject(new KOPrefs());
mInstance->readConfig();
}
return mInstance;
}
void KOPrefs::usrSetDefaults()
{
}
void KOPrefs::fillMailDefaults()
{
if (mName.isEmpty()) mName = i18n ("Please set at");
if (mEmail.isEmpty()) mEmail = i18n ("Settings@General TAB");
}
void KOPrefs::usrReadConfig()
{
KPimPrefs::usrReadConfig();
}
void KOPrefs::usrWriteConfig()
{
KPimPrefs::usrWriteConfig();
}
KConfig* KOPrefs::getConfig()
{
return config();
}
diff --git a/kmicromail/koprefs.h b/kmicromail/koprefs.h
index f2c4fbb..f2501e3 100644
--- a/kmicromail/koprefs.h
+++ b/kmicromail/koprefs.h
@@ -1,80 +1,81 @@
/*
This file is part of KOrganizer.
Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#ifndef KOPREFS_H
#define KOPREFS_H
#include <libkdepim/kpimprefs.h>
class KConfig;
class QFont;
class QColor;
class QStringList;
class KOPrefs : public KPimPrefs
{
public:
virtual ~KOPrefs();
/** Get instance of KOPrefs. It is made sure that there is only one
instance. */
static KOPrefs *instance();
/** Set preferences to default values */
void usrSetDefaults();
/** Read preferences from config file */
void usrReadConfig();
/** Write preferences to config file */
void usrWriteConfig();
void setCategoryDefaults(){;};
protected:
/** Fill empty mail fields with default values. */
void fillMailDefaults();
private:
/** Constructor disabled for public. Use instance() to create a KOPrefs
object. */
KOPrefs();
static KOPrefs *mInstance;
public:
// preferences data
KConfig* getConfig();
QFont mAppFont;
QFont mComposeFont;
QFont mReadFont;
QString mName;
QString mSendCodec;
QString mEmail;
QString mCurrentCodeName;
int mCurrentCodec;
bool mSendLater, mViewAsHtml, mUseKapi, isDirty, mShowToField;
+ bool mShowInfoSub, mShowInfoFrom, mShowInfoTo, mShowInfoStart;
private:
};
#endif
diff --git a/kmicromail/koprefsdialog.cpp b/kmicromail/koprefsdialog.cpp
index 5c8a5a9..4af4a8c 100644
--- a/kmicromail/koprefsdialog.cpp
+++ b/kmicromail/koprefsdialog.cpp
@@ -57,192 +57,211 @@
#include <klineedit.h>
#include "koprefs.h"
#include "koprefsdialog.h"
//#include <kprefswidget.h>
KOPrefsDialog::KOPrefsDialog(QWidget *parent, char *name, bool modal) :
KPrefsDialog(KOPrefs::instance(),parent,name,true)
{
setCaption( i18n("Settings - some need a restart (nr)"));
setupGlobalTab();
setupMainTab();
setupMailTab();;
setupFontsTab();
readConfig();
#if 0
setupMainTab();
setupLocaleTab();
setupTimeZoneTab();
setupTimeTab();
setupLocaleDateTab();
setupFontsTab();
setupColorsTab();
setupViewsTab();
//setupSyncTab();
//setupSyncAlgTab();
//setupPrinterTab();
//setupGroupSchedulingTab();
//setupGroupAutomationTab();
#endif
}
#include "kpimglobalprefs.h"
KOPrefsDialog::~KOPrefsDialog()
{
}
void KOPrefsDialog::setupGlobalTab()
{
QFrame *topFrame = addPage(i18n("Global"),0,0);
kdelibcfg = new KDEPIMConfigWidget( KPimGlobalPrefs::instance(), topFrame, "KCMKdeLibConfig" );
QVBoxLayout *topLayout = new QVBoxLayout(topFrame);
topLayout->addWidget( kdelibcfg );
}
void KOPrefsDialog::setupMainTab()
{
QFrame *topFrame = addPage(i18n("General"),0,0);
QGridLayout *topLayout = new QGridLayout(topFrame,6,2);
topLayout->setSpacing(spacingHint());
topLayout->setMargin(marginHint());
mNameEdit = new QLineEdit(topFrame);
mNameLabel = new QLabel(mNameEdit, i18n("Full &name:"), topFrame);
topLayout->addWidget(mNameLabel,0,0);
topLayout->addWidget(mNameEdit,0,1);
mEmailEdit = new QLineEdit(topFrame);
mEmailLabel = new QLabel(mEmailEdit, i18n("E&mail address:"),topFrame);
topLayout->addWidget(mEmailLabel,1,0);
topLayout->addWidget(mEmailEdit,1,1);
QLabel *lab = new QLabel( i18n("HINT: Separate multiple\neMail addresses by \";\""), topFrame);
topLayout->addMultiCellWidget(lab,2,2,0,1);
KPrefsDialogWidBool* ttt = addWidBool(i18n("Ignore above settings and\nuse KA/Pi \"Who am I\" instead!"),
&(KOPrefs::instance()->mUseKapi),topFrame);
topLayout->addMultiCellWidget(ttt->checkBox(),3,3,0,1);
}
void KOPrefsDialog::setupMailTab()
{
QFrame *topFrame = addPage(i18n("Mail"),0,0);
QGridLayout *topLayout = new QGridLayout(topFrame,4,2);
topLayout->setSpacing(spacingHint());
topLayout->setMargin(marginHint());
KPrefsDialogWidBool* ttt = addWidBool(i18n("View mail as html"),
&(KOPrefs::instance()->mViewAsHtml),topFrame);
topLayout->addMultiCellWidget(ttt->checkBox(),0,0,0,1);
ttt = addWidBool(i18n("Send mails later"),
&(KOPrefs::instance()->mSendLater),topFrame);
topLayout->addMultiCellWidget(ttt->checkBox(),1,1,0,1);
ttt = addWidBool(i18n("Show \"To\" field in list view"),
&(KOPrefs::instance()->mShowToField),topFrame);
topLayout->addMultiCellWidget(ttt->checkBox(),2,2,0,1);
+
+ int iii =3;
+ ttt = addWidBool(i18n("Show info fields at startup"),
+ &(KOPrefs::instance()->mShowInfoStart),topFrame);
+ topLayout->addMultiCellWidget(ttt->checkBox(),iii,iii,0,1);
+ ++iii;
+ ttt = addWidBool(i18n("Show \"Subject\" info field"),
+ &(KOPrefs::instance()->mShowInfoSub),topFrame);
+ topLayout->addMultiCellWidget(ttt->checkBox(),iii,iii,0,1);
+ ++iii;
+ ttt = addWidBool(i18n("Show \"From\" info field"),
+ &(KOPrefs::instance()->mShowInfoFrom),topFrame);
+ topLayout->addMultiCellWidget(ttt->checkBox(),iii,iii,0,1);
+ ++iii;
+ ttt = addWidBool(i18n("Show \"To\" info field"),
+ &(KOPrefs::instance()->mShowInfoTo),topFrame);
+ topLayout->addMultiCellWidget(ttt->checkBox(),iii,iii,0,1);
+ ++iii;
+
/*
mCodecEdit = new QLineEdit(topFrame);
topLayout->addMultiCellWidget( new QLabel(mCodecEdit, i18n("User defined codec for new mails:"), topFrame),2,2,0,1);
topLayout->addMultiCellWidget(mCodecEdit,3,3,0,1);
topLayout->addMultiCellWidget( new QLabel(0, i18n("Example: iso-8859-15"), topFrame),4,4,0,1);
*/
}
void KOPrefsDialog::setupFontsTab()
{
QFrame *topFrame = addPage(i18n("Fonts"),0,0);
// DesktopIcon("fonts",KIcon::SizeMedium));
QGridLayout *topLayout = new QGridLayout(topFrame,7,3);
topLayout->setSpacing(1);
topLayout->setMargin(3);
KPrefsDialogWidFont * tVFont;
int i = 0;
KPrefsDialogWidFont *timeLabelsFont =
addWidFont(i18n("OK"),i18n("Application(nr)"),
&(KOPrefs::instance()->mAppFont),topFrame);
topLayout->addWidget(timeLabelsFont->label(),i,0);
topLayout->addWidget(timeLabelsFont->preview(),i,1);
topLayout->addWidget(timeLabelsFont->button(),i,2);
++i;
timeLabelsFont =
addWidFont(i18n("Dear Mr."),i18n("Compose mail:"),
&(KOPrefs::instance()->mComposeFont),topFrame);
topLayout->addWidget(timeLabelsFont->label(),i,0);
topLayout->addWidget(timeLabelsFont->preview(),i,1);
topLayout->addWidget(timeLabelsFont->button(),i,2);
++i;
KPrefsDialogWidFont *timeBarFont =
addWidFont(i18n("Hello"),i18n("Read mail:"),
&(KOPrefs::instance()->mReadFont),topFrame);
topLayout->addWidget(timeBarFont->label(),i,0);
topLayout->addWidget(timeBarFont->preview(),i,1);
topLayout->addWidget(timeBarFont->button(),i,2);
++i;
topLayout->setColStretch(1,1);
topLayout->setRowStretch(4,1);
}
void KOPrefsDialog::usrReadConfig()
{
mNameEdit->setText(KOPrefs::instance()->mName);
mEmailEdit->setText(KOPrefs::instance()->mEmail);
//mCodecEdit->setText(KOPrefs::instance()->mSendCodec);
kdelibcfg->readConfig();
}
void KOPrefsDialog::usrWriteConfig()
{
KOPrefs::instance()->mName = mNameEdit->text();
KOPrefs::instance()->mEmail = mEmailEdit->text();
//KOPrefs::instance()->mSendCodec = mCodecEdit->text();
kdelibcfg->writeConfig();
}
#if 0
void KOPrefsDialog::setupLocaleDateTab()
{
QFrame *topFrame = addPage(i18n("Date Format"),0,0);
QGridLayout *topLayout = new QGridLayout(topFrame,3,2);
topLayout->setSpacing(spacingHint());
topLayout->setMargin(marginHint());
int iii = 0;
KPrefsWidRadios *syncPrefsGroup =
addWidRadios(i18n("Date Format:"),&(KOPrefs::instance()->mPreferredDate),topFrame);
QString format;
if ( QApplication::desktop()->width() < 480 )
format = "(%d.%m.%Y)";
else
format = "(%d.%m.%Y|%A %d %B %Y)";
syncPrefsGroup->addRadio(i18n("24.03.2004 "+format));
if ( QApplication::desktop()->width() < 480 )
format = "(%m.%d.%Y)";
else
format = "(%m.%d.%Y|%A %B %d %Y)";
syncPrefsGroup->addRadio(i18n("03.24.2004 "+format));
if ( QApplication::desktop()->width() < 480 )
format = "(%Y-%m-%d)";
else
format = "(%Y-%m-%d|%A %Y %B %d)";
syncPrefsGroup->addRadio(i18n("2004-03-24 "+format));
syncPrefsGroup->addRadio(i18n("User defined"));
topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1);
++iii;
diff --git a/kmicromail/mainwindow.cpp b/kmicromail/mainwindow.cpp
index 250d114..0794e00 100644
--- a/kmicromail/mainwindow.cpp
+++ b/kmicromail/mainwindow.cpp
@@ -1,337 +1,357 @@
// CHANGED 2004-08-06 Lutz Rogowski
#include <qlabel.h>
#include <qvbox.h>
#include <qheader.h>
#include <qtimer.h>
#include <qlayout.h>
//#include <kdialog.h>
#include <kiconloader.h>
#include <kapplication.h>
#ifdef DESKTOP_VERSION
#include <qapplication.h>
#include <qstatusbar.h>
#include <kabc/stdaddressbook.h>
extern QStatusBar* globalSstatusBarMainWindow;
#else
#include <qpe/qpeapplication.h>
#include <klocale.h>
#endif
#include "defines.h"
+#include "koprefs.h"
#include "mainwindow.h"
#include "mailistviewitem.h"
#include <KDGanttMinimizeSplitter.h>
#include "koprefs.h"
MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags )
: QMainWindow( parent, name ) //, flags )
{
#ifdef DESKTOP_VERSION
globalSstatusBarMainWindow = statusBar();
#endif
setCaption( i18n( "KOpieMail/Pi" ) );
setToolBarsMovable( false );
//KABC::StdAddressBook::self();
toolBar = new QToolBar( this );
menuBar = new QPEMenuBar( toolBar );
mailMenu = new QPopupMenu( menuBar );
menuBar->insertItem( i18n( "Mail" ), mailMenu );
settingsMenu = new QPopupMenu( menuBar );
menuBar->insertItem( i18n( "Settings" ), settingsMenu );
addToolBar( toolBar );
toolBar->setHorizontalStretchable( true );
QAction* getMail = new QAction( i18n( "Get all new mails" ), SmallIcon("enter"),
0, 0, this );
connect(getMail, SIGNAL( activated() ),
SLOT( slotGetAllMail() ) );
getMail->addTo( mailMenu );
getMail = new QAction( i18n( "Get new messages" ), SmallIcon("add"),
0, 0, this );
getMail->addTo( toolBar );
getMail->addTo( mailMenu );
connect(getMail, SIGNAL( activated() ),
SLOT( slotGetMail() ) );
composeMail = new QAction( i18n( "Compose new mail" ), SmallIcon("composemail"),
0, 0, this );
composeMail->addTo( toolBar );
composeMail->addTo( mailMenu );
sendQueued = new QAction( i18n( "Send queued mails" ), SmallIcon("sendqueued") ,
0, 0, this );
sendQueued->addTo( toolBar );
sendQueued->addTo( mailMenu );
/*
syncFolders = new QAction( i18n( "Sync mailfolders" ), ICON_SYNC,
0, 0, this );
syncFolders->addTo( toolBar );
syncFolders->addTo( mailMenu );
*/
showFolders = new QAction( i18n( "Show/Hide folders" ), SmallIcon("showfolders") ,
0, 0, this, 0, true );
showFolders->addTo( toolBar );
showFolders->addTo( mailMenu );
showFolders->setOn( true );
connect(showFolders, SIGNAL( toggled(bool) ),
SLOT( slotShowFolders(bool) ) );
/*
searchMails = new QAction( i18n( "Search mails" ), SmallIcon("find") ),
0, 0, this );
- searchMails->addTo( toolBar );
+ searchMails->kopddTo( toolBar );
searchMails->addTo( mailMenu );
*/
deleteMails = new QAction(i18n("Delete Mail"), SmallIcon("trash"), 0, 0, this);
deleteMails->addTo( toolBar );
deleteMails->addTo( mailMenu );
connect( deleteMails, SIGNAL( activated() ),
SLOT( slotDeleteAllMail() ) );
editSettings = new QAction( i18n( "Edit settings" ), SmallIcon("SettingsIcon") ,
0, 0, this );
editSettings->addTo( settingsMenu );
connect( editSettings, SIGNAL( activated() ),
SLOT( slotEditSettings() ) );
editAccounts = new QAction( i18n( "Configure accounts" ), SmallIcon("editaccounts") ,
0, 0, this );
editAccounts->addTo( settingsMenu );
codecMenu = new QPopupMenu( menuBar );
codecMenu->insertItem( "Western (iso-8859-1)",0,0);
codecMenu->insertItem( "Cyrillic (iso-8859-5)",1,1);
codecMenu->insertItem( "Western (iso-8859-15)",2,2);
codecMenu->insertItem( "Chinese (big-5)",3,3);
codecMenu->insertItem( "Unicode (utf-8)",4,4);
codecMenu->insertItem( "Userdefined ("+KOPrefs::instance()->mSendCodec+")",5,5);
//disabled
//settingsMenu->insertItem( i18n("Codec for new mails"), codecMenu);
//setCentralWidget( view );
QVBox* wrapperBox = new QVBox( this );
setCentralWidget( wrapperBox );
// QWidget *view = new QWidget( wrapperBox );
KDGanttMinimizeSplitter* splithor = new KDGanttMinimizeSplitter( Qt::Vertical, wrapperBox);
splithor->setMinimizeDirection( KDGanttMinimizeSplitter::Down);
KDGanttMinimizeSplitter* split = new KDGanttMinimizeSplitter( Qt::Horizontal, splithor);
split->setMinimizeDirection( KDGanttMinimizeSplitter::Left);
//layout = new QBoxLayout ( split, QBoxLayout::LeftToRight );
- QWidget* infoBox = new QWidget( splithor );
- QGridLayout *griLay = new QGridLayout( infoBox, 2,2);
- griLay->addWidget( new QLabel ( i18n("Su:"), infoBox ),0,0 );
- griLay->addWidget( new QLabel ( i18n("Fr:"), infoBox ),1,0 );
- griLay->addWidget( new QLabel ( i18n("To:"), infoBox ),2,0 );
- griLay->addWidget( subLE = new QLineEdit( infoBox ),0,1) ;
- griLay->addWidget( fromLE = new QLineEdit( infoBox ),1,1) ;
- griLay->addWidget( toLE = new QLineEdit( infoBox ),2,1) ;
- infoBox->setMaximumHeight( infoBox->sizeHint().height() );
+ subLE = 0;
+ fromLE = 0;
+ toLE = 0;
+ if ( KOPrefs::instance()->mShowInfoSub || KOPrefs::instance()->mShowInfoFrom || KOPrefs::instance()->mShowInfoTo ) {
+ QWidget* infoBox = new QWidget( splithor );
+ QGridLayout *griLay = new QGridLayout( infoBox, 2,2);
+ if ( KOPrefs::instance()->mShowInfoSub ) {
+ griLay->addWidget( new QLabel ( i18n("Su:"), infoBox ),0,0 );
+ griLay->addWidget( subLE = new QLineEdit( infoBox ),0,1) ;
+ }
+ if ( KOPrefs::instance()->mShowInfoFrom ) {
+ griLay->addWidget( new QLabel ( i18n("Fr:"), infoBox ),1,0 );
+ griLay->addWidget( fromLE = new QLineEdit( infoBox ),1,1) ;
+ }
+ if ( KOPrefs::instance()->mShowInfoTo ) {
+ griLay->addWidget( new QLabel ( i18n("To:"), infoBox ),2,0 );
+ griLay->addWidget( toLE = new QLineEdit( infoBox ),2,1) ;
+ }
+ infoBox->setMaximumHeight( infoBox->sizeHint().height() );
+ if ( !KOPrefs::instance()->mShowInfoStart ) {
+ QTimer::singleShot( 1,splithor, SLOT ( toggle() ) );
+ }
+ }
+
+
folderView = new AccountView( split );
folderView->header()->hide();
folderView->setRootIsDecorated( false );
folderView->addColumn( i18n( "Mailbox" ) );
//layout->addWidget( folderView );
mailView = new QListView( split );
mailView->addColumn( i18n( " " ) );
mailView->addColumn( i18n( "Subject" ),QListView::Manual );
mailView->addColumn( i18n( "Sender" ),QListView::Manual );
mailView->addColumn( i18n( "Size" ),QListView::Manual);
mailView->addColumn( i18n( "Date" ),QListView::Manual);
if ( KOPrefs::instance()->mShowToField )
mailView->addColumn( i18n( "To" ),QListView::Manual);
mailView->setAllColumnsShowFocus(true);
//mailView->setSorting(-1);
mailView->setRootIsDecorated( false );
statusWidget = new StatusWidget( wrapperBox );
statusWidget->hide();
//layout->addWidget( mailView );
//layout->setStretchFactor( folderView, 1 );
//layout->setStretchFactor( mailView, 2 );
slotAdjustLayout();
#ifndef DESKTOP_VERSION
QPEApplication::setStylusOperation( mailView->viewport(),QPEApplication::RightOnHold);
QPEApplication::setStylusOperation( folderView->viewport(),QPEApplication::RightOnHold);
- QPEApplication::setStylusOperation( subLE ,QPEApplication::RightOnHold);
- QPEApplication::setStylusOperation( fromLE ,QPEApplication::RightOnHold);
- QPEApplication::setStylusOperation( toLE ,QPEApplication::RightOnHold);
+ if ( subLE )
+ QPEApplication::setStylusOperation( subLE ,QPEApplication::RightOnHold);
+ if ( fromLE )
+ QPEApplication::setStylusOperation( fromLE ,QPEApplication::RightOnHold);
+ if ( toLE )
+ QPEApplication::setStylusOperation( toLE ,QPEApplication::RightOnHold);
#endif
connect( mailView, SIGNAL( doubleClicked (QListViewItem* )),this,
SLOT( mailLeftClicked(QListViewItem*) ) );
connect( mailView, SIGNAL( returnPressed (QListViewItem* )),this,
SLOT( mailLeftClicked(QListViewItem*) ) );
connect( mailView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),this,
SLOT( mailHold(int,QListViewItem*,const QPoint&,int) ) );
connect(folderView, SIGNAL(refreshMailview(const QValueList<RecMailP>&)),
this,SLOT(refreshMailView(const QValueList<RecMailP>&)));
connect( mailView, SIGNAL( currentChanged (QListViewItem* )),this,
SLOT( setInfoFields(QListViewItem*) ) );
connect( composeMail, SIGNAL( activated() ), SLOT( slotComposeMail() ) );
connect( sendQueued, SIGNAL( activated() ), SLOT( slotSendQueued() ) );
// connect( searchMails, SIGNAL( activated() ), SLOT( slotSearchMails() ) );
connect( editAccounts, SIGNAL( activated() ), SLOT( slotEditAccounts() ) );
//mailView->setMultiSelection ( true );
mailView->setSelectionMode( QListView::Extended );
QValueList<int> list;
int fw = 100;
if ( QApplication::desktop()->width() > 320 )
fw = 50;
list.append( fw );
list.append( 100 );
split->setSizes( list );
QTimer::singleShot( 1000, this, SLOT( slotAdjustColumns() ) );
mailView->setShowSortIndicator ( true );
QLabel *spacer = new QLabel( toolBar );
spacer->setBackgroundMode( QWidget::PaletteButton );
toolBar->setStretchableWidget( spacer );
QAction* closeMail = new QAction(i18n("Close"),SmallIcon("exit"), 0, 0, this);
connect( closeMail, SIGNAL( activated() ), SLOT( close() ) );
if ( QApplication::desktop()->width() > 320 )
closeMail->addTo(toolBar);
closeMail->addTo(mailMenu);
QPopupMenu* helpMenu = new QPopupMenu( menuBar );
menuBar->insertItem( i18n( "Help" ), helpMenu );
QAction* li = new QAction(i18n("About"), QPixmap(), 0, 0, this);
connect( li, SIGNAL( activated() ), SLOT( showAbout()) );
li->addTo(helpMenu);
li = new QAction(i18n("Licence"),QPixmap(), 0, 0, this);
connect( li, SIGNAL( activated() ), SLOT( showLicence()) );
li->addTo(helpMenu);
li = new QAction(i18n("LibEtPan Licence"), QPixmap(), 0, 0, this);
connect( li, SIGNAL( activated() ), SLOT( showEtpanLicence()) );
li->addTo(helpMenu);
connect( codecMenu, SIGNAL( activated(int) ), this, SLOT( slotSetCodec( int )) );
slotSetCodec( KOPrefs::instance()->mCurrentCodec );
#ifdef DESKTOP_VERSION
resize ( 640, 480 );
#endif
}
MainWindow::~MainWindow()
{
}
void MainWindow::setInfoFields(QListViewItem* item )
{
if ( item == 0) {
- subLE->setText("");
- fromLE->setText("");
- toLE->setText("");
+ if ( subLE ) subLE->setText("");
+ if ( fromLE ) fromLE->setText("");
+ if ( toLE ) toLE->setText("");
return;
}
RecMailP mail = ((MailListViewItem*)item)->data();
- subLE->setText(mail->getSubject());
- fromLE->setText(mail->getFrom());
- toLE->setText(mail->To().join(";" ));
- subLE->setCursorPosition(0);
- fromLE->setCursorPosition(0);
- toLE->setCursorPosition(0);
+ if ( subLE ) subLE->setText(mail->getSubject());
+ if ( fromLE ) fromLE->setText(mail->getFrom());
+ if ( toLE ) toLE->setText(mail->To().join(";" ));
+ if ( subLE ) subLE->setCursorPosition(0);
+ if ( fromLE ) fromLE->setCursorPosition(0);
+ if ( toLE ) toLE->setCursorPosition(0);
}
void MainWindow::slotSetCodec( int codec )
{
codecMenu->setItemChecked(KOPrefs::instance()->mCurrentCodec, false );
//qDebug("codec %d ", codec);
KOPrefs::instance()->mCurrentCodec = codec;
KOPrefs::instance()->isDirty = true;
QString name;
switch ( codec ) {
case 0:
name = "iso-8859-1";
break;
case 1:
name = "iso-8859-5";
break;
case 2:
name = "iso-8859-15";
break;
case 3:
name = "big-5";
break;
case 4:
name = "utf-8";
break;
case 5:
name = KOPrefs::instance()->mSendCodec.lower();
break;
}
KOPrefs::instance()->mCurrentCodeName = name ;
codecMenu->changeItem ( 5, "Userdefined ("+KOPrefs::instance()->mSendCodec+")");
codecMenu->setItemChecked(KOPrefs::instance()->mCurrentCodec, true );
}
void MainWindow::showLicence()
{
KApplication::showLicence();
}
void MainWindow::showAbout()
{
QString version;
#include <../version>
QString cap = "About KOpieMail/Pi";
QString text = i18n("KOpieMail/Platform-independent\n") +
"(OM/Pi) " + version + " - "
#ifdef DESKTOP_VERSION
"Desktop Edition\n"
#else
"PDA-Edition\nfor: Zaurus 5x00 / 7x0 / 8x0\n"
#endif
"www.pi-sync.net\n\n"
"Copyright (c) 2004 Lutz Rogowski <lutz@pi-sync.net>\n"
"KOpieMail/Pi is based on Opie Mail\n"
"Copyright (c) Rajko Albrecht and the Opie team\n"
"KOpieMail/Pi is licensed under the GPL\n"
"\n"
"KOpieMail/Pi uses LibEtPan - a mail stuff library\n"
"Copyright (C) 2001, 2002 - DINH Viet Hoa\n"
"libEtPan has its own licence - see LibEtPan licence\n";
KApplication::showText( cap, text );
}
void MainWindow::showEtpanLicence()
{
KApplication::showFile( "LibEtPan licence", "kdepim/kopiemail/COPYRIGHTlibetpan" );
}
void MainWindow::appMessage(const QCString &, const QByteArray &)
{
qDebug("appMessage implemented by subclass");
}
void MainWindow::slotAdjustLayout() {
/*
QWidget *d = QApplication::desktop();
if ( d->width() < d->height() ) {
layout->setDirection( QBoxLayout::TopToBottom );
} else {
layout->setDirection( QBoxLayout::LeftToRight );
}
*/
}
void MainWindow::slotAdjustColumns()
{
bool hidden = folderView->isHidden();
if ( hidden ) folderView->show();
folderView->setColumnWidth( 0, folderView->visibleWidth() );
if ( hidden ) folderView->hide();
diff --git a/kmicromail/opiemail.cpp b/kmicromail/opiemail.cpp
index 68f0eb3..f56711d 100644
--- a/kmicromail/opiemail.cpp
+++ b/kmicromail/opiemail.cpp
@@ -402,199 +402,200 @@ void OpieMail::displayMail()
readMail.showMaximized();
#else
readMail.resize( 640, 480);
#endif
connect( &readMail,SIGNAL( showNextMail(ViewMail *) ), this, SLOT( displayNextMail(ViewMail *) ) );
connect( &readMail,SIGNAL( deleteAndDisplayNextMail(ViewMail *) ), this, SLOT(deleteAndDisplayNextMail(ViewMail *) ) );
connect( &readMail,SIGNAL( signalDownloadMail() ), this, SLOT( slotDownloadMail() ) );
readMail.exec();
if ( readMail.deleted )
{
folderView->refreshCurrent();
}
else
{
QListViewItem*item = mailView->currentItem();
if (item)
( (MailListViewItem*)item )->setPixmap( 0, QPixmap() );
}
}
void OpieMail::slotGetAllMail()
{
QListViewItem * item = folderView->firstChild();
while ( item ){
((AccountViewItem *)item)->contextMenuSelected( 101 );
item = item->nextSibling ();
}
}
void OpieMail::slotGetMail()
{
QListViewItem * item = folderView->currentItem();
if ( ! item ) return;
((AccountViewItem *)item)->contextMenuSelected( 101 );
}
void OpieMail::slotDeleteMail()
{
if (!mailView->currentItem()) return;
RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data();
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 )
{
mail->Wrapper()->deleteMail( mail );
folderView->refreshCurrent();
}
}
void OpieMail::slotDeleteAllMail()
{
QValueList<RecMailP> t;
if ( QMessageBox::warning(this, i18n("Delete All Mails"), i18n("Do you really want to delete\nall selected mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes )
{
MailListViewItem* item = (MailListViewItem*)mailView->firstChild ();
while ( item ) {
if ( item->isSelected() ) {
t.append( item->data() );
}
item = (MailListViewItem*)item->nextSibling();
}
}
else
return;
if ( t.count() == 0 )
return;
RecMailP mail = t.first();
mail->Wrapper()->deleteMailList(t);
folderView->refreshCurrent();
}
void OpieMail::clearSelection()
{
mailView->clearSelection();
}
void OpieMail::mailHold(int button, QListViewItem *item,const QPoint&,int )
{
if (!mailView->currentItem()) return;
MAILLIB::ATYPE mailtype = ((MailListViewItem*)mailView->currentItem() )->wrapperType();
/* just the RIGHT button - or hold on pda */
if (button!=2) {return;}
if (!item) return;
QPopupMenu *m = new QPopupMenu(0);
if (m)
{
if (mailtype==MAILLIB::A_NNTP) {
m->insertItem(i18n("Read this posting"),this,SLOT(displayMail()));
m->insertItem(i18n("Copy this posting"),this,SLOT(slotMoveCopyMail()));
m->insertSeparator();
m->insertItem(i18n("Copy all selected postings"),this,SLOT(slotMoveCopyAllMail()));
m->insertItem(i18n("Clear selection"),this,SLOT(clearSelection()));
} else {
if (folderView->currentisDraft()) {
m->insertItem(i18n("Edit this mail"),this,SLOT(reEditMail()));
}
m->insertItem(i18n("Reply to this mail"),this,SLOT(replyMail()));
- m->insertSeparator();
m->insertItem(i18n("Read this mail"),this,SLOT(displayMail()));
+ m->insertSeparator();
m->insertItem(i18n("Move/Copy this mail"),this,SLOT(slotMoveCopyMail()));
m->insertItem(i18n("Delete this mail"),this,SLOT(slotDeleteMail()));
m->insertSeparator();
m->insertItem(i18n("Move/Copy all selected mail"),this,SLOT(slotMoveCopyAllMail()));
m->insertItem(i18n("Delete all selected mails"),this,SLOT(slotDeleteAllMail()));
+ m->insertSeparator();
m->insertItem(i18n("Clear selection"),this,SLOT(clearSelection()));
}
m->setFocus();
m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) );
delete m;
}
}
void OpieMail::slotShowFolders( bool show )
{
if ( show && folderView->isHidden() )
{
folderView->show();
}
else if ( !show && !folderView->isHidden() )
{
folderView->hide();
}
}
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();
}
mailView->setSorting ( 4, false );
}
void OpieMail::mailLeftClicked( QListViewItem *item )
{
mailView->clearSelection();
/* 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 = "";
Selectstore sels;
folderView->setupFolderselect(&sels);
if (!sels.exec()) return;
targetMail = sels.currentMail();
targetFolder = sels.currentFolder();
if ( (mail->Wrapper()==targetMail && mail->getMbox()==targetFolder) ||
targetFolder.isEmpty())
{
return;
}
if (sels.newFolder() && !targetMail->createMbox(targetFolder))
{
QMessageBox::critical(0,i18n("Error creating new Folder"),
i18n("<center>Error while creating<br>new folder - breaking.</center>"));
return;
}
sels.hide();
qApp->processEvents();
// qDebug("hiding sels ");
mail->Wrapper()->mvcpMail(mail,targetFolder,targetMail,sels.moveMails());
folderView->refreshCurrent();
}
void OpieMail::slotMoveCopyAllMail()
{
if (!mailView->currentItem()) return;
QValueList<RecMailP> t;
// 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 )
{
MailListViewItem* item = (MailListViewItem*)mailView->firstChild ();
while ( item ) {
if ( item->isSelected() ) {
t.append( item->data() );
}
item = (MailListViewItem*)item->nextSibling();
}
}
// else
// return;
if ( t.count() == 0 )
return;