summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2004-09-16 15:13:40 (UTC)
committer zautrix <zautrix>2004-09-16 15:13:40 (UTC)
commit02e7ae4983679a787834277176a031286a8310c2 (patch) (side-by-side diff)
treeea7e33e59b86b8fed2b033609d1018a9f245baff
parent68b1f3bce4b6e89bb343b965256537d93e63f7be (diff)
downloadkdepimpi-02e7ae4983679a787834277176a031286a8310c2.zip
kdepimpi-02e7ae4983679a787834277176a031286a8310c2.tar.gz
kdepimpi-02e7ae4983679a787834277176a031286a8310c2.tar.bz2
Foldername fixes
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--Makefile31
-rw-r--r--kmicromail/accountitem.cpp2
-rw-r--r--kmicromail/libmailwrapper/mailwrapper.cpp7
-rw-r--r--kmicromail/libmailwrapper/mailwrapper.h2
4 files changed, 34 insertions, 8 deletions
diff --git a/Makefile b/Makefile
index de9d5ce..6856b62 100644
--- a/Makefile
+++ b/Makefile
@@ -1,303 +1,328 @@
export KDEPIMDIR = $(shell pwd)
ifeq ($(PLATFORM) , zaurus)
BUILD_NO_LDAP_PLUGIN=1
endif
ifneq ($(PLATFORM) , zaurus)
BUILD_NO_SHARP_PLUGIN=1
endif
SUBDIRS_MICROKDE = \
libical/src/libical \
libical/src/libicalss \
qtcompat \
microkde \
libkcal \
libkdepim \
kabc \
kabc/formats/binary \
kabc/plugins/file \
kabc/plugins/dir \
korganizer \
kalarmd \
kaddressbook
SUBDIRS_QTOPIA_PLUGIN = \
kabc/plugins/qtopia
SUBDIRS_OPIE_PLUGIN = \
kabc/plugins/opie
SUBDIRS_SHARP_PLUGIN = \
kabc/plugins/sharpdtm
SUBDIRS_LDAP_PLUGIN = \
kabc/plugins/ldap
SUBDIRS_MICROMAIL = \
kmicromail/libetpan \
kmicromail/libmailwrapper \
kmicromail
SUBDIRS_GAMMU = \
gammu/emb/common \
gammu/emb/gammu
+SUBDIRS_PWMANAGER = \
+ pwmanager/pwmanager
+
SUBDIRS = \
$(SUBDIRS_MICROKDE) \
$(SUBDIRS_QTOPIA_PLUGIN) \
$(SUBDIRS_OPIE_PLUGIN) \
$(SUBDIRS_SHARP_PLUGIN) \
$(SUBDIRS_LDAP_PLUGIN) \
$(SUBDIRS_MICROMAIL) \
- $(SUBDIRS_GAMMU)
+ $(SUBDIRS_GAMMU) \
+ $(SUBDIRS_PWMANAGER)
all: build_microkde \
build_qtopia_plugin \
build_opie_plugin \
build_sharp_plugin \
build_ldap_plugin \
build_micromail \
- build_gammu
+ build_gammu \
+ build_pwmanager
build_microkde: variable_test tmake
for i in $(SUBDIRS_MICROKDE); do pushd $$i; \
make -f Makefile$(PLATFORM) || exit 1; popd; \
done
build_qtopia_plugin: build_microkde
for i in $(SUBDIRS_QTOPIA_PLUGIN); do pushd $$i; \
make -f Makefile$(PLATFORM) || exit 1; popd; \
done
build_opie_plugin: build_microkde
ifdef BUILD_NO_OPIE_PLUGIN
@echo == opie plugin not build.
else
for i in $(SUBDIRS_OPIE_PLUGIN); do pushd $$i; \
make -f Makefile$(PLATFORM) || exit 1; popd; \
done
endif
build_sharp_plugin: build_microkde
ifdef BUILD_NO_SHARP_PLUGIN
@echo == ldap plugin not build.
else
for i in $(SUBDIRS_SHARP_PLUGIN); do pushd $$i; \
make -f Makefile$(PLATFORM) || exit 1; popd; \
done
endif
build_ldap_plugin: build_microkde
ifdef BUILD_NO_LDAP_PLUGIN
@echo == ldap plugin not build.
else
for i in $(SUBDIRS_LDAP_PLUGIN); do pushd $$i; \
make -f Makefile$(PLATFORM) || exit 1; popd; \
done
endif
build_micromail: build_microkde
ifdef BUILD_NO_MICROMAIL
@echo == kmicromail not build.
else
for i in $(SUBDIRS_MICROMAIL); do pushd $$i; \
make -f Makefile$(PLATFORM) || exit 1; popd; \
done
endif
build_gammu: variable_test tmake
ifdef BUILD_NO_GAMMU
@echo == gammu not build.
else
for i in $(SUBDIRS_GAMMU); do pushd $$i; \
make -f Makefile$(PLATFORM) || exit 1; popd; \
done
endif
+build_pwmanager: build_microkde
+ ifdef BUILD_NO_PWMANAGER
+ @echo == pwmanager not build.
+ else
+ for i in $(SUBDIRS_PWMANAGER); do pushd $$i; \
+ make -f Makefile$(PLATFORM) || exit 1; popd; \
+ done
+ endif
+
variable_info:
@echo --------------------------------------
@echo KDEPIM buildsystem, variableinfo...
@echo KDEPIMDIR=$(KDEPIMDIR)
@echo QTDIR=$(QTDIR)
@echo QPEDIR=$(QPEDIR)
@echo OPIEDIR=$(OPIEDIR)
@echo PLATFORM=$(PLATFORM)
@echo RELEASE_DEBUG=$(RELEASE_DEBUG)
@echo BUILD_NO_MICROMAIL=$(BUILD_NO_MICROMAIL)
@echo BUILD_NO_LDAP_PLUGIN=$(BUILD_NO_LDAP_PLUGIN)
@echo BUILD_NO_OPIE_PLUGIN=$(BUILD_NO_OPIE_PLUGIN)
@echo BUILD_NO_SHARP_PLUGIN=$(BUILD_NO_SHARP_PLUGIN)
ifndef BUILD_NO_SHARP_PLUGIN
@echo SHARPDTMSDK=$(SHARPDTMSDK)
endif
@echo BUILD_NO_GAMMU=$(BUILD_NO_GAMMU)
+ @echo BUILD_NO_PWMANAGER=$(BUILD_NO_PWMANAGER)
@echo --------------------------------------
variable_test: variable_info
@echo KDEPIM buildsystem, variablecheck...
ifndef KDEPIMDIR
@echo KDEPIMDIR is not defined.
$(error KDEPIMDIR is not defined)
endif
ifndef PLATFORM
@echo PLATFORM is not defined.
$(error PLATFORM is not defined)
endif
ifdef BUILD_NO_LDAP_PLUGIN
@echo LDAP PLUGIN will not be build, because BUILD_NO_LDAP_PLUGIN is set to $(BUILD_NO_LDAP_PLUGIN)
endif
ifdef BUILD_NO_OPIE_PLUGIN
@echo OPIE PLUGIN will not be build, because BUILD_NO_OPIE_PLUGIN is set to $(BUILD_NO_OPIE_PLUGIN)
endif
ifdef BUILD_NO_MICROMAIL
@echo MICROMAIL will not be build, because BUILD_NO_MICROMAIL is set to $(BUILD_NO_MICROMAIL)
endif
ifdef BUILD_NO_SHARP_PLUGIN
@echo SHARP PLUGIN will not be build, because BUILD_NO_SHARP_PLUGIN is set to $(BUILD_NO_SHARP_PLUGIN)
else
ifndef SHARPDTMSDK
@echo SHARP PLUGIN can not be build, because SHARPDTMSDK is set to $(SHARPDTMSDK)
$(error SHARPDTMSDK is not defined)
endif
endif
ifdef BUILD_NO_GAMMU
@echo GAMMU will not be build, because BUILD_NO_GAMMU is set to $(BUILD_NO_GAMMU)
endif
+ ifdef BUILD_NO_PWMANAGER
+ @echo PWMANAGER will not be build, because BUILD_NO_PWMANAGER is set to $(BUILD_NO_PWMANAGER)
+ endif
@echo --------------------------------------
objects:
for i in $(SUBDIRS); do mkdir -p $$i/obj/$(PLATFORM); done
for i in $(SUBDIRS); do mkdir -p $$i/moc/$(PLATFORM); done
mkdir -p libical/lib/$(PLATFORM)
clean:
rm -rf libical/lib/$(PLATFORM)/*;
for i in $(SUBDIRS); do pushd $$i; make clean; rm -f *~;\
rm -f obj/$(PLATFORM)/*; rm -f moc/$(PLATFORM)/*; rm Makefile$(PLATFORM); popd; \
done
install:
cd bin/kdepim; make install
cp -r Pim $(QPEDIR)/apps
cp db2file/db2file $(QPEDIR)/bin/db2file
cp korganizer/korganizer.desktop $(QPEDIR)/apps/Pim/korganizer.desktop
cp kaddressbook/kaddressbook.desktop $(QPEDIR)/apps/Pim/kaddressbook.desktop
cp kmicromail/kmicromail.desktop $(QPEDIR)/apps/Pim/kopiemail.desktop
+ cp pwmanager/pwmanager/pwmanager.desktop $(QPEDIR)/apps/Pim/pwmanager.desktop
dist:
@echo Dont forget to do "make install" before "make dist"
rm -f *arm.ipk
rm -f *~
cd ..; tar czf kdepim.src.tar.gz --exclude=obj --exclude=moc --exclude=CVS --exclude=Makefilezaurus --exclude=Makefileqtopia kdepim
./mkipks kmicrokdelibs.control
./mkipks korganizer.control
./mkipks kaddressbook.control
ifndef BUILD_NO_MICROMAIL
./mkipks kopiemail.control
endif
./mkipks korganizer-alarm.control
ifndef BUILD_NO_GAMMU
./mkipks kammu.control
endif
+ ifndef BUILD_NO_PWMANAGER
+ ./mkipks pwmanager.control
+ endif
./mkipks pim_TAB_icon.control
tmake: objects \
qtcompat/Makefile$(PLATFORM) \
microkde/Makefile$(PLATFORM) \
libkcal/Makefile$(PLATFORM) \
libkdepim/Makefile$(PLATFORM) \
korganizer/Makefile$(PLATFORM) \
kalarmd/Makefile$(PLATFORM) \
libical/src/libical/Makefile$(PLATFORM) \
libical/src/libicalss/Makefile$(PLATFORM) \
kabc/Makefile$(PLATFORM) \
kabc/formats/binary/Makefile$(PLATFORM) \
kabc/plugins/file/Makefile$(PLATFORM) \
kabc/plugins/dir/Makefile$(PLATFORM) \
kabc/plugins/ldap/Makefile$(PLATFORM) \
kabc/plugins/opie/Makefile$(PLATFORM) \
kabc/plugins/qtopia/Makefile$(PLATFORM) \
kabc/plugins/sharpdtm/Makefile$(PLATFORM) \
kaddressbook/Makefile$(PLATFORM) \
kmicromail/Makefile$(PLATFORM) \
kmicromail/libetpan/Makefile$(PLATFORM) \
kmicromail/libmailwrapper/Makefile$(PLATFORM) \
gammu/emb/common/Makefile$(PLATFORM) \
gammu/emb/gammu/Makefile$(PLATFORM) \
-
+ pwmanager/pwmanager/Makefile$(PLATFORM) \
qtcompat/Makefile$(PLATFORM): qtcompat/qtcompat.pro
cd qtcompat; tmake "CONFIG+=$(RELEASE_DEBUG)" qtcompat.pro -o Makefile$(PLATFORM)
microkde/Makefile$(PLATFORM): microkde/microkdeE.pro
cd microkde; tmake "CONFIG+=$(RELEASE_DEBUG)" microkdeE.pro -o Makefile$(PLATFORM)
libkcal/Makefile$(PLATFORM): libkcal/libkcalE.pro
cd libkcal; tmake "CONFIG+=$(RELEASE_DEBUG)" libkcalE.pro -o Makefile$(PLATFORM)
libkdepim/Makefile$(PLATFORM): libkdepim/libkdepimE.pro
cd libkdepim; tmake "CONFIG+=$(RELEASE_DEBUG)" libkdepimE.pro -o Makefile$(PLATFORM)
kalarmd/Makefile$(PLATFORM): kalarmd/kalarmdE.pro
cd kalarmd; tmake "CONFIG+=$(RELEASE_DEBUG)" kalarmdE.pro -o Makefile$(PLATFORM)
korganizer/Makefile$(PLATFORM): korganizer/korganizerE.pro
cd korganizer; tmake "CONFIG+=$(RELEASE_DEBUG)" korganizerE.pro -o Makefile$(PLATFORM)
libical/src/libical/Makefile$(PLATFORM): libical/src/libical/libicalE.pro
cd libical/src/libical; tmake "CONFIG+=$(RELEASE_DEBUG)" libicalE.pro -o Makefile$(PLATFORM)
libical/src/libicalss/Makefile$(PLATFORM): libical/src/libicalss/libicalssE.pro
cd libical/src/libicalss; tmake "CONFIG+=$(RELEASE_DEBUG)" libicalssE.pro -o Makefile$(PLATFORM)
kabc/Makefile$(PLATFORM): kabc/kabcE.pro
cd kabc; tmake "CONFIG+=$(RELEASE_DEBUG)" kabcE.pro -o Makefile$(PLATFORM)
kabc/formats/binary/Makefile$(PLATFORM): kabc/formats/binary/kabcformat_binaryE.pro
cd kabc/formats/binary; tmake "CONFIG+=$(RELEASE_DEBUG)" kabcformat_binaryE.pro -o Makefile$(PLATFORM)
kabc/plugins/file/Makefile$(PLATFORM): kabc/plugins/file/fileE.pro
cd kabc/plugins/file; tmake "CONFIG+=$(RELEASE_DEBUG)" fileE.pro -o Makefile$(PLATFORM)
kabc/plugins/dir/Makefile$(PLATFORM): kabc/plugins/dir/dirE.pro
cd kabc/plugins/dir; tmake "CONFIG+=$(RELEASE_DEBUG)" dirE.pro -o Makefile$(PLATFORM)
kabc/plugins/ldap/Makefile$(PLATFORM): kabc/plugins/ldap/ldapE.pro
cd kabc/plugins/ldap; tmake "CONFIG+=$(RELEASE_DEBUG)" ldapE.pro -o Makefile$(PLATFORM)
kabc/plugins/opie/Makefile$(PLATFORM): kabc/plugins/opie/opieE.pro
cd kabc/plugins/opie; tmake "CONFIG+=$(RELEASE_DEBUG)" opieE.pro -o Makefile$(PLATFORM)
kabc/plugins/qtopia/Makefile$(PLATFORM): kabc/plugins/qtopia/qtopiaE.pro
cd kabc/plugins/qtopia; tmake "CONFIG+=$(RELEASE_DEBUG)" qtopiaE.pro -o Makefile$(PLATFORM)
kabc/plugins/sharpdtm/Makefile$(PLATFORM): kabc/plugins/sharpdtm/sharpdtmE.pro
cd kabc/plugins/sharpdtm; tmake "CONFIG+=$(RELEASE_DEBUG)" sharpdtmE.pro -o Makefile$(PLATFORM)
kaddressbook/Makefile$(PLATFORM): kaddressbook/kaddressbookE.pro
cd kaddressbook; tmake "CONFIG+=$(RELEASE_DEBUG)" kaddressbookE.pro -o Makefile$(PLATFORM)
kmicromail/Makefile$(PLATFORM): kmicromail/kmicromailE.pro
cd kmicromail; tmake "CONFIG+=$(RELEASE_DEBUG)" kmicromailE.pro -o Makefile$(PLATFORM)
kmicromail/libetpan/Makefile$(PLATFORM): kmicromail/libetpan/libetpanE.pro
cd kmicromail/libetpan; tmake "CONFIG+=$(RELEASE_DEBUG)" libetpanE.pro -o Makefile$(PLATFORM)
kmicromail/libmailwrapper/Makefile$(PLATFORM): kmicromail/libmailwrapper/libmailwrapperE.pro
cd kmicromail/libmailwrapper; tmake "CONFIG+=$(RELEASE_DEBUG)" libmailwrapperE.pro -o Makefile$(PLATFORM)
gammu/emb/common/Makefile$(PLATFORM): gammu/emb/common/commonE.pro
cd gammu/emb/common; tmake "CONFIG+=$(RELEASE_DEBUG)" commonE.pro -o Makefile$(PLATFORM)
gammu/emb/gammu/Makefile$(PLATFORM): gammu/emb/gammu/gammuE.pro
cd gammu/emb/gammu; tmake "CONFIG+=$(RELEASE_DEBUG)" gammuE.pro -o Makefile$(PLATFORM)
+
+pwmanager/pwmanager/Makefile$(PLATFORM): pwmanager/pwmanager/pwmanagerE.pro
+ cd pwmanager/pwmanager; tmake "CONFIG+=$(RELEASE_DEBUG)" pwmanagerE.pro -o Makefile$(PLATFORM)
diff --git a/kmicromail/accountitem.cpp b/kmicromail/accountitem.cpp
index 59c8abb..12d047a 100644
--- a/kmicromail/accountitem.cpp
+++ b/kmicromail/accountitem.cpp
@@ -1,1172 +1,1172 @@
#include "accountitem.h"
#include "accountview.h"
#include "newmaildir.h"
#include "nntpgroupsdlg.h"
#include "defines.h"
#include <libmailwrapper/mailtypes.h>
#include <libmailwrapper/abstractmail.h>
#include <libmailwrapper/mailwrapper.h>
/* OPIE */
//#include <qpe/qpeapplication.h>
/* QT */
#include <qpopupmenu.h>
#include <qmessagebox.h>
#include <kiconloader.h>
#define GET_NEW_MAILS 101
using namespace Opie::Core;
#define SETPIX(x) if (!account->getOffline()) {setPixmap( 0,x);} else {setPixmap( 0, PIXMAP_OFFLINE );}
/**
* POP3 Account stuff
*/
POP3viewItem::POP3viewItem( POP3account *a, AccountView *parent )
: AccountViewItem( parent )
{
account = a;
wrapper = AbstractMail::getWrapper( account );
SETPIX(PIXMAP_POP3FOLDER);
#if 0
if (!account->getOffline())
{
setPixmap( 0, );
}
else
{
setPixmap( 0, PIXMAP_OFFLINE );
}
#endif
setText( 0, account->getAccountName() );
setOpen( true );
}
POP3viewItem::~POP3viewItem()
{
delete wrapper;
}
AbstractMail *POP3viewItem::getWrapper()
{
return wrapper;
}
void POP3viewItem::refresh(QValueList<Opie::Core::OSmartPointer<RecMail> > & )
{
refresh();
}
void POP3viewItem::refresh()
{
if (account->getOffline()) return;
QValueList<FolderP> *folders = wrapper->listFolders();
QListViewItem *child = firstChild();
while ( child )
{
QListViewItem *tmp = child;
child = child->nextSibling();
delete tmp;
}
QValueList<FolderP>::ConstIterator it;
QListViewItem*item = 0;
for ( it = folders->begin(); it!=folders->end(); ++it)
{
item = new POP3folderItem( (*it), this , item );
item->setSelectable( (*it)->may_select());
}
delete folders;
}
RECBODYP POP3viewItem::fetchBody( const RecMailP &mail )
{
return wrapper->fetchBody( mail );
}
QPopupMenu * POP3viewItem::getContextMenu()
{
QPopupMenu *m = new QPopupMenu(0);
if (m)
{
if (!account->getOffline())
{
m->insertItem(QObject::tr("Disconnect",contextName),0);
m->insertItem(QObject::tr("Set offline",contextName),1);
m->insertItem(QObject::tr("Get new messages",contextName),GET_NEW_MAILS);
}
else
{
m->insertItem(QObject::tr("Set online",contextName),1);
m->insertItem(QObject::tr("Get new messages",contextName),GET_NEW_MAILS);
}
}
return m;
}
void POP3viewItem::disconnect()
{
QListViewItem *child = firstChild();
while ( child )
{
QListViewItem *tmp = child;
child = child->nextSibling();
delete tmp;
}
wrapper->logout();
}
void POP3viewItem::setOnOffline()
{
if (!account->getOffline())
{
disconnect();
}
account->setOffline(!account->getOffline());
account->save();
SETPIX(PIXMAP_POP3FOLDER);
refresh();
}
void POP3viewItem::contextMenuSelected(int which)
{
switch (which)
{
case 0:
disconnect();
break;
case 1:
setOnOffline();
break;
case GET_NEW_MAILS: // daunlood
if (account->getOffline())
setOnOffline();
AccountView*bl = accountView();
if (!bl) return;
AccountViewItem* in = findSubItem( "inbox" , 0);
if ( ! in )
return;
bl->downloadMailsInbox(in->getFolder() ,getWrapper());
setOnOffline();
break;
}
}
POP3folderItem::~POP3folderItem()
{}
POP3folderItem::POP3folderItem( const FolderP&folderInit, POP3viewItem *parent , QListViewItem*after )
: AccountViewItem(folderInit,parent,after )
{
pop3 = parent;
if (folder->getDisplayName().lower()!="inbox")
{
setPixmap( 0, PIXMAP_POP3FOLDER );
}
else
{
setPixmap( 0, PIXMAP_INBOXFOLDER);
}
setText( 0, folder->getDisplayName() );
}
void POP3folderItem::refresh(QValueList<RecMailP>&target)
{
if (folder->may_select())
pop3->getWrapper()->listMessages( folder->getName(),target );
}
RECBODYP POP3folderItem::fetchBody(const RecMailP&aMail)
{
return pop3->getWrapper()->fetchBody(aMail);
}
QPopupMenu * POP3folderItem::getContextMenu()
{
QPopupMenu *m = new QPopupMenu(0);
if (m)
{
m->insertItem(QObject::tr("Refresh header list",contextName),0);
m->insertItem(QObject::tr("Delete all mails",contextName),1);
m->insertItem(QObject::tr("Move/Copie all mails",contextName),2);
}
return m;
}
void POP3folderItem::downloadMails()
{
AccountView*bl = pop3->accountView();
if (!bl) return;
bl->downloadMails(folder,pop3->getWrapper());
}
void POP3folderItem::contextMenuSelected(int which)
{
AccountView * view = (AccountView*)listView();
switch (which)
{
case 0:
/* must be 'cause pop3 lists are cached */
pop3->getWrapper()->logout();
view->refreshCurrent();
break;
case 1:
deleteAllMail(pop3->getWrapper(),folder);
break;
case 2:
downloadMails();
break;
default:
break;
}
}
/**
* NNTP Account stuff
*/
NNTPviewItem::NNTPviewItem( NNTPaccount *a, AccountView *parent )
: AccountViewItem( parent )
{
account = a;
wrapper = AbstractMail::getWrapper( account );
//FIXME
SETPIX(PIXMAP_POP3FOLDER);
#if 0
if (!account->getOffline())
{
setPixmap( 0, );
}
else
{
setPixmap( 0, PIXMAP_OFFLINE );
}
#endif
setText( 0, account->getAccountName() );
setOpen( true );
}
NNTPviewItem::~NNTPviewItem()
{
delete wrapper;
}
AbstractMail *NNTPviewItem::getWrapper()
{
return wrapper;
}
void NNTPviewItem::refresh( QValueList<RecMailP> & )
{
refresh();
}
void NNTPviewItem::refresh()
{
if (account->getOffline()) return;
QValueList<FolderP> *folders = wrapper->listFolders();
QListViewItem *child = firstChild();
while ( child )
{
QListViewItem *tmp = child;
child = child->nextSibling();
delete tmp;
}
QValueList<FolderP>::ConstIterator it;
QListViewItem*item = 0;
for ( it = folders->begin(); it!=folders->end(); ++it)
{
item = new NNTPfolderItem( (*it), this , item );
item->setSelectable( (*it)->may_select());
}
delete folders;
}
RECBODYP NNTPviewItem::fetchBody( const RecMailP &mail )
{
return wrapper->fetchBody( mail );
}
QPopupMenu * NNTPviewItem::getContextMenu()
{
QPopupMenu *m = new QPopupMenu(0);
if (m)
{
if (!account->getOffline())
{
m->insertItem(QObject::tr("Disconnect",contextName),0);
m->insertItem(QObject::tr("Set offline",contextName),1);
m->insertItem(QObject::tr("(Un-)Subscribe groups",contextName),2);
}
else
{
m->insertItem(QObject::tr("Set online",contextName),1);
}
}
return m;
}
void NNTPviewItem::subscribeGroups()
{
NNTPGroupsDlg dlg(account);
dlg.showMaximized();
if ( dlg.exec()== QDialog::Accepted ){
refresh();
}
}
void NNTPviewItem::disconnect()
{
QListViewItem *child = firstChild();
while ( child )
{
QListViewItem *tmp = child;
child = child->nextSibling();
delete tmp;
}
wrapper->logout();
}
void NNTPviewItem::setOnOffline()
{
if (!account->getOffline())
{
disconnect();
}
account->setOffline(!account->getOffline());
account->save();
//FIXME
SETPIX(PIXMAP_POP3FOLDER);
refresh();
}
void NNTPviewItem::contextMenuSelected(int which)
{
switch (which)
{
case 0:
disconnect();
break;
case 1:
setOnOffline();
break;
case 2:
subscribeGroups();
break;
}
}
NNTPfolderItem::~NNTPfolderItem()
{}
NNTPfolderItem::NNTPfolderItem( const FolderP &folderInit, NNTPviewItem *parent , QListViewItem*after )
: AccountViewItem( folderInit, parent,after )
{
nntp = parent;
if (folder->getDisplayName().lower()!="inbox")
{
setPixmap( 0, PIXMAP_POP3FOLDER );
}
else
{
setPixmap( 0, PIXMAP_INBOXFOLDER);
}
setText( 0, folder->getDisplayName() );
}
void NNTPfolderItem::refresh(QValueList<RecMailP>&target)
{
if (folder->may_select())
nntp->getWrapper()->listMessages( folder->getName(),target );
}
RECBODYP NNTPfolderItem::fetchBody(const RecMailP&aMail)
{
return nntp->getWrapper()->fetchBody(aMail);
}
QPopupMenu * NNTPfolderItem::getContextMenu()
{
QPopupMenu *m = new QPopupMenu(0);
if (m)
{
m->insertItem(QObject::tr("Refresh header list",contextName),0);
m->insertItem(QObject::tr("Copy all postings",contextName),1);
}
return m;
}
void NNTPfolderItem::downloadMails()
{
AccountView*bl = nntp->accountView();
if (!bl) return;
bl->downloadMails(folder,nntp->getWrapper());
}
void NNTPfolderItem::contextMenuSelected(int which)
{
AccountView * view = (AccountView*)listView();
switch (which)
{
case 0:
/* must be 'cause pop3 lists are cached */
nntp->getWrapper()->logout();
view->refreshCurrent();
break;
case 1:
downloadMails();
break;
default:
break;
}
}
/**
* IMAP Account stuff
*/
IMAPviewItem::IMAPviewItem( IMAPaccount *a, AccountView *parent )
: AccountViewItem( parent )
{
account = a;
wrapper = AbstractMail::getWrapper( account );
SETPIX(PIXMAP_IMAPFOLDER);
setText( 0, account->getAccountName() );
setOpen( true );
}
IMAPviewItem::~IMAPviewItem()
{
delete wrapper;
}
AbstractMail *IMAPviewItem::getWrapper()
{
return wrapper;
}
void IMAPviewItem::refresh(QValueList<RecMailP>&)
{
refreshFolders(false);
}
const QStringList&IMAPviewItem::subFolders()
{
return currentFolders;
}
void IMAPviewItem::refreshFolders(bool force)
{
if (childCount()>0 && force==false) return;
if (account->getOffline()) return;
removeChilds();
currentFolders.clear();
QValueList<FolderP> * folders = wrapper->listFolders();
QValueList<FolderP>::Iterator it;
QListViewItem*item = 0;
QListViewItem*titem = 0;
QString fname,del,search;
int pos;
for ( it = folders->begin(); it!=folders->end(); ++it)
{
if ((*it)->getDisplayName().lower()=="inbox")
{
item = new IMAPfolderItem( (*it), this , item );
folders->remove(it);
break;
}
}
for ( it = folders->begin(); it!=folders->end(); ++it)
{
fname = (*it)->getDisplayName();
currentFolders.append((*it)->getName());
pos = fname.findRev((*it)->Separator());
if (pos != -1)
{
fname = fname.left(pos);
}
IMAPfolderItem*pitem = (IMAPfolderItem*)findSubItem(fname);
if (pitem)
{
titem = item;
item = new IMAPfolderItem( (*it),pitem,pitem->firstChild(),this);
/* setup the short name */
- item->setText(0,(*it)->getDisplayName().right((*it)->getDisplayName().length()-pos-1));
+ item->setText(0,(*it)->getDisplayName().mid(pos+1));
item = titem;
}
else
{
item = new IMAPfolderItem( (*it), this , item );
}
}
delete folders;
}
QPopupMenu * IMAPviewItem::getContextMenu()
{
QPopupMenu *m = new QPopupMenu(0);
if (m)
{
if (!account->getOffline())
{
m->insertItem(QObject::tr("Refresh folder list",contextName),0);
m->insertItem(QObject::tr("Create new folder",contextName),1);
m->insertSeparator();
m->insertItem(QObject::tr("Disconnect",contextName),2);
m->insertItem(QObject::tr("Set offline",contextName),3);
m->insertSeparator();
m->insertItem(QObject::tr("Get new messages",contextName),GET_NEW_MAILS);
}
else
{
m->insertItem(QObject::tr("Set online",contextName),3);
m->insertSeparator();
m->insertItem(QObject::tr("Get new messages",contextName),GET_NEW_MAILS);
}
}
return m;
}
void IMAPviewItem::createNewFolder()
{
Newmdirdlg ndirdlg;
ndirdlg.showMaximized();
if ( ndirdlg.exec() )
{
QString ndir = ndirdlg.Newdir();
bool makesubs = ndirdlg.subpossible();
QString delemiter = "/";
IMAPfolderItem*item = (IMAPfolderItem*)firstChild();
if (item)
{
delemiter = item->Delemiter();
}
if (wrapper->createMbox(ndir,0,delemiter,makesubs))
{
refreshFolders(true);
}
}
}
void IMAPviewItem::contextMenuSelected(int id)
{
switch (id)
{
case 0:
refreshFolders(true);
break;
case 1:
createNewFolder();
break;
case 2:
removeChilds();
wrapper->logout();
break;
case 3:
if (account->getOffline()==false)
{
removeChilds();
wrapper->logout();
}
account->setOffline(!account->getOffline());
account->save();
SETPIX(PIXMAP_IMAPFOLDER);
refreshFolders(false);
break;
case GET_NEW_MAILS: // daunlood
{
if (account->getOffline()) {
contextMenuSelected( 3 );
}
AccountView*bl = accountView();
if (!bl) return;
AccountViewItem* in = findSubItem( "inbox" , 0);
if ( ! in )
return;
bl->downloadMailsInbox(in->getFolder(),getWrapper());
}
break;
default:
break;
}
}
RECBODYP IMAPviewItem::fetchBody(const RecMailP&)
{
return new RecBody();
}
bool IMAPviewItem::offline()
{
return account->getOffline();
}
IMAPfolderItem::IMAPfolderItem( const FolderP& folderInit, IMAPviewItem *parent , QListViewItem*after )
: AccountViewItem( folderInit, parent , after )
{
imap = parent;
if (folder->getDisplayName().lower()!="inbox")
{
setPixmap( 0, PIXMAP_IMAPFOLDER );
}
else
{
setPixmap( 0, PIXMAP_INBOXFOLDER);
}
setText( 0, folder->getDisplayName() );
}
IMAPfolderItem::IMAPfolderItem(const FolderP &folderInit, IMAPfolderItem *parent , QListViewItem*after, IMAPviewItem *master )
: AccountViewItem(folderInit, parent,after )
{
imap = master;
if (folder->getDisplayName().lower()!="inbox")
{
setPixmap( 0, PIXMAP_IMAPFOLDER );
}
else
{
setPixmap( 0, PIXMAP_INBOXFOLDER);
}
setText( 0, folder->getDisplayName() );
}
IMAPfolderItem::~IMAPfolderItem()
{}
const QString& IMAPfolderItem::Delemiter()const
{
return folder->Separator();
}
void IMAPfolderItem::refresh(QValueList<RecMailP>&target)
{
if (folder->may_select())
{
imap->getWrapper()->listMessages( folder->getName(),target );
}
else
{
target.clear();
}
}
RECBODYP IMAPfolderItem::fetchBody(const RecMailP&aMail)
{
return imap->getWrapper()->fetchBody(aMail);
}
QPopupMenu * IMAPfolderItem::getContextMenu()
{
QPopupMenu *m = new QPopupMenu(0);
if (m)
{
if (folder->may_select())
{
m->insertItem(QObject::tr("Refresh header list",contextName),0);
m->insertItem(QObject::tr("Move/Copie all mails",contextName),4);
m->insertItem(QObject::tr("Delete all mails",contextName),1);
}
if (folder->no_inferior()==false)
{
m->insertItem(QObject::tr("Create new subfolder",contextName),2);
}
if (folder->getDisplayName().lower()!="inbox")
{
m->insertItem(QObject::tr("Delete folder",contextName),3);
}
}
return m;
}
void IMAPfolderItem::createNewFolder()
{
Newmdirdlg ndirdlg;
ndirdlg.showMaximized();
if ( ndirdlg.exec() )
{
QString ndir = ndirdlg.Newdir();
bool makesubs = ndirdlg.subpossible();
QString delemiter = Delemiter();
if (imap->wrapper->createMbox(ndir,folder,delemiter,makesubs))
{
imap->refreshFolders(true);
}
}
}
void IMAPfolderItem::deleteFolder()
{
int yesno = QMessageBox::warning(0,QObject::tr("Delete folder",contextName),
QObject::tr("<center>Realy delete folder <br><b>%1</b><br>and all if it content?</center>",contextName).arg(folder->getDisplayName()),
QObject::tr("Yes",contextName),
QObject::tr("No",contextName),QString::null,1,1);
if (yesno == 0)
{
if (imap->getWrapper()->deleteMbox(folder))
{
QListView*v=listView();
IMAPviewItem * box = imap;
/* be carefull - after that this object is destroyd so don't use
* any member of it after that call!!*/
imap->refreshFolders(true);
if (v)
{
v->setSelected(box,true);
}
}
}
}
void IMAPfolderItem::downloadMails()
{
AccountView*bl = imap->accountView();
if (!bl) return;
bl->downloadMails(folder,imap->getWrapper());
}
void IMAPfolderItem::contextMenuSelected(int id)
{
AccountView * view = (AccountView*)listView();
switch(id)
{
case 0:
view->refreshCurrent();
break;
case 1:
deleteAllMail(imap->getWrapper(),folder);
break;
case 2:
createNewFolder();
break;
case 3:
deleteFolder();
break;
case 4:
downloadMails();
break;
default:
break;
}
}
/**
* MH Account stuff
*/
/* MH is a little bit different - the top folder can contains messages other than in IMAP and
POP3 and MBOX */
MHviewItem::MHviewItem( const QString&aPath, AccountView *parent )
: AccountViewItem( parent )
{
m_Path = aPath;
/* be carefull - the space within settext is wanted - thats why the string twice */
wrapper = AbstractMail::getWrapper( m_Path,"Local Folders");
setPixmap( 0, PIXMAP_LOCALFOLDER );
setText( 0, " Local Folders" );
setOpen( true );
folder = 0;
}
MHviewItem::~MHviewItem()
{
delete wrapper;
}
AbstractMail *MHviewItem::getWrapper()
{
return wrapper;
}
void MHviewItem::refresh( QValueList<RecMailP> & target)
{
refresh(false);
getWrapper()->listMessages( "",target );
}
void MHviewItem::refresh(bool force)
{
if (childCount()>0 && force==false) return;
removeChilds();
currentFolders.clear();
QValueList<FolderP> *folders = wrapper->listFolders();
QValueList<FolderP>::ConstIterator it;
MHfolderItem*item = 0;
MHfolderItem*pmaster = 0;
QString fname = "";
int pos;
for ( it = folders->begin(); it!=folders->end(); ++it)
{
fname = (*it)->getDisplayName();
/* this folder itself */
if (fname=="/")
{
currentFolders.append(fname);
folder = (*it);
continue;
}
currentFolders.append(fname);
pos = fname.findRev("/");
if (pos > 0)
{
fname = fname.left(pos);
pmaster = (MHfolderItem*)findSubItem(fname);
}
else
{
pmaster = 0;
}
if (pmaster)
{
item = new MHfolderItem( (*it), pmaster, item, this );
}
else
{
item = new MHfolderItem( (*it), this , item );
}
item->setSelectable((*it)->may_select());
}
delete folders;
}
RECBODYP MHviewItem::fetchBody( const RecMailP &mail )
{
return wrapper->fetchBody( mail );
}
QPopupMenu * MHviewItem::getContextMenu()
{
QPopupMenu *m = new QPopupMenu(0);
if (m)
{
m->insertItem(QObject::tr("Refresh folder list",contextName),0);
m->insertItem(QObject::tr("Create new folder",contextName),1);
m->insertItem(QObject::tr("Delete all mails",contextName),2);
m->insertItem(QObject::tr("Move/Copie all mails",contextName),3);
}
return m;
}
void MHviewItem::createFolder()
{
Newmdirdlg ndirdlg(0,0,true);
ndirdlg.showMaximized();
if ( ndirdlg.exec() )
{
QString ndir = ndirdlg.Newdir();
if (wrapper->createMbox(ndir))
{
refresh(true);
}
}
}
void MHviewItem::downloadMails()
{
AccountView*bl = accountView();
if (!bl) return;
bl->downloadMails(folder,getWrapper());
}
QStringList MHviewItem::subFolders()
{
return currentFolders;
}
void MHviewItem::contextMenuSelected(int which)
{
switch (which)
{
case 0:
refresh(true);
break;
case 1:
createFolder();
break;
case 2:
deleteAllMail(getWrapper(),folder);
break;
case 3:
downloadMails();
break;
default:
break;
}
}
MHfolderItem::~MHfolderItem()
{}
MHfolderItem::MHfolderItem( const FolderP &folderInit, MHviewItem *parent , QListViewItem*after )
: AccountViewItem(folderInit, parent,after )
{
mbox = parent;
initName();
}
MHfolderItem::MHfolderItem(const FolderP& folderInit, MHfolderItem *parent, QListViewItem*after, MHviewItem*master)
: AccountViewItem(folderInit, parent,after )
{
folder = folderInit;
mbox = master;
initName();
}
void MHfolderItem::initName()
{
QString bName = folder->getDisplayName();
if (bName.startsWith("/")&&bName.length()>1)
{
bName.replace(0,1,"");
}
int pos = bName.findRev("/");
if (pos > 0)
{
bName.replace(0,pos+1,"");
}
if (bName.lower() == "outgoing")
{
setPixmap( 0, PIXMAP_OUTBOXFOLDER );
}
else if (bName.lower() == "inbox")
{
setPixmap( 0, PIXMAP_INBOXFOLDER);
} else if (bName.lower() == "drafts") {
setPixmap(0, SmallIcon ("edit"));
} else {
setPixmap( 0, PIXMAP_MBOXFOLDER );
}
setText( 0, bName );
}
const FolderP&MHfolderItem::getFolder()const
{
return folder;
}
void MHfolderItem::refresh(QValueList<RecMailP>&target)
{
if (folder->may_select())
mbox->getWrapper()->listMessages( folder->getName(),target );
}
RECBODYP MHfolderItem::fetchBody(const RecMailP&aMail)
{
return mbox->getWrapper()->fetchBody(aMail);
}
void MHfolderItem::deleteFolder()
{
int yesno = QMessageBox::warning(0,QObject::tr("Delete folder",contextName),
QObject::tr("<center>Realy delete folder <br><b>%1</b><br>and all if it content?</center>",contextName).arg(folder->getDisplayName()),
QObject::tr("Yes",contextName),
QObject::tr("No",contextName),QString::null,1,1);
if (yesno == 0)
{
if (mbox->getWrapper()->deleteMbox(folder))
{
QListView*v=listView();
MHviewItem * box = mbox;
/* be carefull - after that this object is destroyd so don't use
* any member of it after that call!!*/
mbox->refresh(true);
if (v)
{
v->setSelected(box,true);
}
}
}
}
QPopupMenu * MHfolderItem::getContextMenu()
{
QPopupMenu *m = new QPopupMenu(0);
if (m)
{
m->insertItem(QObject::tr("Move/Copie all mails",contextName),2);
m->insertItem(QObject::tr("Delete all mails",contextName),0);
m->insertItem(QObject::tr("Create new subfolder",contextName),3);
m->insertItem(QObject::tr("Delete folder",contextName),1);
}
return m;
}
void MHfolderItem::downloadMails()
{
AccountView*bl = mbox->accountView();
if (!bl) return;
bl->downloadMails(folder,mbox->getWrapper());
}
void MHfolderItem::createFolder()
{
Newmdirdlg ndirdlg(0,0,true);
ndirdlg.showMaximized();
if (ndirdlg.exec() )
{
QString ndir = ndirdlg.Newdir();
if (mbox->getWrapper()->createMbox(ndir,folder))
{
QListView*v=listView();
MHviewItem * box = mbox;
/* be carefull - after that this object is destroyd so don't use
* any member of it after that call!!*/
mbox->refresh(true);
if (v)
{
v->setSelected(box,true);
}
}
}
}
void MHfolderItem::contextMenuSelected(int which)
{
switch(which)
{
case 0:
deleteAllMail(mbox->getWrapper(),folder);
break;
case 1:
deleteFolder();
break;
case 2:
downloadMails();
break;
case 3:
createFolder();
break;
default:
break;
}
}
bool MHfolderItem::isDraftfolder()
{
if (folder && folder->getName()==AbstractMail::defaultLocalfolder()+"/"+AbstractMail::draftFolder()) return true;
return false;
}
/**
* Generic stuff
*/
const QString AccountViewItem::contextName="AccountViewItem";
AccountViewItem::AccountViewItem( AccountView *parent )
: QListViewItem( parent )
{
init();
m_Backlink = parent;
}
AccountViewItem::AccountViewItem( QListViewItem *parent)
: QListViewItem( parent),folder(0)
{
init();
}
AccountViewItem::AccountViewItem( QListViewItem *parent , QListViewItem*after )
:QListViewItem( parent,after ),folder(0)
{
init();
}
AccountViewItem::AccountViewItem( const Opie::Core::OSmartPointer<Folder>&folderInit,QListViewItem *parent , QListViewItem*after )
:QListViewItem( parent,after ),folder(folderInit)
{
init();
}
void AccountViewItem::init()
{
m_Backlink = 0;
}
AccountViewItem::~AccountViewItem()
{
folder = 0;
}
AccountView*AccountViewItem::accountView()
{
return m_Backlink;
}
void AccountViewItem::deleteAllMail(AbstractMail*wrapper,const FolderP&folder)
{
if (!wrapper) return;
QString fname="";
if (folder) fname = folder->getDisplayName();
int yesno = QMessageBox::warning(0,QObject::tr("Delete all mails",contextName),
QObject::tr("<center>Realy delete all mails in box <br>%1</center>",contextName).
arg(fname),
QObject::tr("Yes",contextName),
QObject::tr("No",contextName),QString::null,1,1);
if (yesno == 0)
{
if (wrapper->deleteAllMail(folder))
{
AccountView * view = (AccountView*)listView();
if (view) view->refreshCurrent();
}
}
}
void AccountViewItem::removeChilds()
{
QListViewItem *child = firstChild();
while ( child )
{
QListViewItem *tmp = child;
child = child->nextSibling();
delete tmp;
}
}
bool AccountViewItem::matchName(const QString&name)const
{
if (!folder) return false;
return folder->getDisplayName().lower()==name.lower();
}
AccountViewItem*AccountViewItem::findSubItem(const QString&path,AccountViewItem*start)
{
AccountViewItem*pitem,*sitem;
if (!start) pitem = (AccountViewItem*)firstChild();
else pitem = (AccountViewItem*)start->firstChild();
while (pitem)
{
if (pitem->matchName(path))
{
break;
}
if (pitem->childCount()>0)
{
sitem = findSubItem(path,pitem);
if (sitem)
{
pitem = sitem;
break;
}
}
pitem=(AccountViewItem*)pitem->nextSibling();
}
return pitem;
}
bool AccountViewItem::isDraftfolder()
{
return false;
}
diff --git a/kmicromail/libmailwrapper/mailwrapper.cpp b/kmicromail/libmailwrapper/mailwrapper.cpp
index 9400649..2ee1ab3 100644
--- a/kmicromail/libmailwrapper/mailwrapper.cpp
+++ b/kmicromail/libmailwrapper/mailwrapper.cpp
@@ -1,180 +1,181 @@
#include <stdlib.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include <fcntl.h>
#include <string.h>
#include <qdir.h>
#include "mailwrapper.h"
//#include "logindialog.h"
//#include "defines.h"
#define UNDEFINED 64
#define MAXLINE 76
#define UTF16MASK 0x03FFUL
#define UTF16SHIFT 10
#define UTF16BASE 0x10000UL
#define UTF16HIGHSTART 0xD800UL
#define UTF16HIGHEND 0xDBFFUL
#define UTF16LOSTART 0xDC00UL
#define UTF16LOEND 0xDFFFUL
using namespace Opie::Core;
Attachment::Attachment( QString lnk )
{
doc = lnk;
size = QFileInfo( doc ).size();
mPix = SmallIcon( "files" );
}
Folder::Folder(const QString&tmp_name, const QString&sep )
{
name = tmp_name;
nameDisplay = name;
separator = sep;
prefix = "";
}
Folder::~Folder()
{
}
const QString& Folder::Separator()const
{
return separator;
}
-IMAPFolder::IMAPFolder(const QString&name,const QString&sep, bool select,bool no_inf, const QString&aprefix )
- : Folder( name,sep ),m_MaySelect(select),m_NoInferior(no_inf)
+IMAPFolder::IMAPFolder(const QString&t_name,const QString&sep, bool select,bool no_inf, const QString&aprefix )
+ : Folder( t_name,sep ),m_MaySelect(select),m_NoInferior(no_inf)
{
// Decode IMAP foldername
- nameDisplay = IMAPFolder::decodeFolderName( name );
+ nameDisplay = IMAPFolder::decodeFolderName( t_name );
+ name = nameDisplay ;
/*
odebug << "folder " + name + " - displayed as " + nameDisplay << oendl;
*/
prefix = aprefix;
if (prefix.length()>0) {
if (nameDisplay.startsWith(prefix) && nameDisplay.length()>prefix.length()) {
nameDisplay=nameDisplay.right(nameDisplay.length()-prefix.length());
}
}
}
IMAPFolder::~IMAPFolder()
{
}
static unsigned char base64chars[] =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+,";
/**
* Decodes base64 encoded parts of the imapfolder name
* Code taken from kde cvs: kdebase/kioslave/imap4/rfcdecoder.cc
*/
QString IMAPFolder::decodeFolderName( const QString &name )
{
unsigned char c, i, bitcount;
unsigned long ucs4, utf16, bitbuf;
unsigned char base64[256], utf8[6];
unsigned long srcPtr = 0;
QCString dst = "";
QCString src = name.ascii();
/* initialize modified base64 decoding table */
memset(base64, UNDEFINED, sizeof(base64));
for (i = 0; i < sizeof(base64chars); ++i) {
base64[(int)base64chars[i]] = i;
}
/* loop until end of string */
while (srcPtr < src.length ()) {
c = src[srcPtr++];
/* deal with literal characters and &- */
if (c != '&' || src[srcPtr] == '-') {
/* encode literally */
dst += c;
/* skip over the '-' if this is an &- sequence */
if (c == '&')
srcPtr++;
} else {
/* convert modified UTF-7 -> UTF-16 -> UCS-4 -> UTF-8 -> HEX */
bitbuf = 0;
bitcount = 0;
ucs4 = 0;
while ((c = base64[(unsigned char) src[srcPtr]]) != UNDEFINED) {
++srcPtr;
bitbuf = (bitbuf << 6) | c;
bitcount += 6;
/* enough bits for a UTF-16 character? */
if (bitcount >= 16) {
bitcount -= 16;
utf16 = (bitcount ? bitbuf >> bitcount : bitbuf) & 0xffff;
/* convert UTF16 to UCS4 */
if (utf16 >= UTF16HIGHSTART && utf16 <= UTF16HIGHEND) {
ucs4 = (utf16 - UTF16HIGHSTART) << UTF16SHIFT;
continue;
} else if (utf16 >= UTF16LOSTART && utf16 <= UTF16LOEND) {
ucs4 += utf16 - UTF16LOSTART + UTF16BASE;
} else {
ucs4 = utf16;
}
/* convert UTF-16 range of UCS4 to UTF-8 */
if (ucs4 <= 0x7fUL) {
utf8[0] = ucs4;
i = 1;
} else if (ucs4 <= 0x7ffUL) {
utf8[0] = 0xc0 | (ucs4 >> 6);
utf8[1] = 0x80 | (ucs4 & 0x3f);
i = 2;
} else if (ucs4 <= 0xffffUL) {
utf8[0] = 0xe0 | (ucs4 >> 12);
utf8[1] = 0x80 | ((ucs4 >> 6) & 0x3f);
utf8[2] = 0x80 | (ucs4 & 0x3f);
i = 3;
} else {
utf8[0] = 0xf0 | (ucs4 >> 18);
utf8[1] = 0x80 | ((ucs4 >> 12) & 0x3f);
utf8[2] = 0x80 | ((ucs4 >> 6) & 0x3f);
utf8[3] = 0x80 | (ucs4 & 0x3f);
i = 4;
}
/* copy it */
for (c = 0; c < i; ++c) {
dst += utf8[c];
}
}
}
/* skip over trailing '-' in modified UTF-7 encoding */
if (src[srcPtr] == '-')
++srcPtr;
}
}
return QString::fromUtf8( dst.data() );
}
Mail::Mail()
:Opie::Core::ORefCount(),name(""), mail(""), to(""), cc(""), bcc(""), reply(""), subject(""), message("")
{
}
MHFolder::MHFolder(const QString&disp_name,const QString&mbox)
: Folder( disp_name,"/" )
{
separator = "/";
name = mbox;
if (!disp_name.startsWith("/") && disp_name.length()>0)
name+="/";
name+=disp_name;
if (disp_name.length()==0) {
nameDisplay = separator;
}
prefix = mbox;
}
MHFolder::~MHFolder()
{
}
diff --git a/kmicromail/libmailwrapper/mailwrapper.h b/kmicromail/libmailwrapper/mailwrapper.h
index cefe64e..2ba908b 100644
--- a/kmicromail/libmailwrapper/mailwrapper.h
+++ b/kmicromail/libmailwrapper/mailwrapper.h
@@ -1,128 +1,128 @@
#ifndef MAILWRAPPER_H
#define MAILWRAPPER_H
#include <qpe/applnk.h>
#include <qbitarray.h>
#include <qdatetime.h>
#include <qfileinfo.h>
#include <kiconloader.h>
#include "settings.h"
#include <opie2/osmartpointer.h>
/*
class Attachment
{
public:
Attachment( DocLnk lnk );
virtual ~Attachment(){}
const QString getFileName()const{ return doc.file(); }
const QString getName()const{ return doc.name(); }
const QString getMimeType()const{ return doc.type(); }
const QPixmap getPixmap()const{ return doc.pixmap(); }
const int getSize()const { return size; }
DocLnk getDocLnk() { return doc; }
protected:
DocLnk doc;
int size;
};
*/
class Attachment
{
public:
Attachment( QString lnk );
virtual ~Attachment(){}
const QString getFileName()const{ return doc; }
const QString getName()const{ return QFileInfo( doc ).baseName (); }
const QString getMimeType()const{ return QFileInfo( doc ).extension(false); }
const QPixmap getPixmap()const{ return mPix; }
const int getSize()const { return size; }
QString getDocLnk() { return doc; }
protected:
QPixmap mPix;
QString doc;
int size;
};
class Mail:public Opie::Core::ORefCount
{
public:
Mail();
/* Possible that this destructor must not be declared virtual
* 'cause it seems that it will never have some child classes.
* in this case this object will not get a virtual table -> memory and
* speed will be a little bit better?
*/
virtual ~Mail(){}
void addAttachment( Attachment *att ) { attList.append( att ); }
const QList<Attachment>& getAttachments()const { return attList; }
void removeAttachment( Attachment *att ) { attList.remove( att ); }
const QString&getName()const { return name; }
void setName( QString s ) { name = s; }
const QString&getMail()const{ return mail; }
void setMail( const QString&s ) { mail = s; }
const QString&getTo()const{ return to; }
void setTo( const QString&s ) { to = s; }
const QString&getCC()const{ return cc; }
void setCC( const QString&s ) { cc = s; }
const QString&getBCC()const { return bcc; }
void setBCC( const QString&s ) { bcc = s; }
const QString&getMessage()const { return message; }
void setMessage( const QString&s ) { message = s; }
const QString&getSubject()const { return subject; }
void setSubject( const QString&s ) { subject = s; }
const QString&getReply()const{ return reply; }
void setReply( const QString&a ) { reply = a; }
void setInreply(const QStringList&list){m_in_reply_to = list;}
const QStringList&Inreply()const{return m_in_reply_to;}
private:
QList<Attachment> attList;
QString name, mail, to, cc, bcc, reply, subject, message;
QStringList m_in_reply_to;
};
class Folder:public Opie::Core::ORefCount
{
public:
Folder( const QString&init_name,const QString&sep );
virtual ~Folder();
const QString&getDisplayName()const { return nameDisplay; }
const QString&getName()const { return name; }
const QString&getPrefix()const{return prefix; }
virtual bool may_select()const{return true;}
virtual bool no_inferior()const{return true;}
const QString&Separator()const;
protected:
QString nameDisplay, name, separator,prefix;
};
typedef Opie::Core::OSmartPointer<Folder> FolderP;
class MHFolder : public Folder
{
public:
MHFolder(const QString&disp_name,const QString&mbox);
virtual ~MHFolder();
};
class IMAPFolder : public Folder
{
public:
IMAPFolder(const QString&name, const QString&sep, bool select=true,bool noinf=false,const QString&prefix="" );
virtual ~IMAPFolder();
virtual bool may_select()const{return m_MaySelect;}
virtual bool no_inferior()const{return m_NoInferior;}
- private:
static QString decodeFolderName( const QString &name );
+ private:
bool m_MaySelect,m_NoInferior;
};
#endif