File indexing completed on 2024-05-12 17:16:00

0001 /***************************************************************************
0002  *   Copyright (C) 2005-2009 by Rajko Albrecht                             *
0003  *   ral@alwins-world.de                                                   *
0004  *                                                                         *
0005  *   This program is free software; you can redistribute it and/or modify  *
0006  *   it under the terms of the GNU General Public License as published by  *
0007  *   the Free Software Foundation; either version 2 of the License, or     *
0008  *   (at your option) any later version.                                   *
0009  *                                                                         *
0010  *   This program is distributed in the hope that it will be useful,       *
0011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
0012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
0013  *   GNU General Public License for more details.                          *
0014  *                                                                         *
0015  *   You should have received a copy of the GNU General Public License     *
0016  *   along with this program; if not, write to the                         *
0017  *   Free Software Foundation, Inc.,                                       *
0018  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.         *
0019  ***************************************************************************/
0020 #ifndef KIOLISTENER_H
0021 #define KIOLISTENER_H
0022 
0023 #include "svnqt/context_listener.h"
0024 #include "ksvnwidgets/pwstorage.h"
0025 
0026 namespace KIO
0027 {
0028 class SlaveBase;
0029 class kio_svnProtocol;
0030 
0031 /**
0032 @author Rajko Albrecht
0033 */
0034 class KioListener : public svn::ContextListener
0035 {
0036 public:
0037     explicit KioListener(KIO::kio_svnProtocol *_par);
0038     virtual ~KioListener();
0039 
0040     /* context-listener methods */
0041     bool contextGetLogin(const QString &realm,
0042                                  QString &username,
0043                                  QString &password,
0044                                  bool &maySave) override;
0045     bool contextGetSavedLogin(const QString &realm, QString &username, QString &password) override;
0046     bool contextGetCachedLogin(const QString &realm, QString &username, QString &password) override;
0047 
0048     void contextNotify(const char *path,
0049                                svn_wc_notify_action_t action,
0050                                svn_node_kind_t kind,
0051                                const char *mime_type,
0052                                svn_wc_notify_state_t content_state,
0053                                svn_wc_notify_state_t prop_state,
0054                                svn_revnum_t revision) override;
0055     void contextNotify(const svn_wc_notify_t *action) override;
0056 
0057     bool contextCancel() override;
0058     bool contextGetLogMessage(QString &msg, const svn::CommitItemList &) override;
0059     SslServerTrustAnswer contextSslServerTrustPrompt(const SslServerTrustData &data,
0060             apr_uint32_t &acceptedFailures) override;
0061     bool contextSslClientCertPrompt(QString &certFile) override;
0062     bool contextSslClientCertPwPrompt(QString &password,
0063             const QString &realm, bool &maySave) override;
0064     bool contextLoadSslClientCertPw(QString &password, const QString &realm) override;
0065     /* context listener virtuals end */
0066     unsigned int counter()const
0067     {
0068         return m_notifyCounter;
0069     }
0070     void incCounter()
0071     {
0072         ++m_notifyCounter;
0073     }
0074     void contextProgress(long long int current, long long int max) override;
0075 
0076     void setCancel(bool value)
0077     {
0078         m_Canceld = value;
0079     }
0080 
0081     /** Callback for generating list entries
0082      * This implementation sends items to the protocol, @a entries will ignored.
0083      * @param entries default target list - ignored
0084      * @param dirent entry to add (send by subversion)
0085      * @param lock accociated lock (may be null!)
0086      * @param path the path of the item
0087      * @return true if inserted/displayd, false if dirent or entries aren't valid.
0088      */
0089     bool contextAddListItem(svn::DirEntries *entries, const svn_dirent_t *dirent, const svn_lock_t *lock, const QString &path) override;
0090 
0091     void uncancel()
0092     {
0093         m_Canceld = false;
0094     }
0095 
0096 private:
0097     KIO::kio_svnProtocol *par;
0098 
0099 protected:
0100     unsigned int  m_notifyCounter;
0101     bool m_External;
0102     bool m_HasChanges;
0103     bool m_FirstTxDelta;
0104     bool m_Canceld;
0105 };
0106 }
0107 
0108 #endif