• Skip to content
  • Skip to link menu
KDE 3.5 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

kio

kpropertiesdialog.h

Go to the documentation of this file.
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., 51 Franklin Street, Fifth Floor,
00020    Boston, MA 02110-1301, 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 <qptrlist.h>
00033 
00034 #include <kdemacros.h>
00035 #include <kurl.h>
00036 #include <kfileitem.h>
00037 #include <kdialogbase.h>
00038 
00039 class QLineEdit;
00040 class QCheckBox;
00041 class QPushButton;
00042 class KLineEdit;
00043 class KURLRequester;
00044 class QButton;
00045 class KIconButton;
00046 class KPropsDlgPlugin;
00047 class QComboBox;
00048 
00049 #define KPropsPage KPropsDlgPlugin
00050 
00051 namespace KIO { class Job; }
00052 
00070 class KIO_EXPORT KPropertiesDialog : public KDialogBase
00071 {
00072   Q_OBJECT
00073 
00074 public:
00075 
00082   static bool canDisplay( KFileItemList _items );
00083 
00097   KPropertiesDialog( KFileItem * item,
00098                      QWidget* parent = 0L, const char* name = 0L,
00099                      bool modal = false, bool autoShow = true);
00100 
00115   KPropertiesDialog( KFileItemList _items,
00116                      QWidget *parent = 0L, const char* name = 0L,
00117                      bool modal = false, bool autoShow = true);
00118 
00119 #ifndef KDE_NO_COMPAT
00120 
00130   KPropertiesDialog( const KURL& _url, mode_t _mode,
00131                      QWidget* parent = 0L, const char* name = 0L,
00132                      bool modal = false, bool autoShow = true) KDE_DEPRECATED;
00133 #endif
00134 
00152   KPropertiesDialog( const KURL& _url,
00153                      QWidget* parent = 0L, const char* name = 0L,
00154                      bool modal = false, bool autoShow = true);
00155 
00170   KPropertiesDialog( const KURL& _tempUrl, const KURL& _currentDir,
00171                      const QString& _defaultName,
00172                      QWidget* parent = 0L, const char* name = 0L,
00173                      bool modal = false, bool autoShow = true);
00174 
00184   KPropertiesDialog (const QString& title,
00185                      QWidget* parent = 0L, const char* name = 0L, bool modal = false);
00186 
00192   virtual ~KPropertiesDialog();
00193 
00203   static bool showDialog(KFileItem* item, QWidget* parent = 0, 
00204                          const char* name = 0, bool modal = false);
00205 
00215   static bool showDialog(const KURL& _url, QWidget* parent = 0, 
00216                          const char* name = 0, bool modal = false);
00217 
00228   static bool showDialog(const KFileItemList& _items, QWidget* parent = 0, 
00229                          const char* name = 0, bool modal = false);
00230 
00244   void insertPlugin (KPropsDlgPlugin *plugin);
00245 
00253   const KURL& kurl() const { return m_singleUrl; }
00254 
00262   KFileItem *item() { return m_items.first(); }
00263 
00267   KFileItemList items() const { return m_items; }
00268 
00273   KDE_DEPRECATED KDialogBase* dialog() { return this; }
00278   KDE_DEPRECATED const KDialogBase* dialog() const { return this; }
00279 
00287   const KURL& currentDir() const { return m_currentDir; }
00288 
00295   const QString& defaultName() const { return m_defaultName; }
00296 
00303   void updateUrl( const KURL& _newUrl );
00304 
00311   void rename( const QString& _name );
00312 
00316   void abortApplying();
00317 
00325   void showFileSharingPage();
00326   
00335   void setFileSharingPage(QWidget* page);
00336 
00343   void setFileNameReadOnly( bool ro );
00344 
00345 public slots:
00349   virtual void slotOk();      // Deletes the PropertiesDialog instance
00353   virtual void slotCancel();     // Deletes the PropertiesDialog instance
00354 
00355 signals:
00360   void propertiesClosed();
00361 
00366   void applied();
00367 
00373   void canceled();
00379   void saveAs(const KURL &oldUrl, KURL &newUrl);
00380 
00381 private:
00382 
00386   void init (bool modal = false, bool autoShow = true);
00387 
00391   void insertPages();
00392 
00396   KURL m_singleUrl;
00397 
00401   KFileItemList m_items;
00402 
00406   QString m_defaultName;
00407   KURL m_currentDir;
00408 
00412   QPtrList<KPropsDlgPlugin> m_pageList;
00413 
00414 private slots:
00415   void slotStatResult( KIO::Job * ); // No longer used
00416 protected:
00417   virtual void virtual_hook( int id, void* data );
00418 private:
00419   class KPropertiesDialogPrivate;
00420   KPropertiesDialogPrivate *d;
00421 };
00422 
00437 class KIO_EXPORT KPropsDlgPlugin : public QObject
00438 {
00439   Q_OBJECT
00440 public:
00446   KPropsDlgPlugin( KPropertiesDialog *_props );
00447   virtual ~KPropsDlgPlugin();
00448 
00454   virtual void applyChanges();
00455 
00460   static bool isDesktopFile( KFileItem * _item );
00461 
00462   void setDirty( bool b );
00463   bool isDirty() const;
00464 
00465 public slots:
00466   void setDirty(); // same as setDirty( true )
00467 
00468 signals:
00474   void changed();
00475 
00476 protected:
00480   KPropertiesDialog *properties;
00481 
00482   int fontHeight;
00483 protected:
00484   virtual void virtual_hook( int id, void* data );
00485 private:
00486   class KPropsDlgPluginPrivate;
00487   KPropsDlgPluginPrivate *d;
00488 };
00489 
00495 class KIO_EXPORT KFilePropsPlugin : public KPropsDlgPlugin
00496 {
00497   Q_OBJECT
00498 public:
00502   KFilePropsPlugin( KPropertiesDialog *_props );
00503   virtual ~KFilePropsPlugin();
00504 
00510   virtual void applyChanges();
00511 
00515   static bool supports( KFileItemList _items );
00516 
00520   void postApplyChanges();
00521 
00522   void setFileNameReadOnly( bool ro );
00523 
00524 protected slots:
00525   void slotEditFileType();
00526   void slotCopyFinished( KIO::Job * );
00527   void slotFileRenamed( KIO::Job *, const KURL &, const KURL & );
00528   void slotDirSizeUpdate();
00529   void slotDirSizeFinished( KIO::Job * );
00530   void slotFoundMountPoint( const QString& mp, unsigned long kBSize,
00531                 unsigned long kBUsed, unsigned long kBAvail );
00532   void slotSizeStop();
00533   void slotSizeDetermine();
00534 
00535 private slots:
00536   // workaround for compiler bug
00537   void slotFoundMountPoint( const unsigned long& kBSize, const unsigned long&
00538               kBUsed, const unsigned long& kBAvail, const QString& mp );
00539   void nameFileChanged(const QString &text );
00540   void slotIconChanged();
00541 
00542 private:
00543   void determineRelativePath( const QString & path );
00544   void applyIconChanges();
00545 
00546   QWidget *iconArea;
00547   QWidget *nameArea;
00548 
00549   QLabel *m_sizeLabel;
00550   QPushButton *m_sizeDetermineButton;
00551   QPushButton *m_sizeStopButton;
00552 
00553   QString m_sRelativePath;
00554   bool m_bFromTemplate;
00555 
00559   QString oldName;
00560 
00561   class KFilePropsPluginPrivate;
00562   KFilePropsPluginPrivate *d;
00563 };
00564 
00571 class KIO_EXPORT KFilePermissionsPropsPlugin : public KPropsDlgPlugin
00572 {
00573   Q_OBJECT
00574 public:
00575   enum PermissionsMode {
00576     PermissionsOnlyFiles = 0,
00577     PermissionsOnlyDirs = 1,
00578     PermissionsOnlyLinks = 2,
00579     PermissionsMixed = 3
00580   };
00581 
00582   enum PermissionsTarget {
00583     PermissionsOwner  = 0,
00584     PermissionsGroup  = 1,
00585     PermissionsOthers = 2
00586   };
00587 
00591   KFilePermissionsPropsPlugin( KPropertiesDialog *_props );
00592   virtual ~KFilePermissionsPropsPlugin();
00593 
00594   virtual void applyChanges();
00595 
00599   static bool supports( KFileItemList _items );
00600 
00601 private slots:
00602 
00603   void slotChmodResult( KIO::Job * );
00604   void slotShowAdvancedPermissions();
00605 
00606 private:
00607   void setComboContent(QComboBox *combo, PermissionsTarget target,
00608                mode_t permissions, mode_t partial);
00609   bool isIrregular(mode_t permissions, bool isDir, bool isLink);
00610   void enableAccessControls(bool enable);
00611   void updateAccessControls();
00612   void getPermissionMasks(mode_t &andFilePermissions,
00613               mode_t &andDirPermissions,
00614               mode_t &orFilePermissions,
00615               mode_t &orDirPermissions);
00616 
00617   static const mode_t permissionsMasks[3];
00618   static const mode_t standardPermissions[4];
00619   static const char *permissionsTexts[4][4];
00620 
00621   // unused, for binary compatibility!
00622   QCheckBox *permBox[3][4];
00623 
00624   QComboBox *grpCombo;
00625 
00626   KLineEdit *usrEdit, *grpEdit;
00627 
00631   mode_t permissions;
00635   QString strGroup;
00639   QString strOwner;
00640 
00641   // unused, for compatibility
00642   static mode_t fperm[3][4];
00643 
00644   class KFilePermissionsPropsPluginPrivate;
00645   KFilePermissionsPropsPluginPrivate *d;
00646 };
00647 
00648 
00657 class KIO_EXPORT KURLPropsPlugin : public KPropsDlgPlugin
00658 {
00659   Q_OBJECT
00660 public:
00664   KURLPropsPlugin( KPropertiesDialog *_props );
00665   virtual ~KURLPropsPlugin();
00666 
00667   virtual void applyChanges();
00668 
00669   static bool supports( KFileItemList _items );
00670 
00671 private:
00672   KURLRequester *URLEdit;
00673   KIconButton *iconBox;
00674 
00675   QString URLStr;
00676   QString iconStr;
00677 
00678   QPixmap pixmap;
00679   QString pixmapFile;
00680 private:
00681   class KURLPropsPluginPrivate;
00682   KURLPropsPluginPrivate *d;
00683 };
00684 
00685 
00692 class KIO_EXPORT KBindingPropsPlugin : public KPropsDlgPlugin
00693 {
00694   Q_OBJECT
00695 public:
00699   KBindingPropsPlugin( KPropertiesDialog *_props );
00700   virtual ~KBindingPropsPlugin();
00701 
00702   virtual void applyChanges();
00703   static bool supports( KFileItemList _items );
00704 
00705 private:
00706 
00707   QLineEdit *commentEdit;
00708   QLineEdit *patternEdit;
00709   QLineEdit *mimeEdit;
00710   QString m_sMimeStr;
00711 
00712   QCheckBox * cbAutoEmbed;
00713 
00714   class KBindingPropsPluginPrivate;
00715   KBindingPropsPluginPrivate *d;
00716 };
00717 
00722 class KIO_EXPORT KDevicePropsPlugin : public KPropsDlgPlugin
00723 {
00724   Q_OBJECT
00725 public:
00726   KDevicePropsPlugin( KPropertiesDialog *_props );
00727   virtual ~KDevicePropsPlugin();
00728 
00729   virtual void applyChanges();
00730 
00731   static bool supports( KFileItemList _items );
00732 
00733 private slots:
00734   void slotActivated( int );
00735   void slotDeviceChanged();
00736   void slotFoundMountPoint( const unsigned long& kBSize,
00737                             const unsigned long& /*kBUsed*/,
00738                             const unsigned long& kBAvail,
00739                             const QString& );
00740 
00741 private:
00742   void updateInfo();
00743 
00744 private:
00745   QComboBox* device;
00746   QLabel* mountpoint;
00747   QCheckBox* readonly;
00748   void* unused;
00749   //KIconButton* mounted;
00750   KIconButton* unmounted;
00751 
00752   QStringList m_devicelist;
00753   int indexDevice;
00754   int indexMountPoint;
00755   int indexFSType;
00756 
00757   QPixmap pixmap;
00758   QString pixmapFile;
00759 
00760   class KDevicePropsPluginPrivate;
00761   KDevicePropsPluginPrivate *d;
00762 };
00763 
00764 class KPropertiesDesktopBase;
00765 
00774 class KIO_EXPORT KDesktopPropsPlugin : public KPropsDlgPlugin
00775 {
00776   Q_OBJECT
00777 public:
00781   KDesktopPropsPlugin( KPropertiesDialog *_props );
00782   virtual ~KDesktopPropsPlugin();
00783 
00784   virtual void applyChanges();
00785 
00786   static bool supports( KFileItemList _items );
00787 
00788 public slots:
00789   void slotAddFiletype();
00790   void slotDelFiletype();
00791   void slotBrowseExec();
00792   void slotAdvanced();
00793   void slotSelectMimetype();
00794 
00795 private:
00796   void checkCommandChanged();
00797 
00798 private:
00799   KPropertiesDesktopBase* w;
00800 
00801   QString m_origCommandStr;
00802   QString m_terminalOptionStr;
00803   QString m_suidUserStr;
00804   QString m_dcopServiceType;
00805   bool m_terminalBool;
00806   bool m_terminalCloseBool;
00807   bool m_suidBool;
00808   bool m_startupBool;
00809   bool m_systrayBool;
00810 
00811   class KDesktopPropsPluginPrivate;
00812   KDesktopPropsPluginPrivate *d;
00813 };
00814 
00824 
00825 class KIO_EXPORT_DEPRECATED KExecPropsPlugin : public KPropsDlgPlugin
00826 {
00827   Q_OBJECT
00828 public:
00832   KExecPropsPlugin( KPropertiesDialog *_props );
00833   virtual ~KExecPropsPlugin();
00834 
00835   virtual void applyChanges();
00836 
00837   static bool supports( KFileItemList _items );
00838 
00839 public slots:
00840   void slotBrowseExec();
00841 
00842 private slots:
00843   void enableCheckedEdit();
00844   void enableSuidEdit();
00845 
00846 private:
00847 
00848     QLabel *terminalLabel;
00849     QLabel *suidLabel;
00850     KLineEdit *execEdit;
00851     QCheckBox *terminalCheck;
00852     QCheckBox *suidCheck;
00853     KLineEdit *terminalEdit;
00854     KLineEdit *suidEdit;
00855     KLineEdit *swallowExecEdit;
00856     KLineEdit *swallowTitleEdit;
00857     QButton *execBrowse;
00858 
00859     QString execStr;
00860     QString swallowExecStr;
00861     QString swallowTitleStr;
00862     QString termOptionsStr;
00863     bool termBool;
00864     bool suidBool;
00865     QString suidUserStr;
00866 
00867     class KExecPropsPluginPrivate;
00868     KExecPropsPluginPrivate *d;
00869 };
00870 
00880 
00881 class KIO_EXPORT_DEPRECATED KApplicationPropsPlugin : public KPropsDlgPlugin
00882 {
00883   Q_OBJECT
00884 public:
00888   KApplicationPropsPlugin( KPropertiesDialog *_props );
00889   virtual ~KApplicationPropsPlugin();
00890 
00891   virtual void applyChanges();
00892 
00893   static bool supports( KFileItemList _items );
00894 
00895 public slots:
00896   void slotDelExtension();
00897   void slotAddExtension();
00898 
00899 private slots:
00900   void updateButton();
00901 
00902 private:
00903   void addMimeType( const QString & name );
00904 
00905   QLineEdit *commentEdit;
00906   QLineEdit *genNameEdit;
00907   QLineEdit *nameEdit;
00908   QListBox  *extensionsList;
00909   QListBox  *availableExtensionsList;
00910   QPushButton *addExtensionButton;
00911   QPushButton *delExtensionButton;
00912 
00913   class KApplicationPropsPluginPrivate;
00914   KApplicationPropsPluginPrivate *d;
00915 };
00916 
00917 #endif
00918 

kio

Skip menu "kio"
  • Main Page
  • Modules
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

API Reference

Skip menu "API Reference"
  • dcop
  • DNSSD
  • interfaces
  • Kate
  • kconf_update
  • KDECore
  • KDED
  • kdefx
  • KDEsu
  • kdeui
  • KDocTools
  • KHTML
  • KImgIO
  • KInit
  • kio
  • kioslave
  • KJS
  • KNewStuff
  • KParts
  • KUtils
Generated for API Reference by doxygen 1.5.9
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal