From b363d2579af0a11b77e698aed2e1021c2233b644 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Sat, 26 Jan 2013 13:17:50 -0600 Subject: Rename a number of libraries and executables to avoid conflicts with KDE4 --- kmail/CMakeLists.txt | 6 +- kmail/Mainpage.dox | 2 +- kmail/Makefile.am | 4 +- kmail/encodingdetector.cpp | 2 +- kmail/encodingdetector_ja_p.h | 6 +- kmail/headerstyle.cpp | 2 +- kmail/khtmlparthtmlwriter.cpp | 154 ------------------------------------- kmail/khtmlparthtmlwriter.h | 84 -------------------- kmail/kmail_part.cpp | 4 +- kmail/kmail_part.h | 10 +-- kmail/kmcommands.cpp | 4 +- kmail/kmcomposewin.cpp | 4 +- kmail/kmdict.cpp | 117 ---------------------------- kmail/kmdict.h | 68 ---------------- kmail/kmedit.cpp | 4 +- kmail/kmedit.h | 2 +- kmail/kmheaders.cpp | 2 +- kmail/kmkernel.cpp | 2 +- kmail/kmkernel.h | 2 +- kmail/kmmessage.cpp | 2 +- kmail/kmmsgdict.cpp | 2 +- kmail/kmreaderwin.cpp | 8 +- kmail/kmtransport.cpp | 4 +- kmail/networkaccount.cpp | 2 +- kmail/objecttreeparser.cpp | 2 +- kmail/regexplineedit.cpp | 2 +- kmail/searchwindow.cpp | 2 +- kmail/snippetwidget.h | 4 +- kmail/tdehtmlparthtmlwriter.cpp | 154 +++++++++++++++++++++++++++++++++++++ kmail/tdehtmlparthtmlwriter.h | 84 ++++++++++++++++++++ kmail/tdemdict.cpp | 117 ++++++++++++++++++++++++++++ kmail/tdemdict.h | 68 ++++++++++++++++ kmail/tests/Makefile.am | 24 +++--- kmail/tests/messagedicttests.cpp | 6 +- kmail/tests/messagedicttests.h | 2 +- kmail/tests/mimelibtests.cpp | 8 +- kmail/tests/mimelibtests.h | 2 +- kmail/tests/storagelayermodule.cpp | 6 +- kmail/tests/utiltests.cpp | 6 +- kmail/tests/utiltests.h | 2 +- kmail/urlhandlermanager.cpp | 4 +- 41 files changed, 495 insertions(+), 495 deletions(-) delete mode 100644 kmail/khtmlparthtmlwriter.cpp delete mode 100644 kmail/khtmlparthtmlwriter.h delete mode 100644 kmail/kmdict.cpp delete mode 100644 kmail/kmdict.h create mode 100644 kmail/tdehtmlparthtmlwriter.cpp create mode 100644 kmail/tdehtmlparthtmlwriter.h create mode 100644 kmail/tdemdict.cpp create mode 100644 kmail/tdemdict.h (limited to 'kmail') diff --git a/kmail/CMakeLists.txt b/kmail/CMakeLists.txt index 7e1ac19e..ebd61ef8 100644 --- a/kmail/CMakeLists.txt +++ b/kmail/CMakeLists.txt @@ -140,7 +140,7 @@ set( ${target}_SRCS kmcomposewin.cpp kmfolder.cpp kmmsgpartdlg.cpp kmreaderwin.cpp htmlstatusbar.cpp kmgroupware.cpp folderstorage.cpp listjob.cpp csshelper.cpp klistboxdialog.cpp kmmsginfo.cpp actionscheduler.cpp messageproperty.cpp accountmanager.cpp kmacctfolder.cpp - kmdict.cpp kmsystemtray.cpp kmacctlocal.cpp kmfolderdir.cpp kmfoldermgr.cpp + tdemdict.cpp kmsystemtray.cpp kmacctlocal.cpp kmfolderdir.cpp kmfoldermgr.cpp kmfoldernode.cpp kmsender.cpp kmacctseldlg.cpp kmfiltermgr.cpp kmfilterdlg.cpp filterimporterexporter.cpp kmsearchpatternedit.cpp encodingdetector.cpp encodingdetector_ja.cpp kmfilteraction.cpp kmsearchpattern.cpp kmfolderimap.cpp kmfolderseldlg.cpp kmfilter.cpp @@ -151,7 +151,7 @@ set( ${target}_SRCS kmkernel.cpp accountdialog.cpp searchwindow.cpp vcardviewer.cpp vacationdialog.cpp vacation.cpp sievedebugdialog.cpp sieveconfig.cpp sievejob.cpp kmpopheaders.cpp kmpopfiltercnfrmdlg.cpp kmmimeparttree.cpp mailinglist-magic.cpp kmacctmaildir.cpp - headerstyle.cpp headerstrategy.cpp khtmlparthtmlwriter.cpp filehtmlwriter.cpp + headerstyle.cpp headerstrategy.cpp tdehtmlparthtmlwriter.cpp filehtmlwriter.cpp teehtmlwriter.cpp mailcomposerIface.skel objecttreeparser.cpp objecttreeparser_p.cpp attachmentcollector.cpp bodypartformatterfactory.cpp bodypartformatter.cpp partNode.cpp mailsourceviewer.cpp kmcommands.cpp kmreadermainwin.cpp kmstartup.cpp kmmainwidget.cpp @@ -191,7 +191,7 @@ tde_add_library( ${target} SHARED AUTOMOC SOURCES ${${target}_SRCS} LINK emailfunctions-static kmime-shared kpgp-shared tdepim-shared kpimidentities-shared - mimelib-shared ksieve-shared khtml-shared ${INDEX_LIBRARY} + mimelib-shared ksieve-shared tdehtml-shared ${INDEX_LIBRARY} DESTINATION ${LIB_INSTALL_DIR} ) diff --git a/kmail/Mainpage.dox b/kmail/Mainpage.dox index 927acc7e..42201dad 100644 --- a/kmail/Mainpage.dox +++ b/kmail/Mainpage.dox @@ -42,7 +42,7 @@ access to all the core KMail functionality. FIXME this has moved to libkpimidentities, right? -Files: identity*, kmidentity.{h,cpp}, configuredialog.cpp, +Files: identity*, tdemidentity.{h,cpp}, configuredialog.cpp, signatureconfigurator.{h,cpp} Contact Marc Mutz on questions... diff --git a/kmail/Makefile.am b/kmail/Makefile.am index 9dd1dc0d..6fcc46de 100644 --- a/kmail/Makefile.am +++ b/kmail/Makefile.am @@ -65,7 +65,7 @@ libkmailprivate_la_SOURCES = kmmessage.cpp kmmainwin.cpp configuredialog.cpp \ csshelper.cpp klistboxdialog.cpp \ actionscheduler.cpp messageproperty.cpp \ kmmsgpart.cpp kmmsginfo.cpp \ - accountmanager.cpp kmacctfolder.cpp kmdict.cpp \ + accountmanager.cpp kmacctfolder.cpp tdemdict.cpp \ kmsystemtray.cpp kmacctlocal.cpp kmfolderdir.cpp \ kmfoldermgr.cpp kmfoldernode.cpp kmsender.cpp \ kmacctseldlg.cpp kmfiltermgr.cpp kmsearchpatternedit.cpp \ @@ -88,7 +88,7 @@ libkmailprivate_la_SOURCES = kmmessage.cpp kmmainwin.cpp configuredialog.cpp \ kmmimeparttree.cpp \ mailinglist-magic.cpp kmacctmaildir.cpp \ attachmentstrategy.cpp \ - headerstrategy.cpp headerstyle.cpp khtmlparthtmlwriter.cpp \ + headerstrategy.cpp headerstyle.cpp tdehtmlparthtmlwriter.cpp \ filehtmlwriter.cpp teehtmlwriter.cpp \ mailcomposerIface.skel objecttreeparser.cpp \ objecttreeparser_p.cpp \ diff --git a/kmail/encodingdetector.cpp b/kmail/encodingdetector.cpp index d5ffd5dc..01a60d88 100644 --- a/kmail/encodingdetector.cpp +++ b/kmail/encodingdetector.cpp @@ -1135,7 +1135,7 @@ bool EncodingDetector::analyze(const char *data, int len) case EncodingDetector::WesternEuropean: if (setEncoding(automaticDetectionForWesternEuropean( (const unsigned char*) data, len ), AutoDetectedEncoding)) return true; - else if (d->m_defaultCodec->mibEnum()==MibLatin1) //detection for khtml + else if (d->m_defaultCodec->mibEnum()==MibLatin1) //detection for tdehtml { return setEncoding("iso-8859-15",AutoDetectedEncoding); } diff --git a/kmail/encodingdetector_ja_p.h b/kmail/encodingdetector_ja_p.h index dac255d5..26eaa523 100644 --- a/kmail/encodingdetector_ja_p.h +++ b/kmail/encodingdetector_ja_p.h @@ -42,7 +42,7 @@ #ifdef TQ_WS_WIN #undef UNICODE #endif -namespace khtml { +namespace tdehtml { class guess_arc { public: unsigned int next; /* next state */ @@ -50,7 +50,7 @@ namespace khtml { }; } -using namespace khtml; +using namespace tdehtml; typedef signed char dfa_table[256]; @@ -62,7 +62,7 @@ extern guess_arc guess_sjis_ar[6]; extern const dfa_table guess_utf8_st[]; extern guess_arc guess_utf8_ar[11]; -namespace khtml { +namespace tdehtml { class guess_dfa { public: diff --git a/kmail/headerstyle.cpp b/kmail/headerstyle.cpp index 5c4108ee..1bf75f09 100644 --- a/kmail/headerstyle.cpp +++ b/kmail/headerstyle.cpp @@ -53,7 +53,7 @@ using namespace KPIM; #include #include #include -#include +#include #include #include #include diff --git a/kmail/khtmlparthtmlwriter.cpp b/kmail/khtmlparthtmlwriter.cpp deleted file mode 100644 index 3c8ee388..00000000 --- a/kmail/khtmlparthtmlwriter.cpp +++ /dev/null @@ -1,154 +0,0 @@ -/* -*- c++ -*- - khtmlparthtmlwriter.cpp - - This file is part of KMail, the KDE mail client. - Copyright (c) 2003 Marc Mutz - - KMail is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License, version 2, as - published by the Free Software Foundation. - - KMail is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - - In addition, as a special exception, the copyright holders give - permission to link the code of this program with any edition of - the TQt library by Trolltech AS, Norway (or with modified versions - of TQt that use the same license as TQt), and distribute linked - combinations including the two. You must obey the GNU General - Public License in all respects for all of the code used other than - TQt. If you modify this file, you may extend this exception to - your version of the file, but you are not obligated to do so. If - you do not wish to do so, delete this exception statement from - your version. -*/ - -#include - -#include "khtmlparthtmlwriter.h" - -#include -#include -#include - -#include -#include -#include -#include - -#include - -namespace KMail { - - KHtmlPartHtmlWriter::KHtmlPartHtmlWriter( KHTMLPart * part, - TQObject * parent, const char * name ) - : TQObject( parent, name ), HtmlWriter(), - mHtmlPart( part ), mHtmlTimer( 0, "mHtmlTimer" ), mState( Ended ) - { - assert( part ); - connect( &mHtmlTimer, TQT_SIGNAL(timeout()), TQT_SLOT(slotWriteNextHtmlChunk()) ); - } - - KHtmlPartHtmlWriter::~KHtmlPartHtmlWriter() { - - } - - void KHtmlPartHtmlWriter::begin( const TQString & css ) { - if ( mState != Ended ) { - kdWarning( 5006 ) << "KHtmlPartHtmlWriter: begin() called on non-ended session!" << endl; - reset(); - } - - mEmbeddedPartMap.clear(); - - // clear the widget: - mHtmlPart->view()->setUpdatesEnabled( false ); - mHtmlPart->view()->viewport()->setUpdatesEnabled( false ); - static_cast(mHtmlPart->widget())->ensureVisible( 0, 0 ); - - mHtmlPart->begin( KURL( "file:/" ) ); - if ( !css.isEmpty() ) - mHtmlPart->setUserStyleSheet( css ); - mState = Begun; - } - - void KHtmlPartHtmlWriter::end() { - kdWarning( mState != Begun, 5006 ) << "KHtmlPartHtmlWriter: end() called on non-begun or queued session!" << endl; - mHtmlPart->end(); - - resolveCidUrls(); - - mHtmlPart->view()->viewport()->setUpdatesEnabled( true ); - mHtmlPart->view()->setUpdatesEnabled( true ); - mHtmlPart->view()->viewport()->repaint( false ); - mState = Ended; - } - - void KHtmlPartHtmlWriter::reset() { - if ( mState != Ended ) { - mHtmlTimer.stop(); - mHtmlQueue.clear(); - mState = Begun; // don't run into end()'s warning - end(); - } - mState = Ended; - } - - void KHtmlPartHtmlWriter::write( const TQString & str ) { - kdWarning( mState != Begun, 5006 ) << "KHtmlPartHtmlWriter: write() called in Ended or Queued state!" << endl; - mHtmlPart->write( str ); - } - - void KHtmlPartHtmlWriter::queue( const TQString & str ) { - static const uint chunksize = 16384; - for ( uint pos = 0 ; pos < str.length() ; pos += chunksize ) - mHtmlQueue.push_back( str.mid( pos, chunksize ) ); - mState = Queued; - } - - void KHtmlPartHtmlWriter::flush() { - slotWriteNextHtmlChunk(); - } - - void KHtmlPartHtmlWriter::slotWriteNextHtmlChunk() { - if ( mHtmlQueue.empty() ) { - mState = Begun; // don't run into end()'s warning - end(); - } else { - mHtmlPart->write( mHtmlQueue.front() ); - mHtmlQueue.pop_front(); - mHtmlTimer.start( 0, true ); - } - } - - void KHtmlPartHtmlWriter::embedPart( const TQCString & contentId, - const TQString & contentURL ) { - mEmbeddedPartMap[TQString(contentId)] = contentURL; - } - - void KHtmlPartHtmlWriter::resolveCidUrls() - { - DOM::HTMLDocument document = mHtmlPart->htmlDocument(); - DOM::HTMLCollection images = document.images(); - for ( DOM::Node node = images.firstItem(); !node.isNull(); node = images.nextItem() ) { - DOM::HTMLImageElement image( node ); - KURL url( image.src().string() ); - if ( url.protocol() == "cid" ) { - EmbeddedPartMap::const_iterator it = mEmbeddedPartMap.find( url.path() ); - if ( it != mEmbeddedPartMap.end() ) { - kdDebug(5006) << "Replacing " << url.prettyURL() << " by " << it.data() << endl; - image.setSrc( it.data() ); - } - } - } - } - -} // namespace KMail - -#include "khtmlparthtmlwriter.moc" diff --git a/kmail/khtmlparthtmlwriter.h b/kmail/khtmlparthtmlwriter.h deleted file mode 100644 index 52fad112..00000000 --- a/kmail/khtmlparthtmlwriter.h +++ /dev/null @@ -1,84 +0,0 @@ -/* -*- c++ -*- - khtmlparthtmlwriter.h - - This file is part of KMail, the KDE mail client. - Copyright (c) 2003 Marc Mutz - - KMail is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License, version 2, as - published by the Free Software Foundation. - - KMail is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - - In addition, as a special exception, the copyright holders give - permission to link the code of this program with any edition of - the TQt library by Trolltech AS, Norway (or with modified versions - of TQt that use the same license as TQt), and distribute linked - combinations including the two. You must obey the GNU General - Public License in all respects for all of the code used other than - TQt. If you modify this file, you may extend this exception to - your version of the file, but you are not obligated to do so. If - you do not wish to do so, delete this exception statement from - your version. -*/ - -#ifndef __KMAIL_KHTMLPARTHTMLWRITER_H__ -#define __KMAIL_KHTMLPARTHTMLWRITER_H__ - -#include "interfaces/htmlwriter.h" -#include - -#include -#include - -class TQString; -class KHTMLPart; - -namespace KMail { - - class KHtmlPartHtmlWriter : public TQObject, public HtmlWriter { - Q_OBJECT - - public: - // Key is Content-Id, value is URL - typedef TQMap EmbeddedPartMap; - KHtmlPartHtmlWriter( KHTMLPart * part, - TQObject * parent=0, const char * name = 0 ); - virtual ~KHtmlPartHtmlWriter(); - - void begin( const TQString & cssDefs ); - void end(); - void reset(); - void write( const TQString & str ); - void queue( const TQString & str ); - void flush(); - void embedPart( const TQCString & contentId, const TQString & url ); - - private slots: - void slotWriteNextHtmlChunk(); - - private: - void resolveCidUrls(); - - private: - KHTMLPart * mHtmlPart; - TQStringList mHtmlQueue; - TQTimer mHtmlTimer; - enum State { - Begun, - Queued, - Ended - } mState; - EmbeddedPartMap mEmbeddedPartMap; - }; - -} // namespace KMail - -#endif // __KMAIL_KHTMLPARTHTMLWRITER_H__ diff --git a/kmail/kmail_part.cpp b/kmail/kmail_part.cpp index 1f42a82a..b7857493 100644 --- a/kmail/kmail_part.cpp +++ b/kmail/kmail_part.cpp @@ -44,8 +44,8 @@ using KMail::AccountManager; using KRecentAddress::RecentAddresses; #include -#include -#include +#include +#include #include #include #include diff --git a/kmail/kmail_part.h b/kmail/kmail_part.h index dd5d261a..46f08f68 100644 --- a/kmail/kmail_part.h +++ b/kmail/kmail_part.h @@ -28,11 +28,11 @@ #include "kmailpartIface.h" #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include #include diff --git a/kmail/kmcommands.cpp b/kmail/kmcommands.cpp index 9c1d25f9..023c887d 100644 --- a/kmail/kmcommands.cpp +++ b/kmail/kmcommands.cpp @@ -67,13 +67,13 @@ #include #include #include -#include +#include #include #include #include #include #include -#include +#include #include // KIO headers #include diff --git a/kmail/kmcomposewin.cpp b/kmail/kmcomposewin.cpp index 0857ae2b..d635b647 100644 --- a/kmail/kmcomposewin.cpp +++ b/kmail/kmcomposewin.cpp @@ -109,8 +109,8 @@ using KRecentAddress::RecentAddresses; #include "globalsettings.h" #include "replyphrases.h" -#include -#include +#include +#include #include #include #include diff --git a/kmail/kmdict.cpp b/kmail/kmdict.cpp deleted file mode 100644 index 0ad9367b..00000000 --- a/kmail/kmdict.cpp +++ /dev/null @@ -1,117 +0,0 @@ -/* simple hash table for kmail. inspired by TQDict */ -/* Author: Ronen Tzur */ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include "kmdict.h" -#include "kmglobal.h" -#include - -#include -//----------------------------------------------------------------------------- - -KMDict::KMDict( int size ) -{ - init( ( int ) KMail::nextPrime( size ) ); - //kdDebug( 5006 ) << "KMMDict::KMDict Size: " << mSize << endl; -} - -//----------------------------------------------------------------------------- - -KMDict::~KMDict() -{ - clear(); -} - -//----------------------------------------------------------------------------- - -void KMDict::init(int size) -{ - mSize = size; - mVecs = new KMDictItem *[mSize]; - memset(mVecs, 0, mSize * sizeof(KMDictItem *)); -} - -//----------------------------------------------------------------------------- - -void KMDict::clear() -{ - if (!mVecs) - return; - for (int i = 0; i < mSize; i++) { - KMDictItem *item = mVecs[i]; - while (item) { - KMDictItem *nextItem = item->next; - delete item; - item = nextItem; - } - } - delete [] mVecs; - mVecs = 0; -} - -//----------------------------------------------------------------------------- - -void KMDict::replace( long key, KMDictItem *item ) -{ - insert( key, item ); - removeFollowing( item, key ); // remove other items with same key -} - -//----------------------------------------------------------------------------- - - -void KMDict::insert( long key, KMDictItem *item ) -{ - item->key = key; - int idx = (unsigned long)key % mSize; // insert in - item->next = mVecs[idx]; // appropriate - mVecs[idx] = item; // column -} - -//----------------------------------------------------------------------------- - -void KMDict::remove(long key) -{ - int idx = (unsigned long)key % mSize; - KMDictItem *item = mVecs[idx]; - - if (item) { - if (item->key == key) { // if first in the column - mVecs[idx] = item->next; - delete item; - } else - removeFollowing(item, key); // if deep in the column - } -} - -//----------------------------------------------------------------------------- - -void KMDict::removeFollowing(KMDictItem *item, long key) -{ - while (item) { - KMDictItem *itemNext = item->next; - if (itemNext && itemNext->key == key) { - KMDictItem *itemNextNext = itemNext->next; - delete itemNext; - item->next = itemNextNext; - } else - item = itemNext; - } -} - -//----------------------------------------------------------------------------- - -KMDictItem *KMDict::find(long key) -{ - int idx = (unsigned long)key % mSize; - KMDictItem *item = mVecs[idx]; - while (item) { - if (item->key == key) - break; - item = item->next; - } - return item; -} diff --git a/kmail/kmdict.h b/kmail/kmdict.h deleted file mode 100644 index 6cbbefd5..00000000 --- a/kmail/kmdict.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - * simple hash table for kmail. inspired by TQDict - */ - -#ifndef __KMDICT -#define __KMDICT - -/** - * @short Class representing items in a KMDict - */ -class KMDictItem -{ -public: - long key; - KMDictItem *next; -}; - -/** - * @short KMDict implements a lightweight dictionary with serial numbers as keys. - * - * KMDict is a leightweight dictionary used exclusively by KMMsgDict. It uses - * serial numbers as keys. - * - * @author Ronen Tzur - */ -class KMDict -{ - friend class MessageDictTester; -public: - /** Creates a hash table with @p size columns. */ - KMDict(int size = 17); - - /** Destroys the hash table object. */ - ~KMDict(); - - /** Clears the hash table, removing all items. */ - void clear(); - - /** Returns the size of the hash table. */ - int size() { return mSize; } - - /** Inserts an item, replacing old ones with the same key. */ - void replace(long key, KMDictItem *item); - - /** Inserts an item without replacing ones with the same key. */ - void insert(long key, KMDictItem *item); - - /** Removes an item. */ - void remove(long key); - - /** Find an item by key. Returns pointer to it, or 0 if not found. */ - KMDictItem *find(long key); - -private: - /** Removes all items _following_ @p item with key @p key. */ - void removeFollowing(KMDictItem *item, long key); - - /** Initializes the hash table to @p size colums. */ - void init(int size); - - /** The size of the hash. */ - int mSize; - - /** The buckets. */ - KMDictItem **mVecs; -}; - -#endif /* __KMDICT */ diff --git a/kmail/kmedit.cpp b/kmail/kmedit.cpp index 044e0541..8301a12c 100644 --- a/kmail/kmedit.cpp +++ b/kmail/kmedit.cpp @@ -38,8 +38,8 @@ using KPIM::MailListDrag; #include "globalsettings.h" #include "replyphrases.h" -#include -#include +#include +#include #include #include diff --git a/kmail/kmedit.h b/kmail/kmedit.h index 24458cd3..f545a136 100644 --- a/kmail/kmedit.h +++ b/kmail/kmedit.h @@ -7,7 +7,7 @@ #include #include -#include +#include #include #include #include diff --git a/kmail/kmheaders.cpp b/kmail/kmheaders.cpp index 8e142c91..2ed379c9 100644 --- a/kmail/kmheaders.cpp +++ b/kmail/kmheaders.cpp @@ -2401,7 +2401,7 @@ void KMHeaders::contentsMouseMoveEvent( TQMouseEvent* e ) if( count == 1 ) pixmap = TQPixmap( DesktopIcon("message", KIcon::SizeSmall) ); else - pixmap = TQPixmap( DesktopIcon("kmultiple", KIcon::SizeSmall) ); + pixmap = TQPixmap( DesktopIcon("tdemultiple", KIcon::SizeSmall) ); // Calculate hotspot (as in Konqueror) if( !pixmap.isNull() ) { diff --git a/kmail/kmkernel.cpp b/kmail/kmkernel.cpp index e5dd7072..354fe768 100644 --- a/kmail/kmkernel.cpp +++ b/kmail/kmkernel.cpp @@ -69,7 +69,7 @@ using KMail::FolderIface; #include #include #include -#include +#include using KWallet::Wallet; #include "actionscheduler.h" diff --git a/kmail/kmkernel.h b/kmail/kmkernel.h index fb01231b..9d2b5070 100644 --- a/kmail/kmkernel.h +++ b/kmail/kmkernel.h @@ -11,7 +11,7 @@ #include #include -#include +#include #include #include "kmailIface.h" diff --git a/kmail/kmmessage.cpp b/kmail/kmmessage.cpp index 20f9ce4c..aabc14bc 100644 --- a/kmail/kmmessage.cpp +++ b/kmail/kmmessage.cpp @@ -38,7 +38,7 @@ using KMail::HeaderStrategy; #include #include #include -#include +#include #include #include #include diff --git a/kmail/kmmsgdict.cpp b/kmail/kmmsgdict.cpp index 729a3663..fdf2e1b2 100644 --- a/kmail/kmmsgdict.cpp +++ b/kmail/kmmsgdict.cpp @@ -4,7 +4,7 @@ #include "kmfolderindex.h" #include "kmfolder.h" #include "kmmsgdict.h" -#include "kmdict.h" +#include "tdemdict.h" #include "globalsettings.h" #include "folderstorage.h" diff --git a/kmail/kmreaderwin.cpp b/kmail/kmreaderwin.cpp index 2ce6c862..0568035b 100644 --- a/kmail/kmreaderwin.cpp +++ b/kmail/kmreaderwin.cpp @@ -37,7 +37,7 @@ using KMail::AttachmentStrategy; using KMail::HeaderStrategy; #include "headerstyle.h" using KMail::HeaderStyle; -#include "khtmlparthtmlwriter.h" +#include "tdehtmlparthtmlwriter.h" using KMail::HtmlWriter; using KMail::KHtmlPartHtmlWriter; #include "htmlstatusbar.h" @@ -80,9 +80,9 @@ using KMail::TeeHtmlWriter; #include #include -// khtml headers -#include -#include // So that we can get rid of the frames +// tdehtml headers +#include +#include // So that we can get rid of the frames #include #include #include diff --git a/kmail/kmtransport.cpp b/kmail/kmtransport.cpp index e17fdaf0..2092376f 100644 --- a/kmail/kmtransport.cpp +++ b/kmail/kmtransport.cpp @@ -38,7 +38,7 @@ #include #include #include -#include +#include using KWallet::Wallet; #include @@ -87,7 +87,7 @@ void KMTransportInfo::readConfig(int id) return; if ( !mPasswd.isEmpty() ) { - // migration to kwallet if available + // migration to tdewallet if available if ( Wallet::isEnabled() ) { config->deleteEntry( "pass" ); mPasswdDirty = true; diff --git a/kmail/networkaccount.cpp b/kmail/networkaccount.cpp index e0b68274..62581bf9 100644 --- a/kmail/networkaccount.cpp +++ b/kmail/networkaccount.cpp @@ -37,7 +37,7 @@ #include #include #include -#include +#include using TDEIO::MetaData; using KWallet::Wallet; diff --git a/kmail/objecttreeparser.cpp b/kmail/objecttreeparser.cpp index 9c8c673a..6ea48bf0 100644 --- a/kmail/objecttreeparser.cpp +++ b/kmail/objecttreeparser.cpp @@ -89,7 +89,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/kmail/regexplineedit.cpp b/kmail/regexplineedit.cpp index 3d292182..a6d86ec3 100644 --- a/kmail/regexplineedit.cpp +++ b/kmail/regexplineedit.cpp @@ -38,7 +38,7 @@ #include #include -#include +#include #include #include diff --git a/kmail/searchwindow.cpp b/kmail/searchwindow.cpp index de5e2d7e..15bf5f07 100644 --- a/kmail/searchwindow.cpp +++ b/kmail/searchwindow.cpp @@ -95,7 +95,7 @@ class MatchListView : public KListView if( mailList.count() == 1 ) pixmap = TQPixmap( DesktopIcon("message", KIcon::SizeSmall) ); else - pixmap = TQPixmap( DesktopIcon("kmultiple", KIcon::SizeSmall) ); + pixmap = TQPixmap( DesktopIcon("tdemultiple", KIcon::SizeSmall) ); d->setPixmap( pixmap ); return d; diff --git a/kmail/snippetwidget.h b/kmail/snippetwidget.h index 18573c38..88a96719 100644 --- a/kmail/snippetwidget.h +++ b/kmail/snippetwidget.h @@ -19,8 +19,8 @@ #include #include -#include -#include +#include +#include #include "snippetconfig.h" class KDevProject; diff --git a/kmail/tdehtmlparthtmlwriter.cpp b/kmail/tdehtmlparthtmlwriter.cpp new file mode 100644 index 00000000..7321e128 --- /dev/null +++ b/kmail/tdehtmlparthtmlwriter.cpp @@ -0,0 +1,154 @@ +/* -*- c++ -*- + tdehtmlparthtmlwriter.cpp + + This file is part of KMail, the KDE mail client. + Copyright (c) 2003 Marc Mutz + + KMail is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License, version 2, as + published by the Free Software Foundation. + + KMail is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + + In addition, as a special exception, the copyright holders give + permission to link the code of this program with any edition of + the TQt library by Trolltech AS, Norway (or with modified versions + of TQt that use the same license as TQt), and distribute linked + combinations including the two. You must obey the GNU General + Public License in all respects for all of the code used other than + TQt. If you modify this file, you may extend this exception to + your version of the file, but you are not obligated to do so. If + you do not wish to do so, delete this exception statement from + your version. +*/ + +#include + +#include "tdehtmlparthtmlwriter.h" + +#include +#include +#include + +#include +#include +#include +#include + +#include + +namespace KMail { + + KHtmlPartHtmlWriter::KHtmlPartHtmlWriter( KHTMLPart * part, + TQObject * parent, const char * name ) + : TQObject( parent, name ), HtmlWriter(), + mHtmlPart( part ), mHtmlTimer( 0, "mHtmlTimer" ), mState( Ended ) + { + assert( part ); + connect( &mHtmlTimer, TQT_SIGNAL(timeout()), TQT_SLOT(slotWriteNextHtmlChunk()) ); + } + + KHtmlPartHtmlWriter::~KHtmlPartHtmlWriter() { + + } + + void KHtmlPartHtmlWriter::begin( const TQString & css ) { + if ( mState != Ended ) { + kdWarning( 5006 ) << "KHtmlPartHtmlWriter: begin() called on non-ended session!" << endl; + reset(); + } + + mEmbeddedPartMap.clear(); + + // clear the widget: + mHtmlPart->view()->setUpdatesEnabled( false ); + mHtmlPart->view()->viewport()->setUpdatesEnabled( false ); + static_cast(mHtmlPart->widget())->ensureVisible( 0, 0 ); + + mHtmlPart->begin( KURL( "file:/" ) ); + if ( !css.isEmpty() ) + mHtmlPart->setUserStyleSheet( css ); + mState = Begun; + } + + void KHtmlPartHtmlWriter::end() { + kdWarning( mState != Begun, 5006 ) << "KHtmlPartHtmlWriter: end() called on non-begun or queued session!" << endl; + mHtmlPart->end(); + + resolveCidUrls(); + + mHtmlPart->view()->viewport()->setUpdatesEnabled( true ); + mHtmlPart->view()->setUpdatesEnabled( true ); + mHtmlPart->view()->viewport()->repaint( false ); + mState = Ended; + } + + void KHtmlPartHtmlWriter::reset() { + if ( mState != Ended ) { + mHtmlTimer.stop(); + mHtmlQueue.clear(); + mState = Begun; // don't run into end()'s warning + end(); + } + mState = Ended; + } + + void KHtmlPartHtmlWriter::write( const TQString & str ) { + kdWarning( mState != Begun, 5006 ) << "KHtmlPartHtmlWriter: write() called in Ended or Queued state!" << endl; + mHtmlPart->write( str ); + } + + void KHtmlPartHtmlWriter::queue( const TQString & str ) { + static const uint chunksize = 16384; + for ( uint pos = 0 ; pos < str.length() ; pos += chunksize ) + mHtmlQueue.push_back( str.mid( pos, chunksize ) ); + mState = Queued; + } + + void KHtmlPartHtmlWriter::flush() { + slotWriteNextHtmlChunk(); + } + + void KHtmlPartHtmlWriter::slotWriteNextHtmlChunk() { + if ( mHtmlQueue.empty() ) { + mState = Begun; // don't run into end()'s warning + end(); + } else { + mHtmlPart->write( mHtmlQueue.front() ); + mHtmlQueue.pop_front(); + mHtmlTimer.start( 0, true ); + } + } + + void KHtmlPartHtmlWriter::embedPart( const TQCString & contentId, + const TQString & contentURL ) { + mEmbeddedPartMap[TQString(contentId)] = contentURL; + } + + void KHtmlPartHtmlWriter::resolveCidUrls() + { + DOM::HTMLDocument document = mHtmlPart->htmlDocument(); + DOM::HTMLCollection images = document.images(); + for ( DOM::Node node = images.firstItem(); !node.isNull(); node = images.nextItem() ) { + DOM::HTMLImageElement image( node ); + KURL url( image.src().string() ); + if ( url.protocol() == "cid" ) { + EmbeddedPartMap::const_iterator it = mEmbeddedPartMap.find( url.path() ); + if ( it != mEmbeddedPartMap.end() ) { + kdDebug(5006) << "Replacing " << url.prettyURL() << " by " << it.data() << endl; + image.setSrc( it.data() ); + } + } + } + } + +} // namespace KMail + +#include "tdehtmlparthtmlwriter.moc" diff --git a/kmail/tdehtmlparthtmlwriter.h b/kmail/tdehtmlparthtmlwriter.h new file mode 100644 index 00000000..52f16fd4 --- /dev/null +++ b/kmail/tdehtmlparthtmlwriter.h @@ -0,0 +1,84 @@ +/* -*- c++ -*- + tdehtmlparthtmlwriter.h + + This file is part of KMail, the KDE mail client. + Copyright (c) 2003 Marc Mutz + + KMail is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License, version 2, as + published by the Free Software Foundation. + + KMail is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + + In addition, as a special exception, the copyright holders give + permission to link the code of this program with any edition of + the TQt library by Trolltech AS, Norway (or with modified versions + of TQt that use the same license as TQt), and distribute linked + combinations including the two. You must obey the GNU General + Public License in all respects for all of the code used other than + TQt. If you modify this file, you may extend this exception to + your version of the file, but you are not obligated to do so. If + you do not wish to do so, delete this exception statement from + your version. +*/ + +#ifndef __KMAIL_KHTMLPARTHTMLWRITER_H__ +#define __KMAIL_KHTMLPARTHTMLWRITER_H__ + +#include "interfaces/htmlwriter.h" +#include + +#include +#include + +class TQString; +class KHTMLPart; + +namespace KMail { + + class KHtmlPartHtmlWriter : public TQObject, public HtmlWriter { + Q_OBJECT + + public: + // Key is Content-Id, value is URL + typedef TQMap EmbeddedPartMap; + KHtmlPartHtmlWriter( KHTMLPart * part, + TQObject * parent=0, const char * name = 0 ); + virtual ~KHtmlPartHtmlWriter(); + + void begin( const TQString & cssDefs ); + void end(); + void reset(); + void write( const TQString & str ); + void queue( const TQString & str ); + void flush(); + void embedPart( const TQCString & contentId, const TQString & url ); + + private slots: + void slotWriteNextHtmlChunk(); + + private: + void resolveCidUrls(); + + private: + KHTMLPart * mHtmlPart; + TQStringList mHtmlQueue; + TQTimer mHtmlTimer; + enum State { + Begun, + Queued, + Ended + } mState; + EmbeddedPartMap mEmbeddedPartMap; + }; + +} // namespace KMail + +#endif // __KMAIL_KHTMLPARTHTMLWRITER_H__ diff --git a/kmail/tdemdict.cpp b/kmail/tdemdict.cpp new file mode 100644 index 00000000..a1c73e6d --- /dev/null +++ b/kmail/tdemdict.cpp @@ -0,0 +1,117 @@ +/* simple hash table for kmail. inspired by TQDict */ +/* Author: Ronen Tzur */ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include "tdemdict.h" +#include "kmglobal.h" +#include + +#include +//----------------------------------------------------------------------------- + +KMDict::KMDict( int size ) +{ + init( ( int ) KMail::nextPrime( size ) ); + //kdDebug( 5006 ) << "KMMDict::KMDict Size: " << mSize << endl; +} + +//----------------------------------------------------------------------------- + +KMDict::~KMDict() +{ + clear(); +} + +//----------------------------------------------------------------------------- + +void KMDict::init(int size) +{ + mSize = size; + mVecs = new KMDictItem *[mSize]; + memset(mVecs, 0, mSize * sizeof(KMDictItem *)); +} + +//----------------------------------------------------------------------------- + +void KMDict::clear() +{ + if (!mVecs) + return; + for (int i = 0; i < mSize; i++) { + KMDictItem *item = mVecs[i]; + while (item) { + KMDictItem *nextItem = item->next; + delete item; + item = nextItem; + } + } + delete [] mVecs; + mVecs = 0; +} + +//----------------------------------------------------------------------------- + +void KMDict::replace( long key, KMDictItem *item ) +{ + insert( key, item ); + removeFollowing( item, key ); // remove other items with same key +} + +//----------------------------------------------------------------------------- + + +void KMDict::insert( long key, KMDictItem *item ) +{ + item->key = key; + int idx = (unsigned long)key % mSize; // insert in + item->next = mVecs[idx]; // appropriate + mVecs[idx] = item; // column +} + +//----------------------------------------------------------------------------- + +void KMDict::remove(long key) +{ + int idx = (unsigned long)key % mSize; + KMDictItem *item = mVecs[idx]; + + if (item) { + if (item->key == key) { // if first in the column + mVecs[idx] = item->next; + delete item; + } else + removeFollowing(item, key); // if deep in the column + } +} + +//----------------------------------------------------------------------------- + +void KMDict::removeFollowing(KMDictItem *item, long key) +{ + while (item) { + KMDictItem *itemNext = item->next; + if (itemNext && itemNext->key == key) { + KMDictItem *itemNextNext = itemNext->next; + delete itemNext; + item->next = itemNextNext; + } else + item = itemNext; + } +} + +//----------------------------------------------------------------------------- + +KMDictItem *KMDict::find(long key) +{ + int idx = (unsigned long)key % mSize; + KMDictItem *item = mVecs[idx]; + while (item) { + if (item->key == key) + break; + item = item->next; + } + return item; +} diff --git a/kmail/tdemdict.h b/kmail/tdemdict.h new file mode 100644 index 00000000..6cbbefd5 --- /dev/null +++ b/kmail/tdemdict.h @@ -0,0 +1,68 @@ +/* + * simple hash table for kmail. inspired by TQDict + */ + +#ifndef __KMDICT +#define __KMDICT + +/** + * @short Class representing items in a KMDict + */ +class KMDictItem +{ +public: + long key; + KMDictItem *next; +}; + +/** + * @short KMDict implements a lightweight dictionary with serial numbers as keys. + * + * KMDict is a leightweight dictionary used exclusively by KMMsgDict. It uses + * serial numbers as keys. + * + * @author Ronen Tzur + */ +class KMDict +{ + friend class MessageDictTester; +public: + /** Creates a hash table with @p size columns. */ + KMDict(int size = 17); + + /** Destroys the hash table object. */ + ~KMDict(); + + /** Clears the hash table, removing all items. */ + void clear(); + + /** Returns the size of the hash table. */ + int size() { return mSize; } + + /** Inserts an item, replacing old ones with the same key. */ + void replace(long key, KMDictItem *item); + + /** Inserts an item without replacing ones with the same key. */ + void insert(long key, KMDictItem *item); + + /** Removes an item. */ + void remove(long key); + + /** Find an item by key. Returns pointer to it, or 0 if not found. */ + KMDictItem *find(long key); + +private: + /** Removes all items _following_ @p item with key @p key. */ + void removeFollowing(KMDictItem *item, long key); + + /** Initializes the hash table to @p size colums. */ + void init(int size); + + /** The size of the hash. */ + int mSize; + + /** The buckets. */ + KMDictItem **mVecs; +}; + +#endif /* __KMDICT */ diff --git a/kmail/tests/Makefile.am b/kmail/tests/Makefile.am index 2d492283..c07ad623 100644 --- a/kmail/tests/Makefile.am +++ b/kmail/tests/Makefile.am @@ -2,22 +2,22 @@ INCLUDES = -I$(top_srcdir)/kmail -I$(top_srcdir)/mimelib $(all_includes) AM_CPPFLAGS = -DTDESRCDIR=\"$(srcdir)\" METASOURCES = AUTO -check_LTLIBRARIES = kunittest_storagelayermodule.la \ - kunittest_utilmodule.la \ - kunittest_mimelibmodule.la +check_LTLIBRARIES = tdeunittest_storagelayermodule.la \ + tdeunittest_utilmodule.la \ + tdeunittest_mimelibmodule.la -kunittest_storagelayermodule_la_SOURCES = storagelayermodule.cpp messagedicttests.cpp ../kmdict.cpp -kunittest_storagelayermodule_la_LIBADD = -lkunittest -kunittest_utilmodule_la_SOURCES = utiltests.cpp ../util.cpp -kunittest_utilmodule_la_LIBADD = -lkunittest ../../mimelib/libmimelib.la -kunittest_mimelibmodule_la_SOURCES = mimelibtests.cpp ../util.cpp -kunittest_mimelibmodule_la_LIBADD = -lkunittest ../../mimelib/libmimelib.la +tdeunittest_storagelayermodule_la_SOURCES = storagelayermodule.cpp messagedicttests.cpp ../tdemdict.cpp +tdeunittest_storagelayermodule_la_LIBADD = -ltdeunittest +tdeunittest_utilmodule_la_SOURCES = utiltests.cpp ../util.cpp +tdeunittest_utilmodule_la_LIBADD = -ltdeunittest ../../mimelib/libmimelib.la +tdeunittest_mimelibmodule_la_SOURCES = mimelibtests.cpp ../util.cpp +tdeunittest_mimelibmodule_la_LIBADD = -ltdeunittest ../../mimelib/libmimelib.la -#LIBADD = -lkunittest +#LIBADD = -ltdeunittest AM_LDFLAGS = -module $(KDE_CHECK_PLUGIN) $(all_libraries) check-local: - kunittestmodrunner + tdeunittestmodrunner guicheck: - kunittestguimodrunner + tdeunittestguimodrunner diff --git a/kmail/tests/messagedicttests.cpp b/kmail/tests/messagedicttests.cpp index cdb24f6d..4565f10c 100644 --- a/kmail/tests/messagedicttests.cpp +++ b/kmail/tests/messagedicttests.cpp @@ -4,10 +4,10 @@ */ #include -#include -#include +#include +#include -#include "kmdict.h" +#include "tdemdict.h" #include "messagedicttests.h" diff --git a/kmail/tests/messagedicttests.h b/kmail/tests/messagedicttests.h index abff55da..f60a3b2f 100644 --- a/kmail/tests/messagedicttests.h +++ b/kmail/tests/messagedicttests.h @@ -7,7 +7,7 @@ #ifndef MESSAGEDICTTESTS_H #define MESSAGEDICTTESTS_H -#include +#include class KMDict; diff --git a/kmail/tests/mimelibtests.cpp b/kmail/tests/mimelibtests.cpp index 6f4cf189..e1162093 100644 --- a/kmail/tests/mimelibtests.cpp +++ b/kmail/tests/mimelibtests.cpp @@ -21,12 +21,12 @@ #include "mimelibtests.moc" #include -#include -#include +#include +#include using namespace KUnitTest; -KUNITTEST_MODULE( kunittest_mimelibmodule, "Mimelib Tests" ); +KUNITTEST_MODULE( tdeunittest_mimelibmodule, "Mimelib Tests" ); KUNITTEST_MODULE_REGISTER_TESTER( MimeLibTester ); #include @@ -56,7 +56,7 @@ static TQString makePrintable( const DwString& str ) TQCString MimeLibTester::readFile(const TQString& fileName) { TQFile file( fileName ); - // #!@#$& kunittest... VERIFY() does nothing in setUp. Using assert instead. + // #!@#$& tdeunittest... VERIFY() does nothing in setUp. Using assert instead. bool ok = file.open( IO_ReadOnly ); if ( !ok ) { kdError() << fileName << " not found!" << endl; diff --git a/kmail/tests/mimelibtests.h b/kmail/tests/mimelibtests.h index 0f503324..8fd06124 100644 --- a/kmail/tests/mimelibtests.h +++ b/kmail/tests/mimelibtests.h @@ -20,7 +20,7 @@ #ifndef MIMELIBTEST_H #define MIMELIBTEST_H -#include +#include class DwString; class MimeLibTester : public KUnitTest::SlotTester diff --git a/kmail/tests/storagelayermodule.cpp b/kmail/tests/storagelayermodule.cpp index 91362471..fcfb884e 100644 --- a/kmail/tests/storagelayermodule.cpp +++ b/kmail/tests/storagelayermodule.cpp @@ -5,12 +5,12 @@ * have to fix it" license. */ -#include -#include +#include +#include #include "messagedicttests.h" using namespace KUnitTest; -KUNITTEST_MODULE( kunittest_storagelayermodule, "KMail Storage Layer Tests" ); +KUNITTEST_MODULE( tdeunittest_storagelayermodule, "KMail Storage Layer Tests" ); KUNITTEST_MODULE_REGISTER_TESTER( MessageDictTester ); diff --git a/kmail/tests/utiltests.cpp b/kmail/tests/utiltests.cpp index d0b3135b..936cc3ab 100644 --- a/kmail/tests/utiltests.cpp +++ b/kmail/tests/utiltests.cpp @@ -4,13 +4,13 @@ */ #include -#include -#include +#include +#include #include "utiltests.h" using namespace KUnitTest; -KUNITTEST_MODULE( kunittest_utilmodule, "KMail::Util Tests" ); +KUNITTEST_MODULE( tdeunittest_utilmodule, "KMail::Util Tests" ); KUNITTEST_MODULE_REGISTER_TESTER( UtilTester ); #include "util.h" diff --git a/kmail/tests/utiltests.h b/kmail/tests/utiltests.h index b2cb8c69..0bcbcdf1 100644 --- a/kmail/tests/utiltests.h +++ b/kmail/tests/utiltests.h @@ -7,7 +7,7 @@ #ifndef UTILTESTS_H #define UTILTESTS_H -#include +#include class UtilTester : public KUnitTest::SlotTester { diff --git a/kmail/urlhandlermanager.cpp b/kmail/urlhandlermanager.cpp index 8e72b8ab..65c18d73 100644 --- a/kmail/urlhandlermanager.cpp +++ b/kmail/urlhandlermanager.cpp @@ -47,7 +47,7 @@ #include #include -#include +#include #include #include @@ -399,7 +399,7 @@ TQString KMail::URLHandlerManager::statusBarMessage( const KURL & url, KMReaderW #include #include #include -#include +#include #include -- cgit v1.2.3