Changeset View
Changeset View
Standalone View
Standalone View
part/arkviewer.cpp
Show All 18 Lines | |||||
19 | * | 19 | * | ||
20 | */ | 20 | */ | ||
21 | 21 | | |||
22 | #include "arkviewer.h" | 22 | #include "arkviewer.h" | ||
23 | #include "ark_debug.h" | 23 | #include "ark_debug.h" | ||
24 | 24 | | |||
25 | #include <KLocalizedString> | 25 | #include <KLocalizedString> | ||
26 | #include <KMimeTypeTrader> | 26 | #include <KMimeTypeTrader> | ||
27 | #include <KIconLoader> | | |||
28 | #include <KMessageBox> | 27 | #include <KMessageBox> | ||
29 | #include <KParts/ReadOnlyPart> | 28 | #include <KParts/ReadOnlyPart> | ||
30 | #include <KParts/OpenUrlArguments> | 29 | #include <KParts/OpenUrlArguments> | ||
31 | #include <KRun> | 30 | #include <KRun> | ||
32 | #include <KXMLGUIFactory> | 31 | #include <KXMLGUIFactory> | ||
33 | 32 | | |||
34 | #include <QFile> | 33 | #include <QFile> | ||
35 | #include <QMimeDatabase> | 34 | #include <QMimeDatabase> | ||
36 | #include <QProgressDialog> | 35 | #include <QProgressDialog> | ||
37 | #include <QPushButton> | 36 | #include <QPushButton> | ||
37 | #include <QStyle> | ||||
38 | 38 | | |||
39 | #include <algorithm> | 39 | #include <algorithm> | ||
40 | 40 | | |||
41 | ArkViewer::ArkViewer() | 41 | ArkViewer::ArkViewer() | ||
42 | : KParts::MainWindow() | 42 | : KParts::MainWindow() | ||
43 | { | 43 | { | ||
44 | setupUi(this); | 44 | setupUi(this); | ||
45 | 45 | | |||
▲ Show 20 Lines • Show All 121 Lines • ▼ Show 20 Line(s) | 83 | { | |||
167 | QFile::remove(fileName); | 167 | QFile::remove(fileName); | ||
168 | } | 168 | } | ||
169 | 169 | | |||
170 | bool ArkViewer::viewInInternalViewer(const QString& fileName, const QMimeType &mimeType) | 170 | bool ArkViewer::viewInInternalViewer(const QString& fileName, const QMimeType &mimeType) | ||
171 | { | 171 | { | ||
172 | setWindowFilePath(fileName); | 172 | setWindowFilePath(fileName); | ||
173 | 173 | | |||
174 | // Set icon and comment for the mimetype. | 174 | // Set icon and comment for the mimetype. | ||
175 | m_iconLabel->setPixmap(QIcon::fromTheme(mimeType.iconName()).pixmap(IconSize(KIconLoader::Small), IconSize(KIconLoader::Small))); | 175 | m_iconLabel->setPixmap(QIcon::fromTheme(mimeType.iconName()).pixmap(style()->pixelMetric(QStyle::PixelMetric::PM_SmallIconSize))); | ||
176 | m_commentLabel->setText(mimeType.comment()); | 176 | m_commentLabel->setText(mimeType.comment()); | ||
177 | 177 | | |||
178 | // Create the ReadOnlyPart instance. | 178 | // Create the ReadOnlyPart instance. | ||
179 | m_part = KMimeTypeTrader::self()->createPartInstanceFromQuery<KParts::ReadOnlyPart>(mimeType.name(), this, this); | 179 | m_part = KMimeTypeTrader::self()->createPartInstanceFromQuery<KParts::ReadOnlyPart>(mimeType.name(), this, this); | ||
180 | 180 | | |||
181 | // Drop the KHTMLPart, if necessary. | 181 | // Drop the KHTMLPart, if necessary. | ||
182 | const KService::Ptr service = KMimeTypeTrader::self()->preferredService(mimeType.name(), QStringLiteral("KParts/ReadOnlyPart")); | 182 | const KService::Ptr service = KMimeTypeTrader::self()->preferredService(mimeType.name(), QStringLiteral("KParts/ReadOnlyPart")); | ||
183 | qCDebug(ARK) << "Preferred service for mimetype" << mimeType.name() << "is" << service->library(); | 183 | qCDebug(ARK) << "Preferred service for mimetype" << mimeType.name() << "is" << service->library(); | ||
▲ Show 20 Lines • Show All 60 Lines • Show Last 20 Lines |