kpropertiesdialog.h
/* This file is part of the KDE project
Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
Copyright (c) 1999, 2000 Preston Brown <pbrown@kde.org>
Copyright (c) 2000 Simon Hausmann <hausmann@kde.org>
Copyright (c) 2000 David Faure <faure@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
/*
* This file holds the definitions for all classes used to
* display a properties dialog.
*/
#ifndef __propsdlg_h
#define __propsdlg_h
#include <qstring.h>
#include <qptrlist.h>
#include <kdemacros.h>
#include <kurl.h>
#include <kfileitem.h>
#include <kdialogbase.h>
class QLineEdit;
class QCheckBox;
class QPushButton;
class KLineEdit;
class KURLRequester;
class QButton;
class KIconButton;
class KPropsDlgPlugin;
class QComboBox;
#define KPropsPage KPropsDlgPlugin
namespace KIO { class Job; }
class KIO_EXPORT KPropertiesDialog : public KDialogBase
{
Q_OBJECT
public:
static bool canDisplay( KFileItemList _items );
KPropertiesDialog( KFileItem * item,
QWidget* parent = 0L, const char* name = 0L,
bool modal = false, bool autoShow = true);
KPropertiesDialog( KFileItemList _items,
QWidget *parent = 0L, const char* name = 0L,
bool modal = false, bool autoShow = true);
#ifndef KDE_NO_COMPAT
KPropertiesDialog( const KURL& _url, mode_t _mode,
QWidget* parent = 0L, const char* name = 0L,
bool modal = false, bool autoShow = true) KDE_DEPRECATED;
#endif
KPropertiesDialog( const KURL& _url,
QWidget* parent = 0L, const char* name = 0L,
bool modal = false, bool autoShow = true);
KPropertiesDialog( const KURL& _tempUrl, const KURL& _currentDir,
const QString& _defaultName,
QWidget* parent = 0L, const char* name = 0L,
bool modal = false, bool autoShow = true);
KPropertiesDialog (const QString& title,
QWidget* parent = 0L, const char* name = 0L, bool modal = false);
virtual ~KPropertiesDialog();
static bool showDialog(KFileItem* item, QWidget* parent = 0,
const char* name = 0, bool modal = false);
static bool showDialog(const KURL& _url, QWidget* parent = 0,
const char* name = 0, bool modal = false);
static bool showDialog(const KFileItemList& _items, QWidget* parent = 0,
const char* name = 0, bool modal = false);
void insertPlugin (KPropsDlgPlugin *plugin);
const KURL& kurl() const { return m_singleUrl; }
KFileItem *item() { return m_items.first(); }
KFileItemList items() const { return m_items; }
KDE_DEPRECATED KDialogBase* dialog() { return this; }
KDE_DEPRECATED const KDialogBase* dialog() const { return this; }
const KURL& currentDir() const { return m_currentDir; }
const QString& defaultName() const { return m_defaultName; }
void updateUrl( const KURL& _newUrl );
void rename( const QString& _name );
void abortApplying();
void showFileSharingPage();
void setFileSharingPage(QWidget* page);
void setFileNameReadOnly( bool ro );
public slots:
virtual void slotOk(); // Deletes the PropertiesDialog instance
virtual void slotCancel(); // Deletes the PropertiesDialog instance
signals:
void propertiesClosed();
void applied();
void canceled();
void saveAs(const KURL &oldUrl, KURL &newUrl);
private:
void init (bool modal = false, bool autoShow = true);
void insertPages();
KURL m_singleUrl;
KFileItemList m_items;
QString m_defaultName;
KURL m_currentDir;
QPtrList<KPropsDlgPlugin> m_pageList;
private slots:
void slotStatResult( KIO::Job * ); // No longer used
protected:
virtual void virtual_hook( int id, void* data );
private:
class KPropertiesDialogPrivate;
KPropertiesDialogPrivate *d;
};
class KIO_EXPORT KPropsDlgPlugin : public QObject
{
Q_OBJECT
public:
KPropsDlgPlugin( KPropertiesDialog *_props );
virtual ~KPropsDlgPlugin();
virtual void applyChanges();
static bool isDesktopFile( KFileItem * _item );
void setDirty( bool b );
bool isDirty() const;
public slots:
void setDirty(); // same as setDirty( true )
signals:
void changed();
protected:
KPropertiesDialog *properties;
int fontHeight;
protected:
virtual void virtual_hook( int id, void* data );
private:
class KPropsDlgPluginPrivate;
KPropsDlgPluginPrivate *d;
};
class KIO_EXPORT KFilePropsPlugin : public KPropsDlgPlugin
{
Q_OBJECT
public:
KFilePropsPlugin( KPropertiesDialog *_props );
virtual ~KFilePropsPlugin();
virtual void applyChanges();
static bool supports( KFileItemList _items );
void postApplyChanges();
void setFileNameReadOnly( bool ro );
protected slots:
void slotEditFileType();
void slotCopyFinished( KIO::Job * );
void slotFileRenamed( KIO::Job *, const KURL &, const KURL & );
void slotDirSizeUpdate();
void slotDirSizeFinished( KIO::Job * );
void slotFoundMountPoint( const QString& mp, unsigned long kBSize,
unsigned long kBUsed, unsigned long kBAvail );
void slotSizeStop();
void slotSizeDetermine();
private slots:
// workaround for compiler bug
void slotFoundMountPoint( const unsigned long& kBSize, const unsigned long&
kBUsed, const unsigned long& kBAvail, const QString& mp );
void nameFileChanged(const QString &text );
void slotIconChanged();
private:
void determineRelativePath( const QString & path );
void applyIconChanges();
QWidget *iconArea;
QWidget *nameArea;
QLabel *m_sizeLabel;
QPushButton *m_sizeDetermineButton;
QPushButton *m_sizeStopButton;
QString m_sRelativePath;
bool m_bFromTemplate;
QString oldName;
class KFilePropsPluginPrivate;
KFilePropsPluginPrivate *d;
};
class KIO_EXPORT KFilePermissionsPropsPlugin : public KPropsDlgPlugin
{
Q_OBJECT
public:
enum PermissionsMode {
PermissionsOnlyFiles = 0,
PermissionsOnlyDirs = 1,
PermissionsOnlyLinks = 2,
PermissionsMixed = 3
};
enum PermissionsTarget {
PermissionsOwner = 0,
PermissionsGroup = 1,
PermissionsOthers = 2
};
KFilePermissionsPropsPlugin( KPropertiesDialog *_props );
virtual ~KFilePermissionsPropsPlugin();
virtual void applyChanges();
static bool supports( KFileItemList _items );
private slots:
void slotChmodResult( KIO::Job * );
void slotShowAdvancedPermissions();
private:
void setComboContent(QComboBox *combo, PermissionsTarget target,
mode_t permissions, mode_t partial);
bool isIrregular(mode_t permissions, bool isDir, bool isLink);
void enableAccessControls(bool enable);
void updateAccessControls();
void getPermissionMasks(mode_t &andFilePermissions,
mode_t &andDirPermissions,
mode_t &orFilePermissions,
mode_t &orDirPermissions);
static const mode_t permissionsMasks[3];
static const mode_t standardPermissions[4];
static const char *permissionsTexts[4][4];
// unused, for binary compatibility!
QCheckBox *permBox[3][4];
QComboBox *grpCombo;
KLineEdit *usrEdit, *grpEdit;
mode_t permissions;
QString strGroup;
QString strOwner;
// unused, for compatibility
static mode_t fperm[3][4];
class KFilePermissionsPropsPluginPrivate;
KFilePermissionsPropsPluginPrivate *d;
};
class KIO_EXPORT KURLPropsPlugin : public KPropsDlgPlugin
{
Q_OBJECT
public:
KURLPropsPlugin( KPropertiesDialog *_props );
virtual ~KURLPropsPlugin();
virtual void applyChanges();
static bool supports( KFileItemList _items );
private:
KURLRequester *URLEdit;
KIconButton *iconBox;
QString URLStr;
QString iconStr;
QPixmap pixmap;
QString pixmapFile;
private:
class KURLPropsPluginPrivate;
KURLPropsPluginPrivate *d;
};
class KIO_EXPORT KBindingPropsPlugin : public KPropsDlgPlugin
{
Q_OBJECT
public:
KBindingPropsPlugin( KPropertiesDialog *_props );
virtual ~KBindingPropsPlugin();
virtual void applyChanges();
static bool supports( KFileItemList _items );
private:
QLineEdit *commentEdit;
QLineEdit *patternEdit;
QLineEdit *mimeEdit;
QString m_sMimeStr;
QCheckBox * cbAutoEmbed;
class KBindingPropsPluginPrivate;
KBindingPropsPluginPrivate *d;
};
class KIO_EXPORT KDevicePropsPlugin : public KPropsDlgPlugin
{
Q_OBJECT
public:
KDevicePropsPlugin( KPropertiesDialog *_props );
virtual ~KDevicePropsPlugin();
virtual void applyChanges();
static bool supports( KFileItemList _items );
private slots:
void slotActivated( int );
void slotDeviceChanged();
void slotFoundMountPoint( const unsigned long& kBSize,
const unsigned long& /*kBUsed*/,
const unsigned long& kBAvail,
const QString& );
private:
void updateInfo();
private:
QComboBox* device;
QLabel* mountpoint;
QCheckBox* readonly;
void* unused;
//KIconButton* mounted;
KIconButton* unmounted;
QStringList m_devicelist;
int indexDevice;
int indexMountPoint;
int indexFSType;
QPixmap pixmap;
QString pixmapFile;
class KDevicePropsPluginPrivate;
KDevicePropsPluginPrivate *d;
};
class KPropertiesDesktopBase;
class KIO_EXPORT KDesktopPropsPlugin : public KPropsDlgPlugin
{
Q_OBJECT
public:
KDesktopPropsPlugin( KPropertiesDialog *_props );
virtual ~KDesktopPropsPlugin();
virtual void applyChanges();
static bool supports( KFileItemList _items );
public slots:
void slotAddFiletype();
void slotDelFiletype();
void slotBrowseExec();
void slotAdvanced();
void slotSelectMimetype();
private:
void checkCommandChanged();
private:
KPropertiesDesktopBase* w;
QString m_origCommandStr;
QString m_terminalOptionStr;
QString m_suidUserStr;
QString m_dcopServiceType;
bool m_terminalBool;
bool m_terminalCloseBool;
bool m_suidBool;
bool m_startupBool;
bool m_systrayBool;
class KDesktopPropsPluginPrivate;
KDesktopPropsPluginPrivate *d;
};
class KIO_EXPORT_DEPRECATED KExecPropsPlugin : public KPropsDlgPlugin
{
Q_OBJECT
public:
KExecPropsPlugin( KPropertiesDialog *_props );
virtual ~KExecPropsPlugin();
virtual void applyChanges();
static bool supports( KFileItemList _items );
public slots:
void slotBrowseExec();
private slots:
void enableCheckedEdit();
void enableSuidEdit();
private:
QLabel *terminalLabel;
QLabel *suidLabel;
KLineEdit *execEdit;
QCheckBox *terminalCheck;
QCheckBox *suidCheck;
KLineEdit *terminalEdit;
KLineEdit *suidEdit;
KLineEdit *swallowExecEdit;
KLineEdit *swallowTitleEdit;
QButton *execBrowse;
QString execStr;
QString swallowExecStr;
QString swallowTitleStr;
QString termOptionsStr;
bool termBool;
bool suidBool;
QString suidUserStr;
class KExecPropsPluginPrivate;
KExecPropsPluginPrivate *d;
};
class KIO_EXPORT_DEPRECATED KApplicationPropsPlugin : public KPropsDlgPlugin
{
Q_OBJECT
public:
KApplicationPropsPlugin( KPropertiesDialog *_props );
virtual ~KApplicationPropsPlugin();
virtual void applyChanges();
static bool supports( KFileItemList _items );
public slots:
void slotDelExtension();
void slotAddExtension();
private slots:
void updateButton();
private:
void addMimeType( const QString & name );
QLineEdit *commentEdit;
QLineEdit *genNameEdit;
QLineEdit *nameEdit;
QListBox *extensionsList;
QListBox *availableExtensionsList;
QPushButton *addExtensionButton;
QPushButton *delExtensionButton;
class KApplicationPropsPluginPrivate;
KApplicationPropsPluginPrivate *d;
};
#endif
KPropertiesDialog::dialog
KDE_DEPRECATED KDialogBase * dialog()
Definition: kpropertiesdialog.h:273
KURLPropsPlugin
Used to edit the files containing [Desktop Entry] URL=....
Definition: kpropertiesdialog.h:657
KPropertiesDialog::items
KFileItemList items() const
Definition: kpropertiesdialog.h:267
KPropertiesDialog::kurl
const KURL & kurl() const
The URL of the file that has its properties being displayed.
Definition: kpropertiesdialog.h:253
KIconButton
A pushbutton for choosing an icon.
Definition: kicondialog.h:257
KBindingPropsPlugin
Used to edit the files containing [Desktop Entry] Type=MimeType.
Definition: kpropertiesdialog.h:692
KFilePermissionsPropsPlugin
'Permissions' plugin In this plugin you can modify permissions and change the owner of a file...
Definition: kpropertiesdialog.h:571
KPropertiesDialog::currentDir
const KURL & currentDir() const
If the dialog is being built from a template, this method returns the current directory.
Definition: kpropertiesdialog.h:287
KFilePropsPlugin
'General' plugin This plugin displays the name of the file, its size and access times.
Definition: kpropertiesdialog.h:495
KPropertiesDialog::dialog
KDE_DEPRECATED const KDialogBase * dialog() const
Definition: kpropertiesdialog.h:278
KPropertiesDialog::defaultName
const QString & defaultName() const
If the dialog is being built from a template, this method returns the default name.
Definition: kpropertiesdialog.h:295
KPropertiesDialog
The main properties dialog class.
Definition: kpropertiesdialog.h:70
KDesktopPropsPlugin
Used to edit the files containing [Desktop Entry] Type=Application.
Definition: kpropertiesdialog.h:774
KURLRequester
This class is a widget showing a lineedit and a button, which invokes a filedialog.
Definition: kurlrequester.h:56
KDevicePropsPlugin
Properties plugin for device .desktop files.
Definition: kpropertiesdialog.h:722
KPropertiesDialog::item
KFileItem * item()
Definition: kpropertiesdialog.h:262
KApplicationPropsPlugin
Used to edit the files containing [Desktop Entry] Type=Application.
Definition: kpropertiesdialog.h:881
KExecPropsPlugin
Used to edit the files containing [Desktop Entry] Type=Application.
Definition: kpropertiesdialog.h:825
KPropsDlgPlugin
A Plugin in the Properties dialog This is an abstract class.
Definition: kpropertiesdialog.h:437
KPropsDlgPlugin::applyChanges
virtual void applyChanges()
Applies all changes to the file.
Definition: kpropertiesdialog.cpp:659
KPropsDlgPlugin::properties
KPropertiesDialog * properties
Pointer to the dialog.
Definition: kpropertiesdialog.h:480

KDE Home | KDE Accessibility Home | Description of Access Keys