-rw-r--r-- | kaddressbook/kabcore.cpp | 2 | ||||
-rw-r--r-- | kaddressbook/views/cardview.cpp | 10 | ||||
-rw-r--r-- | kmicromail/koprefsdialog.cpp | 7 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/generatemail.cpp | 16 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/generatemail.h | 1 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/genericwrapper.cpp | 3 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/imapwrapper.cpp | 4 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/mailwrapper.h | 2 | ||||
-rw-r--r-- | kmicromail/mainwindow.cpp | 3 | ||||
-rw-r--r-- | microkde/kdecore/klocale.cpp | 27 | ||||
-rw-r--r-- | microkde/kidmanager.cpp | 2 | ||||
-rw-r--r-- | microkde/kresources/managerimpl.cpp | 4 |
12 files changed, 46 insertions, 35 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index d651224..c339244 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp @@ -2682,129 +2682,129 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo Addressee newAdd; addresseeRSync = newAdd; addresseeRSync.setFamilyName(mCurrentSyncName + i18n(" - sync addressee")); addresseeRSync.setUid("last-syncAddressee-"+mCurrentSyncName ); addresseeRSync.setRevision( mLastAddressbookSync ); addresseeRSync.setCategories( i18n("SyncAddressee") ); } } if ( addresseeLSync.revision() == mLastAddressbookSync ) { // qDebug("FULLDATE 2"); fullDateRange = true; } if ( ! fullDateRange ) { if ( addresseeLSync.revision() != addresseeRSync.revision() ) { // qDebug("set fulldate to true %s %s" ,addresseeLSync->dtStart().toString().latin1(), addresseeRSync->dtStart().toString().latin1() ); //qDebug("%d %d %d %d ", addresseeLSync->dtStart().time().second(), addresseeLSync->dtStart().time().msec() , addresseeRSync->dtStart().time().second(), addresseeRSync->dtStart().time().msec()); fullDateRange = true; //qDebug("FULLDATE 3 %s %s", addresseeLSync.revision().toString().latin1() , addresseeRSync.revision().toString().latin1() ); } } // fullDateRange = true; // debug only! if ( fullDateRange ) mLastAddressbookSync = QDateTime::currentDateTime().addDays( -100*365); else mLastAddressbookSync = addresseeLSync.revision(); // for resyncing if own file has changed // PENDING fixme later when implemented #if 0 if ( mCurrentSyncDevice == "deleteaftersync" ) { mLastAddressbookSync = loadedFileVersion; qDebug("setting mLastAddressbookSync "); } #endif //qDebug("*************************** "); // qDebug("mLastAddressbookSync %s ",mLastAddressbookSync.toString().latin1() ); QStringList er = remote->uidList(); Addressee inR ;//= er.first(); Addressee inL; syncManager->showProgressBar(0, i18n("Syncing - close to abort!"), er.count()); int modulo = (er.count()/10)+1; int incCounter = 0; while ( incCounter < er.count()) { if (syncManager->isProgressBarCanceled()) return false; if ( incCounter % modulo == 0 ) syncManager->showProgressBar(incCounter); uid = er[ incCounter ]; bool skipIncidence = false; if ( uid.left(19) == QString("last-syncAddressee-") ) skipIncidence = true; QString idS,OidS; qApp->processEvents(); if ( !skipIncidence ) { inL = local->findByUid( uid ); inR = remote->findByUid( uid ); //inL.setResource( 0 ); //inR.setResource( 0 ); if ( !inL.isEmpty() ) { // maybe conflict - same uid in both calendars if ( !inL.resource() || inL.resource()->includeInSync() ) { - if ( take = takeAddressee( &inL, &inR, mode, fullDateRange ) ) { + if ( (take = takeAddressee( &inL, &inR, mode, fullDateRange )) ) { //qDebug("take %d %s ", take, inL.summary().latin1()); if ( take == 3 ) return false; if ( take == 1 ) {// take local ********************** if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { inL.setCsum( mCurrentSyncDevice, inR.getCsum(mCurrentSyncDevice) ); inL.setID( mCurrentSyncDevice, inR.getID(mCurrentSyncDevice) ); local->insertAddressee( inL, false ); idS = inR.externalUID(); OidS = inR.originalExternalUID(); } else idS = inR.IDStr(); remote->removeAddressee( inR ); inR = inL; inR.setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { inR.setOriginalExternalUID( OidS ); inR.setExternalUID( idS ); if ( syncManager->syncWithDesktop() ) { inR.setIDStr("changed" ); } //inR.insertCustom( "KADDRESSBOOK", "X-KDESYNC","changed" ); } else { inR.setIDStr( idS ); } inR.setResource( 0 ); remote->insertAddressee( inR , false); ++changedRemote; } else { // take == 2 take remote ********************** if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { if ( inR.revision().date().year() < 2004 ) inR.setRevision( modifiedCalendar ); } idS = inL.IDStr(); local->removeAddressee( inL ); inL = inR; inL.setIDStr( idS ); if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { inL.setCsum( mCurrentSyncDevice, inR.getCsum(mCurrentSyncDevice) ); inL.setID( mCurrentSyncDevice, inR.getID(mCurrentSyncDevice) ); } inL.setResource( 0 ); local->insertAddressee( inL , false ); ++changedLocal; } } } } else { // no conflict ********** add or delete remote if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { QString des = addresseeLSync.note(); if ( des.find( inR.getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it inR.setTempSyncStat( SYNC_TEMPSTATE_DELETE ); remote->insertAddressee( inR, false ); ++deletedAddresseeR; } else { inR.setRevision( modifiedCalendar ); remote->insertAddressee( inR, false ); inL = inR; inL.setIDStr( ":" ); inL.setCsum( mCurrentSyncDevice, inR.getCsum(mCurrentSyncDevice) ); inL.setID( mCurrentSyncDevice, inR.getID(mCurrentSyncDevice) ); inL.setResource( 0 ); local->insertAddressee( inL , false); diff --git a/kaddressbook/views/cardview.cpp b/kaddressbook/views/cardview.cpp index da552c3..03df444 100644 --- a/kaddressbook/views/cardview.cpp +++ b/kaddressbook/views/cardview.cpp @@ -93,178 +93,178 @@ class CardViewItemList : public QPtrList<CardViewItem> return 0; } private: /*int find( const CardViewItem * ) { qDebug("DON'T USE CardViewItemList::find( item )! Use findRef( item )!"); }*/ }; ////////////////////////////////////// // CardViewSeparator class CardViewSeparator { friend class CardView; public: CardViewSeparator(CardView *view) : mView(view) { mRect = QRect(0, 0, view->separatorWidth(), 0); } ~CardViewSeparator() {} void paintSeparator(QPainter *p, QColorGroup &cg) { p->fillRect(0, 0, mRect.width(), mRect.height(), cg.brush(QColorGroup::Button)); } void repaintSeparator() { mView->repaintContents(mRect); } private: CardView *mView; QRect mRect; }; //END Helpers //BEGIN Private Data class CardViewPrivate { public: CardViewPrivate() : mSelectionMode( CardView::Multi ), mDrawCardBorder( true ), mDrawFieldLabels( true ), mDrawSeparators( true), mSepWidth( 2 ), mShowEmptyFields( false ), mLayoutDirty( true ), mLastClickOnItem( false ), mItemMargin( 0 ), mItemSpacing( 10 ), mItemWidth( 200 ), mMaxFieldLines( INT_MAX ), mCurrentItem( 0L ), mLastClickPos( QPoint(0, 0) ), + mResizeAnchor(0), mRubberBandAnchor( 0 ), - mCompText( QString::null ), - mResizeAnchor(0) + mCompText( QString::null ) {}; CardViewItemList mItemList; QPtrList<CardViewSeparator> mSeparatorList; QFontMetrics *mFm; QFontMetrics *mBFm; // bold font QFont mHeaderFont; // custom header font CardView::SelectionMode mSelectionMode; bool mDrawCardBorder; bool mDrawFieldLabels; bool mDrawSeparators; int mSepWidth; bool mShowEmptyFields; bool mLayoutDirty; bool mLastClickOnItem; uint mItemMargin; // internal margin in items uint mItemSpacing; // spacing between items, column seperators and border int mItemWidth; // width of all items uint mMaxFieldLines; // Max lines to dispaly pr field CardViewItem *mCurrentItem; QPoint mLastClickPos; QTimer *mTimer; // times out if mouse rests for more than 500 msecs CardViewTip *mTip; // passed to the item under a resting cursor to display full text bool mOnSeparator; // set/reset on mouse movement // for resizing by dragging the separators int mResizeAnchor; // uint, ulong? the mouse down separator left int mRubberBandAnchor; // for erasing rubber bands // data used for resizing. // as they are beeded by each mouse move while resizing, we store them here, // saving 8 calculations in each mouse move. int colspace; // amount of space between items pr column uint first; // the first col to anchor at for painting rubber bands int firstX; // X position of first in pixel int pressed; // the colummn that was pressed on at resizing start int span; // pressed - first // key completion QString mCompText; // current completion string QDateTime mCompUpdated; // ...was updated at this time }; class CardViewItemPrivate { public: CardViewItemPrivate() : - x( 0 ), - y( 0 ), - mSelected( false ){}; + mSelected( false ), + x( 0 ), + y( 0 ){}; QString mCaption; QPtrList< CardViewItem::Field > mFieldList; bool mSelected; int x; // horizontal position, set by the view int y; // vertical position, set by the view int maxLabelWidth; // the width of the widest label, according to the view font. int hcache; // height cache }; //END Private Data //BEGIN CardViewItem CardViewItem::CardViewItem(CardView *parent, QString caption) : d(new CardViewItemPrivate()), mView(parent) { d->mCaption = caption; initialize(); } CardViewItem::~CardViewItem() { // Remove ourself from the view if (mView != 0) mView->takeItem(this); delete d; d = 0; } void CardViewItem::initialize() { d->mSelected = false; d->mFieldList.setAutoDelete(true); d->maxLabelWidth = 0; d->hcache=0; //calcRect(); // Add ourself to the view if (mView != 0) mView->insertItem(this); } void CardViewItem::paintCard(QPainter *p, QColorGroup &cg) { if (!mView) return; QPen pen; QBrush brush; QFontMetrics fm = *(mView->d->mFm); QFontMetrics bFm = *(mView->d->mBFm); bool drawLabels = mView->d->mDrawFieldLabels; bool drawBorder = mView->d->mDrawCardBorder; int mg = mView->itemMargin(); int w = mView->itemWidth() - (mg*2); int h = height() - (mg*2); const int colonWidth( fm.width(":") ); int labelXPos = 2 + mg; int labelWidth = QMIN( w/2 - 4 - mg, d->maxLabelWidth + colonWidth + 4 ); diff --git a/kmicromail/koprefsdialog.cpp b/kmicromail/koprefsdialog.cpp index 4abf859..13d6681 100644 --- a/kmicromail/koprefsdialog.cpp +++ b/kmicromail/koprefsdialog.cpp @@ -86,187 +86,188 @@ KOPrefsDialog::KOPrefsDialog(QWidget *parent, char *name, bool modal) : 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); + /* 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); + //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(); + //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; ++iii; QLabel * lab; mUserDateFormatLong = new QLineEdit(topFrame); lab = new QLabel(mUserDateFormatLong, i18n("User long date:"), topFrame); topLayout->addWidget(lab ,iii,0); topLayout->addWidget(mUserDateFormatLong,iii,1); ++iii; mUserDateFormatShort = new QLineEdit(topFrame); lab = new QLabel(mUserDateFormatShort, i18n("User short date:"), topFrame); topLayout->addWidget(lab ,iii,0); topLayout->addWidget(mUserDateFormatShort,iii,1); ++iii; lab = new QLabel( i18n("Monday 19 April 2004: %A %d %B %Y"), topFrame); topLayout->addMultiCellWidget(lab ,iii,iii,0,1); ++iii; lab = new QLabel( i18n("Mon 19.04.04: %a %d.%m.%y"), topFrame); topLayout->addMultiCellWidget(lab ,iii,iii,0,1); ++iii; lab = new QLabel( i18n("Mon, 19.Apr.04: %a, %d.%b.%y"), topFrame); topLayout->addMultiCellWidget(lab ,iii,iii,0,1); ++iii; } void KOPrefsDialog::setupLocaleTab() { QFrame *topFrame = addPage(i18n("Locale"),0,0); QGridLayout *topLayout = new QGridLayout(topFrame,4,2); diff --git a/kmicromail/libmailwrapper/generatemail.cpp b/kmicromail/libmailwrapper/generatemail.cpp index 32311d7..2d213fe 100644 --- a/kmicromail/libmailwrapper/generatemail.cpp +++ b/kmicromail/libmailwrapper/generatemail.cpp @@ -1,79 +1,80 @@ #include "generatemail.h" #include "mailwrapper.h" #include <libetpan/libetpan.h> //#include <qt.h> #include <stdlib.h> #include <qfileinfo.h> using namespace Opie::Core; const char* Generatemail::USER_AGENT="KOpieMail 33 1/3"; Generatemail::Generatemail() { + mCharset = "iso-8859-1"; } Generatemail::~Generatemail() { } void Generatemail::addRcpts( clist *list, mailimf_address_list *addr_list ) { clistiter *it, *it2; for ( it = clist_begin( addr_list->ad_list ); it; it = it->next ) { mailimf_address *addr; addr = (mailimf_address *) it->data; if ( addr->ad_type == MAILIMF_ADDRESS_MAILBOX ) { esmtp_address_list_add( list, addr->ad_data.ad_mailbox->mb_addr_spec, 0, NULL ); } else if ( addr->ad_type == MAILIMF_ADDRESS_GROUP ) { clist *l = addr->ad_data.ad_group->grp_mb_list->mb_list; for ( it2 = clist_begin( l ); it2; it2 = it2->next ) { mailimf_mailbox *mbox; mbox = (mailimf_mailbox *) it2->data; esmtp_address_list_add( list, mbox->mb_addr_spec, 0, NULL ); } } } } char *Generatemail::getFrom( mailimf_field *ffrom) { char *from = NULL; if ( ffrom && (ffrom->fld_type == MAILIMF_FIELD_FROM) && ffrom->fld_data.fld_from->frm_mb_list && ffrom->fld_data.fld_from->frm_mb_list->mb_list ) { clist *cl = ffrom->fld_data.fld_from->frm_mb_list->mb_list; clistiter *it; for ( it = clist_begin( cl ); it; it = it->next ) { mailimf_mailbox *mb = (mailimf_mailbox *) it->data; from = strdup( mb->mb_addr_spec ); } } return from; } char *Generatemail::getFrom( mailmime *mail ) { /* no need to delete - its just a pointer to structure content */ mailimf_field *ffrom = 0; ffrom = getField( mail->mm_data.mm_message.mm_fields, MAILIMF_FIELD_FROM ); return getFrom(ffrom); } mailimf_field *Generatemail::getField( mailimf_fields *fields, int type ) { mailimf_field *field; clistiter *it; it = clist_begin( fields->fld_list ); while ( it ) { field = (mailimf_field *) it->data; if ( field->fld_type == type ) { return field; } it = it->next; } return NULL; } @@ -84,233 +85,236 @@ mailimf_address_list *Generatemail::parseAddresses(const QString&addr ) { return NULL; addresses = mailimf_address_list_new_empty(); bool literal_open = false; unsigned int startpos = 0; QStringList list; QString s; unsigned int i = 0; for (; i < addr.length();++i) { switch (addr[i]) { case '\"': literal_open = !literal_open; break; case ',': if (!literal_open) { s = addr.mid(startpos,i-startpos); if (!s.isEmpty()) { list.append(s); } // !!!! this is a MUST BE! startpos = ++i; } break; default: break; } } s = addr.mid(startpos,i-startpos); if (!s.isEmpty()) { list.append(s); } QStringList::Iterator it; for ( it = list.begin(); it != list.end(); it++ ) { int err = mailimf_address_list_add_parse( addresses, (char*)(*it).latin1() ); if ( err != MAILIMF_NO_ERROR ) { qDebug(" Error parsing"); // *it } else { } } return addresses; } mailmime *Generatemail::buildFilePart(const QString&filename,const QString&mimetype,const QString&TextContent ) { mailmime * filePart = 0; mailmime_fields * fields = 0; mailmime_content * content = 0; mailmime_parameter * param = 0; char*name = 0; char*file = 0; int err; int pos = filename.findRev( '/' ); if (filename.length()>0) { QString tmp = filename.right( filename.length() - ( pos + 1 ) ); name = strdup( tmp.latin1() ); // just filename file = strdup( filename.latin1() ); // full name with path } int disptype = MAILMIME_DISPOSITION_TYPE_ATTACHMENT; int mechanism = MAILMIME_MECHANISM_BASE64; if ( mimetype.startsWith( "text/" ) ) { param = mailmime_parameter_new( strdup( "charset" ), - strdup( "iso-8859-1" ) ); + strdup( mCharset.latin1() ) ); mechanism = MAILMIME_MECHANISM_QUOTED_PRINTABLE; } fields = mailmime_fields_new_filename( disptype, name, mechanism ); content = mailmime_content_new_with_str( (char*)mimetype.latin1() ); if (content!=0 && fields != 0) { if (param) { clist_append(content->ct_parameters,param); param = 0; } if (filename.length()>0) { QFileInfo f(filename); param = mailmime_parameter_new(strdup("name"),strdup(f.fileName().latin1())); clist_append(content->ct_parameters,param); param = 0; } filePart = mailmime_new_empty( content, fields ); } if (filePart) { if (filename.length()>0) { err = mailmime_set_body_file( filePart, file ); } else { - err = mailmime_set_body_text(filePart,strdup( TextContent.utf8()),TextContent.utf8().length()); + err = mailmime_set_body_text(filePart,strdup( TextContent.utf8().data()),TextContent.utf8().length()); + //err = mailmime_set_body_text(filePart,strdup( TextContent.latin1()),TextContent.length()); } if (err != MAILIMF_NO_ERROR) { qDebug("Error setting body with file "); mailmime_free( filePart ); filePart = 0; } } if (!filePart) { if ( param != NULL ) { mailmime_parameter_free( param ); } if (content) { mailmime_content_free( content ); } if (fields) { mailmime_fields_free( fields ); } else { if (name) { free( name ); } if (file) { free( file ); } } } return filePart; // Success :) } void Generatemail::addFileParts( mailmime *message,const QList<Attachment>&files ) { const Attachment *it; unsigned int count = files.count(); for ( unsigned int i = 0; i < count; ++i ) { mailmime *filePart; int err; it = ((QList<Attachment>)files).at(i); filePart = buildFilePart( it->getFileName(), it->getMimeType(),"" ); if ( filePart == NULL ) { continue; } err = mailmime_smart_add_part( message, filePart ); if ( err != MAILIMF_NO_ERROR ) { mailmime_free( filePart ); } } } mailmime *Generatemail::buildTxtPart(const QString&str ) { mailmime *txtPart; mailmime_fields *fields; mailmime_content *content; mailmime_parameter *param; int err; QCString __str; + //qDebug(" Generatemail::buildTxtPart %s", str.latin1()); param = mailmime_parameter_new( strdup( "charset" ), - strdup( "iso-8859-1" ) ); + strdup( mCharset.latin1() ) ); if ( param == NULL ) goto err_free; content = mailmime_content_new_with_str( "text/plain" ); if ( content == NULL ) goto err_free_param; err = clist_append( content->ct_parameters, param ); if ( err != MAILIMF_NO_ERROR ) goto err_free_content; fields = mailmime_fields_new_encoding(MAILMIME_MECHANISM_8BIT); if ( fields == NULL ) goto err_free_content; txtPart = mailmime_new_empty( content, fields ); if ( txtPart == NULL ) goto err_free_fields; { - __str = str.utf8(); - err = mailmime_set_body_text( txtPart, __str.data(), __str.length() ); + //__str = str.utf8(); + __str = QCString (str.latin1()); + err = mailmime_set_body_text( txtPart, strdup(__str.data()), __str.length() ); } if ( err != MAILIMF_NO_ERROR ) goto err_free_txtPart; return txtPart; // Success :) err_free_txtPart: mailmime_free( txtPart ); err_free_fields: mailmime_fields_free( fields ); err_free_content: mailmime_content_free( content ); err_free_param: mailmime_parameter_free( param ); err_free: ; return NULL; // Error :( } mailimf_mailbox *Generatemail::newMailbox(const QString&name, const QString&mail ) { return mailimf_mailbox_new( strdup( name.latin1() ), strdup( mail.latin1() ) ); } mailimf_fields *Generatemail::createImfFields(const Opie::Core::OSmartPointer<Mail>&mail ) { mailimf_fields *fields = NULL; mailimf_field *xmailer = NULL; mailimf_mailbox *sender=0,*fromBox=0; mailimf_mailbox_list *from=0; mailimf_address_list *to=0, *cc=0, *bcc=0, *reply=0; clist*in_reply_to = 0; char *subject = strdup( mail->getSubject().latin1() ); int err; int res = 1; sender = newMailbox( mail->getName(), mail->getMail() ); if ( sender == NULL ) { res = 0; } if (res) { fromBox = newMailbox( mail->getName(), mail->getMail() ); } if ( fromBox == NULL ) { res = 0; } if (res) { from = mailimf_mailbox_list_new_empty(); } if ( from == NULL ) { res = 0; } if (res && from) { err = mailimf_mailbox_list_add( from, fromBox ); if ( err != MAILIMF_NO_ERROR ) { res = 0; } } if (res) to = parseAddresses( mail->getTo() ); @@ -337,125 +341,127 @@ mailimf_fields *Generatemail::createImfFields(const Opie::Core::OSmartPointer<Ma nsize = strlen(h.latin1()); /* yes! must be malloc! */ c_reply = (char*)malloc( (nsize+1)*sizeof(char)); memset(c_reply,0,nsize+1); memcpy(c_reply,h.latin1(),nsize); clist_append(in_reply_to,c_reply); } } if (res) { fields = mailimf_fields_new_with_data( from, sender, reply, to, cc, bcc, in_reply_to, NULL, subject ); if ( fields == NULL ) { res = 0; } } if (res) xmailer = mailimf_field_new_custom( strdup( "User-Agent" ), strdup( USER_AGENT ) ); if ( xmailer == NULL ) { res = 0; } else { err = mailimf_fields_add( fields, xmailer ); if ( err != MAILIMF_NO_ERROR ) { res = 0; } } if (!res ) { if (xmailer) { mailimf_field_free( xmailer ); xmailer = NULL; } if (fields) { mailimf_fields_free( fields ); fields = NULL; } else { if (reply) mailimf_address_list_free( reply ); if (bcc) mailimf_address_list_free( bcc ); if (cc) mailimf_address_list_free( cc ); if (to) mailimf_address_list_free( to ); if (fromBox) { mailimf_mailbox_free( fromBox ); } else if (from) { mailimf_mailbox_list_free( from ); } if (sender) { mailimf_mailbox_free( sender ); } if (subject) { free( subject ); } } } return fields; } mailmime *Generatemail::createMimeMail(const Opie::Core::OSmartPointer<Mail> &mail ) { mailmime *message, *txtPart; mailimf_fields *fields; int err; + //LR disabled for now + //mCharset = mail->getCharset().lower(); fields = createImfFields( mail ); if ( fields == NULL ) goto err_free; message = mailmime_new_message_data( NULL ); if ( message == NULL ) goto err_free_fields; mailmime_set_imf_fields( message, fields ); txtPart = buildTxtPart( mail->getMessage() ); if ( txtPart == NULL ) goto err_free_message; err = mailmime_smart_add_part( message, txtPart ); if ( err != MAILIMF_NO_ERROR ) goto err_free_txtPart; addFileParts( message, mail->getAttachments() ); return message; // Success :) err_free_txtPart: mailmime_free( txtPart ); err_free_message: mailmime_free( message ); err_free_fields: mailimf_fields_free( fields ); err_free: ; return NULL; // Error :( } clist *Generatemail::createRcptList( mailimf_fields *fields ) { clist *rcptList; mailimf_field *field; rcptList = esmtp_address_list_new(); field = getField( fields, MAILIMF_FIELD_TO ); if ( field && (field->fld_type == MAILIMF_FIELD_TO) && field->fld_data.fld_to->to_addr_list ) { addRcpts( rcptList, field->fld_data.fld_to->to_addr_list ); } field = getField( fields, MAILIMF_FIELD_CC ); if ( field && (field->fld_type == MAILIMF_FIELD_CC) && field->fld_data.fld_cc->cc_addr_list ) { addRcpts( rcptList, field->fld_data.fld_cc->cc_addr_list ); } field = getField( fields, MAILIMF_FIELD_BCC ); if ( field && (field->fld_type == MAILIMF_FIELD_BCC) && field->fld_data.fld_bcc->bcc_addr_list ) { addRcpts( rcptList, field->fld_data.fld_bcc->bcc_addr_list ); } return rcptList; } diff --git a/kmicromail/libmailwrapper/generatemail.h b/kmicromail/libmailwrapper/generatemail.h index b9f8285..a9fb648 100644 --- a/kmicromail/libmailwrapper/generatemail.h +++ b/kmicromail/libmailwrapper/generatemail.h @@ -1,47 +1,48 @@ #ifndef __GENERATE_MAIL_H #define __GENERATE_MAIL_H //#include <qpe/applnk.h> #include <qobject.h> #include <libetpan/clist.h> #include "mailwrapper.h" #include <opie2/osmartpointer.h> class Mail; class RecMail; struct mailimf_fields; struct mailimf_field; struct mailimf_mailbox; struct mailmime; struct mailimf_address_list; class progressMailSend; struct mailsmtp; class Generatemail : public QObject { Q_OBJECT public: Generatemail(); virtual ~Generatemail(); protected: static void addRcpts( clist *list, mailimf_address_list *addr_list ); static char *getFrom( mailmime *mail ); static char *getFrom( mailimf_field *ffrom); static mailimf_field *getField( mailimf_fields *fields, int type ); mailimf_address_list *parseAddresses(const QString&addr ); void addFileParts( mailmime *message,const QList<Attachment>&files ); mailmime *buildFilePart(const QString&filename,const QString&mimetype,const QString&content); mailmime *buildTxtPart(const QString&str ); mailimf_mailbox *newMailbox(const QString&name,const QString&mail ); mailimf_fields *createImfFields(const Opie::Core::OSmartPointer<Mail> &mail ); mailmime *createMimeMail(const Opie::Core::OSmartPointer<Mail>&mail ); clist *createRcptList( mailimf_fields *fields ); static const char* USER_AGENT; + QString mCharset; }; #endif diff --git a/kmicromail/libmailwrapper/genericwrapper.cpp b/kmicromail/libmailwrapper/genericwrapper.cpp index 28d45ce..eac05e5 100644 --- a/kmicromail/libmailwrapper/genericwrapper.cpp +++ b/kmicromail/libmailwrapper/genericwrapper.cpp @@ -164,129 +164,130 @@ QString Genericwrapper::getencoding(mailmime_mechanism*aEnc) enc = "8bit"; break; case MAILMIME_MECHANISM_BINARY: enc = "binary"; break; case MAILMIME_MECHANISM_QUOTED_PRINTABLE: enc = "quoted-printable"; break; case MAILMIME_MECHANISM_BASE64: enc = "base64"; break; case MAILMIME_MECHANISM_TOKEN: default: if (aEnc->enc_token) { enc = QString(aEnc->enc_token); } break; } return enc; } void Genericwrapper::traverseBody(RecBodyP&target,mailmessage*message,mailmime*mime,QValueList<int>recList,unsigned int current_rec,int current_count) { if (current_rec >= 10) { ; // odebug << "too deep recursion!" << oendl; } if (!message || !mime) { return; } int r; char*data = 0; size_t len; clistiter * cur = 0; QString b; RecPartP part = new RecPart(); switch (mime->mm_type) { case MAILMIME_SINGLE: { QValueList<int>countlist = recList; countlist.append(current_count); r = mailmessage_fetch_section(message,mime,&data,&len); part->setSize(len); part->setPositionlist(countlist); b = gen_attachment_id(); part->setIdentifier(b); fillSingleBody(part,message,mime); if (part->Type()=="text" && target->Bodytext().isNull()) { encodedString*rs = new encodedString(); rs->setContent(data,len); encodedString*res = decode_String(rs,part->Encoding()); if (countlist.count()>2) { bodyCache[b]=rs; target->addPart(part); } else { delete rs; } b = QString(res->Content()); delete res; size_t index = 0; char*resu = 0; int err = MAILIMF_NO_ERROR; QString charset = part->searchParamter( "charset"); qDebug("CHARSET %s ",charset.latin1() ); - if ( !charset.isEmpty() ) { + if (false ) { + //if ( !charset.isEmpty() ) { target->setCharset( charset ); err = mailmime_encoded_phrase_parse(charset.latin1(), b.latin1(), b.length(),&index, "utf-8",&resu); if (err == MAILIMF_NO_ERROR && resu && strlen(resu)) { //qDebug("res %d %s ", index, resu); b = QString::fromUtf8(resu); } if (resu) free(resu); } target->setBodytext(b); target->setDescription(part); } else { bodyCache[b]=new encodedString(data,len); target->addPart(part); } } break; case MAILMIME_MULTIPLE: { unsigned int ccount = 1; mailmime*cbody=0; QValueList<int>countlist = recList; for (cur = clist_begin(mime->mm_data.mm_multipart.mm_mp_list) ; cur != NULL ; cur = clist_next(cur)) { cbody = (mailmime*)clist_content(cur); if (cbody->mm_type==MAILMIME_MULTIPLE) { RecPartP targetPart = new RecPart(); targetPart->setType("multipart"); countlist.append(current_count); targetPart->setPositionlist(countlist); target->addPart(targetPart); } traverseBody(target,message, cbody,countlist,current_rec+1,ccount); if (cbody->mm_type==MAILMIME_MULTIPLE) { countlist = recList; } ++ccount; } } break; case MAILMIME_MESSAGE: { QValueList<int>countlist = recList; countlist.append(current_count); /* the own header is always at recursion 0 - we don't need that */ if (current_rec > 0) { part->setPositionlist(countlist); r = mailmessage_fetch_section(message,mime,&data,&len); part->setSize(len); part->setPositionlist(countlist); b = gen_attachment_id(); part->setIdentifier(b); part->setType("message"); part->setSubtype("rfc822"); bodyCache[b]=new encodedString(data,len); target->addPart(part); } if (mime->mm_data.mm_message.mm_msg_mime != NULL) { traverseBody(target,message,mime->mm_data.mm_message.mm_msg_mime,countlist,current_rec+1); } } break; } } diff --git a/kmicromail/libmailwrapper/imapwrapper.cpp b/kmicromail/libmailwrapper/imapwrapper.cpp index 2a54381..da7065f 100644 --- a/kmicromail/libmailwrapper/imapwrapper.cpp +++ b/kmicromail/libmailwrapper/imapwrapper.cpp @@ -698,130 +698,130 @@ encodedString*IMAPwrapper::fetchRawPart(const RecMailP&mail,const QValueList<int clist*result = 0; err = mailimap_fetch( m_imap, set, fetchType, &result ); mailimap_set_free( set ); mailimap_fetch_type_free( fetchType ); if (err == MAILIMAP_NO_ERROR && (current=clist_begin(result)) ) { mailimap_msg_att * msg_att; msg_att = (mailimap_msg_att*)current->data; mailimap_msg_att_item*msg_att_item; for(cur = clist_begin(msg_att->att_list) ; cur != NULL ; cur = clist_next(cur)) { msg_att_item = (mailimap_msg_att_item*)clist_content(cur); if (msg_att_item->att_type == MAILIMAP_MSG_ATT_ITEM_STATIC) { if (msg_att_item->att_data.att_static->att_type == MAILIMAP_MSG_ATT_BODY_SECTION) { char*text = msg_att_item->att_data.att_static->att_data.att_body_section->sec_body_part; /* detach - we take over the content */ msg_att_item->att_data.att_static->att_data.att_body_section->sec_body_part = 0L; res->setContent(text,msg_att_item->att_data.att_static->att_data.att_body_section->sec_length); } } } } else { ;//odebug << "error fetching text: " << m_imap->imap_response << "" << oendl; } if (result) mailimap_fetch_list_free(result); return res; } /* current_recursion is for recursive calls. current_count means the position inside the internal loop! */ void IMAPwrapper::traverseBody(const RecMailP&mail,mailimap_body*body,RecBodyP&target_body, int current_recursion,QValueList<int>recList,int current_count) { if (!body || current_recursion>=10) { return; } switch (body->bd_type) { case MAILIMAP_BODY_1PART: { QValueList<int>countlist = recList; countlist.append(current_count); RecPartP currentPart = new RecPart(); mailimap_body_type_1part*part1 = body->bd_data.bd_body_1part; QString id(""); currentPart->setPositionlist(countlist); for (unsigned int j = 0; j < countlist.count();++j) { id+=(j>0?" ":""); id+=QString("%1").arg(countlist[j]); } //odebug << "ID = " << id.latin1() << "" << oendl; currentPart->setIdentifier(id); fillSinglePart(currentPart,part1); /* important: Check for is NULL 'cause a body can be empty! And we put it only into the mail if it is the FIRST part */ if (part1->bd_type==MAILIMAP_BODY_TYPE_1PART_TEXT && target_body->Bodytext().isNull() && countlist[0]==1) { QString body_text = fetchTextPart(mail,countlist,true,currentPart->Encoding()); size_t index = 0; char*res = 0; int err = MAILIMF_NO_ERROR; QString charset = currentPart->searchParamter( "charset"); qDebug("CHARSET %s ",charset.latin1() ); - //if ( false ) { - if ( !charset.isEmpty() ) { + if ( false ) { + //if ( !charset.isEmpty() ) { target_body->setCharset( charset ); //err = mailmime_encoded_phrase_parse("iso-8859-1", // text, strlen(text),&index, "iso-8859-1",&res); err = mailmime_encoded_phrase_parse(charset.latin1(), body_text.latin1(), body_text.length(),&index, "utf-8",&res); if (err == MAILIMF_NO_ERROR && res && strlen(res)) { //qDebug("res %d %s ", index, res); body_text = QString::fromUtf8(res); } if (res) free(res); } //qDebug("encoding %d text %s ",currentPart->Encoding().latin1(), body_text.latin1() ); target_body->setDescription(currentPart); target_body->setBodytext(body_text); if (countlist.count()>1) { target_body->addPart(currentPart); } } else { target_body->addPart(currentPart); } if (part1->bd_type==MAILIMAP_BODY_TYPE_1PART_MSG) { traverseBody(mail,part1->bd_data.bd_type_msg->bd_body,target_body,current_recursion+1,countlist); } } break; case MAILIMAP_BODY_MPART: { QValueList<int>countlist = recList; clistcell*current=0; mailimap_body*current_body=0; unsigned int ccount = 1; mailimap_body_type_mpart*mailDescription = body->bd_data.bd_body_mpart; for (current=clist_begin(mailDescription->bd_list);current!=0;current=clist_next(current)) { current_body = (mailimap_body*)current->data; if (current_body->bd_type==MAILIMAP_BODY_MPART) { RecPartP targetPart = new RecPart(); targetPart->setType("multipart"); fillMultiPart(targetPart,mailDescription); countlist.append(current_count); targetPart->setPositionlist(countlist); target_body->addPart(targetPart); QString id(""); for (unsigned int j = 0; j < countlist.count();++j) { id+=(j>0?" ":""); id+=QString("%1").arg(countlist[j]); } // odebug << "ID(mpart) = " << id.latin1() << "" << oendl; } traverseBody(mail,current_body,target_body,current_recursion+1,countlist,ccount); if (current_body->bd_type==MAILIMAP_BODY_MPART) { countlist = recList; } ++ccount; } } break; default: break; } } void IMAPwrapper::fillSinglePart(RecPartP&target_part,mailimap_body_type_1part*Description) { if (!Description) { diff --git a/kmicromail/libmailwrapper/mailwrapper.h b/kmicromail/libmailwrapper/mailwrapper.h index ea6bf36..3e8b51f 100644 --- a/kmicromail/libmailwrapper/mailwrapper.h +++ b/kmicromail/libmailwrapper/mailwrapper.h @@ -22,110 +22,110 @@ public: 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;} void setCharset( const QString&a ) { charset= a; } - const QString& getCharset() { return charset; } + const QString& getCharset() const { return charset; } private: QList<Attachment> attList; QString name, mail, to, cc, bcc, reply, subject, message, charset; 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;} static QString decodeFolderName( const QString &name ); private: bool m_MaySelect,m_NoInferior; }; #endif diff --git a/kmicromail/mainwindow.cpp b/kmicromail/mainwindow.cpp index 3013931..8c0a4cb 100644 --- a/kmicromail/mainwindow.cpp +++ b/kmicromail/mainwindow.cpp @@ -46,129 +46,130 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) 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->addTo( mailMenu ); */ deleteMails = new QAction(i18n("Delete Mail"), SmallIcon("trash"), 0, 0, this); deleteMails->addTo( toolBar ); deleteMails->addTo( mailMenu ); connect( deleteMails, SIGNAL( activated() ), SLOT( slotDeleteMail() ) ); 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); - settingsMenu->insertItem( i18n("Codec for new mails"), codecMenu); + //disabled + //settingsMenu->insertItem( i18n("Codec for new mails"), codecMenu); //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( 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); 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() ) ); //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 ); diff --git a/microkde/kdecore/klocale.cpp b/microkde/kdecore/klocale.cpp index 1da1e99..d7e384c 100644 --- a/microkde/kdecore/klocale.cpp +++ b/microkde/kdecore/klocale.cpp @@ -807,145 +807,146 @@ QString KLocale::monthName(int i,bool shortName) const case 1: return i18n("January"); case 2: return i18n("February"); case 3: return i18n("March"); case 4: return i18n("April"); case 5: return i18n("May long", "May"); case 6: return i18n("June"); case 7: return i18n("July"); case 8: return i18n("August"); case 9: return i18n("September"); case 10: return i18n("October"); case 11: return i18n("November"); case 12: return i18n("December"); } return QString::null; } QString KLocale::country() const { return QString::null; } QString KLocale::dateFormat(IntDateFormat intIntDateFormat) const { const IntDateFormat dformat = (intIntDateFormat == Undefined)?mIntDateFormat:intIntDateFormat; if ( dformat == ISODate ) return "%Y-%m-%d"; if ( QApplication::desktop()->width() < 480 ) { if ( dformat == Default ) return "%a %d %b %Y"; else if ( dformat == Format1 ) return "%a %b %d %Y"; } else { if ( dformat == Default ) return "%A %d %B %Y"; else if ( dformat == Format1 ) return "%A %B %d %Y"; } return mDateFormat ; } QString KLocale::dateFormatShort(IntDateFormat intIntDateFormat) const { const IntDateFormat dformat = (intIntDateFormat == Undefined)?mIntDateFormat:intIntDateFormat; if ( dformat == Default ) return "%d.%m.%Y"; else if ( dformat == Format1 ) return "%m.%d.%Y"; else if ( dformat == ISODate ) // = Qt::ISODate return "%Y-%m-%d"; return mDateFormatShort ; } QString KLocale::timeFormat(IntDateFormat intIntTimeFormat) const { const IntDateFormat tformat = (intIntTimeFormat == Undefined)?mIntTimeFormat:intIntTimeFormat; if ( tformat == Default ) - if ( mHourF24Format) - return "%H:%M:%S"; - else - return "%I:%M:%S%p"; + if ( mHourF24Format) + return "%H:%M:%S"; + else + return "%I:%M:%S%p"; else if ( tformat == Format1 ) - if ( mHourF24Format) - return "%H:%M:%S"; - else - return "%I:%M:%S%p"; + if ( mHourF24Format) + return "%H:%M:%S"; + else + return "%I:%M:%S%p"; else if ( tformat == ISODate ) // = Qt::ISODate - if ( mHourF24Format) - return "%H:%M:%S"; - else - return "%I:%M:%S%p"; - + if ( mHourF24Format) + return "%H:%M:%S"; + else + return "%I:%M:%S%p"; + // to satisfy the compiler + return "%H:%M:%S"; } void KLocale::insertCatalogue ( const QString & ) { } KCalendarSystem *KLocale::calendar() { if ( !mCalendarSystem ) { mCalendarSystem = new KCalendarSystemGregorian; } return mCalendarSystem; } int KLocale::timezoneOffset( QString timeZone ) { int ret = 1001; int index = mTimeZoneList.findIndex( timeZone ); if ( index < 24 ) ret = ( index-11 ) * 60 ; return ret; } QStringList KLocale::timeZoneList() const { return mTimeZoneList; } void KLocale::setTimezone( const QString &timeZone, bool oddTZ ) { mTimeZoneOffset = timezoneOffset( timeZone ); if ( oddTZ ) mTimeZoneOffset += 30; } void KLocale::setDaylightSaving( bool b, int start , int end ) { daylightEnabled = b; daylightStart = start; daylightEnd = end; mSouthDaylight = (end < start); // qDebug("klocale daylight %d %d %d ", b, start , end ); } int KLocale::localTimeOffset( const QDateTime &dt ) { bool addDaylight = false; if ( daylightEnabled ) { int d_end, d_start; int dayofyear = dt.date().dayOfYear(); int year = dt.date().year(); int add = 0; if ( QDate::leapYear(year) ) add = 1; QDate date ( year,1,1 ); if ( daylightEnd > 59 ) d_end = daylightEnd +add; else d_end = daylightEnd; if ( daylightStart > 59 ) d_start = daylightStart +add; else d_start = daylightStart; QDate s_date = date.addDays( d_start -1 ); diff --git a/microkde/kidmanager.cpp b/microkde/kidmanager.cpp index 8cf486a..e687e5d 100644 --- a/microkde/kidmanager.cpp +++ b/microkde/kidmanager.cpp @@ -60,77 +60,77 @@ QString KIdManager::removeId (const QString& idString,const QString& prof ) } else { newIDString = idString; } //qDebug("removeID:profile:%s*retval:%s*oldidstring:%s* ", prof.latin1(), newIDString.latin1() ,idString.latin1() ); return newIDString; } QString KIdManager::setCsum (const QString& idString,const QString& prof,const QString& idCsum ) { int startProf; int startIDnum; int startIDnumlen; int startID; int lenID; int startCsum; int lenCsum; int endall; QString newIDString; if ( KIdManager::getNumbers (idString, prof, startProf, startIDnum, startIDnumlen,startID, lenID, startCsum, lenCsum, endall) ) { newIDString = idString.left(startCsum) + idCsum+ idString.mid( endall +1); } else { newIDString = idString + prof + ";3;_u_;"+ idCsum + ":"; } //qDebug("setCsum:profile:%s*retval:%s*idCsum:%s* ", prof.latin1(), newIDString.latin1() ,idCsum.latin1() ); return newIDString; } QString KIdManager::getCsum (const QString& idString,const QString& prof ) { int startProf; int startIDnum; int startIDnumlen; int startID; int lenID; int startCsum; int lenCsum; int endall; QString idval = ""; if ( KIdManager::getNumbers (idString, prof, startProf, startIDnum, startIDnumlen,startID, lenID, startCsum, lenCsum, endall) ) idval = idString.mid( startCsum, lenCsum ); //qDebug("getCsum:profile:%s*retval:%s*idstring:%s* ", prof.latin1(), idval.latin1() ,idString.latin1() ); return idval; } // :profilename;12;id_withLen12;123456: bool KIdManager::getNumbers (const QString& idString,const QString& prof, int &startProf, int &startIDnum, int &startIDnumlen,int &startID, int& lenID, int &startCsum, int &lenCsum, int & endall) { startProf = idString.find( ":"+prof+";" ); if ( startProf >= 0 ) { startIDnum = prof.length()+2+startProf; startID = idString.find( ";", startIDnum ) +1; startIDnumlen = startID - startIDnum - 1; if ( startIDnum > 0 ) { bool ok; lenID = idString.mid ( startIDnum,startIDnumlen).toInt( &ok ); if (ok) { startCsum = startID+lenID+1; endall = idString.find( ":", startCsum )-1; if ( endall < 0 ) { qDebug("Error getNumbers: andall not found "); return false; } lenCsum = endall-startCsum+1; } else { - qDebug("Error getNumbers:length is no number:*%s* ", idString.mid ( startIDnum,startIDnumlen).toInt( &ok )); + qDebug("Error getNumbers:length is no number:*%s* ", idString.mid ( startIDnum,startIDnumlen).latin1()); return false; } } else { qDebug("Error in KIdManager::getNumbers.startIDnum <= 0"); return false; } } else { //qDebug("getnumbers: profile not found *%s* ",prof.latin1() ); return false; } return true; } diff --git a/microkde/kresources/managerimpl.cpp b/microkde/kresources/managerimpl.cpp index 5bd9eb7..566b8f4 100644 --- a/microkde/kresources/managerimpl.cpp +++ b/microkde/kresources/managerimpl.cpp @@ -96,141 +96,141 @@ void ManagerImpl::readConfig( KConfig *cfg ) mStandard = 0; mConfig->setGroup( "General" ); QStringList keys = mConfig->readListEntry( "ResourceKeys" ); keys += mConfig->readListEntry( "PassiveResourceKeys" ); QString standardKey = mConfig->readEntry( "Standard" ); for ( QStringList::Iterator it = keys.begin(); it != keys.end(); ++it ) { readResourceConfig( *it, false ); } } void ManagerImpl::writeConfig( KConfig *cfg ) { //USqDebug("ManagerImpl::writeConfig begin this= %ul cfg=%ul", this, cfg); kdDebug(5650) << "ManagerImpl::writeConfig()" << endl; if ( !cfg ) { createStandardConfig(); } else { mConfig = cfg; } QStringList activeKeys; QStringList passiveKeys; // First write all keys, collect active and passive keys on the way Resource::List::Iterator it; for ( it = mResources.begin(); it != mResources.end(); ++it ) { writeResourceConfig( *it, false ); QString key = (*it)->identifier(); if( (*it)->isActive() ) activeKeys.append( key ); else passiveKeys.append( key ); } // And then the general group kdDebug(5650) << "Saving general info" << endl; mConfig->setGroup( "General" ); mConfig->writeEntry( "ResourceKeys", activeKeys ); mConfig->writeEntry( "PassiveResourceKeys", passiveKeys ); if ( mStandard ) mConfig->writeEntry( "Standard", mStandard->identifier() ); else mConfig->writeEntry( "Standard", "" ); mConfig->sync(); kdDebug(5650) << "ManagerImpl::save() finished" << endl; //US qDebug("ManagerImpl::writeConfig end this= %ul cfg=%ul", this, cfg); } void ManagerImpl::add( Resource *resource, bool useDCOP ) { -qDebug("ManagerImpl::add begin this= %ul resource=%ul", this, resource); + //qDebug("ManagerImpl::add begin this= %ul resource=%ul", this, resource); resource->setActive( true ); if ( mResources.isEmpty() ) { mStandard = resource; } mResources.append( resource ); writeResourceConfig( resource, true ); - qDebug("ManagerImpl::add end this= %ul resource=%ul", this, resource); + //qDebug("ManagerImpl::add end this= %ul resource=%ul", this, resource); } void ManagerImpl::remove( Resource *resource, bool useDCOP ) { if ( mStandard == resource ) mStandard = 0; removeResource( resource ); mResources.remove( resource ); delete resource; kdDebug(5650) << "Finished ManagerImpl::remove()" << endl; } void ManagerImpl::setActive( Resource *resource, bool active ) { if ( resource && resource->isActive() != active ) { resource->setActive( active ); } } Resource *ManagerImpl::standardResource() { return mStandard; } void ManagerImpl::setStandardResource( Resource *resource ) { mStandard = resource; } void ManagerImpl::resourceChanged( Resource *resource ) { writeResourceConfig( resource, true ); // ManagerIface_stub allManagers( "*", "ManagerIface_" + mFamily.utf8() ); // allManagers.dcopResourceModified( resource->identifier() ); } // DCOP asynchronous functions //US since we work from inside the application, we call the methods directly. QStringList ManagerImpl::resourceNames() { QStringList result; Resource::List::ConstIterator it; for ( it = mResources.begin(); it != mResources.end(); ++it ) { result.append( (*it)->resourceName() ); } return result; } Resource::List *ManagerImpl::resourceList() { return &mResources; } QPtrList<Resource> ManagerImpl::resources() { QPtrList<Resource> result; |