From e9ae80694875f869892f13f4fcaf1170a00dea41 Mon Sep 17 00:00:00 2001 From: toma Date: Wed, 25 Nov 2009 17:56:58 +0000 Subject: Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features. BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdewebdev@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- quanta/project/uploadprofiles.h | 108 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 108 insertions(+) create mode 100644 quanta/project/uploadprofiles.h (limited to 'quanta/project/uploadprofiles.h') diff --git a/quanta/project/uploadprofiles.h b/quanta/project/uploadprofiles.h new file mode 100644 index 00000000..20d77b80 --- /dev/null +++ b/quanta/project/uploadprofiles.h @@ -0,0 +1,108 @@ +// +// C++ Interface: UploadProfiles +// +// Description: +// +// +// Author: Jens Herden , (C) 2004 +// +// Copyright: See COPYING file that comes with this distribution +// +// + +#ifndef UPLOADPROFILES_H +#define UPLOADPROFILES_H + +// QT includes +#include +#include +#include + +// KDE includes +#include + + +class QObject; + +/** + @short The internal representation of upload profiles. + +*/ + + +struct UploadProfile +{ + QString name; ///< name of profile + QDomElement domElement; ///< domtree element of this profile + QGuardedPtr treeview; ///< treeview for this url +}; + +/** a map for the upload profiles */ +typedef QMap UploadProfileMap; + + +class UploadProfiles : public UploadProfileMap +{ +public: + /** + * since this class is a singleton you must use this function to access it + */ + static UploadProfiles* const ref() + { + static UploadProfiles *m_ref; + if (!m_ref) m_ref = new UploadProfiles(); + return m_ref; + } + + ~UploadProfiles(); + + /** + reads the available profiles from the tree and fills the map + + @param the dom document to parse + */ + void readFromXML(const QDomDocument &dom); + + /** + removes a profile from the map and the dom tree + + @param the profile to remove + + @return true if profile was found and removed + */ + bool removeFromMapAndXML(const QString &name); + + /** + clears the map and removes all treeviews + */ + void clear(); + +private: + /** The constructor is privat because we use singleton pattern. + * If you need the class use UploadProfiles::ref() for + * construction and reference + */ + UploadProfiles(); + + /** + creates a treeview for a profile and adds it to the right toolviews + + @param profile the profile + + @return the pointer to the treeview + */ + QWidget * createTreeview(const UploadProfile &profile); + + /** + creates a KURL from a QDomElement + + @param e a QDomElement where the path is saved + + @return KURL of the location + */ + KURL url(const QDomElement &e); + + QDomNode m_profilesNode; ///< under this node the profiles are saved in the dom tree +}; + +#endif -- cgit v1.2.1