From d9ac44e08f8d2abe7104c20e308d05038e1896da Mon Sep 17 00:00:00 2001 From: Peter Penz Date: Tue, 13 Mar 2007 17:31:54 +0000 Subject: Allow renaming of items (note that currently the "rename multiple files" dialog is temporary used for this until KFileItemDelegate offers editing functionality). svn path=/trunk/KDE/kdebase/apps/; revision=642219 --- src/renamedialog.h | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'src/renamedialog.h') diff --git a/src/renamedialog.h b/src/renamedialog.h index 093484f2b..c08856f8c 100644 --- a/src/renamedialog.h +++ b/src/renamedialog.h @@ -1,6 +1,5 @@ /*************************************************************************** - * Copyright (C) 2006 by Peter Penz * - * peter.penz@gmx.at * + * Copyright (C) 2006 by Peter Penz (peter.penz@gmx.at) * * * * 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 * @@ -22,7 +21,8 @@ #include #include -#include + +#include class KLineEdit; @@ -35,10 +35,15 @@ class KLineEdit; * RenameDialog dialog(...); * if (dialog.exec() == QDialog::Accepted) { * const QString& newName = dialog.newName(); - * // ... rename items corresponding to the new name + * if (newName.isEmpty()) { + * // an invalid name has been chosen, use + * // dialog.errorString() to tell the user about this + * } + * else { + * // rename items corresponding to the new name + * } * } * \endcode - * @author Peter Penz */ class RenameDialog : public KDialog { @@ -56,12 +61,18 @@ public: */ const QString& newName() const { return m_newName; } + /** + * Returns the error string, if Dialog::newName() returned an empty string. + */ + const QString& errorString() const { return m_errorString; } + protected slots: virtual void slotButtonClicked(int button); private: KLineEdit* m_lineEdit; QString m_newName; + QString m_errorString; }; #endif -- cgit v1.3.1