File fix_scan_dialog_bnc670968.diff of Package kdegraphics4
--- libs/libksane/libksane/ksane_viewer.cpp 2011/01/26 18:34:46 1217327
+++ libs/libksane/libksane/ksane_viewer.cpp 2011/01/26 18:36:15 1217328
@@ -934,6 +934,11 @@
}
}
+QSize KSaneViewer::sizeHint() const
+{
+ return QSize(250, 300); // a sensible size for a scan preview
+}
+
void KSaneViewer::refineSelections(int pixelMargin)
{
// The end result
--- libs/libksane/libksane/ksane_viewer.h 2011/01/26 18:34:46 1217327
+++ libs/libksane/libksane/ksane_viewer.h 2011/01/26 18:36:15 1217328
@@ -46,6 +46,8 @@
/** Find selections in the picture
* \param area this parameter determine the area of the reduced sized image. */
void findSelections(float area = 10000.0);
+
+ virtual QSize sizeHint() const;
public Q_SLOTS:
--- ksaneplugin/sanedialog.cpp 2011/01/28 20:44:55 1217819
+++ ksaneplugin/sanedialog.cpp 2011/01/28 21:42:52 1217820
@@ -29,6 +29,7 @@
#include <KDebug>
#include <KPluginLoader>
#include <KMessageBox>
+#include <KSharedConfig>
K_PLUGIN_FACTORY(SaneDialogFactory, registerPlugin<SaneDialog>();)
K_EXPORT_PLUGIN(SaneDialogFactory("ksaneplugin"))
@@ -71,12 +72,35 @@
openDev = QString();
return false;
}
+
+ // restore scan dialog size and all options for the selected device if available
+ KSharedConfigPtr configPtr = KSharedConfig::openConfig("scannersettings");
+ restoreDialogSize(KConfigGroup(configPtr, "ScanDialog"));
+ QString groupName = openDev;
+ if (configPtr->hasGroup(groupName)) {
+ KConfigGroup group(configPtr, groupName);
+ QStringList keys = group.keyList();
+ for (int i = 0; i < keys.count(); i++)
+ ksanew->setOptVal(keys[i], group.readEntry(keys[i]));
+ }
+
return true;
}
-
SaneDialog::~SaneDialog()
{
+ if (ksanew && !openDev.isEmpty()) {
+ // save scan dialog size and all options for the selected device if available
+ KSharedConfigPtr configPtr = KSharedConfig::openConfig("scannersettings");
+ KConfigGroup group(configPtr, "ScanDialog");
+ saveDialogSize(group, KConfigGroup::Persistent);
+ group = configPtr->group(openDev);
+ QMap<QString, QString> opts;
+ ksanew->getOptVals(opts);
+ QMap<QString, QString>::const_iterator i = opts.constBegin();
+ for (; i != opts.constEnd(); ++i)
+ group.writeEntry(i.key(), i.value(), KConfigGroup::Persistent);
+ }
}
void SaneDialog::imageReady(QByteArray &data, int w, int h, int bpl, int f)