Changeset View
Changeset View
Standalone View
Standalone View
document/kpDocument_Save.cpp
Show First 20 Lines • Show All 41 Lines • ▼ Show 20 Line(s) | |||||
42 | #include <QRect> | 42 | #include <QRect> | ||
43 | #include <QSaveFile> | 43 | #include <QSaveFile> | ||
44 | #include <QSize> | 44 | #include <QSize> | ||
45 | #include <QTemporaryFile> | 45 | #include <QTemporaryFile> | ||
46 | #include <QTransform> | 46 | #include <QTransform> | ||
47 | #include <QMimeDatabase> | 47 | #include <QMimeDatabase> | ||
48 | 48 | | |||
49 | #include "kpLogCategories.h" | 49 | #include "kpLogCategories.h" | ||
50 | #include <kimageio.h> // kdelibs4support | | |||
51 | #include <KJobWidgets> | 50 | #include <KJobWidgets> | ||
52 | #include <KIO/FileCopyJob> | 51 | #include <KIO/FileCopyJob> | ||
53 | #include <KLocalizedString> | 52 | #include <KLocalizedString> | ||
54 | #include <kmessagebox.h> | 53 | #include <kmessagebox.h> | ||
55 | 54 | | |||
56 | #include "imagelib/kpColor.h" | 55 | #include "imagelib/kpColor.h" | ||
57 | #include "widgets/toolbars/kpColorToolBar.h" | 56 | #include "widgets/toolbars/kpColorToolBar.h" | ||
58 | #include "kpDefs.h" | 57 | #include "kpDefs.h" | ||
▲ Show 20 Lines • Show All 109 Lines • ▼ Show 20 Line(s) | 163 | bool kpDocument::savePixmapToDevice (const QImage &image, | |||
168 | bool lossyPrompt, | 167 | bool lossyPrompt, | ||
169 | QWidget *parent, | 168 | QWidget *parent, | ||
170 | bool *userCancelled) | 169 | bool *userCancelled) | ||
171 | { | 170 | { | ||
172 | if (userCancelled) { | 171 | if (userCancelled) { | ||
173 | *userCancelled = false; | 172 | *userCancelled = false; | ||
174 | } | 173 | } | ||
175 | 174 | | |||
176 | QStringList types = KImageIO::typeForMime (saveOptions.mimeType ()); | 175 | QString type = QMimeDatabase().mimeTypeForName (saveOptions.mimeType ()).preferredSuffix (); | ||
177 | #if DEBUG_KP_DOCUMENT | | |||
178 | qCDebug(kpLogDocument) << "\ttypes=" << types; | | |||
179 | #endif | | |||
180 | if (types.isEmpty ()) { | | |||
181 | return false; | | |||
182 | } | | |||
183 | // It's safe to arbitrarily choose the 0th type as any type in the list | | |||
184 | // should invoke the same KImageIO image loader. | | |||
185 | const QString type = types [0]; | | |||
186 | | ||||
187 | #if DEBUG_KP_DOCUMENT | 176 | #if DEBUG_KP_DOCUMENT | ||
188 | qCDebug(kpLogDocument) << "\tmimeType=" << saveOptions.mimeType () | 177 | qCDebug(kpLogDocument) << "\tmimeType=" << saveOptions.mimeType () | ||
189 | << " type=" << type; | 178 | << " type=" << type; | ||
190 | #endif | 179 | #endif | ||
180 | if (type.isEmpty ()) { | ||||
181 | return false; | ||||
182 | } | ||||
191 | 183 | | |||
192 | if (lossyPrompt && !lossyPromptContinue (image, saveOptions, parent)) | 184 | if (lossyPrompt && !lossyPromptContinue (image, saveOptions, parent)) | ||
193 | { | 185 | { | ||
194 | if (userCancelled) { | 186 | if (userCancelled) { | ||
195 | *userCancelled = true; | 187 | *userCancelled = true; | ||
196 | } | 188 | } | ||
197 | 189 | | |||
198 | #if DEBUG_KP_DOCUMENT | 190 | #if DEBUG_KP_DOCUMENT | ||
▲ Show 20 Lines • Show All 291 Lines • Show Last 20 Lines |