From 533bad2a1503973aaf8186691422c2eda91d02d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sl=C3=A1vek=20Banko?= Date: Tue, 3 Sep 2013 20:02:55 +0200 Subject: Additional k => tde renaming and fixes --- korn/CMakeLists.txt | 2 +- korn/Makefile.am | 8 +- korn/accountmanager.cpp | 2 +- korn/dcop_proto.h | 6 +- korn/imap_proto.h | 4 +- korn/imaps_proto.h | 2 +- korn/kio.cpp | 561 ------------------------- korn/kio.h | 208 --------- korn/kmail_proto.cpp | 2 +- korn/maildir_proto.h | 4 +- korn/maildrop.h | 2 +- korn/mbox_proto.cpp | 2 +- korn/mbox_proto.h | 2 +- korn/nntp_proto.cpp | 2 +- korn/nntp_proto.h | 4 +- korn/polldrop.h | 2 +- korn/pop3_proto.cpp | 2 +- korn/pop3_proto.h | 4 +- korn/pop3s_proto.h | 2 +- korn/process_proto.cpp | 2 +- korn/process_proto.h | 4 +- korn/protocol.h | 4 +- korn/qmail_proto.cpp | 2 +- korn/qmail_proto.h | 4 +- korn/stringid.h | 2 +- korn/tdeconf_update/Makefile.am | 2 +- korn/tdeconf_update/korn-3-4-config_change.cpp | 8 +- korn/tdeio.cpp | 561 +++++++++++++++++++++++++ korn/tdeio.h | 208 +++++++++ korn/tdeio_count.cpp | 84 ++-- korn/tdeio_count.h | 18 +- korn/tdeio_delete.cpp | 52 +-- korn/tdeio_delete.h | 22 +- korn/tdeio_proto.cpp | 6 +- korn/tdeio_proto.h | 18 +- korn/tdeio_read.cpp | 24 +- korn/tdeio_read.h | 16 +- korn/tdeio_single_subject.cpp | 14 +- korn/tdeio_single_subject.h | 16 +- korn/tdeio_subjects.cpp | 64 +-- korn/tdeio_subjects.h | 24 +- 41 files changed, 988 insertions(+), 988 deletions(-) delete mode 100644 korn/kio.cpp delete mode 100644 korn/kio.h create mode 100644 korn/tdeio.cpp create mode 100644 korn/tdeio.h (limited to 'korn') diff --git a/korn/CMakeLists.txt b/korn/CMakeLists.txt index 081d1aaf2..7cdffec96 100644 --- a/korn/CMakeLists.txt +++ b/korn/CMakeLists.txt @@ -45,7 +45,7 @@ tde_add_executable( korn AUTOMOC keditlistboxman.cpp nntp_proto.cpp maildrop.cpp main.cpp polldrop.cpp protocols.cpp kornshell.cpp subjectsdlg.cpp maildlg.cpp mailid.cpp mailsubject.cpp mbox_proto.cpp imap_proto.cpp intid.cpp stringid.cpp - kornapp.cpp kio.cpp tdeio_count.cpp tdeio_proto.cpp tdeio_subjects.cpp + kornapp.cpp tdeio.cpp tdeio_count.cpp tdeio_proto.cpp tdeio_subjects.cpp tdeio_single_subject.cpp tdeio_read.cpp tdeio_delete.cpp kmail_proto.cpp sortedmailsubject.cpp korncfgimpl.cpp kornaccountcfgimpl.cpp kornboxcfgimpl.cpp kornaccountcfg.ui kornboxcfg.ui korncfg.ui password.cpp pop3_proto.cpp diff --git a/korn/Makefile.am b/korn/Makefile.am index 9dafb61c7..bed6770d6 100644 --- a/korn/Makefile.am +++ b/korn/Makefile.am @@ -3,12 +3,12 @@ KDE_CXXFLAGS = $(USE_RTTI) INCLUDES = -I$(top_srcdir)/libkmime \ $(all_includes) #INCLUDES = -I$(top_srcdir)/mimelib -I$(top_srcdir)/libkmime $(all_includes) -AM_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_KIO) -ltdetexteditor +AM_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_TDEIO) -ltdetexteditor METASOURCES = AUTO bin_PROGRAMS = korn -korn_LDADD = $(LIB_KIO) $(top_builddir)/libkmime/libkmime.la +korn_LDADD = $(LIB_TDEIO) $(top_builddir)/libkmime/libkmime.la #korn_LDADD = $(top_builddir)/mimelib/libmimelib.la $(LIB_TDEFILE) $(LIBSOCKET) $(top_builddir)/libkmime/libkmime.la korn_SOURCES = \ @@ -39,7 +39,7 @@ korn_SOURCES = \ intid.cpp \ stringid.cpp \ kornapp.cpp \ - kio.cpp \ + tdeio.cpp \ tdeio_count.cpp \ tdeio_proto.cpp \ tdeio_subjects.cpp \ @@ -91,7 +91,7 @@ noinst_HEADERS = \ intid.h \ stringid.h \ kornapp.h \ - kio.h \ + tdeio.h \ tdeio_count.h \ tdeio_subjects.h \ tdeio_single_subject.h \ diff --git a/korn/accountmanager.cpp b/korn/accountmanager.cpp index a31dd4c10..187f79bd9 100644 --- a/korn/accountmanager.cpp +++ b/korn/accountmanager.cpp @@ -19,7 +19,7 @@ #include "accountmanager.h" #include "dcopdrop.h" -#include "kio.h" +#include "tdeio.h" #include "maildrop.h" #include "password.h" #include "protocol.h" diff --git a/korn/dcop_proto.h b/korn/dcop_proto.h index 18e01e997..defcf0c20 100644 --- a/korn/dcop_proto.h +++ b/korn/dcop_proto.h @@ -24,7 +24,7 @@ class AccountInput; class TDEConfigGroup; -class KIO_Protocol; +class TDEIO_Protocol; class KMailDrop; class Protocol; @@ -106,12 +106,12 @@ public: //Functions that return a derived class. //This way, no explicit cast is needed /** - * This function returns a cast to a KIO_Protocol. Because this isn't a KIO_Protocol, + * This function returns a cast to a TDEIO_Protocol. Because this isn't a TDEIO_Protocol, * it returns 0. * * @return 0 */ - virtual const KIO_Protocol* getKIOProtocol() const { return 0; } + virtual const TDEIO_Protocol* getKIOProtocol() const { return 0; } }; #endif diff --git a/korn/imap_proto.h b/korn/imap_proto.h index 4030c5cc5..6bd90d408 100644 --- a/korn/imap_proto.h +++ b/korn/imap_proto.h @@ -30,10 +30,10 @@ /** * This class define the way a imap-protocol works. - * It implements function of KIO_Protocol to make the kio-modules work with it, + * It implements function of TDEIO_Protocol to make the tdeio-modules work with it, * as well as function of Protocol, to configure it. */ -class Imap_Protocol : public KIO_Protocol +class Imap_Protocol : public TDEIO_Protocol { public: /** diff --git a/korn/imaps_proto.h b/korn/imaps_proto.h index 07f3cfdbe..65b59e64a 100644 --- a/korn/imaps_proto.h +++ b/korn/imaps_proto.h @@ -29,7 +29,7 @@ public: Imaps_Protocol() {} virtual ~Imaps_Protocol() {} - virtual KIO_Protocol * clone() const { return new Imaps_Protocol; } + virtual TDEIO_Protocol * clone() const { return new Imaps_Protocol; } virtual TQString protocol() const { return "imaps"; } virtual TQString configName() const { return "imaps"; } diff --git a/korn/kio.cpp b/korn/kio.cpp deleted file mode 100644 index 678b3848c..000000000 --- a/korn/kio.cpp +++ /dev/null @@ -1,561 +0,0 @@ -/* - * Copyright (C) Sirtaj Singh Kang - * Copyright (C) Kurt Granroth - * Copyright (C) 2004, Mart Kelder (mart.kde@hccnet.nl) - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/* - * kio.cpp -- Implementation of class KKIODrop. - * It is copyied from imap.cpp, with was writed by: - * Author: Kurt Granroth - * Version: $Id$ - * Changed by: - * Mart Kelder , 2004 - */ - -#include "kio.h" -#include "tdeio_count.h" -#include "tdeio_subjects.h" -#include "tdeio_read.h" -#include "tdeio_delete.h" -#include "protocol.h" -#include "protocols.h" -#include "stringid.h" -#include"utils.h" -//#include"kiocfg.h" -//#include"dropdlg.h" -#include "mailsubject.h" - -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#include -#include -#include -#include - -//Headers of protocols -#include"tdeio_proto.h" -//#include"pop3_proto.h" -//#include"pop3s_proto.h" -//#include"imap_proto.h" -//#include"imaps_proto.h" -//#include"nntp_proto.h" -//#include"maildir_proto.h" -//#include"qmail_proto.h" -//#include"process_proto.h" -#include"mbox_proto.h" - -/* - * The 'process' maildrop is a lot different than the other protocols: - * it haven't a tdeioslave and could not result in file list. To prevent - * trowing it away, that functionality is hacked in this file. - */ - -KKioDrop::KKioDrop() - : KPollableDrop(), - _kurl( 0 ), - _metadata( 0 ), - _valid(false), - _protocol( 0 ), - _ssl(false), - _count( 0 ), - _subjects( 0 ), - _read( 0 ), - _readSubjectsTotalSteps( 0 ), - _deleteMailsTotalSteps( 0 ), - _process( 0 ), - _mailurls( 0 ) -{ - _kurl = new KURL; - _metadata = new TDEIO::MetaData; - - //Initialising protocol; if no protocol is set before first use, it will use the first protocol - _protocol = Protocols::firstProtocol()->getKIOProtocol(); //The first protocol is the default - _kurl->setPort( _protocol->defaultPort( _ssl ) ); - - //Creating children and connect them to the outside world; this class passes the messages for them... - //This class handles all the counting. - _count = new KIO_Count( this, "tdeio_count" ); - - //This class is responsible for providing the available subjects - _subjects = new KIO_Subjects( this, "tdeio_subjects" ); - - //This class is used when a full message has to be read. - _read = new KIO_Read( this, "tdeio_read" ); - - //This class can delete mails. - _delete = new KIO_Delete( this, "tdeio_delete" ); - - _mailurls = new TQValueList; -} - -KKioDrop::KKioDrop( TDEConfigGroup* ) - : KPollableDrop(), - _kurl( 0 ), - _metadata( 0 ), - _valid(false), - _protocol( 0 ), - _ssl(false), - _count( 0 ), - _subjects( 0 ), - _read( 0 ), - _readSubjectsTotalSteps( 0 ), - _deleteMailsTotalSteps( 0 ), - _process( 0 ), - _mailurls( 0 ) -{ - _kurl = new KURL; - _metadata = new TDEIO::MetaData; - - //Initialising protocol; if no protocol is set before first use, it will use the first protocol - _protocol = Protocols::firstProtocol()->getKIOProtocol(); //The first protocol is the default - _kurl->setPort( _protocol->defaultPort( _ssl ) ); - - //Creating children and connect them to the outside world; this class passes the messages for them... - //This class handles all the counting. - _count = new KIO_Count( this, "tdeio_count" ); - - //This class is responsible for providing the available subjects - _subjects = new KIO_Subjects( this, "tdeio_subjects" ); - - //This class is used when a full message has to be read. - _read = new KIO_Read( this, "tdeio_read" ); - - //This class can delete mails. - _delete = new KIO_Delete( this, "tdeio_delete" ); - - _mailurls = new TQValueList; - - //readConfigGroup( *config ); -} - -void KKioDrop::setKioServer( const TQString & proto, const TQString & server, int port ) -{ - //Settings default for last vars; could not inline because TDEIO::MetaData-object is not defined in header. - setKioServer( proto, server, port, TDEIO::MetaData(), false, true ); -} - -void KKioDrop::setKioServer(const TQString & proto, const TQString & server, int port, const TDEIO::MetaData metadata, bool ssl, - bool setProtocol ) -{ - TQString auth; - - if( port == -1 ) - port = _protocol->defaultPort( ssl ); - - if( setProtocol ) //false if _protocol already made - { - _protocol = Protocols::getProto( proto )->getKIOProtocol(); - - if( ! _protocol ) - _protocol = Protocols::firstProtocol()->getKIOProtocol(); - } - - _kurl->setProtocol( _protocol->protocol( ssl ) ); - _kurl->setHost ( server ); - _kurl->setPort ( port ); - _ssl = ssl; - - //Checking for authentication-settings. - //if( _metadata->contains("auth") ) - //{ - // auth = (*_metadata)["auth"]; - // *_metadata = metadata; - // if( ! _metadata->contains("auth") ) - // (*_metadata)["auth"] = auth; - //} else - *_metadata = metadata; - - _count->stopActiveCount(); -} - -void KKioDrop::setUser(const TQString & user, const TQString & password, - const TQString & mailbox, const TQString & auth ) -{ - _kurl->setUser( user ); - _password = password ; - _kurl->setPass( _password ); - _kurl->setPath( mailbox ); - if( ! auth.isEmpty() && auth != "Plain" ) - (*_metadata)["auth"] = auth; - else if( _metadata->contains( "auth" ) ) - _metadata->erase( "auth" ); - - _valid = _kurl->isValid(); - emit validChanged( valid() ); - - if( ! _valid ) - kdWarning() << i18n( "url is not valid" ) << endl; - - _count->stopActiveCount(); -} - -TQString KKioDrop::protocol() const -{ - return _protocol->configName(); -} - -TQString KKioDrop::server() const -{ - return _kurl->host(); -} -int KKioDrop::port() const -{ - return _kurl->port(); -} - -TQString KKioDrop::user() const -{ - return _kurl->user(); -} -TQString KKioDrop::password() const -{ - return _password ; -} -TQString KKioDrop::mailbox() const -{ - return _kurl->path(); -} -TQString KKioDrop::auth() const -{ - return ( _metadata->contains("auth")?(*_metadata)["auth"]:"" ); -} - -void KKioDrop::recheck() -{ - if( _protocol->configName() == "process" ) //Process isn't pollable - { - emit rechecked(); - return; - } - - _count->count( this ); - - return; -} - -void KKioDrop::forceRecheck() -{ - if( _protocol->configName() == "process" ) - return; - - _count->stopActiveCount(); - _count->count( this ); - - return; -} - -bool KKioDrop::valid() -{ - return _valid && _count->valid() && _subjects->valid(); -} - -KKioDrop::~KKioDrop() -{ - delete _count; - delete _subjects; - delete _kurl; - delete _metadata; - delete _mailurls; -} - -bool KKioDrop::canReadSubjects( ) -{ - return (_protocol!=0?_protocol->canReadSubjects():false); -} - -TQValueVector * KKioDrop::doReadSubjects(bool * ) -{ - _subjects->doReadSubjects( this ); - - /* - * A empty TQValueVector is made here. - * After that, the size is expanded to the expected number of subjects. - * This way, reallocation of memmory is minimized, and thus more efficient. - */ - TQValueVector *vector = new TQValueVector( ); - vector->reserve( _mailurls->count() ); - return vector; -} - -bool KKioDrop::canReadMail( ) -{ - return (_protocol!=0?_protocol->canReadMail():false); -} - -bool KKioDrop::deleteMails(TQPtrList * ids, bool * /*stop*/) -{ - _delete->deleteMails( ids, this ); - return _delete->valid(); -} - -bool KKioDrop::canDeleteMails () -{ - return (_protocol!=0?_protocol->canDeleteMail():false); -} - -TQString KKioDrop::readMail(const KornMailId * item, bool * ) -{ - _read->readMail( item, this ); - - return ""; -} - -KMailDrop* KKioDrop::clone() const -{ - KKioDrop *clone = new KKioDrop; - - *clone = *this; - - return clone; -} - -bool KKioDrop::readConfigGroup( const TQMap< TQString, TQString > &map, const Protocol* protocol ) -{ - TQString val, val2; - - if( !map.contains( "server" ) || !map.contains( "port" ) || !map.contains( "ssl" ) || !map.contains( "username" ) || - !map.contains( "mailbox" ) || !map.contains( "password" ) || !map.contains( "metadata" ) || !map.contains( "name" ) ) - { - kdWarning() << "Bug: map niet compleet" << endl; - return false; - } - - this->setName( (*map.find( "name" )).utf8() ); - - _protocol = protocol->getKIOProtocol(); - if( !_protocol ) - _protocol = Protocols::firstProtocol()->getKIOProtocol(); - - val = *map.find( "server" ); - setKioServer( val2, val, (*map.find( "port" )).toInt(), TDEIO::MetaData(), *map.find( "ssl" ) == "true", false ); - - _kurl->setUser( *map.find( "username" ) ); - _kurl->setPath( *map.find( "mailbox" ) ); - - _kurl->setPass( *map.find( "password" ) ); - - TQStringList list = TQStringList::split( ',', *map.find( "metadata" ) ); - TQStringList::Iterator it; - for( it = list.begin(); it != list.end(); ++it ) - { - int split = (*it).find( "=" ); - if( split > 0 ) - _metadata->insert( (*it).left( split ), (*it).right( (*it).length() - split - 1 ) ); - } - - _valid = true; - emitValidChanged(); - - return true; -} - -bool KKioDrop::writeConfigGroup( TDEConfigBase& cfg ) const -{ - KPollableDrop::writeConfigGroup( cfg ); - /*TQString p; - - if( _kurl->hasPass() ) { - p = _kurl->pass(); - //encrypt ( p ); - } - - cfg.writeEntry(fu(ProtoConfigKey), _protocol->configName() ); - if( ( _protocol->fields() | _protocol->urlFields() ) & KIO_Protocol::server ) - cfg.writeEntry(fu(HostConfigKey), _kurl->host() ); - if( ( _protocol->fields() | _protocol->urlFields() ) & KIO_Protocol::port ) - cfg.writeEntry(fu(PortConfigKey), _kurl->port() ); - if( ( _protocol->fields() | _protocol->urlFields() ) & KIO_Protocol::username ) - cfg.writeEntry(fu(UserConfigKey), _kurl->user() ); - if( ( _protocol->fields() | _protocol->urlFields() ) & KIO_Protocol::mailbox ) - cfg.writeEntry(fu(MailboxConfigKey), _kurl->path() ); - if( ( _protocol->fields() | _protocol->urlFields() ) & KIO_Protocol::password ) - cfg.writeEntry(fu(PassConfigKey), p ); - if( ( _protocol->fields() | _protocol->urlFields() ) & KIO_Protocol::auth ) - cfg.writeEntry(fu(AuthConfigKey), auth() ); - */ - return true; -} - -KKioDrop& KKioDrop::operator = ( const KKioDrop& other ) -{ - *_kurl=*other._kurl; - setFreq( other.freq() ); - - if( other._protocol ) - _protocol = other._protocol->getKIOProtocol(); - _ssl = other._ssl; - - return *this; -} - -//Public slots -void KKioDrop::readSubjectsCanceled() -{ - _subjects->cancelled(); -} - -void KKioDrop::readMailCanceled() -{ - _read->canceled( ); -} - -void KKioDrop::deleteMailsCanceled() -{ - _delete->canceled( ); -} - -//Private slots for displaying connection errors -void KKioDrop::slotConnectionError( int number, const TQString& arg ) -{ - kdError() << TDEIO::buildErrorString( number, arg ) << endl; -// if( passivePopup() ) - emitShowPassivePopup( TDEIO::buildErrorString( number, arg ) ); -} - -void KKioDrop::slotConnectionWarning( const TQString& msg ) -{ - kdWarning() << msg << endl; -} - -void KKioDrop::slotConnectionInfoMessage( const TQString& msg ) -{ - kdDebug() << msg << endl; //Display only in debug modes -} - -//Private slots - -//The next functions are needed for process maildrops. -bool KKioDrop::startProcess() -{ //code copyied from edrop.cpp - - if( _protocol->configName() != "process" ) - return true; - - if( _process != 0 ) { - return false; - } - - // debug( "proc start: %s", _command.data() ); - - _process = new TDEProcess; - _process->setUseShell( true ); - - // only reading stdin yet - - connect( _process,TQT_SIGNAL(receivedStdout( TDEProcess *, char *, int)), - this, TQT_SLOT(receivedStdout( TDEProcess *,char *,int)) ); - connect( _process, TQT_SIGNAL(processExited(TDEProcess*)), - this, TQT_SLOT(processExit(TDEProcess*)) ); - *_process << _kurl->path(); - _process->start( TDEProcess::NotifyOnExit, TDEProcess::Stdout ); - - return true; -} - -bool KKioDrop::stopProcess() -{ //code copied from edrop.cpp - if( _protocol->configName() != "process" ) - return true; - - if( _process != 0 ) { - // debug( "proc stop" ); - _process->kill( SIGHUP ); - delete _process; - _process = 0; - } - - return true; -} - -void KKioDrop::receivedStdout( TDEProcess *proc, char * buffer, int /*len*/ ) -{ - assert(static_cast(proc) == static_cast(_process)); - - //Original code - /*char *buf = new char[ len + 1 ]; - memcpy( buf, buffer, len ); - buf[ len ] = '\0'; - - char *ptr = buf, *start = buf; - int num = 0; - - while( *ptr ) { - // find number - while( *ptr && !isdigit( *ptr ) ) { - ptr++; - } - start = ptr; - if( *ptr == 0 ) { - break; - } - - // find end - while( *ptr && isdigit( *ptr ) ) { - ptr++; - } - - // atoi number - char back = *ptr; - *ptr = 0; - num = atoi( start ); - *ptr = back; - } - - emit changed( num ); - delete [] buf;*/ - - //Alternatieve code - TQString buf = buffer; - TQRegExp regexp( "^(.*\\D+|\\D*)(\\d+)\\D*$" ); - - if( regexp.search( buf ) == 0 ) - { //Number found - emit changed( regexp.cap( 2 ).toInt(), this ); - } - - -} - -void KKioDrop::processExit(TDEProcess* proc) -{ - assert(static_cast(proc) == static_cast(_process)); - - _process = 0; - -// debug( "proc exited" ); -} - -const char *KKioDrop::ProtoConfigKey = "protocol"; -const char *KKioDrop::HostConfigKey = "server"; -const char *KKioDrop::PortConfigKey = "port"; -const char *KKioDrop::UserConfigKey = "username"; -const char *KKioDrop::PassConfigKey = "password"; -const char *KKioDrop::MailboxConfigKey = "mailbox"; -const char *KKioDrop::SavePassConfigKey = "savepass"; -const char *KKioDrop::MetadataConfigKey = "metadata"; - -#include "kio.moc" diff --git a/korn/kio.h b/korn/kio.h deleted file mode 100644 index a2ac796a2..000000000 --- a/korn/kio.h +++ /dev/null @@ -1,208 +0,0 @@ -/* - * Copyright (C) Kurt Granroth - * Copyright (C) 2004, Mart Kelder (mart.kde@hccnet.nl) - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/* - * kio.h -- Declaration of class KKIODrop. - */ -#ifndef KEG_KIODROP_H -#define KEG_KIODROP_H - -#include "polldrop.h" - -class TQWidget; -class KDropDialog; -class KornMailSubject; -class TDEProcess; -class KIO_Count; -class KIO_Protocol; -class KIO_Subjects; -class KIO_Read; -class KIO_Delete; -class TDEConfigGroup; -class KURL; -template class TQPtrList; -template class TQValueList; -namespace TDEIO { class Job; class MetaData; class Slave; class TransferJob; } - -/** - * Polling monitor for IMAP4 maildrops. - * @author Kurt Granroth (granroth@kde.org) - * Changes to poll with KIO - * @author Mart Kelder (mart.kde@hccnet.nl) - * $version $Id$ - */ -class KKioDrop : public KPollableDrop -{ - Q_OBJECT - -private: - KURL *_kurl; - TDEIO::MetaData *_metadata; - - TQString _password; - - bool _valid; - - const KIO_Protocol * _protocol; - bool _ssl; - - KIO_Count *_count; - KIO_Subjects *_subjects; - KIO_Read *_read; - KIO_Delete *_delete; - - int _readSubjectsTotalSteps; - int _deleteMailsTotalSteps; - //For process - TDEProcess *_process; - - //List of mailurls fetched by the last time emails were counted - struct FileInfo { - TQString name; - long size; - }; - TQValueList *_mailurls; - - /* - * The help-classes of this functions are friend functions, because this way, they can - * access the _kurl and _metadata-values without a function; and this way, no signal or - * public functions are neccesairy to emit a signal from KKioDrop. - */ - friend class KIO_Count; - friend class KIO_Subjects; - friend class KIO_Read; - friend class KIO_Delete; - friend class KIO_Single_Subjects; -public: - static const char *ProtoConfigKey; - static const char *HostConfigKey; - static const char *PortConfigKey; - static const char *UserConfigKey; - static const char *MailboxConfigKey; - static const char *PassConfigKey; - static const char *SavePassConfigKey; - static const char *MetadataConfigKey; - -public: - /** - * KKioDrop Constructor - */ - KKioDrop(); - KKioDrop( TDEConfigGroup* ); - - /** - * Set the server that will be checked for new mail. - */ - void setKioServer( const TQString & proto, const TQString & server, int port = -1 ); - void setKioServer( const TQString & proto, const TQString & server, int port, - const TDEIO::MetaData metadata, bool ssl, bool setProtocol = true ); //Last argument inits _protocol - - /** Set the account information for the PROTO server. */ - void setUser( const TQString & user, const TQString & password, const TQString & mailbox, const TQString & auth ); - - // The next functions return settings - TQString protocol() const; - TQString server() const; - int port() const; - - TQString user() const; - TQString password() const; - TQString mailbox() const; - TQString auth() const; - - virtual void recheck(); - virtual void forceRecheck(); - - virtual bool valid(); - - /** - * KKioDrop Destructor - */ - virtual ~KKioDrop(); - - virtual bool canReadSubjects(void); - virtual TQValueVector * doReadSubjects(bool * stop); - - virtual bool canDeleteMails(); - virtual bool deleteMails(TQPtrList * ids, bool * stop); - - virtual bool canReadMail (); - virtual TQString readMail(const KornMailId * id, bool * stop); - - virtual KMailDrop* clone () const ; - virtual bool readConfigGroup ( const TQMap< TQString, TQString >& map, const Protocol * protocol ); - virtual bool writeConfigGroup ( TDEConfigBase& cfg ) const; - virtual TQString type() const { return TQString::fromUtf8("kio"); } - - virtual bool synchrone() const { return false; } //class is not synchrone - - //virtual void addConfigPage( KDropCfgDialog * ); - - virtual bool asynchrone() const { return true; } - -private: - KKioDrop& operator = ( const KKioDrop& ); - //static void encrypt( TQString& str ); - //static void decrypt( TQString& str ); - - /* - * The next functions are called from the help-classes (which are friend of the class). - * The only thing this functions do is emitting signals. - */ - void emitRechecked() { emit rechecked(); } - void emitChanged( int value ) { emit changed( value, this ); } - - void emitReadSubjectsReady( bool success ) { emit readSubjectsReady( success ); } - void emitReadSubjectsRead( KornMailSubject * subject ) { emit readSubject( subject ); } - void emitReadSubjectsTotalSteps( int value ) { _readSubjectsTotalSteps = value; emit readSubjectsTotalSteps( value ); } - void emitReadSubjectsProgress( int value ) { emit readSubjectsProgress( _readSubjectsTotalSteps - value ); } - - void emitReadMailReady( TQString* msg ) { emit readMailReady( msg ); } - - void emitDeleteMailsReady( bool value ) { emit deleteMailsReady( value ); } - void emitDeleteMailsTotalSteps( int value ) { _deleteMailsTotalSteps = value; emit deleteMailsTotalSteps( value ); } - void emitDeleteMailsProgress( int value ) { emit deleteMailsProgress( _deleteMailsTotalSteps - value ); } - - void emitShowPassivePopup( TQPtrList< KornMailSubject > *subject, int total ) - { emit showPassivePopup( subject, total, passiveDate(), this->realName() ); } - void emitShowPassivePopup( const TQString& error ) - { if( passivePopup() ) { emit showPassivePopup( error, this->realName() ); } } - void emitValidChanged() { emit validChanged( valid() ); } - -private slots: - void slotConnectionError( int, const TQString& ); - void slotConnectionWarning( const TQString& ); - void slotConnectionInfoMessage( const TQString& ); - -protected: - //The next functions are needed for Process; - virtual bool startProcess(); - virtual bool stopProcess(); - -public slots: - virtual void readSubjectsCanceled(); - virtual void readMailCanceled(); - virtual void deleteMailsCanceled(); - -private slots: - //For Process too - void processExit(TDEProcess*); - void receivedStdout( TDEProcess *, char *, int); -}; -#endif // KEG_KIODROP_H diff --git a/korn/kmail_proto.cpp b/korn/kmail_proto.cpp index a3fddad33..b53dae5bc 100644 --- a/korn/kmail_proto.cpp +++ b/korn/kmail_proto.cpp @@ -20,7 +20,7 @@ #include "kmail_proto.h" #include "account_input.h" -#include "kio.h" +#include "tdeio.h" #include "password.h" #include "protocols.h" diff --git a/korn/maildir_proto.h b/korn/maildir_proto.h index b06564e9c..bb1b0e8a8 100644 --- a/korn/maildir_proto.h +++ b/korn/maildir_proto.h @@ -25,13 +25,13 @@ * Protocol for (postfix?) maildir * Only tested with a copy of a maildir forder */ -class Maildir_Protocol : public KIO_Protocol +class Maildir_Protocol : public TDEIO_Protocol { public: Maildir_Protocol() {} virtual ~Maildir_Protocol() {} - virtual KIO_Protocol * clone() const { return new Maildir_Protocol; } + virtual TDEIO_Protocol * clone() const { return new Maildir_Protocol; } virtual TQString protocol() const { return "file"; } virtual TQString configName() const { return "maildir"; } diff --git a/korn/maildrop.h b/korn/maildrop.h index e0f1a46d1..9b755d4ab 100644 --- a/korn/maildrop.h +++ b/korn/maildrop.h @@ -314,7 +314,7 @@ class KMailDrop : public TQObject virtual void forceCountZero(); /* - * The next slots are used by kio; the present at this places + * The next slots are used by tdeio; the present at this places * prevent warnings at runtime. */ virtual void readSubjectsCanceled() {} diff --git a/korn/mbox_proto.cpp b/korn/mbox_proto.cpp index eb53449d0..e466c9264 100644 --- a/korn/mbox_proto.cpp +++ b/korn/mbox_proto.cpp @@ -43,5 +43,5 @@ void MBox_Protocol::readEntries( TQMap< TQString, TQString >*, TQMap< TQString, void MBox_Protocol::writeEntries( TQMap< TQString, TQString >* map ) const { - clearFields( map, (KIO_Protocol::Fields)( server | port | username | password | save_password | metadata ) ); + clearFields( map, (TDEIO_Protocol::Fields)( server | port | username | password | save_password | metadata ) ); } diff --git a/korn/mbox_proto.h b/korn/mbox_proto.h index 5375413ce..afeac8183 100644 --- a/korn/mbox_proto.h +++ b/korn/mbox_proto.h @@ -24,7 +24,7 @@ /* * Protocol for mbox */ -class MBox_Protocol : public KIO_Protocol +class MBox_Protocol : public TDEIO_Protocol { public: MBox_Protocol() {} diff --git a/korn/nntp_proto.cpp b/korn/nntp_proto.cpp index bc2f85251..f5c59a775 100644 --- a/korn/nntp_proto.cpp +++ b/korn/nntp_proto.cpp @@ -52,6 +52,6 @@ void Nntp_Protocol::readEntries( TQMap< TQString, TQString >*, TQMap< TQString, void Nntp_Protocol::writeEntries( TQMap< TQString, TQString >* map ) const { - clearFields( map, (KIO_Protocol::Fields)( KIO_Protocol::mailbox | KIO_Protocol::metadata ) ); + clearFields( map, (TDEIO_Protocol::Fields)( TDEIO_Protocol::mailbox | TDEIO_Protocol::metadata ) ); } diff --git a/korn/nntp_proto.h b/korn/nntp_proto.h index d42e26094..91b3b69dc 100644 --- a/korn/nntp_proto.h +++ b/korn/nntp_proto.h @@ -21,13 +21,13 @@ #include "tdeio_proto.h" -class Nntp_Protocol : public KIO_Protocol +class Nntp_Protocol : public TDEIO_Protocol { public: Nntp_Protocol() { } virtual ~Nntp_Protocol() { } - virtual KIO_Protocol * clone() const { return new Nntp_Protocol; } + virtual TDEIO_Protocol * clone() const { return new Nntp_Protocol; } virtual bool connectionBased() const { return true; } diff --git a/korn/polldrop.h b/korn/polldrop.h index b45cdb4da..a1a3bc895 100644 --- a/korn/polldrop.h +++ b/korn/polldrop.h @@ -39,7 +39,7 @@ public: virtual bool startMonitor(); virtual bool stopMonitor(); - virtual bool startProcess() { return true; } //Start en stop-functions for progress; it is not pollable, but a member of kio + virtual bool startProcess() { return true; } //Start en stop-functions for progress; it is not pollable, but a member of tdeio virtual bool stopProcess() { return true; } virtual bool running() { return _timerRunning; }; diff --git a/korn/pop3_proto.cpp b/korn/pop3_proto.cpp index b42a63ec2..732f85cf3 100644 --- a/korn/pop3_proto.cpp +++ b/korn/pop3_proto.cpp @@ -97,6 +97,6 @@ void Pop3_Protocol::writeEntries( TQMap< TQString, TQString >* map ) const map->insert( "metadata", metadata ); - clearFields( map, KIO_Protocol::mailbox ); + clearFields( map, TDEIO_Protocol::mailbox ); } diff --git a/korn/pop3_proto.h b/korn/pop3_proto.h index 8fd0f0019..f3a008894 100644 --- a/korn/pop3_proto.h +++ b/korn/pop3_proto.h @@ -22,13 +22,13 @@ #include "tdeio_proto.h" #include -class Pop3_Protocol : public KIO_Protocol +class Pop3_Protocol : public TDEIO_Protocol { public: Pop3_Protocol() {} virtual ~Pop3_Protocol() {} - virtual KIO_Protocol * clone() const { return new Pop3_Protocol; } + virtual TDEIO_Protocol * clone() const { return new Pop3_Protocol; } virtual bool connectionBased() const { return true; } diff --git a/korn/pop3s_proto.h b/korn/pop3s_proto.h index 4e10dca1f..2fc1afa13 100644 --- a/korn/pop3s_proto.h +++ b/korn/pop3s_proto.h @@ -29,7 +29,7 @@ public: Pop3s_Protocol() {} virtual ~Pop3s_Protocol() {} - virtual KIO_Protocol * clone() const { return new Pop3s_Protocol; } + virtual TDEIO_Protocol * clone() const { return new Pop3s_Protocol; } virtual TQString protocol() const { return "pop3s"; } virtual TQString configName() const { return "pop3s"; } diff --git a/korn/process_proto.cpp b/korn/process_proto.cpp index 2d4885fdf..bb016a863 100644 --- a/korn/process_proto.cpp +++ b/korn/process_proto.cpp @@ -43,5 +43,5 @@ void Process_Protocol::readEntries( TQMap< TQString, TQString >*, TQMap< TQStrin void Process_Protocol::writeEntries( TQMap< TQString, TQString >* map ) const { - clearFields( map, (KIO_Protocol::Fields)( server | port | username | password | save_password | metadata ) ); + clearFields( map, (TDEIO_Protocol::Fields)( server | port | username | password | save_password | metadata ) ); } diff --git a/korn/process_proto.h b/korn/process_proto.h index ddea2a0b0..f446149c4 100644 --- a/korn/process_proto.h +++ b/korn/process_proto.h @@ -21,13 +21,13 @@ #include "tdeio_proto.h" -class Process_Protocol : public KIO_Protocol +class Process_Protocol : public TDEIO_Protocol { public: Process_Protocol() { } virtual ~Process_Protocol() { } - virtual KIO_Protocol * clone() const { return new Process_Protocol; } + virtual TDEIO_Protocol * clone() const { return new Process_Protocol; } virtual TQString protocol() const { return "process"; } virtual TQString configName() const { return "process"; } diff --git a/korn/protocol.h b/korn/protocol.h index 700cd5979..423d1ba0b 100644 --- a/korn/protocol.h +++ b/korn/protocol.h @@ -22,7 +22,7 @@ class AccountInput; class TDEConfigGroup; -class KIO_Protocol; +class TDEIO_Protocol; class KMailDrop; class TQGroupBox; @@ -56,7 +56,7 @@ public: //Functions that return a derived class. //This way, no explicit cast is needed - virtual const KIO_Protocol* getKIOProtocol() const { return 0; } + virtual const TDEIO_Protocol* getKIOProtocol() const { return 0; } }; #endif //PROTOCOL_H diff --git a/korn/qmail_proto.cpp b/korn/qmail_proto.cpp index c902ad497..96452d44b 100644 --- a/korn/qmail_proto.cpp +++ b/korn/qmail_proto.cpp @@ -45,5 +45,5 @@ void TQMail_Protocol::readEntries( TQMap< TQString, TQString >*, TQMap< TQString void TQMail_Protocol::writeEntries( TQMap< TQString, TQString >* map ) const { - clearFields( map, (KIO_Protocol::Fields)( server | port | username | password | save_password | metadata ) ); + clearFields( map, (TDEIO_Protocol::Fields)( server | port | username | password | save_password | metadata ) ); } diff --git a/korn/qmail_proto.h b/korn/qmail_proto.h index 60483b7ec..090ff09b1 100644 --- a/korn/qmail_proto.h +++ b/korn/qmail_proto.h @@ -21,13 +21,13 @@ #include "tdeio_proto.h" -class TQMail_Protocol : public KIO_Protocol +class TQMail_Protocol : public TDEIO_Protocol { public: TQMail_Protocol() {} virtual ~TQMail_Protocol() {} - virtual KIO_Protocol * clone() const { return new TQMail_Protocol; } + virtual TDEIO_Protocol * clone() const { return new TQMail_Protocol; } virtual bool connectionBased() const { return false; } diff --git a/korn/stringid.h b/korn/stringid.h index f60b21d21..1c6376906 100644 --- a/korn/stringid.h +++ b/korn/stringid.h @@ -21,7 +21,7 @@ /* * This class provides a identification with string, - * because in KIO, I don't know if emails return in the same order. + * because in TDEIO, I don't know if emails return in the same order. * Author Mart Kelder */ diff --git a/korn/tdeconf_update/Makefile.am b/korn/tdeconf_update/Makefile.am index 214f0c81b..a30fb244d 100644 --- a/korn/tdeconf_update/Makefile.am +++ b/korn/tdeconf_update/Makefile.am @@ -8,5 +8,5 @@ tdeconf_PROGRAMS = korn-3-4-config_change tdeconfdir = $(libdir)/tdeconf_update_bin korn_3_4_config_change_SOURCES = korn-3-4-config_change.cpp -korn_3_4_config_change_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_KIO) -ltdetexteditor +korn_3_4_config_change_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_TDEIO) -ltdetexteditor korn_3_4_config_change_LDADD = $(LIB_QT) diff --git a/korn/tdeconf_update/korn-3-4-config_change.cpp b/korn/tdeconf_update/korn-3-4-config_change.cpp index 7eff3ad38..67639362b 100644 --- a/korn/tdeconf_update/korn-3-4-config_change.cpp +++ b/korn/tdeconf_update/korn-3-4-config_change.cpp @@ -77,7 +77,7 @@ void printToprint( TQTextStream &out, TQMap &to_printed, cons { out << "mailbox=" << to_printed[ "command" ] << endl; } - else if( type == "kio" ) + else if( type == "tdeio" ) { out << "host=" << to_printed[ "host" ] << endl; out << "port=" << to_printed[ "port" ] << endl; @@ -202,7 +202,7 @@ int main( int, char** ) { to_printed.insert( key_value.cap( 1 ), key_value.cap( 2 ) ); } - else if( key_value.cap( 1 ) == "type" && key_value.cap( 2 ) != "kio" ) + else if( key_value.cap( 1 ) == "type" && key_value.cap( 2 ) != "tdeio" ) { out << currentGroup2 << endl; if( key_value.cap( 2 ) == "imap4" ) @@ -212,9 +212,9 @@ int main( int, char** ) type = key_value.cap( 2 ); } - else if( key_value.cap( 1 ) == "type" && key_value.cap( 2 ) == "kio" ) + else if( key_value.cap( 1 ) == "type" && key_value.cap( 2 ) == "tdeio" ) { - type = "kio"; + type = "tdeio"; } else if( key_value.cap( 1 ) == "displaystyle" ) { diff --git a/korn/tdeio.cpp b/korn/tdeio.cpp new file mode 100644 index 000000000..faf052141 --- /dev/null +++ b/korn/tdeio.cpp @@ -0,0 +1,561 @@ +/* + * Copyright (C) Sirtaj Singh Kang + * Copyright (C) Kurt Granroth + * Copyright (C) 2004, Mart Kelder (mart.kde@hccnet.nl) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/* + * tdeio.cpp -- Implementation of class KKIODrop. + * It is copyied from imap.cpp, with was writed by: + * Author: Kurt Granroth + * Version: $Id$ + * Changed by: + * Mart Kelder , 2004 + */ + +#include "tdeio.h" +#include "tdeio_count.h" +#include "tdeio_subjects.h" +#include "tdeio_read.h" +#include "tdeio_delete.h" +#include "protocol.h" +#include "protocols.h" +#include "stringid.h" +#include"utils.h" +//#include"kiocfg.h" +//#include"dropdlg.h" +#include "mailsubject.h" + +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include + +//Headers of protocols +#include"tdeio_proto.h" +//#include"pop3_proto.h" +//#include"pop3s_proto.h" +//#include"imap_proto.h" +//#include"imaps_proto.h" +//#include"nntp_proto.h" +//#include"maildir_proto.h" +//#include"qmail_proto.h" +//#include"process_proto.h" +#include"mbox_proto.h" + +/* + * The 'process' maildrop is a lot different than the other protocols: + * it haven't a tdeioslave and could not result in file list. To prevent + * trowing it away, that functionality is hacked in this file. + */ + +KKioDrop::KKioDrop() + : KPollableDrop(), + _kurl( 0 ), + _metadata( 0 ), + _valid(false), + _protocol( 0 ), + _ssl(false), + _count( 0 ), + _subjects( 0 ), + _read( 0 ), + _readSubjectsTotalSteps( 0 ), + _deleteMailsTotalSteps( 0 ), + _process( 0 ), + _mailurls( 0 ) +{ + _kurl = new KURL; + _metadata = new TDEIO::MetaData; + + //Initialising protocol; if no protocol is set before first use, it will use the first protocol + _protocol = Protocols::firstProtocol()->getKIOProtocol(); //The first protocol is the default + _kurl->setPort( _protocol->defaultPort( _ssl ) ); + + //Creating children and connect them to the outside world; this class passes the messages for them... + //This class handles all the counting. + _count = new TDEIO_Count( this, "tdeio_count" ); + + //This class is responsible for providing the available subjects + _subjects = new TDEIO_Subjects( this, "tdeio_subjects" ); + + //This class is used when a full message has to be read. + _read = new TDEIO_Read( this, "tdeio_read" ); + + //This class can delete mails. + _delete = new TDEIO_Delete( this, "tdeio_delete" ); + + _mailurls = new TQValueList; +} + +KKioDrop::KKioDrop( TDEConfigGroup* ) + : KPollableDrop(), + _kurl( 0 ), + _metadata( 0 ), + _valid(false), + _protocol( 0 ), + _ssl(false), + _count( 0 ), + _subjects( 0 ), + _read( 0 ), + _readSubjectsTotalSteps( 0 ), + _deleteMailsTotalSteps( 0 ), + _process( 0 ), + _mailurls( 0 ) +{ + _kurl = new KURL; + _metadata = new TDEIO::MetaData; + + //Initialising protocol; if no protocol is set before first use, it will use the first protocol + _protocol = Protocols::firstProtocol()->getKIOProtocol(); //The first protocol is the default + _kurl->setPort( _protocol->defaultPort( _ssl ) ); + + //Creating children and connect them to the outside world; this class passes the messages for them... + //This class handles all the counting. + _count = new TDEIO_Count( this, "tdeio_count" ); + + //This class is responsible for providing the available subjects + _subjects = new TDEIO_Subjects( this, "tdeio_subjects" ); + + //This class is used when a full message has to be read. + _read = new TDEIO_Read( this, "tdeio_read" ); + + //This class can delete mails. + _delete = new TDEIO_Delete( this, "tdeio_delete" ); + + _mailurls = new TQValueList; + + //readConfigGroup( *config ); +} + +void KKioDrop::setKioServer( const TQString & proto, const TQString & server, int port ) +{ + //Settings default for last vars; could not inline because TDEIO::MetaData-object is not defined in header. + setKioServer( proto, server, port, TDEIO::MetaData(), false, true ); +} + +void KKioDrop::setKioServer(const TQString & proto, const TQString & server, int port, const TDEIO::MetaData metadata, bool ssl, + bool setProtocol ) +{ + TQString auth; + + if( port == -1 ) + port = _protocol->defaultPort( ssl ); + + if( setProtocol ) //false if _protocol already made + { + _protocol = Protocols::getProto( proto )->getKIOProtocol(); + + if( ! _protocol ) + _protocol = Protocols::firstProtocol()->getKIOProtocol(); + } + + _kurl->setProtocol( _protocol->protocol( ssl ) ); + _kurl->setHost ( server ); + _kurl->setPort ( port ); + _ssl = ssl; + + //Checking for authentication-settings. + //if( _metadata->contains("auth") ) + //{ + // auth = (*_metadata)["auth"]; + // *_metadata = metadata; + // if( ! _metadata->contains("auth") ) + // (*_metadata)["auth"] = auth; + //} else + *_metadata = metadata; + + _count->stopActiveCount(); +} + +void KKioDrop::setUser(const TQString & user, const TQString & password, + const TQString & mailbox, const TQString & auth ) +{ + _kurl->setUser( user ); + _password = password ; + _kurl->setPass( _password ); + _kurl->setPath( mailbox ); + if( ! auth.isEmpty() && auth != "Plain" ) + (*_metadata)["auth"] = auth; + else if( _metadata->contains( "auth" ) ) + _metadata->erase( "auth" ); + + _valid = _kurl->isValid(); + emit validChanged( valid() ); + + if( ! _valid ) + kdWarning() << i18n( "url is not valid" ) << endl; + + _count->stopActiveCount(); +} + +TQString KKioDrop::protocol() const +{ + return _protocol->configName(); +} + +TQString KKioDrop::server() const +{ + return _kurl->host(); +} +int KKioDrop::port() const +{ + return _kurl->port(); +} + +TQString KKioDrop::user() const +{ + return _kurl->user(); +} +TQString KKioDrop::password() const +{ + return _password ; +} +TQString KKioDrop::mailbox() const +{ + return _kurl->path(); +} +TQString KKioDrop::auth() const +{ + return ( _metadata->contains("auth")?(*_metadata)["auth"]:"" ); +} + +void KKioDrop::recheck() +{ + if( _protocol->configName() == "process" ) //Process isn't pollable + { + emit rechecked(); + return; + } + + _count->count( this ); + + return; +} + +void KKioDrop::forceRecheck() +{ + if( _protocol->configName() == "process" ) + return; + + _count->stopActiveCount(); + _count->count( this ); + + return; +} + +bool KKioDrop::valid() +{ + return _valid && _count->valid() && _subjects->valid(); +} + +KKioDrop::~KKioDrop() +{ + delete _count; + delete _subjects; + delete _kurl; + delete _metadata; + delete _mailurls; +} + +bool KKioDrop::canReadSubjects( ) +{ + return (_protocol!=0?_protocol->canReadSubjects():false); +} + +TQValueVector * KKioDrop::doReadSubjects(bool * ) +{ + _subjects->doReadSubjects( this ); + + /* + * A empty TQValueVector is made here. + * After that, the size is expanded to the expected number of subjects. + * This way, reallocation of memmory is minimized, and thus more efficient. + */ + TQValueVector *vector = new TQValueVector( ); + vector->reserve( _mailurls->count() ); + return vector; +} + +bool KKioDrop::canReadMail( ) +{ + return (_protocol!=0?_protocol->canReadMail():false); +} + +bool KKioDrop::deleteMails(TQPtrList * ids, bool * /*stop*/) +{ + _delete->deleteMails( ids, this ); + return _delete->valid(); +} + +bool KKioDrop::canDeleteMails () +{ + return (_protocol!=0?_protocol->canDeleteMail():false); +} + +TQString KKioDrop::readMail(const KornMailId * item, bool * ) +{ + _read->readMail( item, this ); + + return ""; +} + +KMailDrop* KKioDrop::clone() const +{ + KKioDrop *clone = new KKioDrop; + + *clone = *this; + + return clone; +} + +bool KKioDrop::readConfigGroup( const TQMap< TQString, TQString > &map, const Protocol* protocol ) +{ + TQString val, val2; + + if( !map.contains( "server" ) || !map.contains( "port" ) || !map.contains( "ssl" ) || !map.contains( "username" ) || + !map.contains( "mailbox" ) || !map.contains( "password" ) || !map.contains( "metadata" ) || !map.contains( "name" ) ) + { + kdWarning() << "Bug: map niet compleet" << endl; + return false; + } + + this->setName( (*map.find( "name" )).utf8() ); + + _protocol = protocol->getKIOProtocol(); + if( !_protocol ) + _protocol = Protocols::firstProtocol()->getKIOProtocol(); + + val = *map.find( "server" ); + setKioServer( val2, val, (*map.find( "port" )).toInt(), TDEIO::MetaData(), *map.find( "ssl" ) == "true", false ); + + _kurl->setUser( *map.find( "username" ) ); + _kurl->setPath( *map.find( "mailbox" ) ); + + _kurl->setPass( *map.find( "password" ) ); + + TQStringList list = TQStringList::split( ',', *map.find( "metadata" ) ); + TQStringList::Iterator it; + for( it = list.begin(); it != list.end(); ++it ) + { + int split = (*it).find( "=" ); + if( split > 0 ) + _metadata->insert( (*it).left( split ), (*it).right( (*it).length() - split - 1 ) ); + } + + _valid = true; + emitValidChanged(); + + return true; +} + +bool KKioDrop::writeConfigGroup( TDEConfigBase& cfg ) const +{ + KPollableDrop::writeConfigGroup( cfg ); + /*TQString p; + + if( _kurl->hasPass() ) { + p = _kurl->pass(); + //encrypt ( p ); + } + + cfg.writeEntry(fu(ProtoConfigKey), _protocol->configName() ); + if( ( _protocol->fields() | _protocol->urlFields() ) & TDEIO_Protocol::server ) + cfg.writeEntry(fu(HostConfigKey), _kurl->host() ); + if( ( _protocol->fields() | _protocol->urlFields() ) & TDEIO_Protocol::port ) + cfg.writeEntry(fu(PortConfigKey), _kurl->port() ); + if( ( _protocol->fields() | _protocol->urlFields() ) & TDEIO_Protocol::username ) + cfg.writeEntry(fu(UserConfigKey), _kurl->user() ); + if( ( _protocol->fields() | _protocol->urlFields() ) & TDEIO_Protocol::mailbox ) + cfg.writeEntry(fu(MailboxConfigKey), _kurl->path() ); + if( ( _protocol->fields() | _protocol->urlFields() ) & TDEIO_Protocol::password ) + cfg.writeEntry(fu(PassConfigKey), p ); + if( ( _protocol->fields() | _protocol->urlFields() ) & TDEIO_Protocol::auth ) + cfg.writeEntry(fu(AuthConfigKey), auth() ); + */ + return true; +} + +KKioDrop& KKioDrop::operator = ( const KKioDrop& other ) +{ + *_kurl=*other._kurl; + setFreq( other.freq() ); + + if( other._protocol ) + _protocol = other._protocol->getKIOProtocol(); + _ssl = other._ssl; + + return *this; +} + +//Public slots +void KKioDrop::readSubjectsCanceled() +{ + _subjects->cancelled(); +} + +void KKioDrop::readMailCanceled() +{ + _read->canceled( ); +} + +void KKioDrop::deleteMailsCanceled() +{ + _delete->canceled( ); +} + +//Private slots for displaying connection errors +void KKioDrop::slotConnectionError( int number, const TQString& arg ) +{ + kdError() << TDEIO::buildErrorString( number, arg ) << endl; +// if( passivePopup() ) + emitShowPassivePopup( TDEIO::buildErrorString( number, arg ) ); +} + +void KKioDrop::slotConnectionWarning( const TQString& msg ) +{ + kdWarning() << msg << endl; +} + +void KKioDrop::slotConnectionInfoMessage( const TQString& msg ) +{ + kdDebug() << msg << endl; //Display only in debug modes +} + +//Private slots + +//The next functions are needed for process maildrops. +bool KKioDrop::startProcess() +{ //code copyied from edrop.cpp + + if( _protocol->configName() != "process" ) + return true; + + if( _process != 0 ) { + return false; + } + + // debug( "proc start: %s", _command.data() ); + + _process = new TDEProcess; + _process->setUseShell( true ); + + // only reading stdin yet + + connect( _process,TQT_SIGNAL(receivedStdout( TDEProcess *, char *, int)), + this, TQT_SLOT(receivedStdout( TDEProcess *,char *,int)) ); + connect( _process, TQT_SIGNAL(processExited(TDEProcess*)), + this, TQT_SLOT(processExit(TDEProcess*)) ); + *_process << _kurl->path(); + _process->start( TDEProcess::NotifyOnExit, TDEProcess::Stdout ); + + return true; +} + +bool KKioDrop::stopProcess() +{ //code copied from edrop.cpp + if( _protocol->configName() != "process" ) + return true; + + if( _process != 0 ) { + // debug( "proc stop" ); + _process->kill( SIGHUP ); + delete _process; + _process = 0; + } + + return true; +} + +void KKioDrop::receivedStdout( TDEProcess *proc, char * buffer, int /*len*/ ) +{ + assert(static_cast(proc) == static_cast(_process)); + + //Original code + /*char *buf = new char[ len + 1 ]; + memcpy( buf, buffer, len ); + buf[ len ] = '\0'; + + char *ptr = buf, *start = buf; + int num = 0; + + while( *ptr ) { + // find number + while( *ptr && !isdigit( *ptr ) ) { + ptr++; + } + start = ptr; + if( *ptr == 0 ) { + break; + } + + // find end + while( *ptr && isdigit( *ptr ) ) { + ptr++; + } + + // atoi number + char back = *ptr; + *ptr = 0; + num = atoi( start ); + *ptr = back; + } + + emit changed( num ); + delete [] buf;*/ + + //Alternatieve code + TQString buf = buffer; + TQRegExp regexp( "^(.*\\D+|\\D*)(\\d+)\\D*$" ); + + if( regexp.search( buf ) == 0 ) + { //Number found + emit changed( regexp.cap( 2 ).toInt(), this ); + } + + +} + +void KKioDrop::processExit(TDEProcess* proc) +{ + assert(static_cast(proc) == static_cast(_process)); + + _process = 0; + +// debug( "proc exited" ); +} + +const char *KKioDrop::ProtoConfigKey = "protocol"; +const char *KKioDrop::HostConfigKey = "server"; +const char *KKioDrop::PortConfigKey = "port"; +const char *KKioDrop::UserConfigKey = "username"; +const char *KKioDrop::PassConfigKey = "password"; +const char *KKioDrop::MailboxConfigKey = "mailbox"; +const char *KKioDrop::SavePassConfigKey = "savepass"; +const char *KKioDrop::MetadataConfigKey = "metadata"; + +#include "tdeio.moc" diff --git a/korn/tdeio.h b/korn/tdeio.h new file mode 100644 index 000000000..2f8f2d8e1 --- /dev/null +++ b/korn/tdeio.h @@ -0,0 +1,208 @@ +/* + * Copyright (C) Kurt Granroth + * Copyright (C) 2004, Mart Kelder (mart.kde@hccnet.nl) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/* + * tdeio.h -- Declaration of class KKIODrop. + */ +#ifndef KEG_TDEIODROP_H +#define KEG_TDEIODROP_H + +#include "polldrop.h" + +class TQWidget; +class KDropDialog; +class KornMailSubject; +class TDEProcess; +class TDEIO_Count; +class TDEIO_Protocol; +class TDEIO_Subjects; +class TDEIO_Read; +class TDEIO_Delete; +class TDEConfigGroup; +class KURL; +template class TQPtrList; +template class TQValueList; +namespace TDEIO { class Job; class MetaData; class Slave; class TransferJob; } + +/** + * Polling monitor for IMAP4 maildrops. + * @author Kurt Granroth (granroth@kde.org) + * Changes to poll with TDEIO + * @author Mart Kelder (mart.kde@hccnet.nl) + * $version $Id$ + */ +class KKioDrop : public KPollableDrop +{ + Q_OBJECT + +private: + KURL *_kurl; + TDEIO::MetaData *_metadata; + + TQString _password; + + bool _valid; + + const TDEIO_Protocol * _protocol; + bool _ssl; + + TDEIO_Count *_count; + TDEIO_Subjects *_subjects; + TDEIO_Read *_read; + TDEIO_Delete *_delete; + + int _readSubjectsTotalSteps; + int _deleteMailsTotalSteps; + //For process + TDEProcess *_process; + + //List of mailurls fetched by the last time emails were counted + struct FileInfo { + TQString name; + long size; + }; + TQValueList *_mailurls; + + /* + * The help-classes of this functions are friend functions, because this way, they can + * access the _kurl and _metadata-values without a function; and this way, no signal or + * public functions are neccesairy to emit a signal from KKioDrop. + */ + friend class TDEIO_Count; + friend class TDEIO_Subjects; + friend class TDEIO_Read; + friend class TDEIO_Delete; + friend class TDEIO_Single_Subjects; +public: + static const char *ProtoConfigKey; + static const char *HostConfigKey; + static const char *PortConfigKey; + static const char *UserConfigKey; + static const char *MailboxConfigKey; + static const char *PassConfigKey; + static const char *SavePassConfigKey; + static const char *MetadataConfigKey; + +public: + /** + * KKioDrop Constructor + */ + KKioDrop(); + KKioDrop( TDEConfigGroup* ); + + /** + * Set the server that will be checked for new mail. + */ + void setKioServer( const TQString & proto, const TQString & server, int port = -1 ); + void setKioServer( const TQString & proto, const TQString & server, int port, + const TDEIO::MetaData metadata, bool ssl, bool setProtocol = true ); //Last argument inits _protocol + + /** Set the account information for the PROTO server. */ + void setUser( const TQString & user, const TQString & password, const TQString & mailbox, const TQString & auth ); + + // The next functions return settings + TQString protocol() const; + TQString server() const; + int port() const; + + TQString user() const; + TQString password() const; + TQString mailbox() const; + TQString auth() const; + + virtual void recheck(); + virtual void forceRecheck(); + + virtual bool valid(); + + /** + * KKioDrop Destructor + */ + virtual ~KKioDrop(); + + virtual bool canReadSubjects(void); + virtual TQValueVector * doReadSubjects(bool * stop); + + virtual bool canDeleteMails(); + virtual bool deleteMails(TQPtrList * ids, bool * stop); + + virtual bool canReadMail (); + virtual TQString readMail(const KornMailId * id, bool * stop); + + virtual KMailDrop* clone () const ; + virtual bool readConfigGroup ( const TQMap< TQString, TQString >& map, const Protocol * protocol ); + virtual bool writeConfigGroup ( TDEConfigBase& cfg ) const; + virtual TQString type() const { return TQString::fromUtf8("tdeio"); } + + virtual bool synchrone() const { return false; } //class is not synchrone + + //virtual void addConfigPage( KDropCfgDialog * ); + + virtual bool asynchrone() const { return true; } + +private: + KKioDrop& operator = ( const KKioDrop& ); + //static void encrypt( TQString& str ); + //static void decrypt( TQString& str ); + + /* + * The next functions are called from the help-classes (which are friend of the class). + * The only thing this functions do is emitting signals. + */ + void emitRechecked() { emit rechecked(); } + void emitChanged( int value ) { emit changed( value, this ); } + + void emitReadSubjectsReady( bool success ) { emit readSubjectsReady( success ); } + void emitReadSubjectsRead( KornMailSubject * subject ) { emit readSubject( subject ); } + void emitReadSubjectsTotalSteps( int value ) { _readSubjectsTotalSteps = value; emit readSubjectsTotalSteps( value ); } + void emitReadSubjectsProgress( int value ) { emit readSubjectsProgress( _readSubjectsTotalSteps - value ); } + + void emitReadMailReady( TQString* msg ) { emit readMailReady( msg ); } + + void emitDeleteMailsReady( bool value ) { emit deleteMailsReady( value ); } + void emitDeleteMailsTotalSteps( int value ) { _deleteMailsTotalSteps = value; emit deleteMailsTotalSteps( value ); } + void emitDeleteMailsProgress( int value ) { emit deleteMailsProgress( _deleteMailsTotalSteps - value ); } + + void emitShowPassivePopup( TQPtrList< KornMailSubject > *subject, int total ) + { emit showPassivePopup( subject, total, passiveDate(), this->realName() ); } + void emitShowPassivePopup( const TQString& error ) + { if( passivePopup() ) { emit showPassivePopup( error, this->realName() ); } } + void emitValidChanged() { emit validChanged( valid() ); } + +private slots: + void slotConnectionError( int, const TQString& ); + void slotConnectionWarning( const TQString& ); + void slotConnectionInfoMessage( const TQString& ); + +protected: + //The next functions are needed for Process; + virtual bool startProcess(); + virtual bool stopProcess(); + +public slots: + virtual void readSubjectsCanceled(); + virtual void readMailCanceled(); + virtual void deleteMailsCanceled(); + +private slots: + //For Process too + void processExit(TDEProcess*); + void receivedStdout( TDEProcess *, char *, int); +}; +#endif // KEG_TDEIODROP_H diff --git a/korn/tdeio_count.cpp b/korn/tdeio_count.cpp index 8ad07dcfc..515e322be 100644 --- a/korn/tdeio_count.cpp +++ b/korn/tdeio_count.cpp @@ -18,7 +18,7 @@ #include "tdeio_count.h" -#include "kio.h" +#include "tdeio.h" #include "tdeio_proto.h" #include "tdeio_single_subject.h" #include "mailsubject.h" @@ -34,7 +34,7 @@ #include -KIO_Count::KIO_Count( TQObject * parent, const char * name ) +TDEIO_Count::TDEIO_Count( TQObject * parent, const char * name ) : TQObject ( parent, name ), _kurl( 0 ), _metadata( 0 ), @@ -47,21 +47,21 @@ KIO_Count::KIO_Count( TQObject * parent, const char * name ) { } -KIO_Count::~KIO_Count() +TDEIO_Count::~TDEIO_Count() { // Delete copies of urls. delete _kurl; delete _metadata; } -void KIO_Count::count( KKioDrop *drop ) +void TDEIO_Count::count( KKioDrop *drop ) { if( _new_mailurls ) return; //A counting is pending, so no new one is started. delete _kurl; delete _metadata; - _kio = drop; + _tdeio = drop; /* * Saving current settings: all actions are asynchroon, so if someone @@ -69,9 +69,9 @@ void KIO_Count::count( KKioDrop *drop ) * finished with counten. To be able to track back te staring values; * these are saved in the class. */ - _kurl = new KURL( *_kio->_kurl ); - _metadata = new TDEIO::MetaData( *_kio->_metadata ); - _protocol = _kio->_protocol; + _kurl = new KURL( *_tdeio->_kurl ); + _metadata = new TDEIO::MetaData( *_tdeio->_metadata ); + _protocol = _tdeio->_protocol; KURL kurl = *_kurl; TDEIO::MetaData metadata = *_metadata; @@ -82,22 +82,22 @@ void KIO_Count::count( KKioDrop *drop ) _protocol->recheckConnectKURL( kurl, metadata ); if( kurl.port() == 0 ) - kurl.setPort( _protocol->defaultPort( _kio->_ssl ) ); + kurl.setPort( _protocol->defaultPort( _tdeio->_ssl ) ); if( ! ( _slave = TDEIO::Scheduler::getConnectedSlave( kurl, metadata ) ) ) //Forcing reload { - kdWarning() << i18n( "Not able to open a kio slave for %1." ).arg( _protocol->configName() ) << endl; - _kio->emitShowPassivePopup( i18n( "Not able to open a kio slave for %1." ).arg( _protocol->configName() ) ); + kdWarning() << i18n( "Not able to open a tdeio slave for %1." ).arg( _protocol->configName() ) << endl; + _tdeio->emitShowPassivePopup( i18n( "Not able to open a tdeio slave for %1." ).arg( _protocol->configName() ) ); _valid = false; - _kio->emitValidChanged(); + _tdeio->emitValidChanged(); _slave = 0; //delete _new_mailurls; _new_mailurls = 0; //No connection pending return; } - connect( _slave, TQT_SIGNAL( error( int, const TQString& ) ), _kio, TQT_SLOT( slotConnectionError( int, const TQString& ) ) ); - connect( _slave, TQT_SIGNAL( warning( const TQString& ) ), _kio, TQT_SLOT( slotConnectionWarning( const TQString& ) ) ); - connect( _slave, TQT_SIGNAL( infoMessage( const TQString& ) ), _kio, TQT_SLOT( slotConnectionInfoMessage( const TQString& ) ) ); + connect( _slave, TQT_SIGNAL( error( int, const TQString& ) ), _tdeio, TQT_SLOT( slotConnectionError( int, const TQString& ) ) ); + connect( _slave, TQT_SIGNAL( warning( const TQString& ) ), _tdeio, TQT_SLOT( slotConnectionWarning( const TQString& ) ) ); + connect( _slave, TQT_SIGNAL( infoMessage( const TQString& ) ), _tdeio, TQT_SLOT( slotConnectionInfoMessage( const TQString& ) ) ); /* * _protocol->recheckConnectKURL could have change kurl and metadata in order to have the right @@ -118,7 +118,7 @@ void KIO_Count::count( KKioDrop *drop ) _protocol->recheckKURL( kurl, metadata ); if( kurl.port() == 0 ) - kurl.setPort( _protocol->defaultPort( _kio->_ssl ) ); + kurl.setPort( _protocol->defaultPort( _tdeio->_ssl ) ); //Making job to fetch file-list @@ -135,7 +135,7 @@ void KIO_Count::count( KKioDrop *drop ) TDEIO::Scheduler::scheduleJob( _job ); } -void KIO_Count::stopActiveCount() +void TDEIO_Count::stopActiveCount() { if( !_new_mailurls ) return; @@ -160,26 +160,26 @@ void KIO_Count::stopActiveCount() delete _new_mailurls; _new_mailurls = 0; } -void KIO_Count::showPassive( const TQString& id ) +void TDEIO_Count::showPassive( const TQString& id ) { - KURL kurl = *_kio->_kurl; - TDEIO::MetaData metadata = *_kio->_metadata; + KURL kurl = *_tdeio->_kurl; + TDEIO::MetaData metadata = *_tdeio->_metadata; kurl = id; //TDEIO::Slave *slave = 0; - _kio->_protocol->readSubjectKURL( kurl, metadata ); + _tdeio->_protocol->readSubjectKURL( kurl, metadata ); if( kurl.port() == 0 ) - kurl.setPort( _kio->_protocol->defaultPort( _kio->_ssl ) ); + kurl.setPort( _tdeio->_protocol->defaultPort( _tdeio->_ssl ) ); - KIO_Single_Subject *subject = new KIO_Single_Subject( this, id.latin1(), kurl, metadata, _kio->_protocol, _slave, id, 0 ); + TDEIO_Single_Subject *subject = new TDEIO_Single_Subject( this, id.latin1(), kurl, metadata, _tdeio->_protocol, _slave, id, 0 ); _subjects_pending++; connect( subject, TQT_SIGNAL( readSubject( KornMailSubject* ) ), this, TQT_SLOT( addtoPassivePopup( KornMailSubject* ) ) ); - connect( subject, TQT_SIGNAL( finished( KIO_Single_Subject* ) ), this, TQT_SLOT( deleteSingleSubject( KIO_Single_Subject* ) ) ); + connect( subject, TQT_SIGNAL( finished( TDEIO_Single_Subject* ) ), this, TQT_SLOT( deleteSingleSubject( TDEIO_Single_Subject* ) ) ); } -void KIO_Count::disconnectSlave() +void TDEIO_Count::disconnectSlave() { if( _subjects_pending > 0 ) return; //Still getting data @@ -197,7 +197,7 @@ void KIO_Count::disconnectSlave() } //This function is called when fetching is over -void KIO_Count::result( TDEIO::Job* job ) +void TDEIO_Count::result( TDEIO::Job* job ) { //job should be the latest job; elsewise: print an error. if( job != _job ) @@ -207,10 +207,10 @@ void KIO_Count::result( TDEIO::Job* job ) //This could be very useful by resolving bugs. if( job->error() ) { - kdError() << i18n( "The next KIO-error occurred by counting: %1" ).arg( job->errorString() ) << endl; - _kio->emitShowPassivePopup( i18n( "The next KIO-error occurred by counting: %1" ).arg( job->errorString() ) ); + kdError() << i18n( "The next TDEIO-error occurred by counting: %1" ).arg( job->errorString() ) << endl; + _tdeio->emitShowPassivePopup( i18n( "The next TDEIO-error occurred by counting: %1" ).arg( job->errorString() ) ); _valid = false; - _kio->emitValidChanged(); + _tdeio->emitValidChanged(); } disconnect( job, TQT_SIGNAL( result( TDEIO::Job* ) ), this, TQT_SLOT( result( TDEIO::Job* ) ) ); @@ -223,24 +223,24 @@ void KIO_Count::result( TDEIO::Job* job ) delete _kurl; _kurl = 0; delete _metadata; _metadata = 0; - if( _kio->_mailurls->count() != _new_mailurls->count() ) + if( _tdeio->_mailurls->count() != _new_mailurls->count() ) { - *_kio->_mailurls = *_new_mailurls; - _kio->emitChanged(_kio->_mailurls->count()); + *_tdeio->_mailurls = *_new_mailurls; + _tdeio->emitChanged(_tdeio->_mailurls->count()); } else { - *_kio->_mailurls = *_new_mailurls; + *_tdeio->_mailurls = *_new_mailurls; } delete _new_mailurls; _new_mailurls = 0; _valid = true; - _kio->emitValidChanged(); - _kio->emitRechecked(); + _tdeio->emitValidChanged(); + _tdeio->emitRechecked(); } -//An file list is ready; now save it in _kio->_mailurls. -void KIO_Count::entries( TDEIO::Job* job, const TDEIO::UDSEntryList &list ) +//An file list is ready; now save it in _tdeio->_mailurls. +void TDEIO_Count::entries( TDEIO::Job* job, const TDEIO::UDSEntryList &list ) { TQStringList old_list; TDEIO::UDSEntryListConstIterator it1 ; @@ -253,7 +253,7 @@ void KIO_Count::entries( TDEIO::Job* job, const TDEIO::UDSEntryList &list ) if( job != _job ) kdError() << i18n( "Got unknown job; something must be wrong..." ) << endl; - for( TQValueListConstIterator it = _kio->_mailurls->begin(); it != _kio->_mailurls->end(); ++it ) + for( TQValueListConstIterator it = _tdeio->_mailurls->begin(); it != _tdeio->_mailurls->end(); ++it ) old_list.append( (*it).name ); for ( it1 = list.begin() ; it1 != list.end() ; it1++ ) @@ -292,13 +292,13 @@ void KIO_Count::entries( TDEIO::Job* job, const TDEIO::UDSEntryList &list ) if( ! fileinfo.name.isNull() && isFile ) { _new_mailurls->append( fileinfo ); - if( ! old_list.contains( fileinfo.name ) && _kio->passivePopup() ) + if( ! old_list.contains( fileinfo.name ) && _tdeio->passivePopup() ) showPassive( fileinfo.name ); } } } -void KIO_Count::addtoPassivePopup( KornMailSubject* subject ) +void TDEIO_Count::addtoPassivePopup( KornMailSubject* subject ) { if( ! _popup_subjects ) { @@ -314,7 +314,7 @@ void KIO_Count::addtoPassivePopup( KornMailSubject* subject ) _total_new_messages++; if( _subjects_pending == 0 ) { - _kio->emitShowPassivePopup( dynamic_cast< TQPtrList* >( _popup_subjects ), _total_new_messages ); + _tdeio->emitShowPassivePopup( dynamic_cast< TQPtrList* >( _popup_subjects ), _total_new_messages ); delete _popup_subjects; _popup_subjects = 0; _total_new_messages = 0; @@ -322,7 +322,7 @@ void KIO_Count::addtoPassivePopup( KornMailSubject* subject ) } } -void KIO_Count::deleteSingleSubject( KIO_Single_Subject* single_subject ) +void TDEIO_Count::deleteSingleSubject( TDEIO_Single_Subject* single_subject ) { delete single_subject; } diff --git a/korn/tdeio_count.h b/korn/tdeio_count.h index e575864e4..512586944 100644 --- a/korn/tdeio_count.h +++ b/korn/tdeio_count.h @@ -23,12 +23,12 @@ #include -#include "kio.h" //Alsewise, no access to KKioDrop::FileInfo (needed in template) +#include "tdeio.h" //Alsewise, no access to KKioDrop::FileInfo (needed in template) #include //FIXME: without this, moc-compiler fails. -class KIO_Protocol; -class KIO_Single_Subject; +class TDEIO_Protocol; +class TDEIO_Single_Subject; class KKioDrop; class KornMailSubject; @@ -41,12 +41,12 @@ class KURL; class TQString; -class KIO_Count : public TQObject +class TDEIO_Count : public TQObject { Q_OBJECT public: - KIO_Count( TQObject * parent = 0, const char * name = 0 ); - ~KIO_Count(); + TDEIO_Count( TQObject * parent = 0, const char * name = 0 ); + ~TDEIO_Count(); //This function starts counting void count( KKioDrop* ); @@ -56,12 +56,12 @@ public: void stopActiveCount(); private: - KKioDrop *_kio; + KKioDrop *_tdeio; TDEIO::ListJob *_job; TDEIO::Slave *_slave; KURL *_kurl; TDEIO::MetaData *_metadata; - const KIO_Protocol *_protocol; + const TDEIO_Protocol *_protocol; bool _valid; TQValueList *_new_mailurls; //entries can come with more function calls. int _subjects_pending; @@ -76,7 +76,7 @@ private slots: void entries( TDEIO::Job*, const TDEIO::UDSEntryList &list ); void addtoPassivePopup( KornMailSubject* ); - void deleteSingleSubject( KIO_Single_Subject* ); + void deleteSingleSubject( TDEIO_Single_Subject* ); }; #endif diff --git a/korn/tdeio_delete.cpp b/korn/tdeio_delete.cpp index 1bb87d258..f26b5fe3d 100644 --- a/korn/tdeio_delete.cpp +++ b/korn/tdeio_delete.cpp @@ -20,7 +20,7 @@ #include "mailid.h" #include "stringid.h" -#include "kio.h" +#include "tdeio.h" #include "tdeio_proto.h" #include @@ -32,8 +32,8 @@ #include -KIO_Delete::KIO_Delete( TQObject * parent, const char * name ) : TQObject( parent, name ), - _kio( 0 ), +TDEIO_Delete::TDEIO_Delete( TQObject * parent, const char * name ) : TQObject( parent, name ), + _tdeio( 0 ), _total( 0 ), _jobs( 0 ), _slave( 0 ), @@ -42,25 +42,25 @@ KIO_Delete::KIO_Delete( TQObject * parent, const char * name ) : TQObject( paren _jobs = new TQPtrList< TDEIO::Job >; } -KIO_Delete::~KIO_Delete( ) +TDEIO_Delete::~TDEIO_Delete( ) { disConnect( ); delete _jobs; } -bool KIO_Delete::deleteMails( TQPtrList< const KornMailId > * ids, KKioDrop *drop ) +bool TDEIO_Delete::deleteMails( TQPtrList< const KornMailId > * ids, KKioDrop *drop ) { KURL kurl = *drop->_kurl; TDEIO::MetaData metadata = *drop->_metadata; - _kio = drop; + _tdeio = drop; _valid = true; //disConnect earlier operations disConnect( ); - if( _kio->_protocol->connectionBased( ) ) + if( _tdeio->_protocol->connectionBased( ) ) { - if( ! setupSlave( kurl, metadata, _kio->_protocol ) ) + if( ! setupSlave( kurl, metadata, _tdeio->_protocol ) ) { _valid = false; return false; @@ -70,24 +70,24 @@ bool KIO_Delete::deleteMails( TQPtrList< const KornMailId > * ids, KKioDrop *dro _total = ids->count( ); for( const KornMailId * item = ids->first(); item; item = ids->next() ) - deleteItem( item, kurl, metadata, _kio->_protocol ); + deleteItem( item, kurl, metadata, _tdeio->_protocol ); if( _jobs->count() == 0 ) { - _kio->emitDeleteMailsReady( true ); + _tdeio->emitDeleteMailsReady( true ); disConnect( ); return true; } - if( _kio->_protocol->commitDelete() ) - commitDelete( kurl, metadata, _kio->_protocol ); + if( _tdeio->_protocol->commitDelete() ) + commitDelete( kurl, metadata, _tdeio->_protocol ); - _kio->emitDeleteMailsTotalSteps( _total ); + _tdeio->emitDeleteMailsTotalSteps( _total ); return true; } -void KIO_Delete::disConnect( ) +void TDEIO_Delete::disConnect( ) { _jobs->clear( ); @@ -98,12 +98,12 @@ void KIO_Delete::disConnect( ) } } -bool KIO_Delete::setupSlave( KURL kurl, TDEIO::MetaData metadata, const KIO_Protocol *& protocol ) +bool TDEIO_Delete::setupSlave( KURL kurl, TDEIO::MetaData metadata, const TDEIO_Protocol *& protocol ) { protocol->deleteMailConnectKURL( kurl, metadata ); if( kurl.port() == 0 ) - kurl.setPort( protocol->defaultPort( _kio->_ssl ) ); + kurl.setPort( protocol->defaultPort( _tdeio->_ssl ) ); if( ! ( _slave = TDEIO::Scheduler::getConnectedSlave( kurl, metadata ) ) ) { @@ -115,7 +115,7 @@ bool KIO_Delete::setupSlave( KURL kurl, TDEIO::MetaData metadata, const KIO_Prot return true; } -void KIO_Delete::deleteItem( const KornMailId *item, KURL kurl, TDEIO::MetaData metadata, const KIO_Protocol *& protocol ) +void TDEIO_Delete::deleteItem( const KornMailId *item, KURL kurl, TDEIO::MetaData metadata, const TDEIO_Protocol *& protocol ) { TDEIO::Job* job = 0; @@ -124,9 +124,9 @@ void KIO_Delete::deleteItem( const KornMailId *item, KURL kurl, TDEIO::MetaData protocol->deleteMailKURL( kurl, metadata ); if( kurl.port() == 0 ) - kurl.setPort( protocol->defaultPort( _kio->_ssl ) ); + kurl.setPort( protocol->defaultPort( _tdeio->_ssl ) ); - if( protocol->deleteFunction() == KIO_Protocol::get ) + if( protocol->deleteFunction() == TDEIO_Protocol::get ) { job = TDEIO::get( kurl, true, false ); @@ -135,7 +135,7 @@ void KIO_Delete::deleteItem( const KornMailId *item, KURL kurl, TDEIO::MetaData else TDEIO::Scheduler::scheduleJob( dynamic_cast< TDEIO::SimpleJob* >( job ) ); } - else if( protocol->deleteFunction() == KIO_Protocol::del ) + else if( protocol->deleteFunction() == TDEIO_Protocol::del ) { job = TDEIO::del( kurl, false, false ); } @@ -152,12 +152,12 @@ void KIO_Delete::deleteItem( const KornMailId *item, KURL kurl, TDEIO::MetaData /* * Some protocols needs to a command to commit protocols. */ -void KIO_Delete::commitDelete( KURL kurl, TDEIO::MetaData metadata, const KIO_Protocol *& protocol ) +void TDEIO_Delete::commitDelete( KURL kurl, TDEIO::MetaData metadata, const TDEIO_Protocol *& protocol ) { protocol->deleteCommitKURL( kurl, metadata ); if( kurl.port() == 0 ) - kurl.setPort( protocol->defaultPort( _kio->_ssl ) ); + kurl.setPort( protocol->defaultPort( _tdeio->_ssl ) ); TDEIO::TransferJob *job = TDEIO::get( kurl, true, false ); job->addMetaData( metadata ); @@ -173,12 +173,12 @@ void KIO_Delete::commitDelete( KURL kurl, TDEIO::MetaData metadata, const KIO_Pr _total++; } -void KIO_Delete::canceled( ) +void TDEIO_Delete::canceled( ) { disConnect( ); } -void KIO_Delete::slotResult( TDEIO::Job* job ) +void TDEIO_Delete::slotResult( TDEIO::Job* job ) { if( job->error() ) { @@ -188,11 +188,11 @@ void KIO_Delete::slotResult( TDEIO::Job* job ) _jobs->remove( job ); - _kio->emitDeleteMailsProgress( _total - _jobs->count() ); + _tdeio->emitDeleteMailsProgress( _total - _jobs->count() ); if( _jobs->isEmpty() ) { - _kio->emitDeleteMailsReady( _valid ); + _tdeio->emitDeleteMailsReady( _valid ); disConnect(); } } diff --git a/korn/tdeio_delete.h b/korn/tdeio_delete.h index c084a58de..3a23f4478 100644 --- a/korn/tdeio_delete.h +++ b/korn/tdeio_delete.h @@ -16,8 +16,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef MK_KIO_DELETE_H -#define MK_KIO_DELETE_H +#ifndef MK_TDEIO_DELETE_H +#define MK_TDEIO_DELETE_H /* * This class handles removing of selected messages. @@ -26,7 +26,7 @@ #include class KKioDrop; -class KIO_Protocol; +class TDEIO_Protocol; class KornMailId; class KURL; @@ -34,13 +34,13 @@ namespace TDEIO { class MetaData; class Job; class Slave; } template class TQPtrList; -class KIO_Delete : public TQObject +class TDEIO_Delete : public TQObject { Q_OBJECT public: //constructors - KIO_Delete( TQObject * parent = 0, const char * name = 0 ); - ~KIO_Delete( ); + TDEIO_Delete( TQObject * parent = 0, const char * name = 0 ); + ~TDEIO_Delete( ); //This function should be called if there are messages to be deleted. bool deleteMails( TQPtrList< const KornMailId > *, KKioDrop* ); @@ -56,15 +56,15 @@ private slots: private: void disConnect( ); - bool setupSlave( KURL kurl, TDEIO::MetaData metadata, const KIO_Protocol *& protocol ); - void deleteItem( const KornMailId *item, KURL, TDEIO::MetaData, const KIO_Protocol *&); - void commitDelete( KURL, TDEIO::MetaData, const KIO_Protocol *& ); + bool setupSlave( KURL kurl, TDEIO::MetaData metadata, const TDEIO_Protocol *& protocol ); + void deleteItem( const KornMailId *item, KURL, TDEIO::MetaData, const TDEIO_Protocol *&); + void commitDelete( KURL, TDEIO::MetaData, const TDEIO_Protocol *& ); - KKioDrop *_kio; + KKioDrop *_tdeio; unsigned int _total; TQPtrList< TDEIO::Job > *_jobs; TDEIO::Slave *_slave; bool _valid; }; -#endif //MK_KIO_DELETE_H +#endif //MK_TDEIO_DELETE_H diff --git a/korn/tdeio_proto.cpp b/korn/tdeio_proto.cpp index c6ebe85cb..cbd97bb6b 100644 --- a/korn/tdeio_proto.cpp +++ b/korn/tdeio_proto.cpp @@ -24,7 +24,7 @@ #include -TQMap< TQString, TQString >* KIO_Protocol::createConfig( TDEConfigGroup * group, const TQString& password ) const +TQMap< TQString, TQString >* TDEIO_Protocol::createConfig( TDEConfigGroup * group, const TQString& password ) const { TQMap< TQString, TQString > *result = new TQMap< TQString, TQString >; @@ -41,7 +41,7 @@ TQMap< TQString, TQString >* KIO_Protocol::createConfig( TDEConfigGroup * group, return result; } -void KIO_Protocol::clearFields( TQMap *map, const KIO_Protocol::Fields fields ) const +void TDEIO_Protocol::clearFields( TQMap *map, const TDEIO_Protocol::Fields fields ) const { if( fields & server ) map->insert( "server", "" ); @@ -59,7 +59,7 @@ void KIO_Protocol::clearFields( TQMap *map, const KIO_Protoc map->insert( "metadata", "" ); } -void KIO_Protocol::readEntries( TQMap< TQString, TQString >* map ) const +void TDEIO_Protocol::readEntries( TQMap< TQString, TQString >* map ) const { TQMap< TQString, TQString> *metadata = new TQMap< TQString, TQString >; diff --git a/korn/tdeio_proto.h b/korn/tdeio_proto.h index 67e673e74..384097683 100644 --- a/korn/tdeio_proto.h +++ b/korn/tdeio_proto.h @@ -16,11 +16,11 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef MK_KIO_PROTO_H -#define MK_KIO_PROTO_H +#ifndef MK_TDEIO_PROTO_H +#define MK_TDEIO_PROTO_H /* - * KIO can handle multiple protocols. But some protocols have their own + * TDEIO can handle multiple protocols. But some protocols have their own * manipulations of KURL or MetaData , and some protocols could do more then other * protocols. So, this class is the generic class of a class specified * by a protocol. @@ -32,20 +32,20 @@ class TQString; #include #include "protocol.h" -#include "kio.h" +#include "tdeio.h" -class KIO_Protocol : public Protocol +class TDEIO_Protocol : public Protocol { public: /* * Constuctor; empty */ - KIO_Protocol() {} + TDEIO_Protocol() {} /* * Destructor; empty too */ - virtual ~KIO_Protocol() {} + virtual ~TDEIO_Protocol() {} /* * Public enumeration @@ -139,7 +139,7 @@ public: virtual void readMailKURL ( KURL &, TDEIO::MetaData & ) const { } - virtual const KIO_Protocol* getKIOProtocol() const { return this; } + virtual const TDEIO_Protocol* getKIOProtocol() const { return this; } virtual void readEntries( TQMap< TQString, TQString >* ) const; virtual void readEntries( TQMap< TQString, TQString >*, TQMap< TQString, TQString >* ) const = 0; @@ -154,4 +154,4 @@ protected: void clearFields( TQMap< TQString, TQString > *map, const Fields fields ) const; }; -#endif //MK_KIO_PROTO_H +#endif //MK_TDEIO_PROTO_H diff --git a/korn/tdeio_read.cpp b/korn/tdeio_read.cpp index 4d8cbf6c0..c34e7429f 100644 --- a/korn/tdeio_read.cpp +++ b/korn/tdeio_read.cpp @@ -18,7 +18,7 @@ #include "tdeio_read.h" -#include "kio.h" +#include "tdeio.h" #include "tdeio_proto.h" #include "mailid.h" #include "stringid.h" @@ -33,7 +33,7 @@ #include #include -KIO_Read::KIO_Read( TQObject * parent, const char * name ) +TDEIO_Read::TDEIO_Read( TQObject * parent, const char * name ) : TQObject( parent, name ), _job( 0 ), _message( 0 ) @@ -41,21 +41,21 @@ KIO_Read::KIO_Read( TQObject * parent, const char * name ) _message = new TQString; } -KIO_Read::~KIO_Read() +TDEIO_Read::~TDEIO_Read() { delete _message; delete _job; } -void KIO_Read::readMail( const KornMailId *& mailid, KKioDrop* drop ) +void TDEIO_Read::readMail( const KornMailId *& mailid, KKioDrop* drop ) { - _kio = drop; - KURL kurl = *_kio->_kurl; - TDEIO::MetaData metadata = *_kio->_metadata; + _tdeio = drop; + KURL kurl = *_tdeio->_kurl; + TDEIO::MetaData metadata = *_tdeio->_metadata; kurl = dynamic_cast(mailid)->getId( ); - _kio->_protocol->readMailKURL( kurl, metadata ); + _tdeio->_protocol->readMailKURL( kurl, metadata ); _job = TDEIO::get( kurl, false, false ); _job->addMetaData( metadata ); @@ -64,14 +64,14 @@ void KIO_Read::readMail( const KornMailId *& mailid, KKioDrop* drop ) connect( _job, TQT_SIGNAL( data( TDEIO::Job*, const TQByteArray& ) ), this, TQT_SLOT( slotData( TDEIO::Job*, const TQByteArray & ) ) ); } -void KIO_Read::canceled( ) +void TDEIO_Read::canceled( ) { if( _job ) delete _job; _job = 0; } -void KIO_Read::slotResult( TDEIO::Job* job ) +void TDEIO_Read::slotResult( TDEIO::Job* job ) { if( job != _job ) kdWarning() << i18n( "Unknown job returned; I will try if this one will do... " ) << endl; @@ -79,13 +79,13 @@ void KIO_Read::slotResult( TDEIO::Job* job ) if( job->error() ) kdWarning() << i18n( "An error occurred when fetching the requested email: %1." ).arg( job->errorString() ) << endl; - _kio->emitReadMailReady( _message ); + _tdeio->emitReadMailReady( _message ); *_message = ""; _job = 0; } -void KIO_Read::slotData( TDEIO::Job* job, const TQByteArray & data ) +void TDEIO_Read::slotData( TDEIO::Job* job, const TQByteArray & data ) { if( job != _job ) kdWarning() << i18n( "Unknown job returned; I will try if this one will do... " ) << endl; diff --git a/korn/tdeio_read.h b/korn/tdeio_read.h index 3b1ddec8e..fc5f9e994 100644 --- a/korn/tdeio_read.h +++ b/korn/tdeio_read.h @@ -16,8 +16,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef MK_KIO_READ_H -#define MK_KIO_READ_H +#ifndef MK_TDEIO_READ_H +#define MK_TDEIO_READ_H //This class should be used if someone wants to read the Full Message @@ -28,16 +28,16 @@ class KornMailId; class KURL; namespace TDEIO { class MetaData; class Job; } -class KIO_Protocol; +class TDEIO_Protocol; class TQString; -class KIO_Read : public TQObject +class TDEIO_Read : public TQObject { Q_OBJECT public: - KIO_Read( TQObject * parent = 0, const char * name = 0 ); - ~KIO_Read(); + TDEIO_Read( TQObject * parent = 0, const char * name = 0 ); + ~TDEIO_Read(); public slots: //This is the function which makes the nessesairy slaves for reading a message @@ -45,7 +45,7 @@ public slots: //This function should be called if the user presses canceled. void canceled(); private: - KKioDrop *_kio; + KKioDrop *_tdeio; TDEIO::Job *_job; TQString *_message; @@ -58,4 +58,4 @@ private slots: void slotData( TDEIO::Job*, const TQByteArray& ); }; -#endif //MK_KIO_READ_H +#endif //MK_TDEIO_READ_H diff --git a/korn/tdeio_single_subject.cpp b/korn/tdeio_single_subject.cpp index 022dac493..3ac765de2 100644 --- a/korn/tdeio_single_subject.cpp +++ b/korn/tdeio_single_subject.cpp @@ -35,8 +35,8 @@ #include #include -KIO_Single_Subject::KIO_Single_Subject( TQObject * parent, const char * name, - KURL &kurl, TDEIO::MetaData &metadata, const KIO_Protocol * protocol, TDEIO::Slave *& slave, +TDEIO_Single_Subject::TDEIO_Single_Subject( TQObject * parent, const char * name, + KURL &kurl, TDEIO::MetaData &metadata, const TDEIO_Protocol * protocol, TDEIO::Slave *& slave, const TQString &url, const long size ) : TQObject( parent, name ) { @@ -50,7 +50,7 @@ KIO_Single_Subject::KIO_Single_Subject( TQObject * parent, const char * name, init( slave ); } -KIO_Single_Subject::~KIO_Single_Subject( ) +TDEIO_Single_Subject::~TDEIO_Single_Subject( ) { if( _job ) TDEIO::Scheduler::cancelJob( _job ); @@ -60,7 +60,7 @@ KIO_Single_Subject::~KIO_Single_Subject( ) delete _message; } -void KIO_Single_Subject::init( TDEIO::Slave *& slave) +void TDEIO_Single_Subject::init( TDEIO::Slave *& slave) { _job = TDEIO::get( *_kurl, false, false ); _job->addMetaData( *_metadata ); @@ -76,7 +76,7 @@ void KIO_Single_Subject::init( TDEIO::Slave *& slave) } -void KIO_Single_Subject::parseMail( TQString * message, KornMailSubject *subject, bool fullMessage ) +void TDEIO_Single_Subject::parseMail( TQString * message, KornMailSubject *subject, bool fullMessage ) { TQTextStream stream( message, IO_ReadOnly ); TQString line; @@ -122,7 +122,7 @@ void KIO_Single_Subject::parseMail( TQString * message, KornMailSubject *subject subject->setHeader( *message, fullMessage ); } -void KIO_Single_Subject::slotData( TDEIO::Job* job, const TQByteArray& data ) +void TDEIO_Single_Subject::slotData( TDEIO::Job* job, const TQByteArray& data ) { if( job != _job ) kdWarning() << i18n( "Got invalid job; something strange happened?" ) << endl; @@ -131,7 +131,7 @@ void KIO_Single_Subject::slotData( TDEIO::Job* job, const TQByteArray& data ) } //TDEIO::Scheduler::disconnectSlave missing if connection stops -void KIO_Single_Subject::slotResult( TDEIO::Job *job ) +void TDEIO_Single_Subject::slotResult( TDEIO::Job *job ) { if( job != _job ) kdWarning() << i18n( "Got invalid job; something strange happened?" ) << endl; diff --git a/korn/tdeio_single_subject.h b/korn/tdeio_single_subject.h index 9aac8baae..616415364 100644 --- a/korn/tdeio_single_subject.h +++ b/korn/tdeio_single_subject.h @@ -16,8 +16,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef MK_KIO_SINGEL_SUBJECT_H -#define MK_KIO_SINGEL_SUBJECT_H +#ifndef MK_TDEIO_SINGEL_SUBJECT_H +#define MK_TDEIO_SINGEL_SUBJECT_H //This function reads a single subject @@ -28,17 +28,17 @@ class KornMailSubject; class KURL; namespace TDEIO { class MetaData; class Job; class TransferJob; class Slave; } -class KIO_Protocol; +class TDEIO_Protocol; class TQString; -class KIO_Single_Subject : public TQObject +class TDEIO_Single_Subject : public TQObject { Q_OBJECT public: - KIO_Single_Subject( TQObject * parent, const char * name, KURL &, TDEIO::MetaData &, const KIO_Protocol *, + TDEIO_Single_Subject( TQObject * parent, const char * name, KURL &, TDEIO::MetaData &, const TDEIO_Protocol *, TDEIO::Slave *&, const TQString &, const long ); - ~KIO_Single_Subject( ); + ~TDEIO_Single_Subject( ); //This functions try's te parse EMail; data, sender names and so on... static void parseMail( TQString * message, KornMailSubject *subject, bool ); @@ -47,7 +47,7 @@ private: TQString *_message; TQString *_name; KURL *_kurl; - const KIO_Protocol *_protocol; + const TDEIO_Protocol *_protocol; TDEIO::MetaData *_metadata; TDEIO::TransferJob* _job; long _size; @@ -62,7 +62,7 @@ signals: //This signal is emitted if the headers are read and put into a KornMailSubject* void readSubject( KornMailSubject* ); //This signal is emitted if this class could be destroyed. - void finished( KIO_Single_Subject* ); + void finished( TDEIO_Single_Subject* ); }; #endif diff --git a/korn/tdeio_subjects.cpp b/korn/tdeio_subjects.cpp index f76a1c99e..985a89e5a 100644 --- a/korn/tdeio_subjects.cpp +++ b/korn/tdeio_subjects.cpp @@ -18,7 +18,7 @@ #include "tdeio_subjects.h" -#include "kio.h" +#include "tdeio.h" #include "tdeio_single_subject.h" #include "tdeio_proto.h" #include "mailsubject.h" @@ -31,20 +31,20 @@ #include #include -KIO_Subjects::KIO_Subjects( TQObject * parent, const char * name ) +TDEIO_Subjects::TDEIO_Subjects( TQObject * parent, const char * name ) : TQObject( parent, name ), _protocol( 0 ), _slave( 0 ), _valid( true ) { - _jobs = new TQPtrList; + _jobs = new TQPtrList; _kurl = new KURL; _metadata = new TDEIO::MetaData; _jobs->setAutoDelete( true ); } -KIO_Subjects::~KIO_Subjects( ) +TDEIO_Subjects::~TDEIO_Subjects( ) { delete _jobs; delete _kurl; @@ -52,15 +52,15 @@ KIO_Subjects::~KIO_Subjects( ) _protocol = 0; } -void KIO_Subjects::doReadSubjects( KKioDrop *drop ) +void TDEIO_Subjects::doReadSubjects( KKioDrop *drop ) { TQValueList::ConstIterator it; TQValueList::ConstIterator end_it = drop->_mailurls->end(); - _kio = drop; - _protocol = _kio->_protocol; - *_kurl = *_kio->_kurl; - *_metadata = *_kio->_metadata; + _tdeio = drop; + _protocol = _tdeio->_protocol; + *_kurl = *_tdeio->_kurl; + *_metadata = *_tdeio->_metadata; if( _jobs->count() > 0 ) kdWarning() << i18n( "Already a slave pending." ) << endl; @@ -71,17 +71,17 @@ void KIO_Subjects::doReadSubjects( KKioDrop *drop ) getConnection( ); //Open jobs for easy item in the list - for( it = _kio->_mailurls->begin(); it != end_it; it++ ) + for( it = _tdeio->_mailurls->begin(); it != end_it; it++ ) startJob( (*it).name, (*it).size ); //close connection for trivial situations (empty list) disConnect( true ); //passing number of subjects for progress bar. - _kio->emitReadSubjectsTotalSteps( _jobs->count() ); + _tdeio->emitReadSubjectsTotalSteps( _jobs->count() ); } -void KIO_Subjects::getConnection( ) +void TDEIO_Subjects::getConnection( ) { KURL kurl = *_kurl; TDEIO::MetaData metadata = *_metadata; @@ -97,43 +97,43 @@ void KIO_Subjects::getConnection( ) _protocol->readSubjectConnectKURL( kurl, metadata ); if( kurl.port() == 0 ) - kurl.setPort( _protocol->defaultPort( _kio->_ssl ) ); + kurl.setPort( _protocol->defaultPort( _tdeio->_ssl ) ); if( ! ( _slave = TDEIO::Scheduler::getConnectedSlave( kurl, metadata ) ) ) { - kdWarning() << i18n( "Not able to open a kio-slave for %1." ).arg( _protocol->configName() ); - _kio->emitShowPassivePopup( i18n( "Not able to open a kio-slave for %1." ).arg( _protocol->configName() ) ); + kdWarning() << i18n( "Not able to open a tdeio-slave for %1." ).arg( _protocol->configName() ); + _tdeio->emitShowPassivePopup( i18n( "Not able to open a tdeio-slave for %1." ).arg( _protocol->configName() ) ); _valid = false; - _kio->emitValidChanged(); + _tdeio->emitValidChanged(); _slave = 0; - _kio->emitReadSubjectsReady( false ); + _tdeio->emitReadSubjectsReady( false ); return; } } } -void KIO_Subjects::startJob( const TQString &name, const long size ) +void TDEIO_Subjects::startJob( const TQString &name, const long size ) { KURL kurl = *_kurl; TDEIO::MetaData metadata = *_metadata; - KIO_Single_Subject *subject; + TDEIO_Single_Subject *subject; kurl = name; _protocol->readSubjectKURL( kurl, metadata ); if( kurl.port() == 0 ) - kurl.setPort( _protocol->defaultPort( _kio->_ssl ) ); + kurl.setPort( _protocol->defaultPort( _tdeio->_ssl ) ); - subject = new KIO_Single_Subject( this, name.latin1(), kurl, metadata, _protocol, _slave, name, size ); + subject = new TDEIO_Single_Subject( this, name.latin1(), kurl, metadata, _protocol, _slave, name, size ); connect( subject, TQT_SIGNAL( readSubject( KornMailSubject* ) ), this, TQT_SLOT( slotReadSubject( KornMailSubject* ) ) ); - connect( subject, TQT_SIGNAL( finished( KIO_Single_Subject* ) ), this, TQT_SLOT( slotFinished( KIO_Single_Subject* ) ) ); + connect( subject, TQT_SIGNAL( finished( TDEIO_Single_Subject* ) ), this, TQT_SLOT( slotFinished( TDEIO_Single_Subject* ) ) ); _jobs->append( subject ); } -void KIO_Subjects::disConnect( bool result ) +void TDEIO_Subjects::disConnect( bool result ) { if( _jobs->isEmpty() ) { @@ -142,33 +142,33 @@ void KIO_Subjects::disConnect( bool result ) TDEIO::Scheduler::disconnectSlave( _slave ); _slave = 0; } - _kio->emitReadSubjectsReady( result ); + _tdeio->emitReadSubjectsReady( result ); } } -void KIO_Subjects::cancelled( ) +void TDEIO_Subjects::cancelled( ) { _jobs->clear(); - //_slave died in cancelJob with is by called from the destructor of KIO_Single_Subject, + //_slave died in cancelJob with is by called from the destructor of TDEIO_Single_Subject, //withs is by called by _jobs->clear because autoRemove equals true. _slave = 0; disConnect( false ); } -void KIO_Subjects::slotReadSubject( KornMailSubject* subject ) +void TDEIO_Subjects::slotReadSubject( KornMailSubject* subject ) { _valid = true; - _kio->emitValidChanged(); - subject->setMailDrop( _kio ); - _kio->emitReadSubjectsRead( subject ); + _tdeio->emitValidChanged(); + subject->setMailDrop( _tdeio ); + _tdeio->emitReadSubjectsRead( subject ); } -void KIO_Subjects::slotFinished( KIO_Single_Subject* item ) +void TDEIO_Subjects::slotFinished( TDEIO_Single_Subject* item ) { //Remove sender.... I didn't know of the computer gonna like me, but it seems he does :) _jobs->remove( item ); - _kio->emitReadSubjectsProgress( _jobs->count( ) ); + _tdeio->emitReadSubjectsProgress( _jobs->count( ) ); disConnect( true ); //Only works when all jobs are finished. } diff --git a/korn/tdeio_subjects.h b/korn/tdeio_subjects.h index 018369de6..bb1f50e00 100644 --- a/korn/tdeio_subjects.h +++ b/korn/tdeio_subjects.h @@ -16,15 +16,15 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef MK_KIO_SUBJECTS_H -#define MK_KIO_SUBJECTS_H +#ifndef MK_TDEIO_SUBJECTS_H +#define MK_TDEIO_SUBJECTS_H //This class calls other class to read all the subjects #include class KKioDrop; -class KIO_Single_Subject; -class KIO_Protocol; +class TDEIO_Single_Subject; +class TDEIO_Protocol; class KornMailSubject; namespace TDEIO { class MetaData; class Slave; } @@ -34,12 +34,12 @@ template class TQPtrList; class TQString; template class TQValueList; -class KIO_Subjects : public TQObject +class TDEIO_Subjects : public TQObject { Q_OBJECT public: - KIO_Subjects( TQObject * parent, const char * name ); - ~KIO_Subjects( ); + TDEIO_Subjects( TQObject * parent, const char * name ); + ~TDEIO_Subjects( ); //This function let it start fetching headers. void doReadSubjects( KKioDrop* ); @@ -48,17 +48,17 @@ public: bool valid( ) { return _valid; } private: - KKioDrop *_kio; + KKioDrop *_tdeio; KURL *_kurl; TDEIO::MetaData *_metadata; - const KIO_Protocol *_protocol; - TQPtrList *_jobs; + const TDEIO_Protocol *_protocol; + TQPtrList *_jobs; TDEIO::Slave *_slave; bool _valid; //Opens a connection. void getConnection( ); - //Start a job; the job itself is executed in KIO_Single_Subject + //Start a job; the job itself is executed in TDEIO_Single_Subject void startJob( const TQString&, const long ); //Disconnect the connection void disConnect( bool ); @@ -69,7 +69,7 @@ public slots: private slots: void slotReadSubject( KornMailSubject* ); - void slotFinished( KIO_Single_Subject* ); + void slotFinished( TDEIO_Single_Subject* ); }; #endif -- cgit v1.2.1