Commit 4d57f1d0 authored by David Faure's avatar David Faure

Remove now unused newDir. Porting instructions in wiki.

parent bb69c7eb
......@@ -590,62 +590,6 @@ void KonqOperations::slotResult(KJob *job)
deleteLater();
}
// Duplicated in KNewFileMenuPrivate::confirmCreatingHiddenDir (and this version isn't kdelibs4support free, so use the other one)
static bool confirmCreatingHiddenDir(const QString& name, QWidget* parent)
{
KGuiItem continueGuiItem(KStandardGuiItem::cont());
continueGuiItem.setText(i18nc("@action:button", "Create directory"));
KGuiItem cancelGuiItem(KStandardGuiItem::cancel());
cancelGuiItem.setText(i18nc("@action:button", "Enter a different name"));
return KMessageBox::warningContinueCancel(
parent,
i18n("The name \"%1\" starts with a dot, so the directory will be hidden by default.", name),
i18nc("@title:window", "Create hidden directory?"),
continueGuiItem,
cancelGuiItem,
"confirm_create_hidden_dir") == KMessageBox::Continue;
}
KIO::Job *KonqOperations::newDir(QWidget * parent, const QUrl &baseUrl, NewDirFlags flags)
{
bool ok;
QString name = i18nc( "@label Default name when creating a folder", "New Folder" );
if ( baseUrl.isLocalFile() && QFileInfo(baseUrl.toLocalFile() + QLatin1Char('/') + name).exists() ) {
name = KIO::suggestName(baseUrl, name);
}
bool askAgain;
do {
askAgain = false;
name = QInputDialog::getText(parent, i18nc( "@title:window", "New Folder" ),
i18nc( "@label:textbox", "Enter folder name:" ), QLineEdit::Normal, name, &ok);
if ( ok && !name.isEmpty() ) {
QUrl url;
if (QDir::isAbsolutePath(name) || (name[0] == '~')) {
url = QUrl::fromLocalFile(KShell::tildeExpand(name));
} else {
const bool viewShowsHiddenFiles = (flags & ViewShowsHiddenFile);
if (!viewShowsHiddenFiles && name.startsWith('.')) {
if (!confirmCreatingHiddenDir(name, parent)) {
askAgain = true;
continue;
}
}
url = baseUrl;
url.setPath(baseUrl.path() + QLatin1Char('/') + name);
}
KIO::Job *job = KIO::mkpath(url, baseUrl);
KJobWidgets::setWindow(job, parent);
job->ui()->setAutoErrorHandlingEnabled(true);
KIO::FileUndoManager::self()->recordJob(KIO::FileUndoManager::Mkpath, QList<QUrl>(), url, job);
return job;
}
} while (askAgain);
return 0;
}
////
QWidget* KonqOperations::parentWidget() const
{
return static_cast<QWidget *>( parent() );
......
......@@ -116,18 +116,6 @@ public:
*/
static QPair<bool, QString> pasteInfo(const KUrl& targetUrl);
enum NewDirFlag { ViewShowsHiddenFile = 1 };
Q_DECLARE_FLAGS(NewDirFlags, NewDirFlag)
/**
* Ask for the name of a new directory and create it (using KIO::mkpath).
*
* @param parent the parent widget
* @param baseUrl the directory to create the new directory in
* @param flags see NewDirFlags
* @return the mkpath job used to create the directory or 0 if the creation was cancelled by the user
*/
static KIO::Job* newDir(QWidget *parent, const QUrl &baseUrl, NewDirFlags flags = NewDirFlags());
/**
* Returns the list of dropped URL's.
*
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment