kauthicon.h
00001 /* This file is part of the KDE libraries 00002 Copyright (c) 1999 Preston Brown <pbrown@kde.org> 00003 00004 This 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., 51 Franklin Street, Fifth Floor, 00016 Boston, MA 02110-1301, USA. 00017 */ 00018 #ifndef _KAUTHICON_H 00019 #define _KAUTHICON_H "$Id: kauthicon.h 465272 2005-09-29 09:47:40Z mueller $" 00020 00021 #include <qfileinfo.h> 00022 #include <qpixmap.h> 00023 #include <qstring.h> 00024 #include <qwidget.h> 00025 00026 #include <kdelibs_export.h> 00027 00028 class QHBoxLayout; 00029 class QLabel; 00030 class KAuthIconPrivate; 00031 00047 class KDEUI_EXPORT KAuthIcon : public QWidget 00048 { 00049 Q_OBJECT 00050 00051 public: 00055 KAuthIcon(QWidget *parent = 0, const char *name = 0); 00056 ~KAuthIcon(); 00057 00058 virtual QSize sizeHint() const; 00062 virtual bool status() const = 0; 00063 00064 public slots: 00069 virtual void updateStatus() = 0; 00070 00071 signals: 00078 void authChanged(bool authorized); 00079 00080 protected: 00081 QHBoxLayout *layout; 00082 00083 QLabel *lockBox; 00084 QLabel *lockLabel; 00085 QPixmap lockPM; 00086 QPixmap openLockPM; 00087 QString lockText; 00088 QString openLockText; 00089 00090 protected: 00091 virtual void virtual_hook( int id, void* data ); 00092 private: 00093 KAuthIconPrivate *d; 00094 }; 00095 00096 class KRootPermsIconPrivate; 00103 class KDEUI_EXPORT KRootPermsIcon : public KAuthIcon 00104 { 00105 Q_OBJECT 00106 00107 public: 00108 KRootPermsIcon(QWidget *parent = 0, const char *name = 0); 00109 ~KRootPermsIcon(); 00110 00114 bool status() const { return root; } 00115 00116 public slots: 00117 void updateStatus(); 00118 00119 protected: 00120 bool root; 00121 00122 protected: 00123 virtual void virtual_hook( int id, void* data ); 00124 private: 00125 KRootPermsIconPrivate *d; 00126 }; 00127 00128 class KWritePermsIconPrivate; 00135 class KDEUI_EXPORT KWritePermsIcon : public KAuthIcon 00136 { 00137 Q_OBJECT 00138 Q_PROPERTY( QString fileName READ fileName WRITE setFileName ) 00139 00140 public: 00141 KWritePermsIcon(const QString & fileName, QWidget *parent = 0, const char *name = 0); 00142 ~KWritePermsIcon(); 00146 bool status() const { return writable; } 00147 00152 void setFileName(const QString & fileName) { fi.setFile(fileName); updateStatus(); } 00153 00158 QString fileName() const { return fi.fileName(); } 00159 00160 public slots: 00161 void updateStatus(); 00162 00163 protected: 00164 bool writable; 00165 QFileInfo fi; 00166 00167 protected: 00168 virtual void virtual_hook( int id, void* data ); 00169 private: 00170 KWritePermsIconPrivate *d; 00171 }; 00172 00173 #endif