kio Library API Documentation

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     $Id: kfilemetainfowidget.h,v 1.5.2.1 2002/12/14 13:23:16 pfeiffer Exp $
00019  */
00020 
00021 #ifndef __KFILEMETAINFOWIDGET_H__
00022 #define __KFILEMETAINFOWIDGET_H__
00023 
00024 #include <qwidget.h>
00025 #include <qvariant.h>
00026 #include <kfilemetainfo.h>
00027 
00031 class KFileMetaInfoWidget: public QWidget
00032 {
00033     Q_OBJECT
00034 public:
00035     KFileMetaInfoWidget(KFileMetaInfoItem item, QValidator* val = 0,
00036                         QWidget* parent = 0, const char* name = 0);
00037     virtual ~KFileMetaInfoWidget();
00038 
00039     bool apply()
00040     {
00041         return m_item.isEditable() && m_item.setValue(m_value);
00042     }
00043 
00044     void setValue(const QVariant& value)  { m_value = value;    }
00045     QVariant value()                      { return m_value;     }
00046     QValidator* validator()               { return m_validator; }
00047     KFileMetaInfoItem item()              { return m_item;      }
00048 
00049 signals:
00050     void valueChanged(const QVariant& value);
00051 
00052 protected:
00053     void reparentValidator(QWidget *widget, QValidator *validator);
00054     virtual QWidget* makeWidget();
00055 
00056     QWidget* makeBoolWidget();
00057     QWidget* makeIntWidget();
00058     QWidget* makeDoubleWidget();
00059     QWidget* makeStringWidget();
00060     QWidget* makeDateWidget();
00061     QWidget* makeTimeWidget();
00062     QWidget* makeDateTimeWidget();
00063 
00064 private slots:
00065     void slotChanged(bool value);
00066     void slotChanged(int value);
00067     void slotChanged(double value);
00068     void slotComboChanged(int item);
00069     void slotLineEditChanged(const QString& value);
00070     void slotMultiLineEditChanged();
00071     void slotDateChanged(const QDate& value);
00072     void slotTimeChanged(const QTime& value);
00073     void slotDateTimeChanged(const QDateTime& value);
00074 
00075 private:
00076     QVariant          m_value;  // the value will be saved here until apply() is called
00077     KFileMetaInfoItem m_item;
00078     QWidget*          m_widget;
00079     QValidator*       m_validator;
00080     bool              m_dirty : 1;
00081 };
00082 
00083 #endif
KDE Logo
This file is part of the documentation for kdelibs Version 3.1.0.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Oct 8 12:21:29 2003 by doxygen 1.2.18 written by Dimitri van Heesch, © 1997-2001