From 5eb58a2799773cfb4b30c2f61d9d8c16b53da558 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Mon, 11 Feb 2013 01:06:45 -0600 Subject: Fix FTBFS --- src/svnfrontend/tdesvnfilelist.cpp | 8 +- src/tdeiosvn/kiobytestream.cpp | 63 ------ src/tdeiosvn/kiobytestream.h | 66 ------ src/tdeiosvn/kiolistener.cpp | 408 ------------------------------------- src/tdeiosvn/kiolistener.h | 83 -------- src/tdeiosvn/tdeiobytestream.cpp | 63 ++++++ src/tdeiosvn/tdeiobytestream.h | 66 ++++++ src/tdeiosvn/tdeiolistener.cpp | 408 +++++++++++++++++++++++++++++++++++++ src/tdeiosvn/tdeiolistener.h | 83 ++++++++ src/tdeiosvn/tdeiosvn.cpp | 4 +- src/tdeiosvn/tdeiosvn.h | 4 +- 11 files changed, 628 insertions(+), 628 deletions(-) delete mode 100644 src/tdeiosvn/kiobytestream.cpp delete mode 100644 src/tdeiosvn/kiobytestream.h delete mode 100644 src/tdeiosvn/kiolistener.cpp delete mode 100644 src/tdeiosvn/kiolistener.h create mode 100644 src/tdeiosvn/tdeiobytestream.cpp create mode 100644 src/tdeiosvn/tdeiobytestream.h create mode 100644 src/tdeiosvn/tdeiolistener.cpp create mode 100644 src/tdeiosvn/tdeiolistener.h (limited to 'src') diff --git a/src/svnfrontend/tdesvnfilelist.cpp b/src/svnfrontend/tdesvnfilelist.cpp index 6af7c8f..2625951 100644 --- a/src/svnfrontend/tdesvnfilelist.cpp +++ b/src/svnfrontend/tdesvnfilelist.cpp @@ -1988,12 +1988,12 @@ void tdesvnfilelist::slotDelete() TQValueList items; TQStringList displist; - KURL::List kioList; + KURL::List tdeioList; while ((cur=liter.current())!=0){ ++liter; if (!cur->isRealVersioned()) { KURL _uri; _uri.setPath(cur->fullName()); - kioList.append(_uri); + tdeioList.append(_uri); } else { items.push_back(cur->fullName()); } @@ -2003,8 +2003,8 @@ void tdesvnfilelist::slotDelete() if (answer!=KMessageBox::Yes) { return; } - if (kioList.count()>0) { - TDEIO::Job*aJob = TDEIO::del(kioList); + if (tdeioList.count()>0) { + TDEIO::Job*aJob = TDEIO::del(tdeioList); connect(aJob,TQT_SIGNAL(result (TDEIO::Job *)),this,TQT_SLOT(slotDeleteFinished(TDEIO::Job*))); dispDummy(); } diff --git a/src/tdeiosvn/kiobytestream.cpp b/src/tdeiosvn/kiobytestream.cpp deleted file mode 100644 index 81c6fc8..0000000 --- a/src/tdeiosvn/kiobytestream.cpp +++ /dev/null @@ -1,63 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2006-2007 by Rajko Albrecht * - * ral@alwins-world.de * - * * - * 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. * - ***************************************************************************/ -#include "kiobytestream.h" - -KioByteStream::KioByteStream(StreamWrittenCb*aCb,const TQString&filename) - : svn::stream::SvnStream(false,true,0L), - m_Cb(aCb),m_Written(0), - m_mimeSend(false),m_Filename(filename) -{ - m_MessageTick.start(); -} - -KioByteStream::~KioByteStream() -{ -} - -bool KioByteStream::isOk() const -{ - return m_Cb != 0; -} - -long KioByteStream::write(const char* data, const unsigned long max) -{ - bool forceInfo = !m_mimeSend; - if (m_Cb) { - if (!m_mimeSend) { - m_mimeSend = true; - array.setRawData(data, max); - KMimeMagicResult * result = KMimeMagic::self()->findBufferFileType(array,m_Filename); - m_Cb->streamSendMime(result); - array.resetRawData(data, max); - m_Cb->streamTotalSizeNull(); - } - array.setRawData(data, max); - m_Cb->streamPushData(array); - array.resetRawData(data, max); - - m_Written+=max; - if (m_MessageTick.elapsed() >=100 || forceInfo) { - m_Cb->streamWritten(m_Written); - m_MessageTick.restart(); - } - return max; - } - return -1; -} diff --git a/src/tdeiosvn/kiobytestream.h b/src/tdeiosvn/kiobytestream.h deleted file mode 100644 index 48addfe..0000000 --- a/src/tdeiosvn/kiobytestream.h +++ /dev/null @@ -1,66 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2006-2007 by Rajko Albrecht * - * ral@alwins-world.de * - * * - * 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. * - ***************************************************************************/ -#ifndef KIOBYTESTREAM_H -#define KIOBYTESTREAM_H - -#include "svnstream.hpp" - -#include -#include -#include -#include -#include - -class StreamWrittenCb -{ -public: - StreamWrittenCb(){} - virtual ~StreamWrittenCb(){} - virtual void streamWritten(const TDEIO::filesize_t current) = 0; - virtual void streamPushData(TQByteArray)=0; - virtual void streamSendMime(KMimeMagicResult*mt)=0; - virtual void streamTotalSizeNull()=0; -}; - -/** - @author Rajko Albrecht -*/ -class KioByteStream : public svn::stream::SvnStream -{ -public: - KioByteStream(StreamWrittenCb*,const TQString&filename); - - ~KioByteStream(); - - virtual bool isOk() const; - virtual long write(const char* data, const unsigned long max); - - TDEIO::filesize_t written(){return m_Written;} - -protected: - StreamWrittenCb*m_Cb; - TDEIO::filesize_t m_Written; - bool m_mimeSend; - TQString m_Filename; - TQByteArray array; - TQTime m_MessageTick; -}; - -#endif diff --git a/src/tdeiosvn/kiolistener.cpp b/src/tdeiosvn/kiolistener.cpp deleted file mode 100644 index f4cd940..0000000 --- a/src/tdeiosvn/kiolistener.cpp +++ /dev/null @@ -1,408 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2005-2007 by Rajko Albrecht * - * ral@alwins-world.de * - * * - * 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. * - ***************************************************************************/ -#include "kiolistener.h" -#include "tdeiosvn.h" - -#include -#include -#include - -namespace TDEIO { - -KioListener::KioListener(TDEIO::tdeio_svnProtocol*_par) - : svn::ContextListener(),m_notifyCounter(0),m_External(false),m_HasChanges(false),m_FirstTxDelta(false),m_Canceld(false) -{ - par = _par; -} - - -KioListener::~KioListener() -{ -} - - - - -/*! - \fn KioListener::contextCancel() - */ -bool KioListener::contextCancel() -{ - return par->wasKilled()||m_Canceld; -} - - -/*! - \fn KioListener::contextGetLogMessage (TQString & msg) - */ -bool KioListener::contextGetLogMessage (TQString & msg,const svn::CommitItemList&_items) -{ -#if 1 - TQByteArray reply; - TQByteArray params; - TQCString replyType; - TQDataStream stream(params,IO_WriteOnly); - - if (_items.count()>0) { - TQMap list; - for (unsigned i = 0;i<_items.count();++i) { - if (_items[i].path().isEmpty()) { - list[_items[i].url()]=TQChar(_items[i].actionType()); - } else { - list[_items[i].path()]=TQChar(_items[i].actionType()); - } - } - stream << list; - if (!par->dcopClient()->call("kded","tdesvnd","get_logmsg(TQMap)",params,replyType,reply)) { - msg = "Communication with dcop failed"; - kdWarning()<dcopClient()->call("kded","tdesvnd","get_logmsg()",params,replyType,reply)) { - msg = "Communication with dcop failed"; - kdWarning()<>lt; - if (lt.count()!=1) { - msg = "Wrong or missing log (may cancel pressed)."; - kdDebug()<< msg << endl; - return false; - } - msg = lt[0]; -#else - msg = "Made with a kio::svn client"; -#endif - return true; -} - -/*! the content of that method is taken from the notify in kio::svn in KDE SDK */ -/* this moment we don't use it full 'cause not all is made via KIO */ -void KioListener::contextNotify (const char * path,svn_wc_notify_action_t action,svn_node_kind_t kind ,const char * mime_type ,svn_wc_notify_state_t content_state, svn_wc_notify_state_t prop_state,svn_revnum_t revision) -{ - if (par->wasKilled()) { - return; - } - TQString userstring; - - switch(action) { - case svn_wc_notify_add: - { - if (mime_type && (svn_mime_type_is_binary (mime_type))) - userstring = i18n( "A (bin) %1" ).arg( path ); - else - userstring = i18n( "A %1" ).arg( path ); - break; - } - break; - case svn_wc_notify_copy: //copy - break; - case svn_wc_notify_delete: //delete - m_HasChanges = TRUE; - userstring = i18n( "D %1" ).arg( path ); - break; - case svn_wc_notify_restore : //restore - userstring=i18n( "Restored %1." ).arg( path ); - break; - case svn_wc_notify_revert : //revert - userstring=i18n( "Reverted %1." ).arg( path ); - break; - case svn_wc_notify_failed_revert: //failed revert - userstring=i18n( "Failed to revert %1.\nTry updating instead." ).arg( path ); - break; - case svn_wc_notify_resolved: //resolved - userstring=i18n( "Resolved conflicted state of %1." ).arg( path ); - break; - case svn_wc_notify_skip: //skip - if ( content_state == svn_wc_notify_state_missing ) - userstring=i18n("Skipped missing target %1.").arg( path ); - else - userstring=i18n("Skipped %1.").arg( path ); - break; - case svn_wc_notify_update_delete: //update_delete - m_HasChanges = TRUE; - userstring=i18n( "D %1" ).arg( path ); - break; - case svn_wc_notify_update_add: //update_add - m_HasChanges = TRUE; - userstring=i18n( "A %1" ).arg( path ); - break; - case svn_wc_notify_update_update: //update_update - { - /* If this is an inoperative dir change, do no notification. - An inoperative dir change is when a directory gets closed - without any props having been changed. */ - if (! ((kind == svn_node_dir) - && ((prop_state == svn_wc_notify_state_inapplicable) - || (prop_state == svn_wc_notify_state_unknown) - || (prop_state == svn_wc_notify_state_unchanged)))) { - m_HasChanges = TRUE; - - if (kind == svn_node_file) { - if (content_state == svn_wc_notify_state_conflicted) - userstring = "C"; - else if (content_state == svn_wc_notify_state_merged) - userstring = "G"; - else if (content_state == svn_wc_notify_state_changed) - userstring = "U"; - } - - if (prop_state == svn_wc_notify_state_conflicted) - userstring += "C"; - else if (prop_state == svn_wc_notify_state_merged) - userstring += "G"; - else if (prop_state == svn_wc_notify_state_changed) - userstring += "U"; - else - userstring += " "; - - if (! ((content_state == svn_wc_notify_state_unchanged - || content_state == svn_wc_notify_state_unknown) - && (prop_state == svn_wc_notify_state_unchanged - || prop_state == svn_wc_notify_state_unknown))) - userstring += TQString( " " ) + path; - } - break; - } - case svn_wc_notify_update_completed: //update_completed - { - if (!m_External) { - if (SVN_IS_VALID_REVNUM(revision)) { - userstring = i18n("Finished at revision %1.").arg(revision); - } else { - userstring = i18n("Finished."); - } - } else { - if (SVN_IS_VALID_REVNUM(revision)) { - userstring = i18n("Finished external at revision %1.").arg(revision); - } else { - userstring = i18n("Finished external."); - } - } - } - if (m_External) - m_External = FALSE; - break; - case svn_wc_notify_update_external: //update_external - m_External = TRUE; - userstring = i18n("Fetching external item into %1." ).arg( path ); - break; - case svn_wc_notify_status_completed: //status_completed - if (SVN_IS_VALID_REVNUM (revision)) - userstring = i18n( "Status against revision: %1.").arg( revision ); - break; - case svn_wc_notify_status_external: //status_external - userstring = i18n("Performing status on external item at %1.").arg( path ); - break; - case svn_wc_notify_commit_modified: //commit_modified - userstring = i18n( "Sending %1.").arg( path ); - break; - case svn_wc_notify_commit_added: //commit_added - if (mime_type && svn_mime_type_is_binary (mime_type)) { - userstring = i18n( "Adding (bin) %1.").arg( path ); - } else { - userstring = i18n( "Adding %1.").arg( path ); - } - break; - case svn_wc_notify_commit_deleted: //commit_deleted - userstring = i18n( "Deleting %1.").arg( path ); - break; - case svn_wc_notify_commit_replaced: //commit_replaced - userstring = i18n( "Replacing %1.").arg( path ); - break; - case svn_wc_notify_commit_postfix_txdelta: //commit_postfix_txdelta - if (!m_FirstTxDelta) { - m_FirstTxDelta = TRUE; - // check fullstops! - userstring=i18n("Transmitting file data "); - } else { - userstring="."; - } - break; - - break; - case svn_wc_notify_blame_revision: //blame_revision - break; - default: - break; - } - par->setMetaData(TQString::number(counter()).rightJustify( 10,'0' )+ "path" , TQString::FROMUTF8( path )); - par->setMetaData(TQString::number( counter() ).rightJustify( 10,'0' )+ "action", TQString::number( action )); - par->setMetaData(TQString::number( counter() ).rightJustify( 10,'0' )+ "kind", TQString::number( kind )); - par->setMetaData(TQString::number( counter() ).rightJustify( 10,'0' )+ "mime_t", TQString::FROMUTF8( mime_type )); - par->setMetaData(TQString::number( counter() ).rightJustify( 10,'0' )+ "content", TQString::number( content_state )); - par->setMetaData(TQString::number( counter() ).rightJustify( 10,'0' )+ "prop", TQString::number( prop_state )); - par->setMetaData(TQString::number( counter() ).rightJustify( 10,'0' )+ "rev", TQString::number( revision )); - par->setMetaData(TQString::number( counter() ).rightJustify( 10,'0' )+ "string", userstring ); - incCounter(); -} - -void KioListener::contextNotify (const svn_wc_notify_t *action) -{ - if (!action) return; -// if (action->actionpath,action->action,action->kind,action->mime_type, - action->content_state,action->prop_state,action->revision); -// return; -// } -// TQString aString = NotifyAction(action->action); -} - -svn::ContextListener::SslServerTrustAnswer -KioListener::contextSslServerTrustPrompt (const SslServerTrustData & data, apr_uint32_t & acceptedFailures) -{ - TQByteArray reply; - TQByteArray params; - TQCString replyType; - TQDataStream stream(params,IO_WriteOnly); - stream << data.hostname - << data.fingerprint - << data.validFrom - << data.validUntil - << data.issuerDName - << data.realm; - - if (!par->dcopClient()->call("kded","tdesvnd", - "get_sslaccept(TQString,TQString,TQString,TQString,TQString,TQString)", - params,replyType,reply)) { - kdWarning()<<"Communication with dcop failed"<>res; - switch (res) { - case -1: - return DONT_ACCEPT; - break; - case 1: - return ACCEPT_PERMANENTLY; - break; - default: - case 0: - return ACCEPT_TEMPORARILY; - break; - } - /* avoid compiler warnings */ - return ACCEPT_TEMPORARILY; -} - -bool KioListener::contextLoadSslClientCertPw(TQString&password,const TQString&realm) -{ - return PwStorage::self()->getCertPw(realm,password); -} - -bool KioListener::contextSslClientCertPrompt (TQString & certFile) -{ - TQByteArray reply; - TQByteArray params; - TQCString replyType; - if (!par->dcopClient()->call("kded","tdesvnd", - "get_sslclientcertfile()", - params,replyType,reply)) { - kdWarning()<<"Communication with dcop failed"<>certFile; - if (certFile.isEmpty()) { - return false; - } - return true; -} - -bool KioListener::contextSslClientCertPwPrompt (TQString & password, - const TQString & realm, bool & maySave) -{ - return false; -} - -bool KioListener::contextGetSavedLogin (const TQString & realm,TQString & username,TQString & password) -{ - PwStorage::self()->getLogin(realm,username,password); - return true; -} - -bool KioListener::contextGetCachedLogin (const TQString & realm,TQString & username,TQString & password) -{ - return true; -} - -bool KioListener::contextGetLogin (const TQString & realm, TQString & username, TQString & password, bool & maySave) -{ - TQByteArray reply; - TQByteArray params; - TQCString replyType; - - TQDataStream stream(params,IO_WriteOnly); - stream << realm; - stream << username; - - if (!par->dcopClient()->call("kded","tdesvnd","get_login(TQString,TQString)",params,replyType,reply)) { - kdWarning()<<"Communication with dcop failed"<>lt; - if (lt.count()!=3) { - kdDebug()<<"Wrong or missing auth list (may cancel pressed)." << endl; - return false; - } - username = lt[0]; - password = lt[1]; - maySave = lt[2]=="true"; - return true; -} - - -/*! - \fn KioListener::contextProgress(long long int current, long long int max) - */ -void KioListener::contextProgress(long long int cur, long long int max) -{ - if (par) { - par->contextProgress(cur,max); - } -} - -} // namespace TDEIO diff --git a/src/tdeiosvn/kiolistener.h b/src/tdeiosvn/kiolistener.h deleted file mode 100644 index f836b65..0000000 --- a/src/tdeiosvn/kiolistener.h +++ /dev/null @@ -1,83 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2005-2007 by Rajko Albrecht * - * ral@alwins-world.de * - * * - * 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. * - ***************************************************************************/ -#ifndef KIOLISTENER_H -#define KIOLISTENER_H - -#include "context_listener.hpp" -#include "pwstorage.h" - -namespace TDEIO { - class SlaveBase; - class tdeio_svnProtocol; - -/** -@author Rajko Albrecht -*/ -class KioListener : public svn::ContextListener -{ -public: - KioListener(TDEIO::tdeio_svnProtocol*_par); - virtual ~KioListener(); - - /* context-listener methods */ - virtual bool contextGetLogin (const TQString & realm, - TQString & username, - TQString & password, - bool & maySave); - virtual bool contextGetSavedLogin (const TQString & realm,TQString & username,TQString & password); - virtual bool contextGetCachedLogin (const TQString & realm,TQString & username,TQString & password); - - virtual void contextNotify (const char *path, - svn_wc_notify_action_t action, - svn_node_kind_t kind, - const char *mime_type, - svn_wc_notify_state_t content_state, - svn_wc_notify_state_t prop_state, - svn_revnum_t revision); - virtual void contextNotify (const svn_wc_notify_t *action); - - virtual bool contextCancel(); - virtual bool contextGetLogMessage (TQString & msg,const svn::CommitItemList&); - virtual SslServerTrustAnswer contextSslServerTrustPrompt (const SslServerTrustData & data, - apr_uint32_t & acceptedFailures); - virtual bool contextSslClientCertPrompt (TQString & certFile); - virtual bool contextSslClientCertPwPrompt (TQString & password, - const TQString & realm, bool & maySave); - virtual bool contextLoadSslClientCertPw(TQString&password,const TQString&realm); - /* context listener virtuals end */ - unsigned int counter()const{return m_notifyCounter;} - void incCounter(){++m_notifyCounter;} - virtual void contextProgress(long long int current, long long int max); - - void setCancel(bool value){m_Canceld=value;} - -private: - TDEIO::tdeio_svnProtocol *par; - -protected: - unsigned int m_notifyCounter; - bool m_External; - bool m_HasChanges; - bool m_FirstTxDelta; - bool m_Canceld; -}; -} - -#endif diff --git a/src/tdeiosvn/tdeiobytestream.cpp b/src/tdeiosvn/tdeiobytestream.cpp new file mode 100644 index 0000000..fe3c3a9 --- /dev/null +++ b/src/tdeiosvn/tdeiobytestream.cpp @@ -0,0 +1,63 @@ +/*************************************************************************** + * Copyright (C) 2006-2007 by Rajko Albrecht * + * ral@alwins-world.de * + * * + * 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. * + ***************************************************************************/ +#include "tdeiobytestream.h" + +KioByteStream::KioByteStream(StreamWrittenCb*aCb,const TQString&filename) + : svn::stream::SvnStream(false,true,0L), + m_Cb(aCb),m_Written(0), + m_mimeSend(false),m_Filename(filename) +{ + m_MessageTick.start(); +} + +KioByteStream::~KioByteStream() +{ +} + +bool KioByteStream::isOk() const +{ + return m_Cb != 0; +} + +long KioByteStream::write(const char* data, const unsigned long max) +{ + bool forceInfo = !m_mimeSend; + if (m_Cb) { + if (!m_mimeSend) { + m_mimeSend = true; + array.setRawData(data, max); + KMimeMagicResult * result = KMimeMagic::self()->findBufferFileType(array,m_Filename); + m_Cb->streamSendMime(result); + array.resetRawData(data, max); + m_Cb->streamTotalSizeNull(); + } + array.setRawData(data, max); + m_Cb->streamPushData(array); + array.resetRawData(data, max); + + m_Written+=max; + if (m_MessageTick.elapsed() >=100 || forceInfo) { + m_Cb->streamWritten(m_Written); + m_MessageTick.restart(); + } + return max; + } + return -1; +} diff --git a/src/tdeiosvn/tdeiobytestream.h b/src/tdeiosvn/tdeiobytestream.h new file mode 100644 index 0000000..48addfe --- /dev/null +++ b/src/tdeiosvn/tdeiobytestream.h @@ -0,0 +1,66 @@ +/*************************************************************************** + * Copyright (C) 2006-2007 by Rajko Albrecht * + * ral@alwins-world.de * + * * + * 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. * + ***************************************************************************/ +#ifndef KIOBYTESTREAM_H +#define KIOBYTESTREAM_H + +#include "svnstream.hpp" + +#include +#include +#include +#include +#include + +class StreamWrittenCb +{ +public: + StreamWrittenCb(){} + virtual ~StreamWrittenCb(){} + virtual void streamWritten(const TDEIO::filesize_t current) = 0; + virtual void streamPushData(TQByteArray)=0; + virtual void streamSendMime(KMimeMagicResult*mt)=0; + virtual void streamTotalSizeNull()=0; +}; + +/** + @author Rajko Albrecht +*/ +class KioByteStream : public svn::stream::SvnStream +{ +public: + KioByteStream(StreamWrittenCb*,const TQString&filename); + + ~KioByteStream(); + + virtual bool isOk() const; + virtual long write(const char* data, const unsigned long max); + + TDEIO::filesize_t written(){return m_Written;} + +protected: + StreamWrittenCb*m_Cb; + TDEIO::filesize_t m_Written; + bool m_mimeSend; + TQString m_Filename; + TQByteArray array; + TQTime m_MessageTick; +}; + +#endif diff --git a/src/tdeiosvn/tdeiolistener.cpp b/src/tdeiosvn/tdeiolistener.cpp new file mode 100644 index 0000000..d8d3210 --- /dev/null +++ b/src/tdeiosvn/tdeiolistener.cpp @@ -0,0 +1,408 @@ +/*************************************************************************** + * Copyright (C) 2005-2007 by Rajko Albrecht * + * ral@alwins-world.de * + * * + * 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. * + ***************************************************************************/ +#include "tdeiolistener.h" +#include "tdeiosvn.h" + +#include +#include +#include + +namespace TDEIO { + +KioListener::KioListener(TDEIO::tdeio_svnProtocol*_par) + : svn::ContextListener(),m_notifyCounter(0),m_External(false),m_HasChanges(false),m_FirstTxDelta(false),m_Canceld(false) +{ + par = _par; +} + + +KioListener::~KioListener() +{ +} + + + + +/*! + \fn KioListener::contextCancel() + */ +bool KioListener::contextCancel() +{ + return par->wasKilled()||m_Canceld; +} + + +/*! + \fn KioListener::contextGetLogMessage (TQString & msg) + */ +bool KioListener::contextGetLogMessage (TQString & msg,const svn::CommitItemList&_items) +{ +#if 1 + TQByteArray reply; + TQByteArray params; + TQCString replyType; + TQDataStream stream(params,IO_WriteOnly); + + if (_items.count()>0) { + TQMap list; + for (unsigned i = 0;i<_items.count();++i) { + if (_items[i].path().isEmpty()) { + list[_items[i].url()]=TQChar(_items[i].actionType()); + } else { + list[_items[i].path()]=TQChar(_items[i].actionType()); + } + } + stream << list; + if (!par->dcopClient()->call("kded","tdesvnd","get_logmsg(TQMap)",params,replyType,reply)) { + msg = "Communication with dcop failed"; + kdWarning()<dcopClient()->call("kded","tdesvnd","get_logmsg()",params,replyType,reply)) { + msg = "Communication with dcop failed"; + kdWarning()<>lt; + if (lt.count()!=1) { + msg = "Wrong or missing log (may cancel pressed)."; + kdDebug()<< msg << endl; + return false; + } + msg = lt[0]; +#else + msg = "Made with a tdeio::svn client"; +#endif + return true; +} + +/*! the content of that method is taken from the notify in tdeio::svn in KDE SDK */ +/* this moment we don't use it full 'cause not all is made via KIO */ +void KioListener::contextNotify (const char * path,svn_wc_notify_action_t action,svn_node_kind_t kind ,const char * mime_type ,svn_wc_notify_state_t content_state, svn_wc_notify_state_t prop_state,svn_revnum_t revision) +{ + if (par->wasKilled()) { + return; + } + TQString userstring; + + switch(action) { + case svn_wc_notify_add: + { + if (mime_type && (svn_mime_type_is_binary (mime_type))) + userstring = i18n( "A (bin) %1" ).arg( path ); + else + userstring = i18n( "A %1" ).arg( path ); + break; + } + break; + case svn_wc_notify_copy: //copy + break; + case svn_wc_notify_delete: //delete + m_HasChanges = TRUE; + userstring = i18n( "D %1" ).arg( path ); + break; + case svn_wc_notify_restore : //restore + userstring=i18n( "Restored %1." ).arg( path ); + break; + case svn_wc_notify_revert : //revert + userstring=i18n( "Reverted %1." ).arg( path ); + break; + case svn_wc_notify_failed_revert: //failed revert + userstring=i18n( "Failed to revert %1.\nTry updating instead." ).arg( path ); + break; + case svn_wc_notify_resolved: //resolved + userstring=i18n( "Resolved conflicted state of %1." ).arg( path ); + break; + case svn_wc_notify_skip: //skip + if ( content_state == svn_wc_notify_state_missing ) + userstring=i18n("Skipped missing target %1.").arg( path ); + else + userstring=i18n("Skipped %1.").arg( path ); + break; + case svn_wc_notify_update_delete: //update_delete + m_HasChanges = TRUE; + userstring=i18n( "D %1" ).arg( path ); + break; + case svn_wc_notify_update_add: //update_add + m_HasChanges = TRUE; + userstring=i18n( "A %1" ).arg( path ); + break; + case svn_wc_notify_update_update: //update_update + { + /* If this is an inoperative dir change, do no notification. + An inoperative dir change is when a directory gets closed + without any props having been changed. */ + if (! ((kind == svn_node_dir) + && ((prop_state == svn_wc_notify_state_inapplicable) + || (prop_state == svn_wc_notify_state_unknown) + || (prop_state == svn_wc_notify_state_unchanged)))) { + m_HasChanges = TRUE; + + if (kind == svn_node_file) { + if (content_state == svn_wc_notify_state_conflicted) + userstring = "C"; + else if (content_state == svn_wc_notify_state_merged) + userstring = "G"; + else if (content_state == svn_wc_notify_state_changed) + userstring = "U"; + } + + if (prop_state == svn_wc_notify_state_conflicted) + userstring += "C"; + else if (prop_state == svn_wc_notify_state_merged) + userstring += "G"; + else if (prop_state == svn_wc_notify_state_changed) + userstring += "U"; + else + userstring += " "; + + if (! ((content_state == svn_wc_notify_state_unchanged + || content_state == svn_wc_notify_state_unknown) + && (prop_state == svn_wc_notify_state_unchanged + || prop_state == svn_wc_notify_state_unknown))) + userstring += TQString( " " ) + path; + } + break; + } + case svn_wc_notify_update_completed: //update_completed + { + if (!m_External) { + if (SVN_IS_VALID_REVNUM(revision)) { + userstring = i18n("Finished at revision %1.").arg(revision); + } else { + userstring = i18n("Finished."); + } + } else { + if (SVN_IS_VALID_REVNUM(revision)) { + userstring = i18n("Finished external at revision %1.").arg(revision); + } else { + userstring = i18n("Finished external."); + } + } + } + if (m_External) + m_External = FALSE; + break; + case svn_wc_notify_update_external: //update_external + m_External = TRUE; + userstring = i18n("Fetching external item into %1." ).arg( path ); + break; + case svn_wc_notify_status_completed: //status_completed + if (SVN_IS_VALID_REVNUM (revision)) + userstring = i18n( "Status against revision: %1.").arg( revision ); + break; + case svn_wc_notify_status_external: //status_external + userstring = i18n("Performing status on external item at %1.").arg( path ); + break; + case svn_wc_notify_commit_modified: //commit_modified + userstring = i18n( "Sending %1.").arg( path ); + break; + case svn_wc_notify_commit_added: //commit_added + if (mime_type && svn_mime_type_is_binary (mime_type)) { + userstring = i18n( "Adding (bin) %1.").arg( path ); + } else { + userstring = i18n( "Adding %1.").arg( path ); + } + break; + case svn_wc_notify_commit_deleted: //commit_deleted + userstring = i18n( "Deleting %1.").arg( path ); + break; + case svn_wc_notify_commit_replaced: //commit_replaced + userstring = i18n( "Replacing %1.").arg( path ); + break; + case svn_wc_notify_commit_postfix_txdelta: //commit_postfix_txdelta + if (!m_FirstTxDelta) { + m_FirstTxDelta = TRUE; + // check fullstops! + userstring=i18n("Transmitting file data "); + } else { + userstring="."; + } + break; + + break; + case svn_wc_notify_blame_revision: //blame_revision + break; + default: + break; + } + par->setMetaData(TQString::number(counter()).rightJustify( 10,'0' )+ "path" , TQString::FROMUTF8( path )); + par->setMetaData(TQString::number( counter() ).rightJustify( 10,'0' )+ "action", TQString::number( action )); + par->setMetaData(TQString::number( counter() ).rightJustify( 10,'0' )+ "kind", TQString::number( kind )); + par->setMetaData(TQString::number( counter() ).rightJustify( 10,'0' )+ "mime_t", TQString::FROMUTF8( mime_type )); + par->setMetaData(TQString::number( counter() ).rightJustify( 10,'0' )+ "content", TQString::number( content_state )); + par->setMetaData(TQString::number( counter() ).rightJustify( 10,'0' )+ "prop", TQString::number( prop_state )); + par->setMetaData(TQString::number( counter() ).rightJustify( 10,'0' )+ "rev", TQString::number( revision )); + par->setMetaData(TQString::number( counter() ).rightJustify( 10,'0' )+ "string", userstring ); + incCounter(); +} + +void KioListener::contextNotify (const svn_wc_notify_t *action) +{ + if (!action) return; +// if (action->actionpath,action->action,action->kind,action->mime_type, + action->content_state,action->prop_state,action->revision); +// return; +// } +// TQString aString = NotifyAction(action->action); +} + +svn::ContextListener::SslServerTrustAnswer +KioListener::contextSslServerTrustPrompt (const SslServerTrustData & data, apr_uint32_t & acceptedFailures) +{ + TQByteArray reply; + TQByteArray params; + TQCString replyType; + TQDataStream stream(params,IO_WriteOnly); + stream << data.hostname + << data.fingerprint + << data.validFrom + << data.validUntil + << data.issuerDName + << data.realm; + + if (!par->dcopClient()->call("kded","tdesvnd", + "get_sslaccept(TQString,TQString,TQString,TQString,TQString,TQString)", + params,replyType,reply)) { + kdWarning()<<"Communication with dcop failed"<>res; + switch (res) { + case -1: + return DONT_ACCEPT; + break; + case 1: + return ACCEPT_PERMANENTLY; + break; + default: + case 0: + return ACCEPT_TEMPORARILY; + break; + } + /* avoid compiler warnings */ + return ACCEPT_TEMPORARILY; +} + +bool KioListener::contextLoadSslClientCertPw(TQString&password,const TQString&realm) +{ + return PwStorage::self()->getCertPw(realm,password); +} + +bool KioListener::contextSslClientCertPrompt (TQString & certFile) +{ + TQByteArray reply; + TQByteArray params; + TQCString replyType; + if (!par->dcopClient()->call("kded","tdesvnd", + "get_sslclientcertfile()", + params,replyType,reply)) { + kdWarning()<<"Communication with dcop failed"<>certFile; + if (certFile.isEmpty()) { + return false; + } + return true; +} + +bool KioListener::contextSslClientCertPwPrompt (TQString & password, + const TQString & realm, bool & maySave) +{ + return false; +} + +bool KioListener::contextGetSavedLogin (const TQString & realm,TQString & username,TQString & password) +{ + PwStorage::self()->getLogin(realm,username,password); + return true; +} + +bool KioListener::contextGetCachedLogin (const TQString & realm,TQString & username,TQString & password) +{ + return true; +} + +bool KioListener::contextGetLogin (const TQString & realm, TQString & username, TQString & password, bool & maySave) +{ + TQByteArray reply; + TQByteArray params; + TQCString replyType; + + TQDataStream stream(params,IO_WriteOnly); + stream << realm; + stream << username; + + if (!par->dcopClient()->call("kded","tdesvnd","get_login(TQString,TQString)",params,replyType,reply)) { + kdWarning()<<"Communication with dcop failed"<>lt; + if (lt.count()!=3) { + kdDebug()<<"Wrong or missing auth list (may cancel pressed)." << endl; + return false; + } + username = lt[0]; + password = lt[1]; + maySave = lt[2]=="true"; + return true; +} + + +/*! + \fn KioListener::contextProgress(long long int current, long long int max) + */ +void KioListener::contextProgress(long long int cur, long long int max) +{ + if (par) { + par->contextProgress(cur,max); + } +} + +} // namespace TDEIO diff --git a/src/tdeiosvn/tdeiolistener.h b/src/tdeiosvn/tdeiolistener.h new file mode 100644 index 0000000..f836b65 --- /dev/null +++ b/src/tdeiosvn/tdeiolistener.h @@ -0,0 +1,83 @@ +/*************************************************************************** + * Copyright (C) 2005-2007 by Rajko Albrecht * + * ral@alwins-world.de * + * * + * 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. * + ***************************************************************************/ +#ifndef KIOLISTENER_H +#define KIOLISTENER_H + +#include "context_listener.hpp" +#include "pwstorage.h" + +namespace TDEIO { + class SlaveBase; + class tdeio_svnProtocol; + +/** +@author Rajko Albrecht +*/ +class KioListener : public svn::ContextListener +{ +public: + KioListener(TDEIO::tdeio_svnProtocol*_par); + virtual ~KioListener(); + + /* context-listener methods */ + virtual bool contextGetLogin (const TQString & realm, + TQString & username, + TQString & password, + bool & maySave); + virtual bool contextGetSavedLogin (const TQString & realm,TQString & username,TQString & password); + virtual bool contextGetCachedLogin (const TQString & realm,TQString & username,TQString & password); + + virtual void contextNotify (const char *path, + svn_wc_notify_action_t action, + svn_node_kind_t kind, + const char *mime_type, + svn_wc_notify_state_t content_state, + svn_wc_notify_state_t prop_state, + svn_revnum_t revision); + virtual void contextNotify (const svn_wc_notify_t *action); + + virtual bool contextCancel(); + virtual bool contextGetLogMessage (TQString & msg,const svn::CommitItemList&); + virtual SslServerTrustAnswer contextSslServerTrustPrompt (const SslServerTrustData & data, + apr_uint32_t & acceptedFailures); + virtual bool contextSslClientCertPrompt (TQString & certFile); + virtual bool contextSslClientCertPwPrompt (TQString & password, + const TQString & realm, bool & maySave); + virtual bool contextLoadSslClientCertPw(TQString&password,const TQString&realm); + /* context listener virtuals end */ + unsigned int counter()const{return m_notifyCounter;} + void incCounter(){++m_notifyCounter;} + virtual void contextProgress(long long int current, long long int max); + + void setCancel(bool value){m_Canceld=value;} + +private: + TDEIO::tdeio_svnProtocol *par; + +protected: + unsigned int m_notifyCounter; + bool m_External; + bool m_HasChanges; + bool m_FirstTxDelta; + bool m_Canceld; +}; +} + +#endif diff --git a/src/tdeiosvn/tdeiosvn.cpp b/src/tdeiosvn/tdeiosvn.cpp index fe17ab1..1365dd2 100644 --- a/src/tdeiosvn/tdeiosvn.cpp +++ b/src/tdeiosvn/tdeiosvn.cpp @@ -19,7 +19,7 @@ ***************************************************************************/ #include "tdesvn-config.h" #include "tdeiosvn.h" -#include "kiolistener.h" +#include "tdeiolistener.h" #include "svnqttypes.hpp" #include "dirent.hpp" @@ -147,7 +147,7 @@ tdeio_svnProtocol::tdeio_svnProtocol(const TQCString &pool_socket, const TQCStri tdeio_svnProtocol::~tdeio_svnProtocol() { - kdDebug()<<"Delete kio protocol"< #include @@ -64,7 +64,7 @@ public: virtual void wc_delete(const KURL::List&); virtual void special(const TQByteArray& data); virtual void wc_resolve(const KURL&,bool); - /* looked on kio::svn from tdesdk */ + /* looked on tdeio::svn from tdesdk */ enum KSVN_METHOD { /* KURL repository, KURL target, int revnumber, TQString revkind */ SVN_CHECKOUT = 1, -- cgit v1.2.3