File indexing completed on 2024-04-28 05:42:09
0001 /* 0002 * Port for usage with qt-framework and development for kdesvn 0003 * Copyright (C) 2005-2009 by Rajko Albrecht (ral@alwins-world.de) 0004 * https://kde.org/applications/development/org.kde.kdesvn 0005 */ 0006 /* 0007 * ==================================================================== 0008 * Copyright (c) 2002-2005 The RapidSvn Group. All rights reserved. 0009 * dev@rapidsvn.tigris.org 0010 * 0011 * This library is free software; you can redistribute it and/or 0012 * modify it under the terms of the GNU Lesser General Public 0013 * License as published by the Free Software Foundation; either 0014 * version 2.1 of the License, or (at your option) any later version. 0015 * 0016 * This library is distributed in the hope that it will be useful, 0017 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0019 * Lesser General Public License for more details. 0020 * 0021 * You should have received a copy of the GNU Lesser General Public 0022 * License along with this library (in the file LGPL.txt); if not, 0023 * write to the Free Software Foundation, Inc., 51 Franklin St, 0024 * Fifth Floor, Boston, MA 02110-1301 USA 0025 * 0026 * This software consists of voluntary contributions made by many 0027 * individuals. For exact contribution history, see the revision 0028 * history and logs, available at http://rapidsvn.tigris.org/. 0029 * ==================================================================== 0030 */ 0031 0032 #ifndef SVNQT_CONTEXT_H 0033 #define SVNQT_CONTEXT_H 0034 0035 // qt 0036 #include <QString> 0037 0038 // Subversion api 0039 #include <svn_client.h> 0040 0041 // svncpp 0042 #include <svnqt/pool.h> 0043 #include <svnqt/svnqt_defines.h> 0044 #include <svnqt/svnqttypes.h> 0045 0046 namespace svn 0047 { 0048 // forward declarations 0049 class ContextListener; 0050 class ContextData; 0051 0052 /** 0053 * This class will hold the client context 0054 * and replace the old notification and baton 0055 * stuff 0056 */ 0057 class SVNQT_EXPORT Context 0058 { 0059 public: 0060 /** 0061 * default constructor 0062 * 0063 * @param configDir location where the 0064 * subversion api stores its 0065 * configuration 0066 */ 0067 explicit Context(const QString &configDir = QString()); 0068 0069 /** 0070 * copy constructor 0071 * 0072 * @param src 0073 */ 0074 Context(const Context &src); 0075 0076 /** 0077 * destructor 0078 */ 0079 virtual ~Context(); 0080 0081 /** 0082 * disable assignment operator 0083 */ 0084 Context &operator=(const Context &) = delete; 0085 0086 /** 0087 * enable/disable authentication caching 0088 * 0089 * @param value true=enable/false=disable 0090 */ 0091 void setAuthCache(bool value); 0092 0093 /** 0094 * set username/password for authentication 0095 */ 0096 void setLogin(const QString &username, const QString &password); 0097 0098 /** 0099 * operator to get svn_client_ctx object 0100 */ 0101 operator svn_client_ctx_t *() const; 0102 0103 /** 0104 * return the svn_client_ctx object 0105 */ 0106 svn_client_ctx_t *ctx() const; 0107 0108 /** 0109 * this will be called at the beginning of an action. 0110 * the log message will be reset. 0111 */ 0112 void reset(); 0113 0114 /** 0115 * set log message 0116 * 0117 * @param msg 0118 */ 0119 void setLogMessage(const QString &msg); 0120 0121 /** 0122 * get log message 0123 * 0124 * @return log message 0125 */ 0126 const QString &getLogMessage() const; 0127 0128 /** 0129 * get username 0130 * 0131 * @return username 0132 */ 0133 const QString &getUsername() const; 0134 0135 /** 0136 * get password 0137 * 0138 * @return password 0139 */ 0140 const QString &getPassword() const; 0141 0142 /** 0143 * set the listener for the context. The listener will be 0144 * called to poll authentication information and other 0145 * information like this 0146 * 0147 * @param listener 0148 */ 0149 void setListener(ContextListener *listener); 0150 0151 /** 0152 * get the listener 0153 * 0154 * @return the listener 0155 */ 0156 ContextListener *getListener() const; 0157 0158 /** Callback for generating list entries 0159 * This base implementation just adds items to @a entries. This may used for special listener like the one from KIO 0160 * where items may displayed direkt on call and not stored into @a entries. 0161 * @param entries default target list 0162 * @param dirent entry to add (send by subversion) 0163 * @param lock accociated lock (may be null!) 0164 * @param path the path of the item 0165 * @return true if inserted/displayd, false if dirent or entries aren't valid. 0166 */ 0167 virtual bool contextAddListItem(DirEntries *entries, const svn_dirent_t *dirent, const svn_lock_t *lock, const QString &path); 0168 0169 private: 0170 ContextData *m; 0171 }; 0172 } 0173 0174 #endif 0175 /* ----------------------------------------------------------------- 0176 * local variables: 0177 * eval: (load-file "../../rapidsvn-dev.el") 0178 * end: 0179 */