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 00262 void showFileSharingPage(); 00263 00269 void setFileNameReadOnly( bool ro ); 00270 00271 public slots: 00275 virtual void slotOk(); // Deletes the PropertiesDialog instance 00276 virtual void slotCancel(); // Deletes the PropertiesDialog instance 00277 00278 signals: 00282 void propertiesClosed(); 00283 void applied(); 00284 void canceled(); 00285 00291 void saveAs(const KURL &oldUrl, KURL &newUrl); 00292 00293 private: 00294 00298 void init (bool modal = false, bool autoShow = true); 00299 00303 void insertPages(); 00304 00308 KURL m_singleUrl; 00309 00313 KFileItemList m_items; 00314 00318 QString m_defaultName; 00319 KURL m_currentDir; 00320 00324 QPtrList<KPropsDlgPlugin> m_pageList; 00325 00326 private slots: 00327 void slotStatResult( KIO::Job * ); // No longer used 00328 protected: 00329 virtual void virtual_hook( int id, void* data ); 00330 private: 00331 class KPropertiesDialogPrivate; 00332 KPropertiesDialogPrivate *d; 00333 }; 00334 00349 class KPropsDlgPlugin : public QObject 00350 { 00351 Q_OBJECT 00352 public: 00358 KPropsDlgPlugin( KPropertiesDialog *_props ); 00359 virtual ~KPropsDlgPlugin(); 00360 00366 virtual void applyChanges(); 00367 00372 static bool isDesktopFile( KFileItem * _item ); 00373 00374 void setDirty( bool b ); 00375 bool isDirty() const; 00376 00377 public slots: 00378 void setDirty(); // same as setDirty( true ) 00379 00380 signals: 00386 void changed(); 00387 00388 protected: 00392 KPropertiesDialog *properties; 00393 00394 int fontHeight; 00395 protected: 00396 virtual void virtual_hook( int id, void* data ); 00397 private: 00398 class KPropsDlgPluginPrivate; 00399 KPropsDlgPluginPrivate *d; 00400 }; 00401 00407 class KFilePropsPlugin : public KPropsDlgPlugin 00408 { 00409 Q_OBJECT 00410 public: 00414 KFilePropsPlugin( KPropertiesDialog *_props ); 00415 virtual ~KFilePropsPlugin(); 00416 00422 virtual void applyChanges(); 00423 00427 static bool supports( KFileItemList _items ); 00428 00432 void postApplyChanges(); 00433 00434 void setFileNameReadOnly( bool ro ); 00435 00436 protected slots: 00437 void slotEditFileType(); 00438 void slotCopyFinished( KIO::Job * ); 00439 void slotFileRenamed( KIO::Job *, const KURL &, const KURL & ); 00440 void slotDirSizeUpdate(); 00441 void slotDirSizeFinished( KIO::Job * ); 00442 void slotFoundMountPoint( const QString& mp, unsigned long kBSize, 00443 unsigned long kBUsed, unsigned long kBAvail ); 00444 void slotSizeStop(); 00445 void slotSizeDetermine(); 00446 00447 private slots: 00448 // workaround for compiler bug 00449 void slotFoundMountPoint( const unsigned long& kBSize, const unsigned long& 00450 kBUsed, const unsigned long& kBAvail, const QString& mp ); 00451 void nameFileChanged(const QString &text ); 00452 void slotIconChanged(); 00453 00454 private: 00455 void determineRelativePath( const QString & path ); 00456 void applyIconChanges(); 00457 00458 QWidget *iconArea; 00459 QWidget *nameArea; 00460 00461 QLabel *m_sizeLabel; 00462 QPushButton *m_sizeDetermineButton; 00463 QPushButton *m_sizeStopButton; 00464 00465 QString m_sRelativePath; 00466 bool m_bFromTemplate; 00467 00471 QString oldName; 00472 00473 class KFilePropsPluginPrivate; 00474 KFilePropsPluginPrivate *d; 00475 }; 00476 00483 class KFilePermissionsPropsPlugin : public KPropsDlgPlugin 00484 { 00485 Q_OBJECT 00486 public: 00487 enum PermissionsMode { 00488 PermissionsOnlyFiles = 0, 00489 PermissionsOnlyDirs = 1, 00490 PermissionsOnlyLinks = 2, 00491 PermissionsMixed = 3 00492 }; 00493 00494 enum PermissionsTarget { 00495 PermissionsOwner = 0, 00496 PermissionsGroup = 1, 00497 PermissionsOthers = 2 00498 }; 00499 00503 KFilePermissionsPropsPlugin( KPropertiesDialog *_props ); 00504 virtual ~KFilePermissionsPropsPlugin(); 00505 00506 virtual void applyChanges(); 00507 00511 static bool supports( KFileItemList _items ); 00512 00513 private slots: 00514 00515 void slotChmodResult( KIO::Job * ); 00516 void slotShowAdvancedPermissions(); 00517 00518 private: 00519 void setComboContent(QComboBox *combo, PermissionsTarget target, 00520 mode_t permissions, mode_t partial); 00521 bool isIrregular(mode_t permissions, bool isDir, bool isLink); 00522 void enableAccessControls(bool enable); 00523 void updateAccessControls(); 00524 void getPermissionMasks(mode_t &andFilePermissions, 00525 mode_t &andDirPermissions, 00526 mode_t &orFilePermissions, 00527 mode_t &orDirPermissions); 00528 00529 static const mode_t permissionsMasks[3]; 00530 static const mode_t standardPermissions[4]; 00531 static const char *permissionsTexts[4][4]; 00532 00533 // unused, for binary compatibility! 00534 QCheckBox *permBox[3][4]; 00535 00536 QComboBox *grpCombo; 00537 00538 KLineEdit *usrEdit, *grpEdit; 00539 00543 mode_t permissions; 00547 QString strGroup; 00551 QString strOwner; 00552 00553 // unused, for compatibility 00554 static mode_t fperm[3][4]; 00555 00556 class KFilePermissionsPropsPluginPrivate; 00557 KFilePermissionsPropsPluginPrivate *d; 00558 }; 00559 00560 00569 class KURLPropsPlugin : public KPropsDlgPlugin 00570 { 00571 Q_OBJECT 00572 public: 00576 KURLPropsPlugin( KPropertiesDialog *_props ); 00577 virtual ~KURLPropsPlugin(); 00578 00579 virtual void applyChanges(); 00580 00581 static bool supports( KFileItemList _items ); 00582 00583 private: 00584 KURLRequester *URLEdit; 00585 KIconButton *iconBox; 00586 00587 QString URLStr; 00588 QString iconStr; 00589 00590 QPixmap pixmap; 00591 QString pixmapFile; 00592 private: 00593 class KURLPropsPluginPrivate; 00594 KURLPropsPluginPrivate *d; 00595 }; 00596 00597 00604 class KBindingPropsPlugin : public KPropsDlgPlugin 00605 { 00606 Q_OBJECT 00607 public: 00611 KBindingPropsPlugin( KPropertiesDialog *_props ); 00612 virtual ~KBindingPropsPlugin(); 00613 00614 virtual void applyChanges(); 00615 static bool supports( KFileItemList _items ); 00616 00617 private: 00618 00619 QLineEdit *commentEdit; 00620 QLineEdit *patternEdit; 00621 QLineEdit *mimeEdit; 00622 QString m_sMimeStr; 00623 00624 QCheckBox * cbAutoEmbed; 00625 00626 class KBindingPropsPluginPrivate; 00627 KBindingPropsPluginPrivate *d; 00628 }; 00629 00634 class KDevicePropsPlugin : public KPropsDlgPlugin 00635 { 00636 Q_OBJECT 00637 public: 00638 KDevicePropsPlugin( KPropertiesDialog *_props ); 00639 virtual ~KDevicePropsPlugin(); 00640 00641 virtual void applyChanges(); 00642 00643 static bool supports( KFileItemList _items ); 00644 00645 private slots: 00646 void slotActivated( int ); 00647 void slotDeviceChanged(); 00648 00649 private: 00650 QComboBox* device; 00651 QLabel* mountpoint; 00652 QCheckBox* readonly; 00653 void* unused; 00654 //KIconButton* mounted; 00655 KIconButton* unmounted; 00656 00657 QStringList m_devicelist; 00658 int indexDevice; 00659 int indexMountPoint; 00660 int indexFSType; 00661 00662 QPixmap pixmap; 00663 QString pixmapFile; 00664 00665 class KDevicePropsPluginPrivate; 00666 KDevicePropsPluginPrivate *d; 00667 }; 00668 00669 class KPropertiesDesktopBase; 00670 00679 class KDesktopPropsPlugin : public KPropsDlgPlugin 00680 { 00681 Q_OBJECT 00682 public: 00686 KDesktopPropsPlugin( KPropertiesDialog *_props ); 00687 virtual ~KDesktopPropsPlugin(); 00688 00689 virtual void applyChanges(); 00690 00691 static bool supports( KFileItemList _items ); 00692 00693 public slots: 00694 void slotAddFiletype(); 00695 void slotDelFiletype(); 00696 void slotBrowseExec(); 00697 void slotAdvanced(); 00698 void slotSelectMimetype(); 00699 00700 private: 00701 void checkCommandChanged(); 00702 00703 private: 00704 KPropertiesDesktopBase* w; 00705 00706 QString m_origCommandStr; 00707 QString m_terminalOptionStr; 00708 QString m_suidUserStr; 00709 QString m_dcopServiceType; 00710 bool m_terminalBool; 00711 bool m_terminalCloseBool; 00712 bool m_suidBool; 00713 bool m_startupBool; 00714 00715 class KDesktopPropsPluginPrivate; 00716 KDesktopPropsPluginPrivate *d; 00717 }; 00718 00728 00729 class KDE_DEPRECATED KExecPropsPlugin : public KPropsDlgPlugin 00730 { 00731 Q_OBJECT 00732 public: 00736 KExecPropsPlugin( KPropertiesDialog *_props ); 00737 virtual ~KExecPropsPlugin(); 00738 00739 virtual void applyChanges(); 00740 00741 static bool supports( KFileItemList _items ); 00742 00743 public slots: 00744 void slotBrowseExec(); 00745 00746 private slots: 00747 void enableCheckedEdit(); 00748 void enableSuidEdit(); 00749 00750 private: 00751 00752 QLabel *terminalLabel; 00753 QLabel *suidLabel; 00754 KLineEdit *execEdit; 00755 QCheckBox *terminalCheck; 00756 QCheckBox *suidCheck; 00757 KLineEdit *terminalEdit; 00758 KLineEdit *suidEdit; 00759 KLineEdit *swallowExecEdit; 00760 KLineEdit *swallowTitleEdit; 00761 QButton *execBrowse; 00762 00763 QString execStr; 00764 QString swallowExecStr; 00765 QString swallowTitleStr; 00766 QString termOptionsStr; 00767 bool termBool; 00768 bool suidBool; 00769 QString suidUserStr; 00770 00771 class KExecPropsPluginPrivate; 00772 KExecPropsPluginPrivate *d; 00773 }; 00774 00784 00785 class KDE_DEPRECATED KApplicationPropsPlugin : public KPropsDlgPlugin 00786 { 00787 Q_OBJECT 00788 public: 00792 KApplicationPropsPlugin( KPropertiesDialog *_props ); 00793 virtual ~KApplicationPropsPlugin(); 00794 00795 virtual void applyChanges(); 00796 00797 static bool supports( KFileItemList _items ); 00798 00799 public slots: 00800 void slotDelExtension(); 00801 void slotAddExtension(); 00802 00803 private slots: 00804 void updateButton(); 00805 00806 private: 00807 void addMimeType( const QString & name ); 00808 00809 QLineEdit *commentEdit; 00810 QLineEdit *genNameEdit; 00811 QLineEdit *nameEdit; 00812 QListBox *extensionsList; 00813 QListBox *availableExtensionsList; 00814 QPushButton *addExtensionButton; 00815 QPushButton *delExtensionButton; 00816 00817 class KApplicationPropsPluginPrivate; 00818 KApplicationPropsPluginPrivate *d; 00819 }; 00820 00821 #endif 00822
KDE Logo
This file is part of the documentation for kio Library Version 3.2.3.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Fri Oct 8 11:14:59 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003