• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdelibs API Reference
  • KDE Home
  • Contact Us
 

KFile

Public Slots | Signals | Public Member Functions | Protected Slots | List of all members
KNewFileMenu Class Reference

#include <knewfilemenu.h>

Inheritance diagram for KNewFileMenu:
Inheritance graph
[legend]

Public Slots

void checkUpToDate ()
 
void createDirectory ()
 

Signals

void directoryCreated (const KUrl &url)
 
void fileCreated (const KUrl &url)
 
- Signals inherited from KAction
void authorized (KAuth::Action *action)
 
void globalShortcutChanged (const QKeySequence &)
 
void triggered (Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers)
 

Public Member Functions

 KNewFileMenu (KActionCollection *collection, const QString &name, QObject *parent)
 
virtual ~KNewFileMenu ()
 
bool isModal () const
 
KUrl::List popupFiles () const
 
void setModal (bool modality)
 
void setParentWidget (QWidget *parentWidget)
 
void setPopupFiles (const KUrl::List &files)
 
void setSupportedMimeTypes (const QStringList &mime)
 
void setViewShowsHiddenFiles (bool b)
 
QStringList supportedMimeTypes () const
 
- Public Member Functions inherited from KActionMenu
 KActionMenu (QObject *parent)
 
 KActionMenu (const QString &text, QObject *parent)
 
 KActionMenu (const KIcon &icon, const QString &text, QObject *parent)
 
virtual ~KActionMenu ()
 
void addAction (QAction *action)
 
QAction * addSeparator ()
 
virtual QWidget * createWidget (QWidget *parent)
 
bool delayed () const
 
void insertAction (QAction *before, QAction *action)
 
QAction * insertSeparator (QAction *before)
 
KMenu * menu ()
 
KMenu * popupMenu ()
 
void remove (KAction *)
 
void removeAction (QAction *action)
 
void setDelayed (bool delayed)
 
void setMenu (KMenu *menu)
 
void setStickyMenu (bool sticky)
 
bool stickyMenu () const
 
- Public Member Functions inherited from KAction
 KAction (QObject *parent)
 
 KAction (const QString &text, QObject *parent)
 
 KAction (const KIcon &icon, const QString &text, QObject *parent)
 
virtual ~KAction ()
 
KAuth::Action * authAction () const
 
bool event (QEvent *)
 
void forgetGlobalShortcut ()
 
const KShortcut & globalShortcut (ShortcutTypes type=ActiveShortcut) const
 
bool globalShortcutAllowed () const
 
bool isGlobalShortcutEnabled () const
 
bool isShortcutConfigurable () const
 
KRockerGesture rockerGesture (ShortcutTypes type=ActiveShortcut) const
 
void setAuthAction (KAuth::Action *action)
 
void setAuthAction (const QString &actionName)
 
void setGlobalShortcut (const KShortcut &shortcut, ShortcutTypes type=ShortcutTypes(ActiveShortcut|DefaultShortcut), GlobalShortcutLoading loading=Autoloading)
 
void setGlobalShortcutAllowed (bool allowed, GlobalShortcutLoading loading=Autoloading)
 
void setHelpText (const QString &text)
 
void setRockerGesture (const KRockerGesture &gest, ShortcutTypes type=ShortcutTypes(ActiveShortcut|DefaultShortcut))
 
void setShapeGesture (const KShapeGesture &gest, ShortcutTypes type=ShortcutTypes(ActiveShortcut|DefaultShortcut))
 
void setShortcut (const KShortcut &shortcut, ShortcutTypes type=ShortcutTypes(ActiveShortcut|DefaultShortcut))
 
void setShortcut (const QKeySequence &shortcut, ShortcutTypes type=ShortcutTypes(ActiveShortcut|DefaultShortcut))
 
void setShortcutConfigurable (bool configurable)
 
void setShortcuts (const QList< QKeySequence > &shortcuts, ShortcutTypes type=ShortcutTypes(ActiveShortcut|DefaultShortcut))
 
KShapeGesture shapeGesture (ShortcutTypes type=ActiveShortcut) const
 
KShortcut shortcut (ShortcutTypes types=ActiveShortcut) const
 
- Public Member Functions inherited from QAction
 QAction (QObject *parent)
 
 QAction (const QString &text, QObject *parent)
 
 QAction (QObject *parent, const char *name)
 
 QAction (const QString &text, const QKeySequence &shortcut, QObject *parent, const char *name)
 
 QAction (const QIcon &icon, const QString &text, QObject *parent)
 
 QAction (const QIcon &icon, const QString &text, const QKeySequence &shortcut, QObject *parent, const char *name)
 
 ~QAction ()
 
QKeySequence accel () const
 
QActionGroup * actionGroup () const
 
void activate (ActionEvent event)
 
void activated (int i)
 
bool addTo (QWidget *w)
 
QList< QGraphicsWidget * > associatedGraphicsWidgets () const
 
QList< QWidget * > associatedWidgets () const
 
bool autoRepeat () const
 
void changed ()
 
QVariant data () const
 
QFont font () const
 
void hover ()
 
void hovered ()
 
QIcon icon () const
 
QIcon iconSet () const
 
QString iconText () const
 
bool isCheckable () const
 
bool isChecked () const
 
bool isEnabled () const
 
bool isIconVisibleInMenu () const
 
bool isOn () const
 
bool isSeparator () const
 
bool isToggleAction () const
 
bool isVisible () const
 
QMenu * menu () const
 
MenuRole menuRole () const
 
QString menuText () const
 
QWidget * parentWidget () const
 
Priority priority () const
 
bool removeFrom (QWidget *w)
 
void setAccel (const QKeySequence &shortcut)
 
void setActionGroup (QActionGroup *group)
 
void setAutoRepeat (bool)
 
void setCheckable (bool)
 
void setChecked (bool)
 
void setData (const QVariant &userData)
 
void setDisabled (bool b)
 
void setEnabled (bool)
 
void setFont (const QFont &font)
 
void setIcon (const QIcon &icon)
 
void setIconSet (const QIcon &i)
 
void setIconText (const QString &text)
 
void setIconVisibleInMenu (bool visible)
 
void setMenu (QMenu *menu)
 
void setMenuRole (MenuRole menuRole)
 
void setMenuText (const QString &text)
 
void setOn (bool b)
 
void setPriority (Priority priority)
 
void setSeparator (bool b)
 
void setShortcut (const QKeySequence &shortcut)
 
void setShortcutContext (Qt::ShortcutContext context)
 
void setShortcuts (QKeySequence::StandardKey key)
 
void setShortcuts (const QList< QKeySequence > &shortcuts)
 
void setSoftKeyRole (SoftKeyRole softKeyRole)
 
void setStatusTip (const QString &statusTip)
 
void setText (const QString &text)
 
void setToggleAction (bool b)
 
void setToolTip (const QString &tip)
 
void setVisible (bool)
 
void setWhatsThis (const QString &what)
 
QKeySequence shortcut () const
 
Qt::ShortcutContext shortcutContext () const
 
QList< QKeySequence > shortcuts () const
 
bool showStatusText (QWidget *widget)
 
SoftKeyRole softKeyRole () const
 
QString statusTip () const
 
QString text () const
 
void toggle ()
 
void toggled (bool checked)
 
QString toolTip () const
 
void trigger ()
 
void triggered (bool checked)
 
QString whatsThis () const
 
- Public Member Functions inherited from QObject
 QObject (QObject *parent)
 
 QObject (QObject *parent, const char *name)
 
virtual  ~QObject ()
 
bool blockSignals (bool block)
 
QObject * child (const char *objName, const char *inheritsClass, bool recursiveSearch) const
 
const QObjectList & children () const
 
const char * className () const
 
bool connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const
 
void deleteLater ()
 
void destroyed (QObject *obj)
 
bool disconnect (const QObject *receiver, const char *method)
 
bool disconnect (const char *signal, const QObject *receiver, const char *method)
 
void dumpObjectInfo ()
 
void dumpObjectTree ()
 
QList< QByteArray > dynamicPropertyNames () const
 
T findChild (const QString &name) const
 
QList< T > findChildren (const QRegExp &regExp) const
 
QList< T > findChildren (const QString &name) const
 
bool inherits (const char *className) const
 
void insertChild (QObject *object)
 
void installEventFilter (QObject *filterObj)
 
bool isA (const char *className) const
 
bool isWidgetType () const
 
void killTimer (int id)
 
virtual const QMetaObject * metaObject () const
 
void moveToThread (QThread *targetThread)
 
const char * name () const
 
const char * name (const char *defaultName) const
 
QString objectName () const
 
QObject * parent () const
 
QVariant property (const char *name) const
 
void removeChild (QObject *object)
 
void removeEventFilter (QObject *obj)
 
void setName (const char *name)
 
void setObjectName (const QString &name)
 
void setParent (QObject *parent)
 
bool setProperty (const char *name, const QVariant &value)
 
bool signalsBlocked () const
 
int startTimer (int interval)
 
QThread * thread () const
 
- Public Member Functions inherited from QWidgetAction
 QWidgetAction (QObject *parent)
 
virtual  ~QWidgetAction ()
 
QWidget * defaultWidget () const
 
void releaseWidget (QWidget *widget)
 
QWidget * requestWidget (QWidget *parent)
 
void setDefaultWidget (QWidget *widget)
 

Protected Slots

virtual void slotResult (KJob *job)
 

Additional Inherited Members

- Public Types inherited from KAction
enum  GlobalShortcutLoading
 
enum  ShortcutType
 
- Static Public Member Functions inherited from QObject
bool connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
 
bool connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type)
 
bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method)
 
bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)
 
QString tr (const char *sourceText, const char *disambiguation, int n)
 
QString trUtf8 (const char *sourceText, const char *disambiguation, int n)
 
- Protected Member Functions inherited from QObject
bool checkConnectArgs (const char *signal, const QObject *object, const char *method)
 
virtual void childEvent (QChildEvent *event)
 
virtual void connectNotify (const char *signal)
 
virtual void customEvent (QEvent *event)
 
virtual void disconnectNotify (const char *signal)
 
int receivers (const char *signal) const
 
QObject * sender () const
 
int senderSignalIndex () const
 
virtual void timerEvent (QTimerEvent *event)
 
- Protected Member Functions inherited from QWidgetAction
QList< QWidget * > createdWidgets () const
 
virtual void deleteWidget (QWidget *widget)
 
virtual bool eventFilter (QObject *obj, QEvent *event)
 
- Static Protected Member Functions inherited from QObject
QByteArray normalizeSignalSlot (const char *signalSlot)
 
- Properties inherited from KActionMenu
bool delayed
 
bool stickyMenu
 
- Properties inherited from KAction
KShortcut globalShortcut
 
bool globalShortcutAllowed
 
bool globalShortcutEnabled
 
KShortcut shortcut
 
bool shortcutConfigurable
 
- Properties inherited from QAction
 autoRepeat
 
 checkable
 
 checked
 
 enabled
 
 font
 
 icon
 
 iconText
 
 iconVisibleInMenu
 
 menuRole
 
 priority
 
 shortcut
 
 shortcutContext
 
 softKeyRole
 
 statusTip
 
 text
 
 toolTip
 
 visible
 
 whatsThis
 
- Properties inherited from QObject
 objectName
 

Detailed Description

The 'Create New' submenu, for creating files using templates (e.g.

"new HTML file") and directories.

The same instance can be used by both for the File menu and the RMB popup menu, in a file manager. This is also used in the file dialog's RMB menu.

To use this class, you need to connect aboutToShow() of the File menu with slotCheckUpToDate() and to call slotCheckUpToDate() before showing the RMB popupmenu.

KNewFileMenu automatically updates the list of templates shown if installed templates are added/updated/deleted.

Author
Björn Ruberg bjoer.nosp@m.n@ru.nosp@m.berg-.nosp@m.wege.nosp@m.ner.d.nosp@m.e Made dialogs working asynchronously
David Faure faure.nosp@m.@kde.nosp@m..org Ideas and code for the new template handling mechanism ('link' desktop files) from Christoph Pickart picka.nosp@m.rt@i.nosp@m.am.un.nosp@m.i-bo.nosp@m.nn.de
Since
4.5

Definition at line 54 of file knewfilemenu.h.

Constructor & Destructor Documentation

KNewFileMenu::KNewFileMenu ( KActionCollection *  collection,
const QString &  name,
QObject *  parent 
)

Constructor.

Parameters
collectionthe KActionCollection this KAction should be added to.
nameaction name, when adding the action to the collection
parentthe parent object, for ownership. If the parent object is a widget, it will also used as parent widget for any dialogs that this class might show. Otherwise, call setParentWidget.

Definition at line 967 of file knewfilemenu.cpp.

KNewFileMenu::~KNewFileMenu ( )
virtual

Destructor.

KNewMenu uses internally a globally shared cache, so that multiple instances of it don't need to parse the installed templates multiple times. Therefore you can safely create and delete KNewMenu instances without a performance issue.

Definition at line 984 of file knewfilemenu.cpp.

Member Function Documentation

void KNewFileMenu::checkUpToDate ( )
slot

Checks if updating the list is necessary IMPORTANT : Call this in the slot for aboutToShow.

And while you're there, you probably want to call setViewShowsHiddenFiles ;)

Definition at line 990 of file knewfilemenu.cpp.

void KNewFileMenu::createDirectory ( )
slot

Call this to create a new directory as if the user had done it using a popupmenu.

This is useful to make sure that creating a directory with a key shortcut (e.g. F10) triggers the exact same code as when using the New menu. Requirements: call setPopupFiles first, and keep this KNewFileMenu instance alive (the mkdir is async).

Definition at line 1020 of file knewfilemenu.cpp.

void KNewFileMenu::directoryCreated ( const KUrl &  url)
signal

Emitted once the directory url has been successfully created.

void KNewFileMenu::fileCreated ( const KUrl &  url)
signal

Emitted once the file (or symlink) url has been successfully created.

bool KNewFileMenu::isModal ( ) const

Returns the modality of dialogs.

Definition at line 1065 of file knewfilemenu.cpp.

KUrl::List KNewFileMenu::popupFiles ( ) const

Returns the files that the popup is shown for.

Definition at line 1070 of file knewfilemenu.cpp.

void KNewFileMenu::setModal ( bool  modality)

Sets the modality of dialogs created by KNewFile.

Set to false if you do not want to block your application window when entering a new directory name i.e.

Definition at line 1075 of file knewfilemenu.cpp.

void KNewFileMenu::setParentWidget ( QWidget *  parentWidget)

Sets a parent widget for the dialogs shown by KNewFileMenu.

This is strongly recommended, for apps with a main window.

Definition at line 1099 of file knewfilemenu.cpp.

void KNewFileMenu::setPopupFiles ( const KUrl::List &  files)

Set the files the popup is shown for Call this before showing up the menu.

Definition at line 1080 of file knewfilemenu.cpp.

void KNewFileMenu::setSupportedMimeTypes ( const QStringList &  mime)

Only show the files in a given set of mimetypes.

This is useful in specialized applications (while file managers, on the other hand, want to show all mimetypes).

Definition at line 1104 of file knewfilemenu.cpp.

void KNewFileMenu::setViewShowsHiddenFiles ( bool  b)

Set if the directory view currently shows dot files.

Definition at line 1109 of file knewfilemenu.cpp.

void KNewFileMenu::slotResult ( KJob *  job)
protectedvirtualslot

Called when the job that copied the template has finished.

This method is virtual so that error handling can be reimplemented. Make sure to call the base class slotResult when !job->error() though.

Definition at line 1114 of file knewfilemenu.cpp.

QStringList KNewFileMenu::supportedMimeTypes ( ) const

Returns the mimetypes set in supportedMimeTypes()

Definition at line 1144 of file knewfilemenu.cpp.


The documentation for this class was generated from the following files:
  • knewfilemenu.h
  • knewfilemenu.cpp
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:27:27 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KFile

Skip menu "KFile"
  • Main Page
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal