diff --git a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -135,7 +135,7 @@ ${CMAKE_CURRENT_SOURCE_DIR}/dialogs/imagelib/transforms/kpTransformRotateDialog.cpp ${CMAKE_CURRENT_SOURCE_DIR}/dialogs/imagelib/transforms/kpTransformSkewDialog.cpp ${CMAKE_CURRENT_SOURCE_DIR}/dialogs/kpColorSimilarityDialog.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/dialogs/kpDocumentSaveOptionsPreviewDialog.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/dialogs/kpDocumentSaveOptionsDialog.cpp ${CMAKE_CURRENT_SOURCE_DIR}/document/kpDocument.cpp ${CMAKE_CURRENT_SOURCE_DIR}/document/kpDocument_Open.cpp ${CMAKE_CURRENT_SOURCE_DIR}/document/kpDocument_Save.cpp @@ -293,7 +293,6 @@ ${CMAKE_CURRENT_SOURCE_DIR}/widgets/kpColorCells.cpp ${CMAKE_CURRENT_SOURCE_DIR}/widgets/kpColorPalette.cpp ${CMAKE_CURRENT_SOURCE_DIR}/widgets/kpDefaultColorCollection.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/widgets/kpDocumentSaveOptionsWidget.cpp ${CMAKE_CURRENT_SOURCE_DIR}/widgets/kpDualColorButton.cpp ${CMAKE_CURRENT_SOURCE_DIR}/widgets/kpPrintDialogPage.cpp ${CMAKE_CURRENT_SOURCE_DIR}/widgets/kpTransparentColorCell.cpp diff --git a/widgets/kpDocumentSaveOptionsWidget.h b/dialogs/kpDocumentSaveOptionsDialog.h rename from widgets/kpDocumentSaveOptionsWidget.h rename to dialogs/kpDocumentSaveOptionsDialog.h --- a/widgets/kpDocumentSaveOptionsWidget.h +++ b/dialogs/kpDocumentSaveOptionsDialog.h @@ -26,43 +26,47 @@ */ -#ifndef kpDocumentSaveOptionsWidget_H -#define kpDocumentSaveOptionsWidget_H +#ifndef kpDocumentSaveOptionsDialog_H +#define kpDocumentSaveOptionsDialog_H +#include "generic/widgets/kpSubWindow.h" -#include -#include -#include +#include +#include +#include +#include #include "imagelib/kpDocumentMetaInfo.h" #include "document/kpDocumentSaveOptions.h" - +class QCloseEvent; class QComboBox; class QImage; class QLabel; -class QTimer; -class QSpinBox; +class QMoveEvent; class QPushButton; +class QResizeEvent; +class QSpinBox; +class QTimer; -class kpDocumentSaveOptionsPreviewDialog; - +class kpDocumentSaveOptionsPreviewWidget; +class kpResizeSignallingLabel; -class kpDocumentSaveOptionsWidget : public QWidget +class kpDocumentSaveOptionsDialog : public QDialog { Q_OBJECT public: - kpDocumentSaveOptionsWidget (const QImage &docPixmap, + kpDocumentSaveOptionsDialog (const QImage &docPixmap, const kpDocumentSaveOptions &saveOptions, const kpDocumentMetaInfo &metaInfo, QWidget *parent); - kpDocumentSaveOptionsWidget (QWidget *parent); + kpDocumentSaveOptionsDialog (QWidget *parent); + QSize preferredMinimumSize () const; private: void init (); public: - ~kpDocumentSaveOptionsWidget () override; - + ~kpDocumentSaveOptionsDialog () override; // is usually the filedialog void setVisualParent (QWidget *visualParent); @@ -71,6 +75,10 @@ protected: bool mimeTypeHasConfigurableColorDepth () const; bool mimeTypeHasConfigurableQuality () const; + static const QSize s_pixmapLabelMinimumSize; + +signals: + void resized (); public: QString mimeType () const; @@ -119,11 +127,10 @@ protected slots: - void showPreview (bool yes = true); - void hidePreview (); + void setFilePixmapAndSize (const QImage &filePixmap, qint64 fileSize); + void updatePixmapPreview (); void updatePreviewDelayed (); void updatePreview (); - void updatePreviewDialogLastRelativeGeometry (); protected: @@ -132,6 +139,10 @@ Mode m_mode; QImage *m_documentPixmap; + QImage *m_filePixmap; + qint64 m_fileSize; + + void resizeEvent (QResizeEvent *e) override; kpDocumentSaveOptions m_baseDocumentSaveOptions; kpDocumentMetaInfo m_documentMetaInfo; @@ -144,13 +155,11 @@ QLabel *m_qualityLabel; QSpinBox *m_qualityInput; - QPushButton *m_previewButton; - kpDocumentSaveOptionsPreviewDialog *m_previewDialog; - QRect m_previewDialogLastRelativeGeometry; QTimer *m_updatePreviewTimer; int m_updatePreviewDelay; - QTimer *m_updatePreviewDialogLastRelativeGeometryTimer; + kpResizeSignallingLabel *m_filePixmapLabel; + QLabel *m_fileSizeLabel; }; -#endif // kpDocumentSaveOptionsWidget_H +#endif // kpDocumentSaveOptionsDialog_H diff --git a/widgets/kpDocumentSaveOptionsWidget.cpp b/dialogs/kpDocumentSaveOptionsDialog.cpp rename from widgets/kpDocumentSaveOptionsWidget.cpp rename to dialogs/kpDocumentSaveOptionsDialog.cpp --- a/widgets/kpDocumentSaveOptionsWidget.cpp +++ b/dialogs/kpDocumentSaveOptionsDialog.cpp @@ -27,41 +27,42 @@ #define DEBUG_KP_DOCUMENT_SAVE_OPTIONS_WIDGET 0 - -#include "widgets/kpDocumentSaveOptionsWidget.h" - -#include "kpDefs.h" -#include "document/kpDocument.h" -#include "dialogs/kpDocumentSaveOptionsPreviewDialog.h" -#include "pixmapfx/kpPixmapFX.h" -#include "generic/widgets/kpResizeSignallingLabel.h" +#include "commands/kpCommandSize.h" #include "dialogs/imagelib/transforms/kpTransformPreviewDialog.h" +#include "dialogs/kpDocumentSaveOptionsDialog.h" +#include "document/kpDocument.h" #include "generic/kpWidgetMapper.h" - +#include "generic/widgets/kpResizeSignallingLabel.h" +#include "kpDefs.h" #include "kpLogCategories.h" +#include "pixmapfx/kpPixmapFX.h" + #include #include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -kpDocumentSaveOptionsWidget::kpDocumentSaveOptionsWidget ( +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +kpDocumentSaveOptionsDialog::kpDocumentSaveOptionsDialog ( const QImage &docPixmap, const kpDocumentSaveOptions &saveOptions, const kpDocumentMetaInfo &metaInfo, QWidget *parent) - : QWidget (parent), + : QDialog (parent), m_visualParent (parent) { init (); @@ -70,21 +71,22 @@ setDocumentMetaInfo (metaInfo); } -kpDocumentSaveOptionsWidget::kpDocumentSaveOptionsWidget ( +kpDocumentSaveOptionsDialog::kpDocumentSaveOptionsDialog ( QWidget *parent) - : QWidget (parent), + : QDialog (parent), m_visualParent (parent) { init (); } // private -void kpDocumentSaveOptionsWidget::init () +void kpDocumentSaveOptionsDialog::init () { m_documentPixmap = nullptr; - m_previewDialog = nullptr; + m_filePixmap = nullptr; m_visualParent = nullptr; + setWindowTitle (i18nc("@title:window", "Save Options")); m_colorDepthLabel = new QLabel (i18n ("Convert &to:"), this); m_colorDepthCombo = new QComboBox (this); @@ -99,28 +101,42 @@ // TODO: 100 quality is also misleading since that implies perfect quality. m_qualityInput->setRange (1, 100); - m_previewButton = new QPushButton (i18n ("&Preview"), this); - m_previewButton->setCheckable (true); - - m_colorDepthLabel->setBuddy (m_colorDepthCombo); m_qualityLabel->setBuddy (m_qualityInput); + m_filePixmapLabel = new kpResizeSignallingLabel (this); + m_filePixmapLabel->setMinimumSize (250, 210); + m_fileSizeLabel = new QLabel (this); + + connect (m_filePixmapLabel, SIGNAL (resized()), + this, SLOT (updatePixmapPreview())); + + QDialogButtonBox *buttons = new QDialogButtonBox (QDialogButtonBox::Ok | + QDialogButtonBox::Cancel, this); + connect (buttons, &QDialogButtonBox::accepted, this, &kpDocumentSaveOptionsDialog::accept); + connect (buttons, &QDialogButtonBox::rejected, this, &kpDocumentSaveOptionsDialog::reject); + + QVBoxLayout *lay = new QVBoxLayout (this); + lay->setMargin(10); - QHBoxLayout *lay = new QHBoxLayout (this); - lay->setMargin(0); + QHBoxLayout *layH = new QHBoxLayout (); + layH->setMargin(0); - lay->addWidget (m_colorDepthLabel, 0/*stretch*/, Qt::AlignLeft); - lay->addWidget (m_colorDepthCombo, 0/*stretch*/); + layH->addWidget (m_colorDepthLabel, 0/*stretch*/, Qt::AlignLeft); + layH->addWidget (m_colorDepthCombo, 0/*stretch*/); - lay->addWidget (m_colorDepthSpaceWidget, 1/*stretch*/); + layH->addWidget (m_colorDepthSpaceWidget, 1/*stretch*/); - lay->addWidget (m_qualityLabel, 0/*stretch*/, Qt::AlignLeft); - lay->addWidget (m_qualityInput, 2/*stretch*/); + layH->addWidget (m_qualityLabel, 0/*stretch*/, Qt::AlignLeft); + layH->addWidget (m_qualityInput, 2/*stretch*/); - lay->addWidget (m_previewButton, 0/*stretch*/, Qt::AlignRight); + lay->addLayout (layH); + lay->addWidget (m_filePixmapLabel, 2/*stretch*/); + lay->addWidget (m_fileSizeLabel); + + lay->addWidget (buttons); connect (m_colorDepthCombo, SIGNAL (activated(int)), this, SLOT (slotColorDepthSelected())); @@ -130,10 +146,6 @@ connect (m_qualityInput, SIGNAL (valueChanged(int)), this, SLOT (updatePreviewDelayed())); - connect (m_previewButton, SIGNAL (toggled(bool)), - this, SLOT (showPreview(bool))); - - m_updatePreviewDelay = 200/*ms*/; m_updatePreviewTimer = new QTimer (this); @@ -141,32 +153,25 @@ connect (m_updatePreviewTimer, SIGNAL (timeout()), this, SLOT (updatePreview())); - m_updatePreviewDialogLastRelativeGeometryTimer = new QTimer (this); - connect (m_updatePreviewDialogLastRelativeGeometryTimer, SIGNAL (timeout()), - this, SLOT (updatePreviewDialogLastRelativeGeometry())); - - setMode (None); slotColorDepthSelected (); } -kpDocumentSaveOptionsWidget::~kpDocumentSaveOptionsWidget () +kpDocumentSaveOptionsDialog::~kpDocumentSaveOptionsDialog () { #if DEBUG_KP_DOCUMENT_SAVE_OPTIONS_WIDGET - qCDebug(kpLogWidgets) << "kpDocumentSaveOptionsWidget::()"; + qCDebug(kpLogWidgets) << "kpDocumentSaveOptionsDialog::()"; #endif - hidePreview (); - delete m_documentPixmap; } // public -void kpDocumentSaveOptionsWidget::setVisualParent (QWidget *visualParent) +void kpDocumentSaveOptionsDialog::setVisualParent (QWidget *visualParent) { #if DEBUG_KP_DOCUMENT_SAVE_OPTIONS_WIDGET - qCDebug(kpLogWidgets) << "kpDocumentSaveOptionsWidget::setVisualParent(" + qCDebug(kpLogWidgets) << "kpDocumentSaveOptionsDialog::setVisualParent(" << visualParent << ")" << endl; #endif @@ -175,29 +180,29 @@ // protected -bool kpDocumentSaveOptionsWidget::mimeTypeHasConfigurableColorDepth () const +bool kpDocumentSaveOptionsDialog::mimeTypeHasConfigurableColorDepth () const { return kpDocumentSaveOptions::mimeTypeHasConfigurableColorDepth (mimeType ()); } // protected -bool kpDocumentSaveOptionsWidget::mimeTypeHasConfigurableQuality () const +bool kpDocumentSaveOptionsDialog::mimeTypeHasConfigurableQuality () const { return kpDocumentSaveOptions::mimeTypeHasConfigurableQuality (mimeType ()); } // public -QString kpDocumentSaveOptionsWidget::mimeType () const +QString kpDocumentSaveOptionsDialog::mimeType () const { return m_baseDocumentSaveOptions.mimeType (); } // public slots -void kpDocumentSaveOptionsWidget::setMimeType (const QString &string) +void kpDocumentSaveOptionsDialog::setMimeType (const QString &string) { #if DEBUG_KP_DOCUMENT_SAVE_OPTIONS_WIDGET - qCDebug(kpLogWidgets) << "kpDocumentSaveOptionsWidget::setMimeType(" << string + qCDebug(kpLogWidgets) << "kpDocumentSaveOptionsDialog::setMimeType(" << string << ") maxColorDepth=" << kpDocumentSaveOptions::mimeTypeMaximumColorDepth (string) << endl; @@ -272,7 +277,7 @@ // public -int kpDocumentSaveOptionsWidget::colorDepth () const +int kpDocumentSaveOptionsDialog::colorDepth () const { if (mode () & ColorDepth) { @@ -302,7 +307,7 @@ } // public -bool kpDocumentSaveOptionsWidget::dither () const +bool kpDocumentSaveOptionsDialog::dither () const { if (mode () & ColorDepth) { @@ -316,7 +321,7 @@ } // protected static -int kpDocumentSaveOptionsWidget::colorDepthComboItemFromColorDepthAndDither ( +int kpDocumentSaveOptionsDialog::colorDepthComboItemFromColorDepthAndDither ( int depth, bool dither) { if (depth == 1) @@ -352,10 +357,10 @@ } // public slots -void kpDocumentSaveOptionsWidget::setColorDepthDither (int newDepth, bool newDither) +void kpDocumentSaveOptionsDialog::setColorDepthDither (int newDepth, bool newDither) { #if DEBUG_KP_DOCUMENT_SAVE_OPTIONS_WIDGET - qCDebug(kpLogWidgets) << "kpDocumentSaveOptionsWidget::setColorDepthDither(" + qCDebug(kpLogWidgets) << "kpDocumentSaveOptionsDialog::setColorDepthDither(" << "depth=" << newDepth << ",dither=" << newDither << ")" << endl; @@ -380,7 +385,7 @@ // protected slot -void kpDocumentSaveOptionsWidget::slotColorDepthSelected () +void kpDocumentSaveOptionsDialog::slotColorDepthSelected () { if (mode () & ColorDepth) { @@ -395,7 +400,7 @@ } #if DEBUG_KP_DOCUMENT_SAVE_OPTIONS_WIDGET - qCDebug(kpLogWidgets) << "kpDocumentSaveOptionsWidget::slotColorDepthSelected()" + qCDebug(kpLogWidgets) << "kpDocumentSaveOptionsDialog::slotColorDepthSelected()" << " mode&ColorDepth=" << (mode () & ColorDepth) << " colorDepthComboLastSelectedItem=" << m_colorDepthComboLastSelectedItem @@ -405,7 +410,7 @@ // public -int kpDocumentSaveOptionsWidget::quality () const +int kpDocumentSaveOptionsDialog::quality () const { if (mode () & Quality) { @@ -418,10 +423,10 @@ } // public -void kpDocumentSaveOptionsWidget::setQuality (int newQuality) +void kpDocumentSaveOptionsDialog::setQuality (int newQuality) { #if DEBUG_KP_DOCUMENT_SAVE_OPTIONS_WIDGET - qCDebug(kpLogWidgets) << "kpDocumentSaveOptionsWidget::setQuality(" + qCDebug(kpLogWidgets) << "kpDocumentSaveOptionsDialog::setQuality(" << newQuality << ")" << endl; #endif @@ -433,13 +438,13 @@ // public -kpDocumentSaveOptions kpDocumentSaveOptionsWidget::documentSaveOptions () const +kpDocumentSaveOptions kpDocumentSaveOptionsDialog::documentSaveOptions () const { return kpDocumentSaveOptions (mimeType (), colorDepth (), dither (), quality ()); } // public -void kpDocumentSaveOptionsWidget::setDocumentSaveOptions ( +void kpDocumentSaveOptionsDialog::setDocumentSaveOptions ( const kpDocumentSaveOptions &saveOptions) { setMimeType (saveOptions.mimeType ()); @@ -449,7 +454,7 @@ // public -void kpDocumentSaveOptionsWidget::setDocumentPixmap (const QImage &documentPixmap) +void kpDocumentSaveOptionsDialog::setDocumentPixmap (const QImage &documentPixmap) { delete m_documentPixmap; m_documentPixmap = new QImage (documentPixmap); @@ -458,7 +463,7 @@ } // public -void kpDocumentSaveOptionsWidget::setDocumentMetaInfo ( +void kpDocumentSaveOptionsDialog::setDocumentMetaInfo ( const kpDocumentMetaInfo &metaInfo) { m_documentMetaInfo = metaInfo; @@ -468,13 +473,13 @@ // public -kpDocumentSaveOptionsWidget::Mode kpDocumentSaveOptionsWidget::mode () const +kpDocumentSaveOptionsDialog::Mode kpDocumentSaveOptionsDialog::mode () const { return m_mode; } // public -void kpDocumentSaveOptionsWidget::setMode (Mode mode) +void kpDocumentSaveOptionsDialog::setMode (Mode mode) { m_mode = mode; @@ -503,7 +508,7 @@ } // protected slot -void kpDocumentSaveOptionsWidget::repaintLabels () +void kpDocumentSaveOptionsDialog::repaintLabels () { if (mode () != Quality) m_colorDepthLabel->repaint (); @@ -513,171 +518,16 @@ // protected slot -void kpDocumentSaveOptionsWidget::showPreview (bool yes) -{ -#if DEBUG_KP_DOCUMENT_SAVE_OPTIONS_WIDGET - qCDebug(kpLogWidgets) << "kpDocumentSaveOptionsWidget::showPreview(" << yes << ")" - << " m_previewDialog=" << bool (m_previewDialog) - << endl; -#endif - - if (yes == bool (m_previewDialog)) - return; - - if (!m_visualParent) - return; - - if (yes) - { - m_previewDialog = new kpDocumentSaveOptionsPreviewDialog( m_visualParent ); - m_previewDialog->setObjectName( QLatin1String( "previewSaveDialog" ) ); - updatePreview (); - - connect (m_previewDialog, SIGNAL (finished()), - this, SLOT (hidePreview())); - - - KConfigGroup cfg (KSharedConfig::openConfig (), kpSettingsGroupPreviewSave); - - if (cfg.hasKey (kpSettingPreviewSaveUpdateDelay)) - { - m_updatePreviewDelay = cfg.readEntry (kpSettingPreviewSaveUpdateDelay, 0); - } - else - { - cfg.writeEntry (kpSettingPreviewSaveUpdateDelay, m_updatePreviewDelay); - cfg.sync (); - } - - if (m_updatePreviewDelay < 0) - m_updatePreviewDelay = 0; - #if DEBUG_KP_DOCUMENT_SAVE_OPTIONS_WIDGET - qCDebug(kpLogWidgets) << "\tread cfg preview dialog update delay=" - << m_updatePreviewDelay - << endl; - #endif - - - if (m_previewDialogLastRelativeGeometry.isEmpty ()) - { - #if DEBUG_KP_DOCUMENT_SAVE_OPTIONS_WIDGET - qCDebug(kpLogWidgets) << "\tread cfg preview dialog last rel geometry"; - #endif - KConfigGroup cfg (KSharedConfig::openConfig (), kpSettingsGroupPreviewSave); - - m_previewDialogLastRelativeGeometry = cfg.readEntry ( - kpSettingPreviewSaveGeometry, QRect ()); - } - - #if DEBUG_KP_DOCUMENT_SAVE_OPTIONS_WIDGET - qCDebug(kpLogWidgets) << "\tpreviewDialogLastRelativeGeometry=" - << m_previewDialogLastRelativeGeometry - << " visualParent->rect()=" << m_visualParent->rect () - << endl; - #endif - - QRect relativeGeometry; - if (!m_previewDialogLastRelativeGeometry.isEmpty () && - m_visualParent->rect ().intersects (m_previewDialogLastRelativeGeometry)) - { - #if DEBUG_KP_DOCUMENT_SAVE_OPTIONS_WIDGET - qCDebug(kpLogWidgets) << "\tok"; - #endif - relativeGeometry = m_previewDialogLastRelativeGeometry; - } - else - { - #if DEBUG_KP_DOCUMENT_SAVE_OPTIONS_WIDGET - qCDebug(kpLogWidgets) << "\t\tinvalid"; - #endif - const int margin = 20; - - relativeGeometry = - QRect (m_visualParent->width () - - m_previewDialog->preferredMinimumSize ().width () - - margin, - margin * 2, // Avoid folder combo - m_previewDialog->preferredMinimumSize ().width (), - m_previewDialog->preferredMinimumSize ().height ()); - } - - - const QRect globalGeometry = - kpWidgetMapper::toGlobal (m_visualParent, - relativeGeometry); - #if DEBUG_KP_DOCUMENT_SAVE_OPTIONS_WIDGET - qCDebug(kpLogWidgets) << "\trelativeGeometry=" << relativeGeometry - << " globalGeometry=" << globalGeometry - << endl; - #endif - - m_previewDialog->resize (globalGeometry.size ()); - m_previewDialog->move (globalGeometry.topLeft ()); - - - m_previewDialog->show (); - - - #if DEBUG_KP_DOCUMENT_SAVE_OPTIONS_WIDGET - qCDebug(kpLogWidgets) << "\tgeometry after show=" - << QRect (m_previewDialog->x (), m_previewDialog->y (), - m_previewDialog->width (), m_previewDialog->height ()) - << endl; - #endif - - updatePreviewDialogLastRelativeGeometry (); - - connect (m_previewDialog, SIGNAL (moved()), - this, SLOT (updatePreviewDialogLastRelativeGeometry())); - connect (m_previewDialog, SIGNAL (resized()), - this, SLOT (updatePreviewDialogLastRelativeGeometry())); - - m_updatePreviewDialogLastRelativeGeometryTimer->start (200/*ms*/); - } - else - { - m_updatePreviewDialogLastRelativeGeometryTimer->stop (); - - KConfigGroup cfg (KSharedConfig::openConfig (), kpSettingsGroupPreviewSave); - - cfg.writeEntry (kpSettingPreviewSaveGeometry, m_previewDialogLastRelativeGeometry); - cfg.sync (); - - #if DEBUG_KP_DOCUMENT_SAVE_OPTIONS_WIDGET - qCDebug(kpLogWidgets) << "\tsaving preview geometry " - << m_previewDialogLastRelativeGeometry - << " (Qt would have us believe " - << kpWidgetMapper::fromGlobal (m_visualParent, - QRect (m_previewDialog->x (), m_previewDialog->y (), - m_previewDialog->width (), m_previewDialog->height ())) - << ")" - << endl; - #endif - - m_previewDialog->deleteLater (); - m_previewDialog = nullptr; - } -} - -// protected slot -void kpDocumentSaveOptionsWidget::hidePreview () -{ - if (m_previewButton->isChecked ()) - m_previewButton->toggle (); -} - - -// protected slot -void kpDocumentSaveOptionsWidget::updatePreviewDelayed () +void kpDocumentSaveOptionsDialog::updatePreviewDelayed () { // (single shot) m_updatePreviewTimer->start (m_updatePreviewDelay); } // protected slot -void kpDocumentSaveOptionsWidget::updatePreview () +void kpDocumentSaveOptionsDialog::updatePreview () { - if (!m_previewDialog || !m_documentPixmap) + if (!m_documentPixmap) return; @@ -715,42 +565,137 @@ { // Leave as invalid. // TODO: This code path has not been well tested. - // Will we trigger divide by zero errors in "m_previewDialog"? + // Will we trigger divide by zero errors in "m_previewWidget"? } // REFACTOR: merge with kpDocument::getPixmapFromFile() - m_previewDialog->setFilePixmapAndSize (image, data.size ()); + setFilePixmapAndSize (image, data.size ()); QApplication::restoreOverrideCursor (); } -// protected slot -void kpDocumentSaveOptionsWidget::updatePreviewDialogLastRelativeGeometry () + +// protected static +const QSize kpDocumentSaveOptionsDialog::s_pixmapLabelMinimumSize (25, 25); + +// public +QSize kpDocumentSaveOptionsDialog::preferredMinimumSize () const +{ + const int contentsWidth = 180; + const int totalMarginsWidth = fontMetrics ().height (); + + return QSize (contentsWidth + totalMarginsWidth, + contentsWidth * 3 / 4 + totalMarginsWidth); +} + + +// public slot +void kpDocumentSaveOptionsDialog::setFilePixmapAndSize (const QImage &pixmap, + qint64 fileSize) +{ + delete m_filePixmap; + m_filePixmap = new QImage (pixmap); + + updatePixmapPreview (); + + m_fileSize = fileSize; + + const kpCommandSize::SizeType pixmapSize = kpCommandSize::PixmapSize (pixmap); + // (int cast is safe as long as the file size is not more than 20 million + // -- i.e. INT_MAX / 100 -- times the pixmap size) + const int percent = pixmapSize ? + qMax (1, + (int) ((kpCommandSize::SizeType) fileSize * 100 / pixmapSize)) : + 0; +#if DEBUG_KP_DOCUMENT_SAVE_OPTIONS_WIDGET + qCDebug(kpLogDialogs) << "kpDocumentSaveOptionsDialog::setFilePixmapAndSize()" + << " pixmapSize=" << pixmapSize + << " fileSize=" << fileSize + << " raw fileSize/pixmapSize%=" + << (pixmapSize ? (kpCommandSize::SizeType) fileSize * 100 / pixmapSize : 0) + << endl; +#endif + + m_fileSizeLabel->setText (i18np ("1 byte (approx. %2%)", "%1 bytes (approx. %2%)", + m_fileSize, percent)); +} + +// public slot +void kpDocumentSaveOptionsDialog::updatePixmapPreview () { #if DEBUG_KP_DOCUMENT_SAVE_OPTIONS_WIDGET - qCDebug(kpLogWidgets) << "kpDocumentSaveOptionsWidget::" - << "updatePreviewDialogLastRelativeGeometry()" + qCDebug(kpLogDialogs) << "kpDocumentSaveOptionsDialog::updatePreviewPixmap()" + << " filePixmapLabel.size=" << m_filePixmapLabel->size () + << " filePixmap.size=" << m_filePixmap->size () << endl; #endif - if (m_previewDialog && m_previewDialog->isVisible ()) + if (m_filePixmap) { - m_previewDialogLastRelativeGeometry = - kpWidgetMapper::fromGlobal (m_visualParent, - QRect (m_previewDialog->x (), m_previewDialog->y (), - m_previewDialog->width (), m_previewDialog->height ())); + int maxNewWidth = qMin (m_filePixmap->width (), + m_filePixmapLabel->width ()), + maxNewHeight = qMin (m_filePixmap->height (), + m_filePixmapLabel->height ()); + + double keepsAspect = kpTransformPreviewDialog::aspectScale ( + maxNewWidth, maxNewHeight, + m_filePixmap->width (), m_filePixmap->height ()); #if DEBUG_KP_DOCUMENT_SAVE_OPTIONS_WIDGET - qCDebug(kpLogWidgets) << "\tcaching pos = " - << m_previewDialogLastRelativeGeometry + qCDebug(kpLogDialogs) << "\tmaxNewWidth=" << maxNewWidth + << " maxNewHeight=" << maxNewHeight + << " keepsAspect=" << keepsAspect << endl; #endif + + + const int newWidth = kpTransformPreviewDialog::scaleDimension ( + m_filePixmap->width (), + keepsAspect, + 1, + maxNewWidth); + const int newHeight = kpTransformPreviewDialog::scaleDimension ( + m_filePixmap->height (), + keepsAspect, + 1, + maxNewHeight); + #if DEBUG_KP_DOCUMENT_SAVE_OPTIONS_WIDGET + qCDebug(kpLogDialogs) << "\tnewWidth=" << newWidth + << " newHeight=" << newHeight + << endl; + #endif + + + QImage transformedPixmap = + kpPixmapFX::scale (*m_filePixmap, + newWidth, newHeight); + + + QImage labelPixmap (m_filePixmapLabel->width (), + m_filePixmapLabel->height (), QImage::Format_ARGB32_Premultiplied); + labelPixmap.fill(QColor(Qt::transparent).rgba()); + kpPixmapFX::setPixmapAt (&labelPixmap, + (labelPixmap.width () - transformedPixmap.width ()) / 2, + (labelPixmap.height () - transformedPixmap.height ()) / 2, + transformedPixmap); + + + m_filePixmapLabel->setPixmap (QPixmap::fromImage(labelPixmap)); } else { - #if DEBUG_KP_DOCUMENT_SAVE_OPTIONS_WIDGET - qCDebug(kpLogWidgets) << "\tnot visible - ignoring geometry"; - #endif + m_filePixmapLabel->setPixmap (QPixmap ()); } } +// protected virtual [base QDialog] +void kpDocumentSaveOptionsDialog::resizeEvent (QResizeEvent *e) +{ +#if DEBUG_KP_DOCUMENT_SAVE_OPTIONS_WIDGET + qCDebug(kpLogDialogs) << "kpDocumentSaveOptionsDialog::resizeEvent()"; +#endif + + QDialog::resizeEvent (e); + + emit resized (); +} diff --git a/dialogs/kpDocumentSaveOptionsPreviewDialog.h b/dialogs/kpDocumentSaveOptionsPreviewDialog.h deleted file mode 100644 --- a/dialogs/kpDocumentSaveOptionsPreviewDialog.h +++ /dev/null @@ -1,82 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - - -#ifndef kpDocumentSaveOptionsPreviewDialog_H -#define kpDocumentSaveOptionsPreviewDialog_H - -#include "generic/widgets/kpSubWindow.h" - -#include - - -class QCloseEvent; -class QImage; -class QLabel; -class QMoveEvent; -class QResizeEvent; - -class kpResizeSignallingLabel; - - -class kpDocumentSaveOptionsPreviewDialog : public kpSubWindow -{ -Q_OBJECT - -public: - kpDocumentSaveOptionsPreviewDialog (QWidget *parent); - ~kpDocumentSaveOptionsPreviewDialog () override; - - QSize preferredMinimumSize () const; - -protected: - static const QSize s_pixmapLabelMinimumSize; - -signals: - void moved (); - void resized (); - void finished (); - -public slots: - void setFilePixmapAndSize (const QImage &filePixmap, qint64 fileSize); - void updatePixmapPreview (); - -protected: - void closeEvent (QCloseEvent *e) override; - void moveEvent (QMoveEvent *e) override; - void resizeEvent (QResizeEvent *e) override; - -protected: - QImage *m_filePixmap; - qint64 m_fileSize; - - kpResizeSignallingLabel *m_filePixmapLabel; - QLabel *m_fileSizeLabel; -}; - - -#endif // kpDocumentSaveOptionsPreviewDialog_H diff --git a/dialogs/kpDocumentSaveOptionsPreviewDialog.cpp b/dialogs/kpDocumentSaveOptionsPreviewDialog.cpp deleted file mode 100644 --- a/dialogs/kpDocumentSaveOptionsPreviewDialog.cpp +++ /dev/null @@ -1,239 +0,0 @@ - -/* - Copyright (c) 2003-2007 Clarence Dang - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#define DEBUG_KP_DOCUMENT_SAVE_OPTIONS_WIDGET 0 - - -#include "kpDocumentSaveOptionsPreviewDialog.h" - -#include -#include -#include -#include -#include - -#include -#include "kpLogCategories.h" -#include - -#include "commands/kpCommandSize.h" -#include "kpDefs.h" -#include "document/kpDocument.h" -#include "pixmapfx/kpPixmapFX.h" -#include "generic/widgets/kpResizeSignallingLabel.h" -#include "dialogs/imagelib/transforms/kpTransformPreviewDialog.h" - - -// protected static -const QSize kpDocumentSaveOptionsPreviewDialog::s_pixmapLabelMinimumSize (25, 25); - - -kpDocumentSaveOptionsPreviewDialog::kpDocumentSaveOptionsPreviewDialog ( - QWidget *parent ) - : kpSubWindow (parent), - m_filePixmap (nullptr), - m_fileSize (0) -{ - setWindowTitle (i18nc ("@title:window", "Save Preview")); - - QWidget *baseWidget = this;//new QWidget (this); - //setMainWidget (baseWidget); - - - QGridLayout *lay = new QGridLayout ( baseWidget ); - - m_filePixmapLabel = new kpResizeSignallingLabel (baseWidget); - m_fileSizeLabel = new QLabel (baseWidget); - - - m_filePixmapLabel->setMinimumSize (s_pixmapLabelMinimumSize); - - - lay->addWidget (m_filePixmapLabel, 0, 0); - lay->addWidget (m_fileSizeLabel, 1, 0, Qt::AlignHCenter); - - - lay->setRowStretch (0, 1); - - - connect (m_filePixmapLabel, SIGNAL (resized()), - this, SLOT (updatePixmapPreview())); -} - -kpDocumentSaveOptionsPreviewDialog::~kpDocumentSaveOptionsPreviewDialog () -{ - delete m_filePixmap; -} - - -// public -QSize kpDocumentSaveOptionsPreviewDialog::preferredMinimumSize () const -{ - const int contentsWidth = 180; - const int totalMarginsWidth = fontMetrics ().height (); - - return QSize (contentsWidth + totalMarginsWidth, - contentsWidth * 3 / 4 + totalMarginsWidth); -} - - -// public slot -void kpDocumentSaveOptionsPreviewDialog::setFilePixmapAndSize (const QImage &pixmap, - qint64 fileSize) -{ - delete m_filePixmap; - m_filePixmap = new QImage (pixmap); - - updatePixmapPreview (); - - m_fileSize = fileSize; - - const kpCommandSize::SizeType pixmapSize = kpCommandSize::PixmapSize (pixmap); - // (int cast is safe as long as the file size is not more than 20 million - // -- i.e. INT_MAX / 100 -- times the pixmap size) - const int percent = pixmapSize ? - qMax (1, - (int) ((kpCommandSize::SizeType) fileSize * 100 / pixmapSize)) : - 0; -#if DEBUG_KP_DOCUMENT_SAVE_OPTIONS_WIDGET - qCDebug(kpLogDialogs) << "kpDocumentSaveOptionsPreviewDialog::setFilePixmapAndSize()" - << " pixmapSize=" << pixmapSize - << " fileSize=" << fileSize - << " raw fileSize/pixmapSize%=" - << (pixmapSize ? (kpCommandSize::SizeType) fileSize * 100 / pixmapSize : 0) - << endl; -#endif - - m_fileSizeLabel->setText (i18np ("1 byte (approx. %2%)", "%1 bytes (approx. %2%)", - m_fileSize, percent)); -} - -// public slot -void kpDocumentSaveOptionsPreviewDialog::updatePixmapPreview () -{ -#if DEBUG_KP_DOCUMENT_SAVE_OPTIONS_WIDGET - qCDebug(kpLogDialogs) << "kpDocumentSaveOptionsPreviewDialog::updatePreviewPixmap()" - << " filePixmapLabel.size=" << m_filePixmapLabel->size () - << " filePixmap.size=" << m_filePixmap->size () - << endl; -#endif - - if (m_filePixmap) - { - int maxNewWidth = qMin (m_filePixmap->width (), - m_filePixmapLabel->width ()), - maxNewHeight = qMin (m_filePixmap->height (), - m_filePixmapLabel->height ()); - - double keepsAspect = kpTransformPreviewDialog::aspectScale ( - maxNewWidth, maxNewHeight, - m_filePixmap->width (), m_filePixmap->height ()); - #if DEBUG_KP_DOCUMENT_SAVE_OPTIONS_WIDGET - qCDebug(kpLogDialogs) << "\tmaxNewWidth=" << maxNewWidth - << " maxNewHeight=" << maxNewHeight - << " keepsAspect=" << keepsAspect - << endl; - #endif - - - const int newWidth = kpTransformPreviewDialog::scaleDimension ( - m_filePixmap->width (), - keepsAspect, - 1, - maxNewWidth); - const int newHeight = kpTransformPreviewDialog::scaleDimension ( - m_filePixmap->height (), - keepsAspect, - 1, - maxNewHeight); - #if DEBUG_KP_DOCUMENT_SAVE_OPTIONS_WIDGET - qCDebug(kpLogDialogs) << "\tnewWidth=" << newWidth - << " newHeight=" << newHeight - << endl; - #endif - - - QImage transformedPixmap = - kpPixmapFX::scale (*m_filePixmap, - newWidth, newHeight); - - - QImage labelPixmap (m_filePixmapLabel->width (), - m_filePixmapLabel->height (), QImage::Format_ARGB32_Premultiplied); - labelPixmap.fill(QColor(Qt::transparent).rgba()); - kpPixmapFX::setPixmapAt (&labelPixmap, - (labelPixmap.width () - transformedPixmap.width ()) / 2, - (labelPixmap.height () - transformedPixmap.height ()) / 2, - transformedPixmap); - - - m_filePixmapLabel->setPixmap (QPixmap::fromImage(labelPixmap)); - } - else - { - m_filePixmapLabel->setPixmap (QPixmap ()); - } -} - - -// protected virtual [base QWidget] -void kpDocumentSaveOptionsPreviewDialog::closeEvent (QCloseEvent *e) -{ -#if DEBUG_KP_DOCUMENT_SAVE_OPTIONS_WIDGET - qCDebug(kpLogDialogs) << "kpDocumentSaveOptionsPreviewDialog::closeEvent()"; -#endif - - QWidget::closeEvent (e); - - emit finished (); -} - -// protected virtual [base QWidget] -void kpDocumentSaveOptionsPreviewDialog::moveEvent (QMoveEvent *e) -{ -#if DEBUG_KP_DOCUMENT_SAVE_OPTIONS_WIDGET - qCDebug(kpLogDialogs) << "kpDocumentSaveOptionsPreviewDialog::moveEvent()"; -#endif - - QWidget::moveEvent (e); - - emit moved (); -} - -// protected virtual [base QWidget] -void kpDocumentSaveOptionsPreviewDialog::resizeEvent (QResizeEvent *e) -{ -#if DEBUG_KP_DOCUMENT_SAVE_OPTIONS_WIDGET - qCDebug(kpLogDialogs) << "kpDocumentSaveOptionsPreviewDialog::resizeEvent()"; -#endif - - QWidget::resizeEvent (e); - - emit resized (); -} - - diff --git a/mainWindow/kpMainWindow.h b/mainWindow/kpMainWindow.h --- a/mainWindow/kpMainWindow.h +++ b/mainWindow/kpMainWindow.h @@ -354,7 +354,7 @@ void slotProperties (); - bool save (bool localOnly = false); + bool save (); bool slotSave (); private: @@ -364,14 +364,13 @@ const kpDocumentSaveOptions &startSaveOptions, const kpDocumentMetaInfo &docMetaInfo, const QString &forcedSaveOptionsGroup, - bool localOnly, kpDocumentSaveOptions *chosenSaveOptions, bool isSavingForFirstTime, bool *allowOverwritePrompt, bool *allowLossyPrompt); private slots: - bool saveAs (bool localOnly = false); + bool saveAs (); bool slotSaveAs (); bool slotExport (); diff --git a/mainWindow/kpMainWindow_Edit.cpp b/mainWindow/kpMainWindow_Edit.cpp --- a/mainWindow/kpMainWindow_Edit.cpp +++ b/mainWindow/kpMainWindow_Edit.cpp @@ -851,7 +851,6 @@ d->lastCopyToSaveOptions, kpDocumentMetaInfo (), kpSettingsGroupEditCopyTo, - false/*allow remote files*/, &chosenSaveOptions, d->copyToFirstTime, &allowOverwritePrompt, diff --git a/mainWindow/kpMainWindow_File.cpp b/mainWindow/kpMainWindow_File.cpp --- a/mainWindow/kpMainWindow_File.cpp +++ b/mainWindow/kpMainWindow_File.cpp @@ -30,33 +30,34 @@ #include "kpMainWindow.h" #include "kpMainWindowPrivate.h" -#include -#include +#include +#include +#include +#include #include #include #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include #include +#include #include +#include +#include +#include #include +#include +#include +#include +#include +#include #include #include #include +#include #include -#include // kdelibs4support +#include #include #include // kdelibs4support #include @@ -73,7 +74,7 @@ #include "document/kpDocument.h" #include "commands/imagelib/kpDocumentMetaInfoCommand.h" #include "dialogs/imagelib/kpDocumentMetaInfoDialog.h" -#include "widgets/kpDocumentSaveOptionsWidget.h" +#include "dialogs/kpDocumentSaveOptionsDialog.h" #include "pixmapfx/kpPixmapFX.h" #include "widgets/kpPrintDialogPage.h" #include "views/kpView.h" @@ -735,7 +736,7 @@ //--------------------------------------------------------------------- // private slot -bool kpMainWindow::save (bool localOnly) +bool kpMainWindow::save () { if (d->document->url ().isEmpty () || !QImageWriter::supportedMimeTypes() @@ -744,9 +745,9 @@ // from file so it has been set initially to an invalid value. (d->document->saveOptions ()->mimeTypeHasConfigurableQuality () && d->document->saveOptions ()->qualityIsInvalid ()) || - (localOnly && !d->document->url ().isLocalFile ())) + !d->document->url ().isLocalFile ()) { - return saveAs (localOnly); + return saveAs (); } else { @@ -780,7 +781,6 @@ const kpDocumentSaveOptions &startSaveOptions, const kpDocumentMetaInfo &docMetaInfo, const QString &forcedSaveOptionsGroup, - bool localOnly, kpDocumentSaveOptions *chosenSaveOptions, bool isSavingForFirstTime, bool *allowOverwritePrompt, @@ -881,27 +881,40 @@ fdSaveOptions.printDebug ("\tcorrected saveOptions passed to fileDialog"); #endif - kpDocumentSaveOptionsWidget *saveOptionsWidget = - new kpDocumentSaveOptionsWidget (imageToBeSaved, + kpDocumentSaveOptionsDialog *saveOptionsDialog = + new kpDocumentSaveOptionsDialog (imageToBeSaved, fdSaveOptions, docMetaInfo, this); + QString recentDirClass; + QUrl defaultURL = QUrl (startURL); + if ( defaultURL.url().isEmpty() ) + { + defaultURL = KFileWidget::getStartUrl(QUrl(QStringLiteral("kfiledialog:///savedImages")), recentDirClass); + } - KFileDialog fd (QUrl (startURL), QString(), this, - saveOptionsWidget); - saveOptionsWidget->setVisualParent (&fd); - fd.setWindowTitle (caption); - fd.setOperationMode (KFileDialog::Saving); - fd.setMimeFilter (mimeTypes, fdSaveOptions.mimeType ()); - if (localOnly) - fd.setMode (KFile::File | KFile::LocalOnly); - - connect (&fd, SIGNAL (filterChanged(QString)), - saveOptionsWidget, SLOT (setMimeType(QString))); + QFileDialog fd ( this, Qt::WindowFlags() ); + fd.setWindowTitle( caption ); + fd.setAcceptMode( QFileDialog::AcceptSave ); + fd.setMimeTypeFilters ( mimeTypes ); + if ( startURL.isEmpty() ) + { + fd.setDirectoryUrl( defaultURL ); + fd.selectFile( i18n("unnamed") + QLatin1String(".png") ); + fd.selectMimeTypeFilter("image/png"); + } + else + { + fd.selectUrl( defaultURL ); + fd.selectMimeTypeFilter("image/" + QFileInfo(startURL).suffix().toLower()); + } + + connect (&fd, &QFileDialog::filterSelected, + saveOptionsDialog, &kpDocumentSaveOptionsDialog::setMimeType); - if ( fd.exec() == QDialog::Accepted ) + if ( fd.exec() == QDialog::Accepted && saveOptionsDialog->exec() == QDialog::Accepted ) { - kpDocumentSaveOptions newSaveOptions = saveOptionsWidget->documentSaveOptions (); + kpDocumentSaveOptions newSaveOptions = saveOptionsDialog->documentSaveOptions (); #if DEBUG_KP_MAIN_WINDOW newSaveOptions.printDebug ("\tnewSaveOptions"); #endif @@ -919,7 +932,7 @@ bool shouldAllowOverwritePrompt = - (fd.selectedUrl () != QUrl (startURL) || + (fd.selectedUrls ().first ().toLocalFile() != QUrl (startURL).toLocalFile() || newSaveOptions.mimeType () != startSaveOptions.mimeType ()); if (allowOverwritePrompt) { @@ -944,12 +957,16 @@ qCDebug(kpLogMainWindow) << "\tallowLossyPrompt=" << *allowLossyPrompt; #endif } + if (!recentDirClass.isEmpty() && defaultURL.toLocalFile()!=fd.selectedUrls ().first ().toLocalFile ()) + { + KRecentDirs::add(recentDirClass, QFileInfo(fd.selectedUrls ().first ().toLocalFile ()).absolutePath ()); + } #if DEBUG_KP_MAIN_WINDOW - qCDebug(kpLogMainWindow) << "\tselectedUrl=" << fd.selectedUrl (); + qCDebug(kpLogMainWindow) << "\tselectedUrl=" << fd.selectedUrls ().at(0); #endif - return fd.selectedUrl (); + return fd.selectedUrls ().at(0); } else return QUrl (); @@ -959,7 +976,7 @@ //--------------------------------------------------------------------- // private slot -bool kpMainWindow::saveAs (bool localOnly) +bool kpMainWindow::saveAs () { kpDocumentSaveOptions chosenSaveOptions; bool allowOverwritePrompt, allowLossyPrompt; @@ -969,7 +986,6 @@ *d->document->saveOptions (), *d->document->metaInfo (), kpSettingsGroupFileSaveAs, - localOnly, &chosenSaveOptions, !d->document->savedAtLeastOnceBefore (), &allowOverwritePrompt, @@ -1018,7 +1034,6 @@ d->lastExportSaveOptions, *d->document->metaInfo (), kpSettingsGroupFileExport, - false/*allow remote files*/, &chosenSaveOptions, d->exportFirstTime, &allowOverwritePrompt,