kio Library API Documentation

kpropertiesdialog.h

00001 /* This file is part of the KDE project
00002    Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
00003    Copyright (c) 1999, 2000 Preston Brown <pbrown@kde.org>
00004    Copyright (c) 2000 Simon Hausmann <hausmann@kde.org>
00005    Copyright (c) 2000 David Faure <faure@kde.org>
00006 
00007    This library is free software; you can redistribute it and/or
00008    modify it under the terms of the GNU Library General Public
00009    License as published by the Free Software Foundation; either
00010    version 2 of the License, or (at your option) any later version.
00011 
00012    This library is distributed in the hope that it will be useful,
00013    but WITHOUT ANY WARRANTY; without even the implied warranty of
00014    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015    Library General Public License for more details.
00016 
00017    You should have received a copy of the GNU Library General Public License
00018    along with this library; see the file COPYING.LIB.  If not, write to
00019    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00020    Boston, MA 02111-1307, USA.
00021 */
00022 
00023 /*
00024  * This file holds the definitions for all classes used to
00025  * display a properties dialog.
00026  */
00027 
00028 #ifndef __propsdlg_h
00029 #define __propsdlg_h
00030 
00031 #include <qstring.h>
00032 #include <qlist.h>
00033 
00034 #include <kurl.h>
00035 #include <kfileitem.h>
00036 #include <kdialogbase.h>
00037 
00038 class QLineEdit;
00039 class QCheckBox;
00040 class QPushButton;
00041 class KLineEdit;
00042 class KURLRequester;
00043 class QButton;
00044 class KIconButton;
00045 class KPropsDlgPlugin;
00046 class QComboBox;
00047 
00048 #define KPropsPage KPropsDlgPlugin
00049 
00050 namespace KIO { class Job; }
00051 
00064 class KPropertiesDialog : public KDialogBase
00065 {
00066   Q_OBJECT
00067 
00068 public:
00069 
00074   static bool canDisplay( KFileItemList _items );
00075 
00087   KPropertiesDialog( KFileItem * item,
00088                      QWidget* parent = 0L, const char* name = 0L,
00089                      bool modal = false, bool autoShow = true);
00102   KPropertiesDialog( KFileItemList _items,
00103                      QWidget *parent = 0L, const char* name = 0L,
00104                      bool modal = false, bool autoShow = true);
00105 
00106 #ifndef KDE_NO_COMPAT
00107 
00119   KPropertiesDialog( const KURL& _url, mode_t _mode,
00120                      QWidget* parent = 0L, const char* name = 0L,
00121                      bool modal = false, bool autoShow = true);
00122 #endif
00123 
00140   KPropertiesDialog( const KURL& _url,
00141                      QWidget* parent = 0L, const char* name = 0L,
00142                      bool modal = false, bool autoShow = true);
00143 
00158   KPropertiesDialog( const KURL& _tempUrl, const KURL& _currentDir,
00159                      const QString& _defaultName,
00160                      QWidget* parent = 0L, const char* name = 0L,
00161                      bool modal = false, bool autoShow = true);
00162 
00172   KPropertiesDialog (const QString& title,
00173                      QWidget* parent = 0L, const char* name = 0L, bool modal = false);
00174 
00180   virtual ~KPropertiesDialog();
00181 
00182 
00196   void insertPlugin (KPropsDlgPlugin *plugin);
00197 
00202   const KURL& kurl() const { return m_singleUrl; }
00203 
00210   KFileItem *item() { return m_items.first(); }
00211 
00215   KFileItemList items() const { return m_items; }
00216 
00221   KDialogBase* dialog() { return this; }
00222   const KDialogBase* dialog() const { return this; }
00223 
00229   const KURL& currentDir() const { return m_currentDir; }
00230 
00236   const QString& defaultName() const { return m_defaultName; }
00237 
00244   void updateUrl( const KURL& _newUrl );
00245 
00251   void rename( const QString& _name );
00252 
00256   void abortApplying();
00257 
00261   void showFileSharingPage();
00262 
00263 public slots:
00267   virtual void slotOk();      // Deletes the PropertiesDialog instance
00268   virtual void slotCancel();     // Deletes the PropertiesDialog instance
00269 
00270 signals:
00274   void propertiesClosed();
00275   void applied();
00276   void canceled();
00277 
00278 private:
00279 
00283   void init (bool modal = false, bool autoShow = true);
00284 
00288   void insertPages();
00289 
00293   KURL m_singleUrl;
00294 
00298   KFileItemList m_items;
00299 
00303   QString m_defaultName;
00304   KURL m_currentDir;
00305 
00309   QPtrList<KPropsDlgPlugin> m_pageList;
00310 
00311 private slots:
00312   void slotStatResult( KIO::Job * job );
00313 protected:
00314   virtual void virtual_hook( int id, void* data );
00315 private:
00316   class KPropertiesDialogPrivate;
00317   KPropertiesDialogPrivate *d;
00318 };
00319 
00334 class KPropsDlgPlugin : public QObject
00335 {
00336   Q_OBJECT
00337 public:
00343   KPropsDlgPlugin( KPropertiesDialog *_props );
00344   virtual ~KPropsDlgPlugin();
00345 
00351   virtual void applyChanges();
00352 
00357   static bool isDesktopFile( KFileItem * _item );
00358 
00359   void setDirty( bool b );
00360   bool isDirty() const;
00361 
00362 public slots:
00363   void setDirty(); // same as setDirty( true )
00364 
00365 signals:
00371   void changed();
00372 
00373 protected:
00377   KPropertiesDialog *properties;
00378 
00379   int fontHeight;
00380 protected:
00381   virtual void virtual_hook( int id, void* data );
00382 private:
00383   class KPropsDlgPluginPrivate;
00384   KPropsDlgPluginPrivate *d;
00385 };
00386 
00392 class KFilePropsPlugin : public KPropsDlgPlugin
00393 {
00394   Q_OBJECT
00395 public:
00399   KFilePropsPlugin( KPropertiesDialog *_props );
00400   virtual ~KFilePropsPlugin();
00401 
00407   virtual void applyChanges();
00408 
00412   static bool supports( KFileItemList _items );
00413 
00417   void postApplyChanges();
00418 
00419 protected slots:
00420   void slotCopyFinished( KIO::Job * );
00421   void slotFileRenamed( KIO::Job *, const KURL &, const KURL & );
00422   void slotDirSizeFinished( KIO::Job * );
00423   void slotFoundMountPoint( const QString& mp, unsigned long kBSize, unsigned long kBUsed, unsigned long kBAvail );
00424   void slotSizeStop();
00425   void slotSizeDetermine();
00426 
00427 private slots:
00428   // workaround for compiler bug
00429 void slotFoundMountPoint( const unsigned long& kBSize, const unsigned long& kBUsed, const unsigned long& kBAvail, const QString& mp );
00430  void nameFileChanged(const QString &text );
00431 private:
00432 
00433   void determineRelativePath( const QString & path );
00434 
00435   QWidget *iconArea;
00436   QWidget *nameArea;
00437 
00438   QLabel *m_sizeLabel;
00439   QPushButton *m_sizeDetermineButton;
00440   QPushButton *m_sizeStopButton;
00441 
00442   QString m_sRelativePath;
00443   bool m_bFromTemplate;
00444 
00448   QString oldName;
00449 
00450   class KFilePropsPluginPrivate;
00451   KFilePropsPluginPrivate *d;
00452 };
00453 
00460 class KFilePermissionsPropsPlugin : public KPropsDlgPlugin
00461 {
00462   Q_OBJECT
00463 public:
00467   KFilePermissionsPropsPlugin( KPropertiesDialog *_props );
00468   virtual ~KFilePermissionsPropsPlugin();
00469 
00470   virtual void applyChanges();
00471 
00475   static bool supports( KFileItemList _items );
00476 
00477 private slots:
00478 
00479   void slotChmodResult( KIO::Job * );
00480   void slotRecursiveClicked();
00481 
00482 private:
00483   QCheckBox *permBox[3][4];
00484 
00485   QComboBox *grpCombo;
00486   KLineEdit *usrEdit, *grpEdit;
00487 
00491   mode_t permissions;
00495   QString strGroup;
00499   QString strOwner;
00500 
00504   static mode_t fperm[3][4];
00505 
00506   class KFilePermissionsPropsPluginPrivate;
00507   KFilePermissionsPropsPluginPrivate *d;
00508 };
00509 
00518 class KExecPropsPlugin : public KPropsDlgPlugin
00519 {
00520   Q_OBJECT
00521 public:
00525   KExecPropsPlugin( KPropertiesDialog *_props );
00526   virtual ~KExecPropsPlugin();
00527 
00528   virtual void applyChanges();
00529 
00530   static bool supports( KFileItemList _items );
00531 
00532 public slots:
00533   void slotBrowseExec();
00534 
00535 private slots:
00536   void enableCheckedEdit();
00537   void enableSuidEdit();
00538 
00539 private:
00540 
00541     QLabel *terminalLabel;
00542     QLabel *suidLabel;
00543     KLineEdit *execEdit;
00544     QCheckBox *terminalCheck;
00545     QCheckBox *suidCheck;
00546     KLineEdit *terminalEdit;
00547     KLineEdit *suidEdit;
00548     KLineEdit *swallowExecEdit;
00549     KLineEdit *swallowTitleEdit;
00550     QButton *execBrowse;
00551 
00552     QString execStr;
00553     QString swallowExecStr;
00554     QString swallowTitleStr;
00555     QString termOptionsStr;
00556     bool termBool;
00557     bool suidBool;
00558     QString suidUserStr;
00559 
00560     class KExecPropsPluginPrivate;
00561     KExecPropsPluginPrivate *d;
00562 };
00563 
00572 class KURLPropsPlugin : public KPropsDlgPlugin
00573 {
00574   Q_OBJECT
00575 public:
00579   KURLPropsPlugin( KPropertiesDialog *_props );
00580   virtual ~KURLPropsPlugin();
00581 
00582   virtual void applyChanges();
00583 
00584   static bool supports( KFileItemList _items );
00585 
00586 private:
00587   KURLRequester *URLEdit;
00588   KIconButton *iconBox;
00589 
00590   QString URLStr;
00591   QString iconStr;
00592 
00593   QPixmap pixmap;
00594   QString pixmapFile;
00595 private:
00596   class KURLPropsPluginPrivate;
00597   KURLPropsPluginPrivate *d;
00598 };
00599 
00608 class KApplicationPropsPlugin : public KPropsDlgPlugin
00609 {
00610   Q_OBJECT
00611 public:
00615   KApplicationPropsPlugin( KPropertiesDialog *_props );
00616   virtual ~KApplicationPropsPlugin();
00617 
00618   virtual void applyChanges();
00619 
00620   static bool supports( KFileItemList _items );
00621 
00622 public slots:
00623   void slotDelExtension();
00624   void slotAddExtension();
00625 
00626 private slots:
00627   void updateButton();
00628 
00629 private:
00630   void addMimeType( const QString & name );
00631 
00632   QLineEdit *commentEdit;
00633   QLineEdit *genNameEdit;
00634   QLineEdit *nameEdit;
00635   QListBox  *extensionsList;
00636   QListBox  *availableExtensionsList;
00637   QPushButton *addExtensionButton;
00638   QPushButton *delExtensionButton;
00639 
00640   class KApplicationPropsPluginPrivate;
00641   KApplicationPropsPluginPrivate *d;
00642 };
00643 
00650 class KBindingPropsPlugin : public KPropsDlgPlugin
00651 {
00652   Q_OBJECT
00653 public:
00657   KBindingPropsPlugin( KPropertiesDialog *_props );
00658   virtual ~KBindingPropsPlugin();
00659 
00660   virtual void applyChanges();
00661   static bool supports( KFileItemList _items );
00662 
00663 private:
00664 
00665   QLineEdit *commentEdit;
00666   QLineEdit *patternEdit;
00667   QLineEdit *mimeEdit;
00668   QString m_sMimeStr;
00669 
00670   QCheckBox * cbAutoEmbed;
00671 
00672   class KBindingPropsPluginPrivate;
00673   KBindingPropsPluginPrivate *d;
00674 };
00675 
00680 class KDevicePropsPlugin : public KPropsDlgPlugin
00681 {
00682   Q_OBJECT
00683 public:
00684   KDevicePropsPlugin( KPropertiesDialog *_props );
00685   virtual ~KDevicePropsPlugin();
00686 
00687   virtual void applyChanges();
00688 
00689   static bool supports( KFileItemList _items );
00690 
00691 private slots:
00692   void slotActivated( int );
00693 
00694 private:
00695   QComboBox* device;
00696   QLabel* mountpoint;
00697   QCheckBox* readonly;
00698   void* unused;
00699   //KIconButton* mounted;
00700   KIconButton* unmounted;
00701 
00702   QStringList m_devicelist;
00703   int indexDevice;
00704   int indexMountPoint;
00705   int indexFSType;
00706 
00707   QPixmap pixmap;
00708   QString pixmapFile;
00709 
00710   class KDevicePropsPluginPrivate;
00711   KDevicePropsPluginPrivate *d;
00712 };
00713 
00714 #endif
00715 
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:31 2003 by doxygen 1.2.18 written by Dimitri van Heesch, © 1997-2001