diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/kvilib/CMakeLists.txt | 3 | ||||
| -rw-r--r-- | src/kvilib/tal/kvi_tal_filedialog.cpp | 159 | ||||
| -rw-r--r-- | src/kvilib/tal/kvi_tal_filedialog.h | 86 | ||||
| -rw-r--r-- | src/kvilib/tal/kvi_tal_filedialog_kde.h | 102 | ||||
| -rw-r--r-- | src/kvilib/tal/kvi_tal_filedialog_qt.h | 98 |
5 files changed, 153 insertions, 295 deletions
diff --git a/src/kvilib/CMakeLists.txt b/src/kvilib/CMakeLists.txt index f612ebdf7..fd9ed2e58 100644 --- a/src/kvilib/CMakeLists.txt +++ b/src/kvilib/CMakeLists.txt @@ -25,6 +25,7 @@ SET(kvilib_MOC_HDRS system/kvi_locale.h system/kvi_thread.h tal/kvi_tal_application.h + tal/kvi_tal_filedialog.h tal/kvi_tal_groupbox.h tal/kvi_tal_hbox.h tal/kvi_tal_iconview.h @@ -45,14 +46,12 @@ SET(kvilib_MOC_HDRS IF(COMPILE_KDE_SUPPORT) LIST(APPEND kvilib_MOC_HDRS tal/kvi_tal_menubar_kde.h - tal/kvi_tal_filedialog_kde.h tal/kvi_tal_mainwindow_kde.h tal/kvi_tal_toolbar_kde.h ) ELSE() LIST(APPEND kvilib_MOC_HDRS tal/kvi_tal_menubar_qt.h - tal/kvi_tal_filedialog_qt.h tal/kvi_tal_mainwindow_qt.h tal/kvi_tal_toolbar_qt.h ) diff --git a/src/kvilib/tal/kvi_tal_filedialog.cpp b/src/kvilib/tal/kvi_tal_filedialog.cpp index 2f22c74bd..78cc641d7 100644 --- a/src/kvilib/tal/kvi_tal_filedialog.cpp +++ b/src/kvilib/tal/kvi_tal_filedialog.cpp @@ -28,102 +28,85 @@ #ifdef COMPILE_KDE_SUPPORT - KviTalFileDialog::KviTalFileDialog(const QString & szDirName, const QString & szFilter, QWidget * pParent, const char * pcName, bool bModal) - : KFileDialog(KUrl(szDirName),szFilter,pParent) - { - //clearWFlags(WDestructiveClose); - } +KviTalFileDialog::KviTalFileDialog(const QString & szDirName, const QString & szFilter, QWidget * pParent, const char * pcName, bool bModal) +: KFileDialog(KUrl(szDirName),szFilter,pParent) +{ + //clearWFlags(WDestructiveClose); +} - KviTalFileDialog::~KviTalFileDialog() - { - } +#else // COMPILE_KDE_SUPPORT - void KviTalFileDialog::setFileMode(FileMode m) - { - switch(m) - { - case AnyFile: - setMode(KFile::File | KFile::LocalOnly); - setOperationMode(Saving); - break; - case ExistingFile: - setMode(KFile::File | KFile::ExistingOnly | KFile::LocalOnly); - setOperationMode(Opening); - break; - case ExistingFiles: - setMode(KFile::Files | KFile::ExistingOnly | KFile::LocalOnly); - setOperationMode(Opening); - break; - case Directory: - setMode(KFile::Directory); - break; - case DirectoryOnly: - setMode(KFile::Directory); - break; - default: - setMode(KFile::File | KFile::LocalOnly); - setOperationMode(Saving); - break; - } - } +KviTalFileDialog::KviTalFileDialog(const QString & szDirName, const QString & szFilter, QWidget * pParent, const char * pcName, bool bModal) +: QFileDialog(pParent,"",szDirName,szFilter) +{ + setModal(bModal); +} - void KviTalFileDialog::setDirectory(const QString & szDirectory) - { - setUrl(KUrl(szDirectory)); - } +#endif // COMPILE_KDE_SUPPORT +KviTalFileDialog::~KviTalFileDialog() +{ +} -#ifndef COMPILE_USE_STANDALONE_MOC_SOURCES - #include "kvi_tal_filedialog_kde.moc" -#endif //COMPILE_USE_STANDALONE_MOC_SOURCES - -#else - - #include <QDir> - - KviTalFileDialog::KviTalFileDialog(const QString & szDirName, const QString & szFilter, QWidget * pParent, const char * pcName, bool bModal) - : QFileDialog(pParent,"",szDirName,szFilter) +void KviTalFileDialog::setFileMode(FileMode m) +{ + switch(m) { - setModal(bModal); - } - - KviTalFileDialog::~KviTalFileDialog() - { - } - - void KviTalFileDialog::setFileMode(FileMode m) - { - switch(m) - { - case AnyFile: - QFileDialog::setFileMode(QFileDialog::AnyFile); - break; - case ExistingFile: - QFileDialog::setFileMode(QFileDialog::ExistingFile); - break; - case ExistingFiles: - QFileDialog::setFileMode(QFileDialog::ExistingFiles); - break; - case Directory: - QFileDialog::setFileMode(QFileDialog::Directory); - break; - case DirectoryOnly: - QFileDialog::setFileMode(QFileDialog::DirectoryOnly); - break; - default: - QFileDialog::setFileMode(QFileDialog::AnyFile); - break; - } - } - - void KviTalFileDialog::setDirectory(const QString & szDirectory) - { - QFileDialog::setDirectory(szDirectory); +#ifdef COMPILE_KDE_SUPPORT + case AnyFile: + setMode(KFile::File | KFile::LocalOnly); + setOperationMode(Saving); + break; + case ExistingFile: + setMode(KFile::File | KFile::ExistingOnly | KFile::LocalOnly); + setOperationMode(Opening); + break; + case ExistingFiles: + setMode(KFile::Files | KFile::ExistingOnly | KFile::LocalOnly); + setOperationMode(Opening); + break; + case Directory: + setMode(KFile::Directory); + break; + case DirectoryOnly: + setMode(KFile::Directory); + break; + default: + setMode(KFile::File | KFile::LocalOnly); + setOperationMode(Saving); + break; +#else // COMPILE_KDE_SUPPORT + case AnyFile: + QFileDialog::setFileMode(QFileDialog::AnyFile); + break; + case ExistingFile: + QFileDialog::setFileMode(QFileDialog::ExistingFile); + break; + case ExistingFiles: + QFileDialog::setFileMode(QFileDialog::ExistingFiles); + break; + case Directory: + QFileDialog::setFileMode(QFileDialog::Directory); + break; + case DirectoryOnly: + QFileDialog::setFileMode(QFileDialog::DirectoryOnly); + break; + default: + QFileDialog::setFileMode(QFileDialog::AnyFile); + break; +#endif // COMPILE_KDE_SUPPORT } +} +void KviTalFileDialog::setDirectory(const QString & szDirectory) +{ +#ifdef COMPILE_KDE_SUPPORT + setUrl(KUrl(szDirectory)); +#else + QFileDialog::setDirectory(szDirectory); +#endif +} #ifndef COMPILE_USE_STANDALONE_MOC_SOURCES - #include "kvi_tal_filedialog_qt.moc" + #include "kvi_tal_filedialog.moc" #endif //COMPILE_USE_STANDALONE_MOC_SOURCES - -#endif diff --git a/src/kvilib/tal/kvi_tal_filedialog.h b/src/kvilib/tal/kvi_tal_filedialog.h index 621f3c6c1..7667d3ed2 100644 --- a/src/kvilib/tal/kvi_tal_filedialog.h +++ b/src/kvilib/tal/kvi_tal_filedialog.h @@ -28,15 +28,91 @@ /** * \file kvi_tal_filedialog.h * \author Szymon Stefanek -* \brief Switcher between Qt and KDE classes +* \brief Toolkit Abstraction Layer class */ #include "kvi_settings.h" +/** +* \class KviTalFileDialog +* \brief Toolkit Abstraction Layer: filedialog class +*/ + +#ifdef COMPILE_KDE_SUPPORT + +#include <KFileDialog> + +class KVILIB_API KviTalFileDialog : public KFileDialog + +#else // COMPILE_KDE_SUPPORT + +#include <QFileDialog> + +class KVILIB_API KviTalFileDialog : public QFileDialog + +#endif // COMPILE_KDE_SUPPORT +{ + Q_OBJECT +public: + /** + * \brief Constructs the filedialog object + * \param szDirName The initial directory to display + * \param szFilter The filter to use to display + * \param pParent The parent object + * \param pcName The caption name of the dialog + * \param bModal Whether the dialog is modal + * \return KviTalFileDialog + */ + KviTalFileDialog(const QString & szDirName, const QString & szFilter = QString(), QWidget * pParent = 0, const char * pcName = 0, bool bModal = false); + + /** + * \brief Destroys the filedialog object + */ + ~KviTalFileDialog(); +public: + /** + * \enum FileMode + * \brief Indicate what the user may select in the file dialog + */ + enum FileMode { + AnyFile, /**< The name of a file, whether it exists or not */ + ExistingFile, /**< The name of a single existing file */ + ExistingFiles, /**< The names of zero or more existing files */ + Directory, /**< The name of a directory. Both files and directories are displayed */ + DirectoryOnly /**< The name of a directory. The file dialog will only display directories */ + }; + + /** + * \brief Sets the file mode + * \param m The mode :) + * \return void + */ + void setFileMode(FileMode m); + + /** + * \brief Sets the current directory + * \param szDirectory The directory + * \return void + */ + void setDirectory(const QString & szDirectory); + + /** + * \brief Returns an existing directory selected by the user + * \param szDir The directory to display + * \param szCaption The caption of the dialog + * \param pParent The parent object + * \return QString + */ + static QString getExistingDirectoryPath(const QString & szDir = QString(), const QString & szCaption = QString(), QWidget * pParent = 0) + { #ifdef COMPILE_KDE_SUPPORT - #include "kvi_tal_filedialog_kde.h" -#else - #include "kvi_tal_filedialog_qt.h" -#endif + // QFileDialog allows making new directories...kfiledialog not :/ + return KFileDialog::getExistingDirectory(KUrl(szDir),pParent,szCaption); + //return getExistingDirectory(dir,parent,caption); +#else // COMPILE_KDE_SUPPORT + return getExistingDirectory(pParent,szCaption,szDir); +#endif // COMPILE_KDE_SUPPORT + }; +}; #endif // _KVI_TAL_FILEDIALOG_H_ diff --git a/src/kvilib/tal/kvi_tal_filedialog_kde.h b/src/kvilib/tal/kvi_tal_filedialog_kde.h deleted file mode 100644 index 9a4c211bf..000000000 --- a/src/kvilib/tal/kvi_tal_filedialog_kde.h +++ /dev/null @@ -1,102 +0,0 @@ -#ifndef _KVI_TAL_FILEDIALOG_KDE_H_ -#define _KVI_TAL_FILEDIALOG_KDE_H_ -//============================================================================= -// -// File : kvi_tal_filedialog_kde.h -// Creation date : Thu Aug 11 2003 04:43:58 by Szymon Stefanek -// -// This file is part of the KVirc irc client distribution -// Copyright (C) 2003-2008 Szymon Stefanek (pragma at kvirc dot net) -// -// 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 opinion) 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. ,59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -// -//============================================================================= - -/** -* \file kvi_tal_filedialog_qt.h -* \author Szymon Stefanek -* \brief KDE class for application -*/ - -#include "kvi_settings.h" - -#include <KFileDialog> - -/** -* \class KviTalFileDialog -* \brief Toolkit Abstraction Layer: filedialog class -*/ -class KVILIB_API KviTalFileDialog : public KFileDialog -{ - Q_OBJECT -public: - /** - * \brief Constructs the filedialog object - * \param szDirName The initial directory to display - * \param szFilter The filter to use to display - * \param pParent The parent object - * \param pcName The caption name of the dialog - * \param bModal Whether the dialog is modal - * \return KviTalFileDialog - */ - KviTalFileDialog(const QString & szDirName, const QString & szFilter = QString(), QWidget * pParent = 0, const char * pcName = 0, bool bModal = false); - - /** - * \brief Destroys the filedialog object - */ - ~KviTalFileDialog(); -public: - /** - * \enum FileMode - * \brief Indicate what the user may select in the file dialog - */ - enum FileMode { - AnyFile, /**< The name of a file, whether it exists or not */ - ExistingFile, /**< The name of a single existing file */ - ExistingFiles, /**< The names of zero or more existing files */ - Directory, /**< The name of a directory. Both files and directories are displayed */ - DirectoryOnly /**< The name of a directory. The file dialog will only display directories */ - }; - - /** - * \brief Sets the file mode - * \param m The mode :) - * \return void - */ - void setFileMode(FileMode m); - - /** - * \brief Sets the current directory - * \param szDirectory The directory - * \return void - */ - void setDirectory(const QString & szDirectory); - - /** - * \brief Returns an existing directory selected by the user - * \param szDir The directory to display - * \param szCaption The caption of the dialog - * \param pParent The parent object - * \return QString - */ - static QString getExistingDirectoryPath(const QString & szDir = QString(), const QString & szCaption = QString(), QWidget * pParent = 0) - { - // QFileDialog allows making new directories...kfiledialog not :/ - return KFileDialog::getExistingDirectory(KUrl(szDir),pParent,szCaption); - //return getExistingDirectory(dir,parent,caption); - }; -}; - -#endif // _KVI_TAL_FILEDIALOG_KDE_H_ diff --git a/src/kvilib/tal/kvi_tal_filedialog_qt.h b/src/kvilib/tal/kvi_tal_filedialog_qt.h deleted file mode 100644 index 695ad2a21..000000000 --- a/src/kvilib/tal/kvi_tal_filedialog_qt.h +++ /dev/null @@ -1,98 +0,0 @@ -#ifndef _KVI_TAL_FILEDIALOG_QT_H_ -#define _KVI_TAL_FILEDIALOG_QT_H_ - -//============================================================================= -// -// File : kvi_tal_filedialog_qt.h -// Creation date : Fri 19 Jan 2007 02:17:12 by Szymon Stefanek -// -// This file is part of the KVirc irc client distribution -// Copyright (C) 2007-2008 Szymon Stefanek (pragma at kvirc dot net) -// -// 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 opinion) 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. ,59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -// -//============================================================================= - -/** -* \file kvi_tal_filedialog_qt.h -* \author Szymon Stefanek -* \brief Qt class for application -*/ - -#include "kvi_settings.h" - -#include <QFileDialog> - -/** -* \class KviTalFileDialog -* \brief Toolkit Abstraction Layer: filedialog class -*/ -class KVILIB_API KviTalFileDialog : public QFileDialog -{ - Q_OBJECT -public: - /** - * \brief Constructs the filedialog object - * \param szDirName The initial directory to display - * \param szFilter The filter to use to display - * \param pParent The parent object - * \param pcName The caption name of the dialog - * \param bModal Whether the dialog is modal - * \return KviTalFileDialog - */ - KviTalFileDialog(const QString & szDirName, const QString & szFilter = QString(), QWidget * pParent = 0, const char * pcName = 0, bool bModal = false); - - /** - * \brief Destroys the filedialog object - */ - ~KviTalFileDialog(); -public: - /** - * \enum FileMode - * \brief Indicate what the user may select in the file dialog - */ - enum FileMode { - AnyFile, /**< The name of a file, whether it exists or not */ - ExistingFile, /**< The name of a single existing file */ - ExistingFiles, /**< The names of zero or more existing files */ - Directory, /**< The name of a directory. Both files and directories are displayed */ - DirectoryOnly /**< The name of a directory. The file dialog will only display directories */ - }; - - /** - * \brief Sets the file mode - * \param m The mode :) - * \return void - */ - void setFileMode(FileMode m); - - /** - * \brief Sets the current directory - * \param szDirectory The directory - * \return void - */ - void setDirectory(const QString & szDirectory); - - /** - * \brief Returns an existing directory selected by the user - * \param szDir The directory to display - * \param szCaption The caption of the dialog - * \param pParent The parent object - * \return QString - */ - static QString getExistingDirectoryPath(const QString & szDir = QString(), const QString & szCaption = QString(), QWidget * pParent = 0){ return getExistingDirectory(pParent,szCaption,szDir); }; -}; - -#endif // _KVI_TAL_FILEDIALOG_QT_H_ |
