00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef __propsdlg_h
00029 #define __propsdlg_h
00030
00031 #include <tqstring.h>
00032 #include <tqptrlist.h>
00033
00034 #include <kdemacros.h>
00035 #include <kurl.h>
00036 #include <tdefileitem.h>
00037 #include <kdialogbase.h>
00038
00039 class TQLineEdit;
00040 class TQCheckBox;
00041 class TQPushButton;
00042 class KLineEdit;
00043 class KURLRequester;
00044 class TQButton;
00045 class TDEIconButton;
00046 class KPropsDlgPlugin;
00047 class TQComboBox;
00048
00049 #define KPropsPage KPropsDlgPlugin
00050
00051 namespace TDEIO { class Job; }
00052
00070 class TDEIO_EXPORT KPropertiesDialog : public KDialogBase
00071 {
00072 Q_OBJECT
00073
00074 public:
00075
00082 static bool canDisplay( KFileItemList _items );
00083
00097 KPropertiesDialog( KFileItem * item,
00098 TQWidget* parent = 0L, const char* name = 0L,
00099 bool modal = false, bool autoShow = true);
00100
00115 KPropertiesDialog( KFileItemList _items,
00116 TQWidget *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 TQWidget* parent = 0L, const char* name = 0L,
00132 bool modal = false, bool autoShow = true) KDE_DEPRECATED;
00133 #endif
00134
00152 KPropertiesDialog( const KURL& _url,
00153 TQWidget* parent = 0L, const char* name = 0L,
00154 bool modal = false, bool autoShow = true);
00155
00170 KPropertiesDialog( const KURL& _tempUrl, const KURL& _currentDir,
00171 const TQString& _defaultName,
00172 TQWidget* parent = 0L, const char* name = 0L,
00173 bool modal = false, bool autoShow = true);
00174
00184 KPropertiesDialog (const TQString& title,
00185 TQWidget* parent = 0L, const char* name = 0L, bool modal = false);
00186
00192 virtual ~KPropertiesDialog();
00193
00203 static bool showDialog(KFileItem* item, TQWidget* parent = 0,
00204 const char* name = 0, bool modal = false);
00205
00215 static bool showDialog(const KURL& _url, TQWidget* parent = 0,
00216 const char* name = 0, bool modal = false);
00217
00228 static bool showDialog(const KFileItemList& _items, TQWidget* 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 TQString& defaultName() const { return m_defaultName; }
00296
00303 void updateUrl( const KURL& _newUrl );
00304
00311 void rename( const TQString& _name );
00312
00316 void abortApplying();
00317
00325 void showFileSharingPage();
00326
00335 void setFileSharingPage(TQWidget* page);
00336
00343 void setFileNameReadOnly( bool ro );
00344
00345 public slots:
00349 virtual void slotOk();
00353 virtual void slotCancel();
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 TQString m_defaultName;
00407 KURL m_currentDir;
00408
00412 TQPtrList<KPropsDlgPlugin> m_pageList;
00413
00414 private slots:
00415 void slotStatResult( TDEIO::Job * );
00416 protected:
00417 virtual void virtual_hook( int id, void* data );
00418 private:
00419 class KPropertiesDialogPrivate;
00420 KPropertiesDialogPrivate *d;
00421 };
00422
00437 class TDEIO_EXPORT KPropsDlgPlugin : public TQObject
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();
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 TDEIO_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( TDEIO::Job * );
00527 void slotFileRenamed( TDEIO::Job *, const KURL &, const KURL & );
00528 void slotDirSizeUpdate();
00529 void slotDirSizeFinished( TDEIO::Job * );
00530 void slotFoundMountPoint( const TQString& mp, unsigned long kBSize,
00531 unsigned long kBUsed, unsigned long kBAvail );
00532 void slotSizeStop();
00533 void slotSizeDetermine();
00534
00535 private slots:
00536
00537 void slotFoundMountPoint( const unsigned long& kBSize, const unsigned long&
00538 kBUsed, const unsigned long& kBAvail, const TQString& mp );
00539 void nameFileChanged(const TQString &text );
00540 void slotIconChanged();
00541
00542 private:
00543 void determineRelativePath( const TQString & path );
00544 void applyIconChanges();
00545
00546 TQWidget *iconArea;
00547 TQWidget *nameArea;
00548
00549 TQLabel *m_sizeLabel;
00550 TQPushButton *m_sizeDetermineButton;
00551 TQPushButton *m_sizeStopButton;
00552
00553 TQString m_sRelativePath;
00554 bool m_bFromTemplate;
00555
00559 TQString oldName;
00560
00561 class KFilePropsPluginPrivate;
00562 KFilePropsPluginPrivate *d;
00563 };
00564
00571 class TDEIO_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( TDEIO::Job * );
00604 void slotShowAdvancedPermissions();
00605
00606 private:
00607 void setComboContent(TQComboBox *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
00622 TQCheckBox *permBox[3][4];
00623
00624 TQComboBox *grpCombo;
00625
00626 KLineEdit *usrEdit, *grpEdit;
00627
00631 mode_t permissions;
00635 TQString strGroup;
00639 TQString strOwner;
00640
00641
00642 static mode_t fperm[3][4];
00643
00644 class KFilePermissionsPropsPluginPrivate;
00645 KFilePermissionsPropsPluginPrivate *d;
00646 };
00647
00648
00657 class TDEIO_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 TDEIconButton *iconBox;
00674
00675 TQString URLStr;
00676 TQString iconStr;
00677
00678 TQPixmap pixmap;
00679 TQString pixmapFile;
00680 private:
00681 class KURLPropsPluginPrivate;
00682 KURLPropsPluginPrivate *d;
00683 };
00684
00685
00692 class TDEIO_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 TQLineEdit *commentEdit;
00708 TQLineEdit *patternEdit;
00709 TQLineEdit *mimeEdit;
00710 TQString m_sMimeStr;
00711
00712 TQCheckBox * cbAutoEmbed;
00713
00714 class KBindingPropsPluginPrivate;
00715 KBindingPropsPluginPrivate *d;
00716 };
00717
00722 class TDEIO_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& ,
00738 const unsigned long& kBAvail,
00739 const TQString& );
00740
00741 private:
00742 void updateInfo();
00743 void processLockouts();
00744
00745 private:
00746 TQComboBox* device;
00747 TQLabel* mountpoint;
00748 TQCheckBox* readonly;
00749 void* unused;
00750
00751 TDEIconButton* unmounted;
00752
00753 TQStringList m_devicelist;
00754 int indexDevice;
00755 int indexMountPoint;
00756 int indexFSType;
00757
00758 TQPixmap pixmap;
00759 TQString pixmapFile;
00760
00761 class KDevicePropsPluginPrivate;
00762 KDevicePropsPluginPrivate *d;
00763 };
00764
00765 class KPropertiesDesktopBase;
00766
00775 class TDEIO_EXPORT KDesktopPropsPlugin : public KPropsDlgPlugin
00776 {
00777 Q_OBJECT
00778 public:
00782 KDesktopPropsPlugin( KPropertiesDialog *_props );
00783 virtual ~KDesktopPropsPlugin();
00784
00785 virtual void applyChanges();
00786
00787 static bool supports( KFileItemList _items );
00788
00789 public slots:
00790 void slotAddFiletype();
00791 void slotDelFiletype();
00792 void slotBrowseExec();
00793 void slotAdvanced();
00794 void slotSelectMimetype();
00795
00796 private:
00797 void checkCommandChanged();
00798
00799 private:
00800 KPropertiesDesktopBase* w;
00801
00802 TQString m_origCommandStr;
00803 TQString m_terminalOptionStr;
00804 TQString m_suidUserStr;
00805 TQString m_dcopServiceType;
00806 bool m_terminalBool;
00807 bool m_terminalCloseBool;
00808 bool m_suidBool;
00809 bool m_startupBool;
00810 bool m_systrayBool;
00811
00812 class KDesktopPropsPluginPrivate;
00813 KDesktopPropsPluginPrivate *d;
00814 };
00815
00825
00826 class TDEIO_EXPORT_DEPRECATED KExecPropsPlugin : public KPropsDlgPlugin
00827 {
00828 Q_OBJECT
00829 public:
00833 KExecPropsPlugin( KPropertiesDialog *_props );
00834 virtual ~KExecPropsPlugin();
00835
00836 virtual void applyChanges();
00837
00838 static bool supports( KFileItemList _items );
00839
00840 public slots:
00841 void slotBrowseExec();
00842
00843 private slots:
00844 void enableCheckedEdit();
00845 void enableSuidEdit();
00846
00847 private:
00848
00849 TQLabel *terminalLabel;
00850 TQLabel *suidLabel;
00851 KLineEdit *execEdit;
00852 TQCheckBox *terminalCheck;
00853 TQCheckBox *suidCheck;
00854 KLineEdit *terminalEdit;
00855 KLineEdit *suidEdit;
00856 KLineEdit *swallowExecEdit;
00857 KLineEdit *swallowTitleEdit;
00858 TQButton *execBrowse;
00859
00860 TQString execStr;
00861 TQString swallowExecStr;
00862 TQString swallowTitleStr;
00863 TQString termOptionsStr;
00864 bool termBool;
00865 bool suidBool;
00866 TQString suidUserStr;
00867
00868 class KExecPropsPluginPrivate;
00869 KExecPropsPluginPrivate *d;
00870 };
00871
00881
00882 class TDEIO_EXPORT_DEPRECATED TDEApplicationPropsPlugin : public KPropsDlgPlugin
00883 {
00884 Q_OBJECT
00885 public:
00889 TDEApplicationPropsPlugin( KPropertiesDialog *_props );
00890 virtual ~TDEApplicationPropsPlugin();
00891
00892 virtual void applyChanges();
00893
00894 static bool supports( KFileItemList _items );
00895
00896 public slots:
00897 void slotDelExtension();
00898 void slotAddExtension();
00899
00900 private slots:
00901 void updateButton();
00902
00903 private:
00904 void addMimeType( const TQString & name );
00905
00906 TQLineEdit *commentEdit;
00907 TQLineEdit *genNameEdit;
00908 TQLineEdit *nameEdit;
00909 TQListBox *extensionsList;
00910 TQListBox *availableExtensionsList;
00911 TQPushButton *addExtensionButton;
00912 TQPushButton *delExtensionButton;
00913
00914 class TDEApplicationPropsPluginPrivate;
00915 TDEApplicationPropsPluginPrivate *d;
00916 };
00917
00918 #endif
00919