activate the overwriting confirmation in all the other file save dialogs

svn path=/trunk/KDE/kdegraphics/okular/; revision=1066352
remotes/origin/KDE/4.4
Pino Toscano 16 years ago
parent 184deb5112
commit b025b4113a
  1. 18
      ui/guiutils.cpp
  2. 3
      ui/pageview.cpp
  3. 19
      ui/propertiesdialog.cpp

@ -200,23 +200,19 @@ KIconLoader* iconLoader()
void saveEmbeddedFile( Okular::EmbeddedFile *ef, QWidget *parent )
{
const QString caption = i18n( "Where do you want to save %1?", ef->name() );
const QString path = KFileDialog::getSaveFileName( ef->name(), QString(), parent, caption );
const QString path = KFileDialog::getSaveFileName( ef->name(), QString(), parent, caption,
KFileDialog::ConfirmOverwrite );
if ( path.isEmpty() )
return;
QFile f( path );
if ( !f.exists() || KMessageBox::warningContinueCancel( parent, i18n( "A file named \"%1\" already exists. Are you sure you want to overwrite it?", path ), QString(), KGuiItem( i18nc( "@action:button", "&Overwrite" ) ) ) == KMessageBox::Continue )
if ( !f.open( QIODevice::WriteOnly ) )
{
if ( f.open( QIODevice::WriteOnly ) )
{
f.write( ef->data() );
f.close();
}
else
{
KMessageBox::error( parent, i18n( "Could not open \"%1\" for writing. File was not saved.", path ) );
}
KMessageBox::error( parent, i18n( "Could not open \"%1\" for writing. File was not saved.", path ) );
return;
}
f.write( ef->data() );
f.close();
}
}

@ -2024,7 +2024,8 @@ void PageView::mouseReleaseEvent( QMouseEvent * e )
else if ( choice == imageToFile )
{
// [3] save pixmap to file
QString fileName = KFileDialog::getSaveFileName( KUrl(), "image/png image/jpeg", this );
QString fileName = KFileDialog::getSaveFileName( KUrl(), "image/png image/jpeg", this, QString(),
KFileDialog::ConfirmOverwrite );
if ( fileName.isEmpty() )
d->messageWindow->display( i18n( "File not saved." ), PageViewMessage::Warning );
else

@ -259,22 +259,19 @@ void PropertiesDialog::showFontsMenu(const QPoint &pos)
{
Okular::FontInfo fi = index.data(FontInfoRole).value<Okular::FontInfo>();
const QString caption = i18n( "Where do you want to save %1?", fi.name() );
const QString path = KFileDialog::getSaveFileName( fi.name(), QString(), this, caption );
const QString path = KFileDialog::getSaveFileName( fi.name(), QString(), this, caption, KFileDialog::ConfirmOverwrite );
if ( path.isEmpty() )
return;
QFile f( path );
if ( !f.exists() || KMessageBox::warningContinueCancel( this, i18n( "A file named \"%1\" already exists. Are you sure you want to overwrite it?", path ), QString(), KGuiItem( i18nc( "@action:button", "&Overwrite" ) ) ) == KMessageBox::Continue )
if ( f.open( QIODevice::WriteOnly ) )
{
if ( f.open( QIODevice::WriteOnly ) )
{
f.write( m_document->fontData(fi) );
f.close();
}
else
{
KMessageBox::error( this, i18n( "Could not open \"%1\" for writing. File was not saved.", path ) );
}
f.write( m_document->fontData(fi) );
f.close();
}
else
{
KMessageBox::error( this, i18n( "Could not open \"%1\" for writing. File was not saved.", path ) );
}
}
}

Loading…
Cancel
Save