KFile
knewfilemenu.cpp
Go to the documentation of this file.
475 // We don't set the text of lineEdit in its constructor because the clear button would not be shown then.
476 // It seems that setClearButtonShown(true) must be called *before* the text is set to make it work.
499 KNameAndUrlInputDialog* dlg = new KNameAndUrlInputDialog(i18n("File name:"), entry.comment, m_popupFiles.first(), m_parentWidget);
530 KMimeType::Ptr mime = KMimeType::findByNameAndContent(m_copyData.m_chosenFileName, srcFile.read(1024));
568 KNameAndUrlInputDialog* dlg = new KNameAndUrlInputDialog(i18n("File name:"), entry.comment, m_popupFiles.first(), m_parentWidget);
613 // The best way to identify the "Create Directory", "Link to Location", "Link to Application" was the template
718 q->trigger(); // was for kdesktop's slotNewMenuActivated() in kde3 times. Can't hurt to keep it...
826 const QStringList files = m_actionCollection->componentData().dirs()->findAllResources("templates");
892 i18n("Basic links can only point to local files or directories.\nPlease use \"Link to Location\" for remote URLs."),
922 if (KUriFilter::self()->filterUri(uriData, QStringList() << QLatin1String("kshorturifilter"))) {
974 connect(d->m_newMenuGroup, SIGNAL(triggered(QAction*)), this, SLOT(_k_slotActionTriggered(QAction*)));
1029 if (baseUrl.isLocalFile() && QFileInfo(baseUrl.toLocalFile(KUrl::AddTrailingSlash) + name).exists())
1042 // We don't set the text of lineEdit in its constructor because the clear button would not be shown then.
1043 // It seems that setClearButtonShown(true) must be called *before* the text is set to make it work.
1049 d->_k_slotTextChanged(name); // have to save string in d->m_text in case user does not touch dialog
AddTrailingSlash
void addPath(const QString &txt)
KUrl uri() const
KStandardDirs * dirs()
static QString defaultMimeType()
QString protocol() const
KNewFileMenu(KActionCollection *collection, const QString &name, QObject *parent)
Constructor.
Definition: knewfilemenu.cpp:967
The 'Create New' submenu, for creating files using templates (e.g.
Definition: knewfilemenu.h:54
void setEscapeButton(ButtonCode id)
static bool shouldBeShownContinue(const QString &dontShowAgainName)
void setData(const KUrl &url)
static KUriFilter * self()
SimpleJob * mkdir(const KUrl &url, int permissions=-1)
QString i18nc(const char *ctxt, const char *text)
static bool supportsWriting(const KUrl &url)
void setClearButtonShown(bool show)
void setModal(bool modality)
Sets the modality of dialogs created by KNewFile.
Definition: knewfilemenu.cpp:1075
void setMainWidget(QWidget *widget)
static KUrl mostLocalUrl(const KUrl &url, QWidget *window)
static QDebug kError(bool cond, int area=KDE_DEFAULT_DEBUG_AREA)
QStringList supportedMimeTypes() const
Returns the mimetypes set in supportedMimeTypes()
Definition: knewfilemenu.cpp:1144
QString label(StandardShortcut id)
void setParentWidget(QWidget *parentWidget)
Sets a parent widget for the dialogs shown by KNewFileMenu.
Definition: knewfilemenu.cpp:1099
virtual void setText(const QString &)
static Ptr findByUrl(const KUrl &url, mode_t mode=0, bool is_local_file=false, bool fast_mode=false, int *accuracy=0)
static QString suggestName(const KUrl &baseURL, const QString &oldName)
static QDebug kDebug(bool cond, int area=KDE_DEFAULT_DEBUG_AREA)
void directoryCreated(const KUrl &url)
Emitted once the directory url has been successfully created.
void setButtonGuiItem(ButtonCode id, const KGuiItem &item)
static FileUndoManager * self()
QString fileName(const DirectoryOptions &options=IgnoreTrailingSlash) const
KGuiItem cancel()
void fileCreated(const KUrl &url)
Emitted once the file (or symlink) url has been successfully created.
QString toLocalFile(AdjustPathOption trailing=LeaveTrailingSlash) const
KUrl destUrl() const
bool isLocalFile() const
void recordJob(CommandType op, const KUrl::List &src, const KUrl &dst, KIO::Job *job)
void triggered(Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers)
static Ptr findByPath(const QString &path, mode_t mode=0, bool fast_mode=false, int *accuracy=0)
void createDirectory()
Call this to create a new directory as if the user had done it using a popupmenu.
Definition: knewfilemenu.cpp:1020
void setViewShowsHiddenFiles(bool b)
Set if the directory view currently shows dot files.
Definition: knewfilemenu.cpp:1109
int utime(const QString &filename, struct utimbuf *buf)
Unknown
static int createKMessageBox(KDialog *dialog, const QIcon &icon, const QString &text, const QStringList &strlist, const QString &ask, bool *checkboxReturn, Options options, const QString &details=QString(), QMessageBox::Icon notifyType=QMessageBox::Information)
QString tildeExpand(const QString &path)
JobUiDelegate * ui() const
static bool isDesktopFile(const QString &path)
KSharedConfigPtr config()
QString i18n(const char *text)
static QDebug kWarning(bool cond, int area=KDE_DEFAULT_DEBUG_AREA)
QString encodeFileName(const QString &str)
void setPopupFiles(const KUrl::List &files)
Set the files the popup is shown for Call this before showing up the menu.
Definition: knewfilemenu.cpp:1080
CopyJob * copyAs(const KUrl &src, const KUrl &dest, JobFlags flags=DefaultFlags)
group
static QString icon(const QString &protocol)
virtual void slotResult(KJob *job)
Called when the job that copied the template has finished.
Definition: knewfilemenu.cpp:1114
void setCheckForExecutables(bool check)
QString pathOrUrl() const
NoExec
virtual void setWindow(QWidget *window)
static Ptr findByNameAndContent(const QString &name, const QByteArray &data, mode_t mode=0, int *accuracy=0)
void setDefaultButton(ButtonCode id)
static Ptr mimeType(const QString &name, FindByNameOption options=ResolveAliases)
const char * name(StandardAction id)
SimpleJob * symlink(const QString &target, const KUrl &dest, JobFlags flags=DefaultFlags)
KGuiItem cont()
virtual void setCaption(const QString &caption)
Cancel
static bool supportsMakeDir(const KUrl &url)
QString prettyUrl(AdjustPathOption trailing=LeaveTrailingSlash) const
void checkUpToDate()
Checks if updating the list is necessary IMPORTANT : Call this in the slot for aboutToShow.
Definition: knewfilemenu.cpp:990
void setButtons(ButtonCodes buttonMask)
int error() const
void setSupportedMimeTypes(const QStringList &mime)
Only show the files in a given set of mimetypes.
Definition: knewfilemenu.cpp:1104
K_GLOBAL_STATIC(KUrl, lastDirectory) static const char autocompletionWhatsThisText[]
KActionMenu(const KIcon &icon, const QString &text, QObject *parent)
void setDefaultPermissions(bool b)
KUrl::List popupFiles() const
Returns the files that the popup is shown for.
Definition: knewfilemenu.cpp:1070
Unknown
void setPath(const QString &path)
bool filterUri(KUriFilterData &data, const QStringList &filters=QStringList())
void setAutoErrorHandlingEnabled(bool enable)
QStringList resourceDirs(const char *type) const
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Sun Jan 19 2020 00:00:00 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2020 The KDE developers.
Generated on Sun Jan 19 2020 00:00:00 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.