File indexing completed on 2024-05-12 16:39:36
0001 /* This file is part of the KDE project 0002 Copyright (C) 2005-2011 Jarosław Staniek <staniek@kde.org> 0003 0004 This library is free software; you can redistribute it and/or 0005 modify it under the terms of the GNU Library General Public 0006 License as published by the Free Software Foundation; either 0007 version 2 of the License, or (at your option) any later version. 0008 0009 This library is distributed in the hope that it will be useful, 0010 but WITHOUT ANY WARRANTY; without even the implied warranty of 0011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0012 Library General Public License for more details. 0013 0014 You should have received a copy of the GNU Library General Public License 0015 along with this library; see the file COPYING.LIB. If not, write to 0016 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 0017 * Boston, MA 02110-1301, USA. 0018 */ 0019 0020 #ifndef KEXIDBSHORTCUTFILE_H 0021 #define KEXIDBSHORTCUTFILE_H 0022 0023 #include <QString> 0024 #include <KDbResult> 0025 0026 #include "kexicore_export.h" 0027 0028 class KDbConnectionData; 0029 0030 /*! Loads and saves information for a "shortcut to a connection" file containing 0031 connection information with database name (i.e. ProjectData). 0032 This is implementation for handling .KEXIS files. 0033 See http://www.kexi-project.org/wiki/wikiview/index.php@KexiMimeTypes_DataSaving_Loading.html 0034 */ 0035 class KEXICORE_EXPORT KexiDBShortcutFile 0036 { 0037 public: 0038 /*! Creates a new object for \a fileName. */ 0039 explicit KexiDBShortcutFile(const QString& fileName); 0040 0041 ~KexiDBShortcutFile(); 0042 0043 //! \return filename provided on this object's construction. */ 0044 QString fileName() const; 0045 0046 protected: 0047 class Private; 0048 Private * const d; 0049 }; 0050 0051 /*! Loads and saves information for a "shortcut" file containing 0052 connection information (i.e. KDbConnectionData). 0053 This is implementation for handling .KEXIC files. 0054 See http://www.kexi-project.org/wiki/wikiview/index.php@KexiMimeTypes_DataSaving_Loading.html 0055 */ 0056 class KEXICORE_EXPORT KexiDBConnShortcutFile : protected KexiDBShortcutFile, public KDbResultable 0057 { 0058 public: 0059 /*! Creates a new object for \a fileName. */ 0060 explicit KexiDBConnShortcutFile(const QString& fileName); 0061 0062 ~KexiDBConnShortcutFile(); 0063 0064 /*! Loads connection data into \a data. 0065 \a groupKey, if provided will be set to a group key, 0066 so you can later use it in saveConnectionData(). 0067 \return true on success. */ 0068 bool loadConnectionData(KDbConnectionData* data, QString* groupKey = 0); 0069 0070 /*! Saves connection data \a data to a shortcut file. 0071 If \a storePassword is true, password will be saved in the file, 0072 even if data.savePassword is false. 0073 Existing data is merged with new data. \a groupKey is reused, if specified. 0074 If \a overwriteFirstGroup is true (the default) first found group will be overwritten 0075 instead of creating of a new unique group. This mode is usable for updating .kexic files 0076 containing single connection data, what's used for storing connections repository. 0077 \return true on success. */ 0078 bool saveConnectionData(const KDbConnectionData& data, 0079 bool savePassword, QString* groupKey = 0, bool overwriteFirstGroup = true); 0080 0081 //! \return filename provided on this object's construction. */ 0082 QString fileName() const { 0083 return KexiDBShortcutFile::fileName(); 0084 } 0085 0086 protected: 0087 }; 0088 0089 #endif