kio Library: kfilemetainfowidget.h Source File (kio Library)

| # kio Library API Documentation
Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Namespaces | Source Files

# kfilemetainfowidget.h

    00001 /* This file is part of the KDE libraries
    00002     Copyright (C) 2001,2002 Rolf Magnus <ramagnus@kde.org>
    00003
    00004     library is free software; you can redistribute it and/or
    00005     modify it under the terms of the GNU Library General Public
    00006     License version 2 as published by the Free Software Foundation.
    00007
    00008     This library is distributed in the hope that it will be useful,
    00009     but WITHOUT ANY WARRANTY; without even the implied warranty of
    00010     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00011     Library General Public License for more details.
    00012
    00013     You should have received a copy of the GNU Library General Public License
    00014     along with this library; see the file COPYING.LIB.  If not, write to
    00015     the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    00016     Boston, MA 02111-1307, USA.
    00017
    00018  */
    00019
    00020 #ifndef __KFILEMETAINFOWIDGET_H__
    00021 #define __KFILEMETAINFOWIDGET_H__
    00022
    00023 #include <qwidget.h>
    00024 #include <qvariant.h>
    00025 #include <kfilemetainfo.h>
    00026
    00030 class KIO_EXPORT KFileMetaInfoWidget: public QWidget
    00031 {
    00032     Q_OBJECT
    00033 public:
    00034     enum Mode
    00035     {
    00036       ReadOnly  = 1,
    00037       ReadWrite = 0,
    00038       Reserve = 0xff
    00039     };
    00040
    00041     KFileMetaInfoWidget(KFileMetaInfoItem item, QValidator* val = 0,
    00042                         QWidget* parent = 0, const char* name = 0);
    00043
    00044     KFileMetaInfoWidget(KFileMetaInfoItem item, Mode mode, QValidator* val = 0,
    00045                         QWidget* parent = 0, const char* name = 0);
    00046
    00047     virtual ~KFileMetaInfoWidget();
    00048
    00049     bool apply()
    00050     {
    00051         return m_item.isEditable() && m_item.setValue(m_value);
    00052     }
    00053
    00054     void setValue(const QVariant& value)  { m_value = value;    }
    00055     QVariant value()const                      { return m_value;     }
    00056     QValidator* validator() const              { return m_validator; }
    00057     KFileMetaInfoItem item()const              { return m_item;      }
    00058
    00059 signals:
    00060     void valueChanged(const QVariant& value);
    00061
    00062 protected:
    00063     void reparentValidator(QWidget *widget, QValidator *validator);
    00064     virtual QWidget* makeWidget();
    00065
    00066     QWidget* makeBoolWidget();
    00067     QWidget* makeIntWidget();
    00068     QWidget* makeDoubleWidget();
    00069     QWidget* makeStringWidget();
    00070     QWidget* makeDateWidget();
    00071     QWidget* makeTimeWidget();
    00072     QWidget* makeDateTimeWidget();
    00073
    00074 private slots:
    00075     void slotChanged(bool value);
    00076     void slotChanged(int value);
    00077     void slotChanged(double value);
    00078     void slotComboChanged(const QString &value);
    00079     void slotLineEditChanged(const QString& value);
    00080     void slotMultiLineEditChanged();
    00081     void slotDateChanged(const QDate& value);
    00082     void slotTimeChanged(const QTime& value);
    00083     void slotDateTimeChanged(const QDateTime& value);
    00084
    00085 private:
    00086     void init(KFileMetaInfoItem item, Mode mode);
    00087
    00088     QVariant          m_value;  // the value will be saved here until apply() is called
    00089     KFileMetaInfoItem m_item;
    00090     QWidget*          m_widget;
    00091     QValidator*       m_validator;
    00092     bool              m_dirty : 1;
    00093 };
    00094
    00095 #endif

This file is part of the documentation for kio Library Version 3.4.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat Jun 11 20:23:58 2005 by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2003