KIO
renamedialog.h
Go to the documentation of this file.
00001 /* This file is part of the KDE libraries 00002 Copyright (C) 2000 Stephan Kulow <coolo@kde.org> 00003 1999 - 2008 David Faure <faure@kde.org> 00004 2001 Holger Freyther <freyther@kde.org> 00005 00006 This library is free software; you can redistribute it and/or 00007 modify it under the terms of the GNU Library General Public 00008 License as published by the Free Software Foundation; either 00009 version 2 of the License, or (at your option) any later version. 00010 00011 This library is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 Library General Public License for more details. 00015 00016 You should have received a copy of the GNU Library General Public License 00017 along with this library; see the file COPYING.LIB. If not, write to 00018 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00019 Boston, MA 02110-1301, USA. 00020 */ 00021 00022 #ifndef KIO_RENAMEDIALOG_H 00023 #define KIO_RENAMEDIALOG_H 00024 00025 #include <ksqueezedtextlabel.h> 00026 #include <kurl.h> 00027 #include <QtGui/QDialog> 00028 #include <QtCore/QString> 00029 #include <sys/types.h> 00030 00031 #include <kio/global.h> 00032 00033 class QScrollArea; 00034 class QLabel; 00035 class QPixmap; 00036 class KFileItem; 00037 00038 namespace KIO 00039 { 00040 00041 // KDE5: get rid of M_OVERWRITE_ITSELF, trigger it internally if src==dest 00042 // KDE5: get rid of M_SINGLE. If not multi, then single ;) 00043 // KDE5: use QFlags to get rid of all the casting! 00056 enum RenameDialog_Mode { M_OVERWRITE = 1, M_OVERWRITE_ITSELF = 2, M_SKIP = 4, M_SINGLE = 8, M_MULTI = 16, M_RESUME = 32, M_NORENAME = 64, M_ISDIR = 128 }; 00057 00061 enum RenameDialog_Result {R_RESUME = 6, R_RESUME_ALL = 7, R_OVERWRITE = 4, R_OVERWRITE_ALL = 5, R_SKIP = 2, R_AUTO_SKIP = 3, R_RENAME = 1, R_AUTO_RENAME = 8, R_CANCEL = 0}; 00062 00063 00070 class KIO_EXPORT RenameDialog : public QDialog 00071 { 00072 Q_OBJECT 00073 public: 00090 RenameDialog(QWidget *parent, const QString & caption, 00091 const KUrl & src, const KUrl & dest, 00092 RenameDialog_Mode mode, 00093 KIO::filesize_t sizeSrc = KIO::filesize_t(-1), 00094 KIO::filesize_t sizeDest = KIO::filesize_t(-1), 00095 time_t ctimeSrc = time_t(-1), 00096 time_t ctimeDest = time_t(-1), 00097 time_t mtimeSrc = time_t(-1), 00098 time_t mtimeDest = time_t(-1)); 00099 ~RenameDialog(); 00100 00105 KUrl newDestUrl(); 00106 00107 00113 KUrl autoDestUrl() const; 00114 00121 static QString suggestName(const KUrl& baseURL, const QString& oldName); 00122 00123 public Q_SLOTS: 00124 void cancelPressed(); 00125 void renamePressed(); 00126 void skipPressed(); 00127 void autoSkipPressed(); 00128 void overwritePressed(); 00129 void overwriteAllPressed(); 00130 void resumePressed(); 00131 void resumeAllPressed(); 00132 void suggestNewNamePressed(); 00133 00134 protected Q_SLOTS: 00135 void enableRenameButton(const QString &); 00136 private Q_SLOTS: 00137 void applyAllPressed(); 00138 void showSrcIcon(const KFileItem &); 00139 void showDestIcon(const KFileItem &); 00140 void showSrcPreview(const KFileItem &, const QPixmap &); 00141 void showDestPreview(const KFileItem &, const QPixmap &); 00142 00143 private: 00144 QScrollArea* createContainerLayout(QWidget* parent, const KFileItem& item, QLabel* preview); 00145 QLabel* createLabel(QWidget* parent, const QString& text, const bool containerTitle); 00146 KSqueezedTextLabel* createSqueezedLabel(QWidget* parent, const QString& text); 00147 class RenameDialogPrivate; 00148 RenameDialogPrivate* const d; 00149 }; 00150 00151 } 00152 00153 #endif
KDE 4.6 API Reference