514
bool enableLinking = true; // for now, but see below
515
516
// We don't want to offer "move" for temp files. They might come from
516
517
// kmail using a tempfile for attachments, or ark using a tempdir for
517
518
// extracting an archive -- in all cases, we can't implement a real move,
518
519
// it's just a copy of the tempfile [and the source app will delete it later].
519
520
// https://www.intevation.de/roundup/kolab/issue2026
522
// Similarly, linking to a temp file is pointless.
520
523
if (url.isLocalFile() && url.toLocalFile().startsWith(KStandardDirs::locateLocal("tmp", QString()))) {
522
525
sDeleting = false;
526
enableLinking = false;
802
807
rename( parent, oldurl, newurl );
805
KIO::SimpleJob* KonqOperations::newDir( QWidget * parent, const KUrl & baseUrl )
810
// Duplicated in libkfile's KDirOperator
811
static bool confirmCreatingHiddenDir(const QString& name, QWidget* parent)
813
KGuiItem continueGuiItem(KStandardGuiItem::cont());
814
continueGuiItem.setText(i18nc("@action:button", "Create directory"));
815
KGuiItem cancelGuiItem(KStandardGuiItem::cancel());
816
cancelGuiItem.setText(i18nc("@action:button", "Enter a different name"));
817
return KMessageBox::warningContinueCancel(
819
i18n("The name \"%1\" starts with a dot, so the directory will be hidden by default.", name),
820
i18n("Create hidden directory?"),
823
"confirm_create_hidden_dir") == KMessageBox::Continue;
826
KIO::SimpleJob* KonqOperations::newDir(QWidget * parent, const KUrl & baseUrl)
828
return newDir(parent, baseUrl, NewDirFlags());
831
KIO::SimpleJob* KonqOperations::newDir(QWidget * parent, const KUrl & baseUrl, NewDirFlags flags)
833
// Notice that kfile's KDirOperator::mkdir() is somewhat similar
808
835
QString name = i18n( "New Folder" );
809
836
if ( baseUrl.isLocalFile() && QFileInfo( baseUrl.toLocalFile( KUrl::AddTrailingSlash ) + name ).exists() )
810
name = KIO::RenameDialog::suggestName( baseUrl, i18n( "New Folder" ) );
837
name = KIO::RenameDialog::suggestName(baseUrl, name);
812
name = KInputDialog::getText ( i18n( "New Folder" ),
813
i18n( "Enter folder name:" ), name, &ok, parent );
814
if ( ok && !name.isEmpty() )
817
if ((name[0] == '/') || (name[0] == '~'))
819
url.setPath(KShell::tildeExpand(name));
823
name = KIO::encodeFileName( name );
827
return KonqOperations::mkdir( parent, url );
842
name = KInputDialog::getText ( i18n( "New Folder" ),
843
i18n( "Enter folder name:" ), name, &ok, parent );
844
if ( ok && !name.isEmpty() ) {
846
if ((name[0] == '/') || (name[0] == '~')) {
847
url.setPath(KShell::tildeExpand(name));
849
const bool viewShowsHiddenFiles = (flags & ViewShowsHiddenFile);
850
if (!viewShowsHiddenFiles && name.startsWith('.')) {
851
if (!confirmCreatingHiddenDir(name, parent)) {
856
name = KIO::encodeFileName( name );
860
return KonqOperations::mkdir( parent, url );