summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp5
-rw-r--r--kmicromail/composemail.cpp24
-rw-r--r--kmicromail/mailistviewitem.cpp73
-rw-r--r--kmicromail/mailistviewitem.h5
-rw-r--r--kmicromail/mainwindow.cpp8
-rw-r--r--kmicromail/opiemail.cpp2
6 files changed, 75 insertions, 42 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index a6d722d..68d3d2d 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -988,49 +988,50 @@ QString KABCore::getNameByPhone( const QString &phone )
found = true;
}
}
}
return ownerName;
#else //KAB_EMBEDDED
qDebug("KABCore::getNameByPhone finsih method");
return "";
#endif //KAB_EMBEDDED
}
void KABCore::openConfigDialog()
{
KCMultiDialog* ConfigureDialog = new KCMultiDialog( "PIM", this ,"kabconfigdialog", true );
KCMKabConfig* kabcfg = new KCMKabConfig( ConfigureDialog->getNewVBoxPage(i18n( "Addressbook")) , "KCMKabConfig" );
ConfigureDialog->addModule(kabcfg );
connect( ConfigureDialog, SIGNAL( applyClicked() ),
this, SLOT( configurationChanged() ) );
connect( ConfigureDialog, SIGNAL( okClicked() ),
this, SLOT( configurationChanged() ) );
saveSettings();
ConfigureDialog->showMaximized();
- ConfigureDialog->exec();
+ if ( ConfigureDialog->exec() )
+ KMessageBox::information( this, i18n("If you configured \nExtensions,\nplease restart!\n") );
delete ConfigureDialog;
}
void KABCore::openLDAPDialog()
{
#ifndef KAB_EMBEDDED
if ( !mLdapSearchDialog ) {
mLdapSearchDialog = new LDAPSearchDialog( mAddressBook, this );
connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), mViewManager,
SLOT( refreshView() ) );
connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), this,
SLOT( setModified() ) );
} else
mLdapSearchDialog->restoreSettings();
if ( mLdapSearchDialog->isOK() )
mLdapSearchDialog->exec();
#else //KAB_EMBEDDED
qDebug("KABCore::openLDAPDialog() finsih method");
#endif //KAB_EMBEDDED
}
void KABCore::print()
{
@@ -1340,48 +1341,49 @@ void KABCore::initActions()
actionCollection(), "edit_delete" );
mActionUndo->setEnabled( false );
mActionRedo->setEnabled( false );
// settings menu
#ifdef KAB_EMBEDDED
//US special menuentry to configure the addressbook resources. On KDE
// you do that through the control center !!!
mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this,
SLOT( configureResources() ), actionCollection(),
"kaddressbook_configure_resources" );
#endif //KAB_EMBEDDED
if ( mIsPart ) {
mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this,
SLOT( openConfigDialog() ), actionCollection(),
"kaddressbook_configure" );
mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0,
this, SLOT( configureKeyBindings() ), actionCollection(),
"kaddressbook_configure_shortcuts" );
#ifdef KAB_EMBEDDED
mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() );
+ mActionConfigureToolbars->setEnabled( false );
#endif //KAB_EMBEDDED
} else {
mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() );
mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() );
}
mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0,
actionCollection(), "options_show_jump_bar" );
connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBarVisible( bool ) ) );
mActionDetails = new KToggleAction( i18n( "Show Details" ), 0, 0,
actionCollection(), "options_show_details" );
connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) );
// misc
// only enable LDAP lookup if we can handle the protocol
#ifndef KAB_EMBEDDED
if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) {
new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0,
this, SLOT( openLDAPDialog() ), actionCollection(),
"ldap_lookup" );
}
@@ -1575,32 +1577,33 @@ void KABCore::updateActionMenu()
if ( !redo->top() )
mActionRedo->setText( i18n( "Redo" ) );
else
mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) );
mActionRedo->setEnabled( !redo->isEmpty() );
}
void KABCore::configureKeyBindings()
{
#ifndef KAB_EMBEDDED
KKeyDialog::configure( actionCollection(), true );
#else //KAB_EMBEDDED
qDebug("KABCore::configureKeyBindings() not implemented");
#endif //KAB_EMBEDDED
}
#ifdef KAB_EMBEDDED
void KABCore::configureResources()
{
KRES::KCMKResources dlg( this, "" , 0 );
if ( !dlg.exec() )
return;
+ KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") );
}
#endif //KAB_EMBEDDED
#ifndef KAB_EMBEDDED
#include "kabcore.moc"
#endif //KAB_EMBEDDED
diff --git a/kmicromail/composemail.cpp b/kmicromail/composemail.cpp
index ca4f247..c1b58a4 100644
--- a/kmicromail/composemail.cpp
+++ b/kmicromail/composemail.cpp
@@ -22,96 +22,96 @@
#include <qmessagebox.h>
#include <qpushbutton.h>
#include <qmultilineedit.h>
#include <qlabel.h>
#include <qtabwidget.h>
#include <qlistview.h>
#include <kabc/addresseedialog.h>
#include <kabc/stdaddressbook.h>
#include <kabc/addressee.h>
//using namespace Opie::Core;
//using namespace Opie::Ui;
ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool modal, WFlags flags )
: ComposeMailUI( parent, name, modal, flags )
{
settings = s;
m_replyid = "";
KABC::Addressee con = KABC::StdAddressBook::self()->whoAmI( );
QStringList mails = con.emails();
QString defmail = con.preferredEmail();
if ( mails.count() == 0)
- QMessageBox::information( parentWidget(), tr( "Hint" ),
- tr( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!" ),
+ QMessageBox::information( 0, tr( "Hint" ),
+ tr( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ),
tr( "Ok" ) );
if (defmail.length()!=0) {
fromBox->insertItem(defmail);
}
QStringList::ConstIterator sit = mails.begin();
for (;sit!=mails.end();++sit) {
if ( (*sit)==defmail)
continue;
fromBox->insertItem((*sit));
}
senderNameEdit->setText(con.formattedName());
Config cfg( "mail" );
cfg.setGroup( "Compose" );
checkBoxLater->setChecked( cfg.readBoolEntry( "sendLater", false ) );
attList->addColumn( tr( "Name" ) );
attList->addColumn( tr( "Size" ) );
QList<Account> accounts = settings->getAccounts();
Account *it;
for ( it = accounts.first(); it; it = accounts.next() ) {
if ( it->getType()==MAILLIB::A_SMTP ) {
SMTPaccount *smtp = static_cast<SMTPaccount *>(it);
smtpAccountBox->insertItem( smtp->getAccountName() );
smtpAccounts.append( smtp );
}
}
- if ( smtpAccounts.count() > 0 ) {
- fillValues( smtpAccountBox->currentItem() );
- } else {
- QMessageBox::information( parentWidget(), tr( "Problem" ),
- tr( "Please create an SMTP account first.\nThe SMTP is needed for sending mail." ),
- tr( "Ok" ) );
- return;
- }
connect( smtpAccountBox, SIGNAL( activated(int) ), SLOT( fillValues(int) ) );
connect( toButton, SIGNAL( clicked() ), SLOT( pickAddressTo() ) );
connect( ccButton, SIGNAL( clicked() ), SLOT( pickAddressCC() ) );
connect( bccButton, SIGNAL( clicked() ), SLOT( pickAddressBCC() ) );
connect( replyButton, SIGNAL( clicked() ), SLOT( pickAddressReply() ) );
connect( addButton, SIGNAL( clicked() ), SLOT( addAttachment() ) );
connect( deleteButton, SIGNAL( clicked() ), SLOT( removeAttachment() ) );
connect( SaveButton, SIGNAL( clicked() ), SLOT( saveAsDraft()) );
mMail = 0;
warnAttach = true;
+ if ( smtpAccounts.count() > 0 ) {
+ fillValues( smtpAccountBox->currentItem() );
+ } else {
+ QMessageBox::information( 0, tr( "Problem" ),
+ tr( "Please create an SMTP account first.\nThe SMTP is needed for sending mail.\n" ),
+ tr( "Ok" ) );
+ return;
+ }
}
void ComposeMail::saveAsDraft()
{
Opie::Core::OSmartPointer<Mail> mail= new Mail();
mail->setMail(fromBox->currentText());
mail->setTo( toLine->text() );
mail->setName(senderNameEdit->text());
mail->setCC( ccLine->text() );
mail->setBCC( bccLine->text() );
mail->setReply( replyLine->text() );
mail->setSubject( subjectLine->text() );
if (!m_replyid.isEmpty()) {
QStringList ids;
ids.append(m_replyid);
mail->setInreply(ids);
}
QString txt = message->text();
if ( !sigMultiLine->text().isEmpty() ) {
txt.append( "\n--\n" );
txt.append( sigMultiLine->text() );
}
mail->setMessage( txt );
@@ -299,50 +299,50 @@ void ComposeMail::accept()
txt.append( sigMultiLine->text() );
}
mail->setMessage( txt );
AttachViewItem *it = (AttachViewItem *) attList->firstChild();
while ( it != 0 ) {
mail->addAttachment( it->getAttachment() );
it = (AttachViewItem *) it->nextSibling();
}
SMTPwrapper wrapper( smtp );
if ( wrapper.sendMail( mail,checkBoxLater->isChecked() ) )
setStatus( tr ("Mail sent"));
else {
setStatus( tr ("Error: Something went wrong. Nothing sent"));
return;
}
QDialog::accept();
}
void ComposeMail::reject()
{
//qDebug("ComposeMail::reject() ");
- int yesno = QMessageBox::warning(0,tr("Stop editing message"),
- tr("Store message into drafts?"),
+ int yesno = QMessageBox::warning(0,tr("Store message?"),
+ tr("Store message into drafts?\n"),
tr("Yes"),
tr("No"));
//qDebug("button %d ", yesno);
if (yesno == 0) {
saveAsDraft();
}
if (yesno == 2) {
qDebug("return ");
return;
}
QDialog::reject();
}
ComposeMail::~ComposeMail()
{
}
void ComposeMail::reEditMail(const RecMailP&current)
{
RecMailP data = current;
message->setText(data->Wrapper()->fetchBody(current)->Bodytext());
subjectLine->setText( data->getSubject());
toLine->setText(data->To().join(","));
diff --git a/kmicromail/mailistviewitem.cpp b/kmicromail/mailistviewitem.cpp
index b9b4cd9..1ca0ada 100644
--- a/kmicromail/mailistviewitem.cpp
+++ b/kmicromail/mailistviewitem.cpp
@@ -1,115 +1,142 @@
#include "mailistviewitem.h"
#include <libmailwrapper/abstractmail.h>
#include <qtextstream.h>
#include <kiconloader.h>
//#include <qpe/resource.h>
MailListViewItem::MailListViewItem(QListView * parent, MailListViewItem * item )
:QListViewItem(parent,item),mail_data()
{
}
void MailListViewItem::showEntry()
{
if ( mail_data->getFlags().testBit( FLAG_ANSWERED ) == true) {
setPixmap( 0, SmallIcon ( "kmmsgreplied") );
} else if ( mail_data->getFlags().testBit( FLAG_SEEN ) == true ) {
/* I think it looks nicer if there are not such a log of icons but only on mails
replied or new - Alwin*/
//setPixmap( 0,SmallIcon ("kmmsgunseen") );
} else {
setPixmap( 0,SmallIcon ( "kmmsgnew") );
}
double s = mail_data->Msgsize();
- int w;
- w=0;
-
- while (s>1024) {
+ int w = 0;
s/=1024;
+ if (s>999.0) {
+ s/=1024.0;
++w;
- if (w>=2) break;
}
-
- QString q="";
- QString fsize="";
- switch(w) {
- case 1:
- q="k";
+ QString fsort;
+ fsort.sprintf( "%.2f", s );
+ QString fsize = QString::number( s, 'f', 2 );
+ // 1.23
+ // 11.23
+ // 111.23
+ // 999.23 maxlen
+ switch(fsize.length() ) {
+ case 4:
+ fsort = "00" + fsize ;
break;
- case 2:
- q="M";
+ case 5:
+ fsort = "0" + fsize ;
break;
default:
+ fsort = fsize ;
break;
- }
- {
- QTextOStream o(&fsize);
- if (w>0) o.precision(2); else o.precision(0);
- o.setf(QTextStream::fixed);
- o << s << " " << q << "Byte";
}
-
+ if ( w == 0 ) {
+ setText(3, fsize + "kB" );
+ mKeyMap.insert(3, "k" + fsort);
+ //setText(3, "kB" + fsort ); // test only
+ } else {
+ //setText(3, fsize + "MB");
+ mKeyMap.insert(4, "M" +fsort );
+ }
setText(1,mail_data->getSubject());
setText(2,mail_data->getFrom());
- setText(3,fsize);
+
QString date = mail_data->getDate();
int kom = date.find( ",")+2;
if ( kom == 1 )
kom = 0;
if ( date.mid(kom,1) == " ")
++kom;
if ( date.mid(kom+1,1) == " " )
date = "0" + date.mid( kom );
else if ( kom )
date = date.mid( kom );
if ( kom || date.mid(2,1 ) == " ") {
QString mon = date.mid(3,3);
QString so = 00;
if ( mon == "Jan" )
so = "01";
else if ( mon == "Feb" )
so = "02";
else if ( mon == "Mar" )
so = "03";
else if ( mon == "Apr" )
so = "04";
else if ( mon == "May" )
so = "05";
else if ( mon == "Jun" )
so = "06";
else if ( mon == "Jul" )
so = "07";
else if ( mon == "Aug" )
so = "08";
else if ( mon == "Sep" )
so = "09";
else if ( mon == "Oct" )
so = "10";
else if ( mon == "Nov" )
so = "11";
else if ( mon == "Dec" )
so = "12";
- date = date.mid(7,4)+"-"+so+"-"+date.left(2)+" "+date.mid(12,14);
+ date = date.mid(7,4)+so+date.left(2)+date.mid(12,14);
}
// if ( date.left(1) != "1" || date.left(1) != "2" )
// date = date.mid(5);
- setText(4,date);
+ mKeyMap.insert(4,date);
+ setText(4,mail_data->getDate());
}
void MailListViewItem::storeData(const RecMailP&data)
{
mail_data = data;
}
+void MailListViewItem::setSortKey(int column,const QString &key)
+{
+ mKeyMap.insert(column,key);
+}
+QString MailListViewItem::key(int column, bool) const
+{
+ // to make is fast, we use here special cases
+ if ( column == 3 || column == 4 ) {
+ return *mKeyMap.find(column);
+ }
+ if ( column == 1 ) {
+ if ( text(1).left(4).lower() == "re: " )
+ return text(1).mid(4);
+
+ }
+ return text(column);
+ /*
+ QMap<int,QString>::ConstIterator it = mKeyMap.find(column);
+ if (it == mKeyMap.end()) return text(column);
+ else return *it;
+ */
+}
const RecMailP& MailListViewItem::data()const
{
return mail_data;
}
MAILLIB::ATYPE MailListViewItem::wrapperType()
{
if (!mail_data->Wrapper()) return MAILLIB::A_UNDEFINED;
return mail_data->Wrapper()->getType();
}
diff --git a/kmicromail/mailistviewitem.h b/kmicromail/mailistviewitem.h
index d953d83..cf8040b 100644
--- a/kmicromail/mailistviewitem.h
+++ b/kmicromail/mailistviewitem.h
@@ -1,23 +1,26 @@
#ifndef __MAILLISTVIEWITEM_H
#define __MAILLISTVIEWITEM_H
#include <qlistview.h>
#include <libmailwrapper/mailtypes.h>
#include <libmailwrapper/maildefines.h>
class MailListViewItem:public QListViewItem
{
public:
MailListViewItem(QListView * parent, MailListViewItem * after );
virtual ~MailListViewItem(){}
void storeData(const RecMailP&data);
const RecMailP&data()const;
void showEntry();
MAILLIB::ATYPE wrapperType();
-
+ QString key(int column, bool) const;
+ void setSortKey(int column,const QString &key);
protected:
RecMailP mail_data;
+ private:
+ QMap<int,QString> mKeyMap;
};
#endif
diff --git a/kmicromail/mainwindow.cpp b/kmicromail/mainwindow.cpp
index 78377ea..ddc7b3e 100644
--- a/kmicromail/mainwindow.cpp
+++ b/kmicromail/mainwindow.cpp
@@ -74,62 +74,62 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags )
connect( deleteMails, SIGNAL( activated() ),
SLOT( slotDeleteMail() ) );
editSettings = new QAction( tr( "Edit settings" ), SmallIcon("SettingsIcon") ,
0, 0, this );
editSettings->addTo( settingsMenu );
connect( editSettings, SIGNAL( activated() ),
SLOT( slotEditSettings() ) );
editAccounts = new QAction( tr( "Configure accounts" ), SmallIcon("editaccounts") ,
0, 0, this );
editAccounts->addTo( settingsMenu );
//setCentralWidget( view );
QVBox* wrapperBox = new QVBox( this );
setCentralWidget( wrapperBox );
// QWidget *view = new QWidget( wrapperBox );
KDGanttMinimizeSplitter* split = new KDGanttMinimizeSplitter( Qt::Horizontal, wrapperBox);
split->setMinimizeDirection( KDGanttMinimizeSplitter::Left);
//layout = new QBoxLayout ( split, QBoxLayout::LeftToRight );
folderView = new AccountView( split );
folderView->header()->hide();
- folderView->setRootIsDecorated( true );
+ folderView->setRootIsDecorated( false );
folderView->addColumn( tr( "Mailbox" ) );
//layout->addWidget( folderView );
mailView = new QListView( split );
mailView->addColumn( tr( "" ) );
mailView->addColumn( tr( "Subject" ),QListView::Manual );
mailView->addColumn( tr( "Sender" ),QListView::Manual );
mailView->addColumn( tr( "Size" ),QListView::Manual);
- mailView->addColumn( tr( "Date" ));
+ mailView->addColumn( tr( "Date" ),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);
#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( composeMail, SIGNAL( activated() ), SLOT( slotComposeMail() ) );
connect( sendQueued, SIGNAL( activated() ), SLOT( slotSendQueued() ) );
// connect( searchMails, SIGNAL( activated() ), SLOT( slotSearchMails() ) );
connect( editAccounts, SIGNAL( activated() ), SLOT( slotEditAccounts() ) );
@@ -155,49 +155,49 @@ 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();
mailView->setColumnWidth( 0, 10 );
- mailView->setColumnWidth( 1, mailView->visibleWidth() - 130 );
+ mailView->setColumnWidth( 1, 80 );
mailView->setColumnWidth( 2, 80 );
mailView->setColumnWidth( 3, 50 );
mailView->setColumnWidth( 4, 50 );
}
void MainWindow::slotEditSettings()
{
}
void MainWindow::slotShowFolders( bool )
{
qDebug("not implemented: ");
}
void MainWindow::refreshMailView(const QValueList<RecMailP>&)
{
qDebug("not implemented: ");
}
void MainWindow::mailLeftClicked(QListViewItem * )
{
qDebug("not implemented: ");
}
diff --git a/kmicromail/opiemail.cpp b/kmicromail/opiemail.cpp
index b1992ec..bdbd93a 100644
--- a/kmicromail/opiemail.cpp
+++ b/kmicromail/opiemail.cpp
@@ -127,49 +127,49 @@ void OpieMail::slotwriteMail(const QString&name,const QString&email)
void OpieMail::slotComposeMail()
{
slotwriteMail2( QString () );
//slotwriteMail(0l,0l);
}
void OpieMail::slotSendQueued()
{
SMTPaccount *smtp = 0;
QList<Account> list = settings->getAccounts();
QList<SMTPaccount> smtpList;
smtpList.setAutoDelete(false);
Account *it;
for ( it = list.first(); it; it = list.next() )
{
if ( it->getType() == MAILLIB::A_SMTP )
{
smtp = static_cast<SMTPaccount *>(it);
smtpList.append(smtp);
}
}
if (smtpList.count()==0)
{
- QMessageBox::information(0,tr("Info"),tr("Define a smtp account first"));
+ QMessageBox::information(0,tr("Info"),tr("Define a smtp account first!\n"));
return;
}
if (smtpList.count()==1)
{
smtp = smtpList.at(0);
}
else
{
smtp = 0;
selectsmtp selsmtp;
selsmtp.setSelectionlist(&smtpList);
selsmtp.showMaximized();
if ( selsmtp.exec() == QDialog::Accepted )
{
smtp = selsmtp.selected_smtp();
}
}
if (smtp)
{
SMTPwrapper * wrap = new SMTPwrapper(smtp);
if ( wrap->flushOutbox() )
{
QMessageBox::information(0,tr("Info"),tr("Mail queue flushed"));
}