kio: cleanup kfile

This commit is contained in:
Ivailo Monev 2015-05-03 21:08:53 +00:00
parent f33caea49d
commit 34e0dbd352
3 changed files with 5 additions and 96 deletions

View file

@ -1,69 +0,0 @@
/*****************************************************************************
* Copyright (C) 2008 by Sebastian Trueg <trueg@kde.org> *
* Copyright (C) 2009 by Peter Penz <peter.penz@gmx.at> *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library 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 *
* Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public License *
* along with this library; see the file COPYING.LIB. If not, write to *
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, *
* Boston, MA 02110-1301, USA. *
*****************************************************************************/
#ifndef KCOMMENT_WIDGET
#define KCOMMENT_WIDGET
#include <QString>
#include <QWidget>
class QLabel;
/**
* @brief Allows to edit and show a comment as part of KMetaDataWidget.
*/
class KCommentWidget : public QWidget
{
Q_OBJECT
public:
explicit KCommentWidget(QWidget* parent = 0);
virtual ~KCommentWidget();
void setText(const QString& comment);
QString text() const;
/**
* If set to true, the comment cannot be changed by the user.
* Per default read-only is disabled.
*/
// TODO: provide common interface class for metadatawidgets
void setReadOnly(bool readOnly);
bool isReadOnly() const;
virtual QSize sizeHint() const;
signals:
void commentChanged(const QString& comment);
protected:
virtual bool event(QEvent* event);
private slots:
void slotLinkActivated(const QString& link);
private:
bool m_readOnly;
QLabel* m_label;
QLabel* m_sizeHintHelper; // see comment in KCommentWidget::sizeHint()
QString m_comment;
};
#endif

View file

@ -44,7 +44,7 @@ public:
{
}
void init(KFileMetaInfoItem item, KFileMetaInfoWidget::Mode mode);
void init(KFileMetaInfoItem item);
KFileMetaInfoWidget *q;
QVariant m_value; // the value will be saved here until apply() is called
@ -65,18 +65,6 @@ public:
*/
KFileMetaInfoWidget::KFileMetaInfoWidget(KFileMetaInfoItem item,
QValidator* val,
QWidget* parent )
: QWidget(parent), d(new KFileMetaInfoWidgetPrivate(this))
{
d->m_value = item.value();
d->m_item = item;
d->m_validator = val;
d->init(item, ReadWrite);
}
KFileMetaInfoWidget::KFileMetaInfoWidget(KFileMetaInfoItem item,
Mode mode,
QValidator* val,
QWidget* parent)
: QWidget(parent), d(new KFileMetaInfoWidgetPrivate(this))
@ -84,16 +72,16 @@ KFileMetaInfoWidget::KFileMetaInfoWidget(KFileMetaInfoItem item,
d->m_value = item.value();
d->m_item = item;
d->m_validator = val;
d->init(item, mode);
d->init(item);
}
void KFileMetaInfoWidgetPrivate::init(KFileMetaInfoItem item, KFileMetaInfoWidget::Mode mode)
void KFileMetaInfoWidgetPrivate::init(KFileMetaInfoItem item)
{
Q_UNUSED(item)
kDebug(7033) << "*** item " << m_item.name()
<< " is a " << m_value.typeName() << endl;
if (m_item.isEditable() && !(mode & KFileMetaInfoWidget::ReadOnly))
if (m_item.isEditable())
m_widget = q->makeWidget();
else
switch (m_value.type())

View file

@ -33,20 +33,10 @@ class KIO_EXPORT KFileMetaInfoWidget: public QWidget
{
Q_OBJECT
public:
enum Mode
{
ReadOnly = 1, ///Only display the meta information, and do not permit the user to edit them
ReadWrite = 0, ///Permits user to edit the displayed meta-info
Reserve = 0xff
};
explicit KFileMetaInfoWidget(KFileMetaInfoItem item,
KFileMetaInfoWidget(KFileMetaInfoItem item,
QValidator* val = 0,
QWidget* parent = 0);
KFileMetaInfoWidget(KFileMetaInfoItem item, Mode mode, QValidator* val = 0,
QWidget* parent = 0 );
virtual ~KFileMetaInfoWidget();
bool apply();