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 <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 00065 class KPropertiesDialog : public KDialogBase 00066 { 00067 Q_OBJECT 00068 00069 public: 00070 00075 static bool canDisplay( KFileItemList _items ); 00076 00088 KPropertiesDialog( KFileItem * item, 00089 QWidget* parent = 0L, const char* name = 0L, 00090 bool modal = false, bool autoShow = true); 00103 KPropertiesDialog( KFileItemList _items, 00104 QWidget *parent = 0L, const char* name = 0L, 00105 bool modal = false, bool autoShow = true); 00106 00107 #ifndef KDE_NO_COMPAT 00108 00120 KPropertiesDialog( const KURL& _url, mode_t _mode, 00121 QWidget* parent = 0L, const char* name = 0L, 00122 bool modal = false, bool autoShow = true) KDE_DEPRECATED; 00123 #endif 00124 00141 KPropertiesDialog( const KURL& _url, 00142 QWidget* parent = 0L, const char* name = 0L, 00143 bool modal = false, bool autoShow = true); 00144 00159 KPropertiesDialog( const KURL& _tempUrl, const KURL& _currentDir, 00160 const QString& _defaultName, 00161 QWidget* parent = 0L, const char* name = 0L, 00162 bool modal = false, bool autoShow = true); 00163 00173 KPropertiesDialog (const QString& title, 00174 QWidget* parent = 0L, const char* name = 0L, bool modal = false); 00175 00181 virtual ~KPropertiesDialog(); 00182 00183 00197 void insertPlugin (KPropsDlgPlugin *plugin); 00198 00203 const KURL& kurl() const { return m_singleUrl; } 00204 00211 KFileItem *item() { return m_items.first(); } 00212 00216 KFileItemList items() const { return m_items; } 00217 00222 KDE_DEPRECATED KDialogBase* dialog() { return this; } 00223 KDE_DEPRECATED const KDialogBase* dialog() const { return this; } 00224 00230 const KURL& currentDir() const { return m_currentDir; } 00231 00237 const QString& defaultName() const { return m_defaultName; } 00238 00245 void updateUrl( const KURL& _newUrl ); 00246 00252 void rename( const QString& _name ); 00253 00257 void abortApplying(); 00258 00266 void showFileSharingPage(); 00267 00274 void setFileSharingPage(QWidget* page); 00275 00281 void setFileNameReadOnly( bool ro ); 00282 00283 public slots: 00287 virtual void slotOk(); // Deletes the PropertiesDialog instance 00288 virtual void slotCancel(); // Deletes the PropertiesDialog instance 00289 00290 signals: 00294 void propertiesClosed(); 00295 void applied(); 00296 void canceled(); 00297 00303 void saveAs(const KURL &oldUrl, KURL &newUrl); 00304 00305 private: 00306 00310 void init (bool modal = false, bool autoShow = true); 00311 00315 void insertPages(); 00316 00320 KURL m_singleUrl; 00321 00325 KFileItemList m_items; 00326 00330 QString m_defaultName; 00331 KURL m_currentDir; 00332 00336 QPtrList<KPropsDlgPlugin> m_pageList; 00337 00338 private slots: 00339 void slotStatResult( KIO::Job * ); // No longer used 00340 protected: 00341 virtual void virtual_hook( int id, void* data ); 00342 private: 00343 class KPropertiesDialogPrivate; 00344 KPropertiesDialogPrivate *d; 00345 }; 00346 00361 class KPropsDlgPlugin : public QObject 00362 { 00363 Q_OBJECT 00364 public: 00370 KPropsDlgPlugin( KPropertiesDialog *_props ); 00371 virtual ~KPropsDlgPlugin(); 00372 00378 virtual void applyChanges(); 00379 00384 static bool isDesktopFile( KFileItem * _item ); 00385 00386 void setDirty( bool b ); 00387 bool isDirty() const; 00388 00389 public slots: 00390 void setDirty(); // same as setDirty( true ) 00391 00392 signals: 00398 void changed(); 00399 00400 protected: 00404 KPropertiesDialog *properties; 00405 00406 int fontHeight; 00407 protected: 00408 virtual void virtual_hook( int id, void* data ); 00409 private: 00410 class KPropsDlgPluginPrivate; 00411 KPropsDlgPluginPrivate *d; 00412 }; 00413 00419 class KFilePropsPlugin : public KPropsDlgPlugin 00420 { 00421 Q_OBJECT 00422 public: 00426 KFilePropsPlugin( KPropertiesDialog *_props ); 00427 virtual ~KFilePropsPlugin(); 00428 00434 virtual void applyChanges(); 00435 00439 static bool supports( KFileItemList _items ); 00440 00444 void postApplyChanges(); 00445 00446 void setFileNameReadOnly( bool ro ); 00447 00448 protected slots: 00449 void slotEditFileType(); 00450 void slotCopyFinished( KIO::Job * ); 00451 void slotFileRenamed( KIO::Job *, const KURL &, const KURL & ); 00452 void slotDirSizeUpdate(); 00453 void slotDirSizeFinished( KIO::Job * ); 00454 void slotFoundMountPoint( const QString& mp, unsigned long kBSize, 00455 unsigned long kBUsed, unsigned long kBAvail ); 00456 void slotSizeStop(); 00457 void slotSizeDetermine(); 00458 00459 private slots: 00460 // workaround for compiler bug 00461 void slotFoundMountPoint( const unsigned long& kBSize, const unsigned long& 00462 kBUsed, const unsigned long& kBAvail, const QString& mp ); 00463 void nameFileChanged(const QString &text ); 00464 void slotIconChanged(); 00465 00466 private: 00467 void determineRelativePath( const QString & path ); 00468 void applyIconChanges(); 00469 00470 QWidget *iconArea; 00471 QWidget *nameArea; 00472 00473 QLabel *m_sizeLabel; 00474 QPushButton *m_sizeDetermineButton; 00475 QPushButton *m_sizeStopButton; 00476 00477 QString m_sRelativePath; 00478 bool m_bFromTemplate; 00479 00483 QString oldName; 00484 00485 class KFilePropsPluginPrivate; 00486 KFilePropsPluginPrivate *d; 00487 }; 00488 00495 class KFilePermissionsPropsPlugin : public KPropsDlgPlugin 00496 { 00497 Q_OBJECT 00498 public: 00499 enum PermissionsMode { 00500 PermissionsOnlyFiles = 0, 00501 PermissionsOnlyDirs = 1, 00502 PermissionsOnlyLinks = 2, 00503 PermissionsMixed = 3 00504 }; 00505 00506 enum PermissionsTarget { 00507 PermissionsOwner = 0, 00508 PermissionsGroup = 1, 00509 PermissionsOthers = 2 00510 }; 00511 00515 KFilePermissionsPropsPlugin( KPropertiesDialog *_props ); 00516 virtual ~KFilePermissionsPropsPlugin(); 00517 00518 virtual void applyChanges(); 00519 00523 static bool supports( KFileItemList _items ); 00524 00525 private slots: 00526 00527 void slotChmodResult( KIO::Job * ); 00528 void slotShowAdvancedPermissions(); 00529 00530 private: 00531 void setComboContent(QComboBox *combo, PermissionsTarget target, 00532 mode_t permissions, mode_t partial); 00533 bool isIrregular(mode_t permissions, bool isDir, bool isLink); 00534 void enableAccessControls(bool enable); 00535 void updateAccessControls(); 00536 void getPermissionMasks(mode_t &andFilePermissions, 00537 mode_t &andDirPermissions, 00538 mode_t &orFilePermissions, 00539 mode_t &orDirPermissions); 00540 00541 static const mode_t permissionsMasks[3]; 00542 static const mode_t standardPermissions[4]; 00543 static const char *permissionsTexts[4][4]; 00544 00545 // unused, for binary compatibility! 00546 QCheckBox *permBox[3][4]; 00547 00548 QComboBox *grpCombo; 00549 00550 KLineEdit *usrEdit, *grpEdit; 00551 00555 mode_t permissions; 00559 QString strGroup; 00563 QString strOwner; 00564 00565 // unused, for compatibility 00566 static mode_t fperm[3][4]; 00567 00568 class KFilePermissionsPropsPluginPrivate; 00569 KFilePermissionsPropsPluginPrivate *d; 00570 }; 00571 00572 00581 class KURLPropsPlugin : public KPropsDlgPlugin 00582 { 00583 Q_OBJECT 00584 public: 00588 KURLPropsPlugin( KPropertiesDialog *_props ); 00589 virtual ~KURLPropsPlugin(); 00590 00591 virtual void applyChanges(); 00592 00593 static bool supports( KFileItemList _items ); 00594 00595 private: 00596 KURLRequester *URLEdit; 00597 KIconButton *iconBox; 00598 00599 QString URLStr; 00600 QString iconStr; 00601 00602 QPixmap pixmap; 00603 QString pixmapFile; 00604 private: 00605 class KURLPropsPluginPrivate; 00606 KURLPropsPluginPrivate *d; 00607 }; 00608 00609 00616 class KBindingPropsPlugin : public KPropsDlgPlugin 00617 { 00618 Q_OBJECT 00619 public: 00623 KBindingPropsPlugin( KPropertiesDialog *_props ); 00624 virtual ~KBindingPropsPlugin(); 00625 00626 virtual void applyChanges(); 00627 static bool supports( KFileItemList _items ); 00628 00629 private: 00630 00631 QLineEdit *commentEdit; 00632 QLineEdit *patternEdit; 00633 QLineEdit *mimeEdit; 00634 QString m_sMimeStr; 00635 00636 QCheckBox * cbAutoEmbed; 00637 00638 class KBindingPropsPluginPrivate; 00639 KBindingPropsPluginPrivate *d; 00640 }; 00641 00646 class KDevicePropsPlugin : public KPropsDlgPlugin 00647 { 00648 Q_OBJECT 00649 public: 00650 KDevicePropsPlugin( KPropertiesDialog *_props ); 00651 virtual ~KDevicePropsPlugin(); 00652 00653 virtual void applyChanges(); 00654 00655 static bool supports( KFileItemList _items ); 00656 00657 private slots: 00658 void slotActivated( int ); 00659 void slotDeviceChanged(); 00660 00661 private: 00662 QComboBox* device; 00663 QLabel* mountpoint; 00664 QCheckBox* readonly; 00665 void* unused; 00666 //KIconButton* mounted; 00667 KIconButton* unmounted; 00668 00669 QStringList m_devicelist; 00670 int indexDevice; 00671 int indexMountPoint; 00672 int indexFSType; 00673 00674 QPixmap pixmap; 00675 QString pixmapFile; 00676 00677 class KDevicePropsPluginPrivate; 00678 KDevicePropsPluginPrivate *d; 00679 }; 00680 00681 class KPropertiesDesktopBase; 00682 00691 class KDesktopPropsPlugin : public KPropsDlgPlugin 00692 { 00693 Q_OBJECT 00694 public: 00698 KDesktopPropsPlugin( KPropertiesDialog *_props ); 00699 virtual ~KDesktopPropsPlugin(); 00700 00701 virtual void applyChanges(); 00702 00703 static bool supports( KFileItemList _items ); 00704 00705 public slots: 00706 void slotAddFiletype(); 00707 void slotDelFiletype(); 00708 void slotBrowseExec(); 00709 void slotAdvanced(); 00710 void slotSelectMimetype(); 00711 00712 private: 00713 void checkCommandChanged(); 00714 00715 private: 00716 KPropertiesDesktopBase* w; 00717 00718 QString m_origCommandStr; 00719 QString m_terminalOptionStr; 00720 QString m_suidUserStr; 00721 QString m_dcopServiceType; 00722 bool m_terminalBool; 00723 bool m_terminalCloseBool; 00724 bool m_suidBool; 00725 bool m_startupBool; 00726 bool m_systrayBool; 00727 00728 class KDesktopPropsPluginPrivate; 00729 KDesktopPropsPluginPrivate *d; 00730 }; 00731 00741 00742 class KDE_DEPRECATED KExecPropsPlugin : public KPropsDlgPlugin 00743 { 00744 Q_OBJECT 00745 public: 00749 KExecPropsPlugin( KPropertiesDialog *_props ); 00750 virtual ~KExecPropsPlugin(); 00751 00752 virtual void applyChanges(); 00753 00754 static bool supports( KFileItemList _items ); 00755 00756 public slots: 00757 void slotBrowseExec(); 00758 00759 private slots: 00760 void enableCheckedEdit(); 00761 void enableSuidEdit(); 00762 00763 private: 00764 00765 QLabel *terminalLabel; 00766 QLabel *suidLabel; 00767 KLineEdit *execEdit; 00768 QCheckBox *terminalCheck; 00769 QCheckBox *suidCheck; 00770 KLineEdit *terminalEdit; 00771 KLineEdit *suidEdit; 00772 KLineEdit *swallowExecEdit; 00773 KLineEdit *swallowTitleEdit; 00774 QButton *execBrowse; 00775 00776 QString execStr; 00777 QString swallowExecStr; 00778 QString swallowTitleStr; 00779 QString termOptionsStr; 00780 bool termBool; 00781 bool suidBool; 00782 QString suidUserStr; 00783 00784 class KExecPropsPluginPrivate; 00785 KExecPropsPluginPrivate *d; 00786 }; 00787 00797 00798 class KDE_DEPRECATED KApplicationPropsPlugin : public KPropsDlgPlugin 00799 { 00800 Q_OBJECT 00801 public: 00805 KApplicationPropsPlugin( KPropertiesDialog *_props ); 00806 virtual ~KApplicationPropsPlugin(); 00807 00808 virtual void applyChanges(); 00809 00810 static bool supports( KFileItemList _items ); 00811 00812 public slots: 00813 void slotDelExtension(); 00814 void slotAddExtension(); 00815 00816 private slots: 00817 void updateButton(); 00818 00819 private: 00820 void addMimeType( const QString & name ); 00821 00822 QLineEdit *commentEdit; 00823 QLineEdit *genNameEdit; 00824 QLineEdit *nameEdit; 00825 QListBox *extensionsList; 00826 QListBox *availableExtensionsList; 00827 QPushButton *addExtensionButton; 00828 QPushButton *delExtensionButton; 00829 00830 class KApplicationPropsPluginPrivate; 00831 KApplicationPropsPluginPrivate *d; 00832 }; 00833 00834 #endif 00835
KDE Logo
This file is part of the documentation for kio Library Version 3.3.0.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Sep 29 09:43:53 2004 by doxygen 1.3.8 written by Dimitri van Heesch, © 1997-2003