mirror of
https://bitbucket.org/smil3y/kde-extraapps.git
synced 2025-02-23 18:32:53 +00:00
gwenview: drop the part
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
bc2a235c3b
commit
9b438b75d9
7 changed files with 0 additions and 369 deletions
|
@ -43,7 +43,6 @@ include_directories(
|
||||||
add_subdirectory(lib)
|
add_subdirectory(lib)
|
||||||
add_subdirectory(app)
|
add_subdirectory(app)
|
||||||
add_subdirectory(importer)
|
add_subdirectory(importer)
|
||||||
add_subdirectory(part)
|
|
||||||
if(ENABLE_TESTING)
|
if(ENABLE_TESTING)
|
||||||
add_subdirectory(tests)
|
add_subdirectory(tests)
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -103,8 +103,6 @@ struct AbstractImageViewPrivate
|
||||||
|
|
||||||
void setupZoomCursor()
|
void setupZoomCursor()
|
||||||
{
|
{
|
||||||
// We do not use "appdata" here because that does not work when this
|
|
||||||
// code is called from a KPart.
|
|
||||||
QString path = KStandardDirs::locate("data", "gwenview/cursors/zoom.png");
|
QString path = KStandardDirs::locate("data", "gwenview/cursors/zoom.png");
|
||||||
QPixmap cursorPixmap = QPixmap(path);
|
QPixmap cursorPixmap = QPixmap(path);
|
||||||
mZoomCursor = QCursor(cursorPixmap, 11, 11);
|
mZoomCursor = QCursor(cursorPixmap, 11, 11);
|
||||||
|
|
|
@ -1,24 +0,0 @@
|
||||||
include_directories(
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/..
|
|
||||||
)
|
|
||||||
|
|
||||||
set(gvpart_SRCS
|
|
||||||
gvpart.cpp
|
|
||||||
)
|
|
||||||
|
|
||||||
kde4_add_plugin(gvpart ${gvpart_SRCS})
|
|
||||||
|
|
||||||
target_link_libraries(gvpart KDE4::kparts gwenviewlib)
|
|
||||||
|
|
||||||
install(
|
|
||||||
TARGETS gvpart
|
|
||||||
DESTINATION ${KDE4_PLUGIN_INSTALL_DIR}
|
|
||||||
)
|
|
||||||
install(
|
|
||||||
FILES gvpart.desktop
|
|
||||||
DESTINATION ${KDE4_SERVICES_INSTALL_DIR}
|
|
||||||
)
|
|
||||||
install(
|
|
||||||
FILES gvpart.rc
|
|
||||||
DESTINATION ${KDE4_DATA_INSTALL_DIR}/gvpart
|
|
||||||
)
|
|
|
@ -1,187 +0,0 @@
|
||||||
/*
|
|
||||||
Gwenview: an image viewer
|
|
||||||
Copyright 2007-2012 Aurélien Gâteau <agateau@kde.org>
|
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU General Public License
|
|
||||||
as published by the Free Software Foundation; either version 2
|
|
||||||
of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
||||||
|
|
||||||
*/
|
|
||||||
#include "moc_gvpart.cpp"
|
|
||||||
|
|
||||||
// Qt
|
|
||||||
|
|
||||||
// KDE
|
|
||||||
#include <KAboutData>
|
|
||||||
#include <KAction>
|
|
||||||
#include <KActionCollection>
|
|
||||||
#include <KDebug>
|
|
||||||
#include <KFileDialog>
|
|
||||||
#include <KIcon>
|
|
||||||
#include <KIconLoader>
|
|
||||||
#include <KImageIO>
|
|
||||||
#include <KIO/Job>
|
|
||||||
#include <KIO/JobUiDelegate>
|
|
||||||
#include <KLocale>
|
|
||||||
#include <KMenu>
|
|
||||||
#include <KStandardAction>
|
|
||||||
#include <KPluginFactory>
|
|
||||||
#include <KPropertiesDialog>
|
|
||||||
|
|
||||||
// Local
|
|
||||||
#include "../lib/about.h"
|
|
||||||
#include "../lib/document/document.h"
|
|
||||||
#include "../lib/document/documentfactory.h"
|
|
||||||
#include "../lib/documentview/documentview.h"
|
|
||||||
#include "../lib/documentview/documentviewcontainer.h"
|
|
||||||
#include "../lib/documentview/documentviewcontroller.h"
|
|
||||||
#include "../lib/urlutils.h"
|
|
||||||
#include "../lib/zoomwidget.h"
|
|
||||||
|
|
||||||
//Factory Code
|
|
||||||
K_PLUGIN_FACTORY(GVPartFactory, registerPlugin<Gwenview::GVPart>();)
|
|
||||||
K_EXPORT_PLUGIN(GVPartFactory)
|
|
||||||
|
|
||||||
namespace Gwenview
|
|
||||||
{
|
|
||||||
|
|
||||||
GVPart::GVPart(QWidget* parentWidget, QObject* parent, const QVariantList& /*args*/)
|
|
||||||
: KParts::ReadOnlyPart(parent)
|
|
||||||
{
|
|
||||||
setObjectName(QString::fromLatin1("GVPart"));
|
|
||||||
|
|
||||||
KGlobal::locale()->insertCatalog("gwenview");
|
|
||||||
DocumentViewContainer* container = new DocumentViewContainer(parentWidget);
|
|
||||||
setWidget(container);
|
|
||||||
mDocumentView = container->createView();
|
|
||||||
|
|
||||||
connect(mDocumentView, SIGNAL(captionUpdateRequested(QString)),
|
|
||||||
SIGNAL(setWindowCaption(QString)));
|
|
||||||
connect(mDocumentView, SIGNAL(completed()),
|
|
||||||
SIGNAL(completed()));
|
|
||||||
|
|
||||||
connect(mDocumentView, SIGNAL(contextMenuRequested()),
|
|
||||||
SLOT(showContextMenu()));
|
|
||||||
|
|
||||||
// Necessary to have zoom actions
|
|
||||||
DocumentViewController* documentViewController = new DocumentViewController(actionCollection(), this);
|
|
||||||
documentViewController->setView(mDocumentView);
|
|
||||||
|
|
||||||
KAction* action = new KAction(actionCollection());
|
|
||||||
action->setText(i18nc("@action", "Properties"));
|
|
||||||
connect(action, SIGNAL(triggered()), SLOT(showProperties()));
|
|
||||||
actionCollection()->addAction("file_show_properties", action);
|
|
||||||
|
|
||||||
KStandardAction::saveAs(this, SLOT(saveAs()), actionCollection());
|
|
||||||
|
|
||||||
setXMLFile("gvpart/gvpart.rc");
|
|
||||||
}
|
|
||||||
|
|
||||||
void GVPart::showProperties()
|
|
||||||
{
|
|
||||||
KPropertiesDialog::showDialog(url(), widget());
|
|
||||||
}
|
|
||||||
|
|
||||||
bool GVPart::openFile()
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool GVPart::openUrl(const KUrl& url)
|
|
||||||
{
|
|
||||||
if (!url.isValid()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
setUrl(url);
|
|
||||||
Document::Ptr doc = DocumentFactory::instance()->load(url);
|
|
||||||
if (arguments().reload()) {
|
|
||||||
doc->reload();
|
|
||||||
}
|
|
||||||
if (!UrlUtils::urlIsFastLocalFile(url)) {
|
|
||||||
// Keep raw data of remote files to avoid downloading them again in
|
|
||||||
// saveAs()
|
|
||||||
doc->setKeepRawData(true);
|
|
||||||
}
|
|
||||||
DocumentView::Setup setup;
|
|
||||||
setup.zoomToFit = true;
|
|
||||||
mDocumentView->openUrl(url, setup);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
KAboutData* GVPart::createAboutData()
|
|
||||||
{
|
|
||||||
KAboutData* aboutData = Gwenview::createAboutData(
|
|
||||||
"gvpart", /* appname */
|
|
||||||
"gwenview", /* catalogName */
|
|
||||||
ki18n("Gwenview KPart") /* programName */
|
|
||||||
);
|
|
||||||
aboutData->setShortDescription(ki18n("An Image Viewer"));
|
|
||||||
return aboutData;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void addActionToMenu(KMenu* menu, KActionCollection* actionCollection, const char* name)
|
|
||||||
{
|
|
||||||
QAction* action = actionCollection->action(name);
|
|
||||||
if (action) {
|
|
||||||
menu->addAction(action);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void GVPart::showContextMenu()
|
|
||||||
{
|
|
||||||
KMenu menu(widget());
|
|
||||||
addActionToMenu(&menu, actionCollection(), "file_save_as");
|
|
||||||
menu.addSeparator();
|
|
||||||
addActionToMenu(&menu, actionCollection(), "view_actual_size");
|
|
||||||
addActionToMenu(&menu, actionCollection(), "view_zoom_to_fit");
|
|
||||||
addActionToMenu(&menu, actionCollection(), "view_zoom_in");
|
|
||||||
addActionToMenu(&menu, actionCollection(), "view_zoom_out");
|
|
||||||
menu.addSeparator();
|
|
||||||
addActionToMenu(&menu, actionCollection(), "file_show_properties");
|
|
||||||
menu.exec(QCursor::pos());
|
|
||||||
}
|
|
||||||
|
|
||||||
void GVPart::saveAs()
|
|
||||||
{
|
|
||||||
KUrl srcUrl = url();
|
|
||||||
KUrl dstUrl = KFileDialog::getSaveUrl(srcUrl.fileName(), KImageIO::pattern(KImageIO::Writing), widget());
|
|
||||||
if (!dstUrl.isValid()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
KIO::Job* job;
|
|
||||||
Document::Ptr doc = DocumentFactory::instance()->load(srcUrl);
|
|
||||||
QByteArray rawData = doc->rawData();
|
|
||||||
if (rawData.length() > 0) {
|
|
||||||
job = KIO::storedPut(rawData, dstUrl, -1);
|
|
||||||
} else {
|
|
||||||
job = KIO::file_copy(srcUrl, dstUrl);
|
|
||||||
}
|
|
||||||
connect(job, SIGNAL(result(KJob*)),
|
|
||||||
this, SLOT(showJobError(KJob*)));
|
|
||||||
}
|
|
||||||
|
|
||||||
void GVPart::showJobError(KJob* job)
|
|
||||||
{
|
|
||||||
if (job->error() != 0) {
|
|
||||||
KIO::JobUiDelegate* ui = static_cast<KIO::Job*>(job)->ui();
|
|
||||||
if (!ui) {
|
|
||||||
kError() << "Saving failed. job->ui() is null.";
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
ui->setWindow(widget());
|
|
||||||
ui->showErrorMessage();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace
|
|
|
@ -1,70 +0,0 @@
|
||||||
[Desktop Entry]
|
|
||||||
Type=Service
|
|
||||||
Name=Gwenview Image Viewer
|
|
||||||
Name[ar]=جوِينفيو مستعرض الصورة
|
|
||||||
Name[ast]=Visor d'imáxenes Gwenview
|
|
||||||
Name[bg]=Програма за снимки Gwenview
|
|
||||||
Name[bs]=Gvenview prikazivač slika
|
|
||||||
Name[ca]=Visualitzador d'imatges Gwenview
|
|
||||||
Name[ca@valencia]=Visualitzador d'imatges Gwenview
|
|
||||||
Name[cs]=Prohlížeč obrázků Gwenview
|
|
||||||
Name[da]=Gwenview billedfremviser
|
|
||||||
Name[de]=Gwenview Bildbetrachter
|
|
||||||
Name[el]=Προβολέας εικόνων Gwenview
|
|
||||||
Name[en_GB]=Gwenview Image Viewer
|
|
||||||
Name[eo]=Gwenview bildorigardilo
|
|
||||||
Name[es]=Visor de imágenes Gwenview
|
|
||||||
Name[et]=Gwenview pildinäitaja
|
|
||||||
Name[eu]=Gwenview irudi ikustailea
|
|
||||||
Name[fa]=مشاهدهگر تصویر Gwenview
|
|
||||||
Name[fi]=Gwenview-kuvankatselin
|
|
||||||
Name[fr]=Afficheur d'images Gwenview
|
|
||||||
Name[ga]=Amharcán Íomhánna Gwenview
|
|
||||||
Name[gl]=Visor de imaxes Gwenview
|
|
||||||
Name[hi]=ग्वेन-व्यू छवि प्रदर्शक
|
|
||||||
Name[hne]=ग्वेन-व्यू फोटू प्रदर्सक
|
|
||||||
Name[hr]=Preglednik slika Gwenview
|
|
||||||
Name[hu]=Gwenview képnézegető
|
|
||||||
Name[ia]=Visor de imagine Gwenview
|
|
||||||
Name[is]=Gwenview myndskoðari
|
|
||||||
Name[it]=Visore di immagini Gwenview
|
|
||||||
Name[ja]=Gwenview 画像ビューア
|
|
||||||
Name[kk]=Gwenview кескінді қарау құралы
|
|
||||||
Name[km]=កម្មវិធីមើលរូបភាពរបស់ Gwenview
|
|
||||||
Name[ko]=Gwenview 그림 뷰어
|
|
||||||
Name[ku]=Gwenview Nîşanderê Wêneyan
|
|
||||||
Name[lt]=Gwenview paveikslėlių žiūryklė
|
|
||||||
Name[lv]=Gwenview attēlu skatītājs
|
|
||||||
Name[mr]=ग्वेनव्यु प्रतिमा प्रदर्शक
|
|
||||||
Name[nb]=Bildeviseren Gwenview
|
|
||||||
Name[nds]=Bildkieker Gwenview
|
|
||||||
Name[ne]=जीवेनभ्यू छवि दर्शक
|
|
||||||
Name[nl]=GWenview Afbeeldingenviewer
|
|
||||||
Name[nn]=Gwenview biletvisar
|
|
||||||
Name[pa]=ਜੀਵੀਨ-ਵਿਊ ਚਿੱਤਰ ਦਰਸ਼ਕ
|
|
||||||
Name[pl]=Przeglądarka obrazów Gwenview
|
|
||||||
Name[pt]=Visualizador de Imagens Gwenview
|
|
||||||
Name[pt_BR]=Visualizador de imagens do Gwenview
|
|
||||||
Name[ro]=Vizualizator de imagini KView
|
|
||||||
Name[ru]=Просмотр изображений в Gwenview
|
|
||||||
Name[si]=Gwenview පිංතූර දසුන
|
|
||||||
Name[sk]=Prehliadač obrázkov Gwenview
|
|
||||||
Name[sl]=Pregledovalnik slik Gwenview
|
|
||||||
Name[sr]=Гвенвју приказивач слика
|
|
||||||
Name[sr@ijekavian]=Гвенвју приказивач слика
|
|
||||||
Name[sr@ijekavianlatin]=GwenView prikazivač slika
|
|
||||||
Name[sr@latin]=GwenView prikazivač slika
|
|
||||||
Name[sv]=Gwenview bildvisare
|
|
||||||
Name[th]=เกวนวิว - เครื่องมือแสดงภาพ
|
|
||||||
Name[tr]=Gwenview Resim Gösterici
|
|
||||||
Name[ug]=Gwenview سۈرەت كۆرگۈ
|
|
||||||
Name[uk]=Переглядач зображень Gwenview
|
|
||||||
Name[vi]=Bộ xem ảnh Gwenview
|
|
||||||
Name[x-test]=xxGwenview Image Viewerxx
|
|
||||||
Name[zh_CN]=Gwenview 图像查看器
|
|
||||||
Name[zh_TW]=Gwenview 影像檢視程式
|
|
||||||
MimeType=image/png;image/jpeg;image/x-ico;image/x-portable-pixmap;image/x-xpixmap;image/x-webp;image/webp;image/svg+xml;image/svg+xml-compressed;image/x-dcraw;image/tiff;image/jp2;image/x-jp2-codestream;image/jpx;image/katie
|
|
||||||
X-KDE-ServiceTypes=KParts/ReadOnlyPart
|
|
||||||
X-KDE-Library=gvpart
|
|
||||||
InitialPreference=12
|
|
||||||
Icon=gwenview
|
|
|
@ -1,63 +0,0 @@
|
||||||
/*
|
|
||||||
Gwenview: an image viewer
|
|
||||||
Copyright 2007 Aurélien Gâteau <agateau@kde.org>
|
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU General Public License
|
|
||||||
as published by the Free Software Foundation; either version 2
|
|
||||||
of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
||||||
|
|
||||||
*/
|
|
||||||
#ifndef GVPART_H
|
|
||||||
#define GVPART_H
|
|
||||||
|
|
||||||
// Qt
|
|
||||||
#include <QPoint>
|
|
||||||
|
|
||||||
// KDE
|
|
||||||
#include <KParts/Part>
|
|
||||||
|
|
||||||
// Local
|
|
||||||
#include <lib/document/document.h>
|
|
||||||
|
|
||||||
class KAboutData;
|
|
||||||
|
|
||||||
namespace Gwenview
|
|
||||||
{
|
|
||||||
|
|
||||||
class DocumentView;
|
|
||||||
|
|
||||||
class GVPart : public KParts::ReadOnlyPart
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
GVPart(QWidget* parentWidget, QObject* parent, const QVariantList&);
|
|
||||||
|
|
||||||
static KAboutData* createAboutData();
|
|
||||||
|
|
||||||
protected:
|
|
||||||
virtual bool openFile();
|
|
||||||
virtual bool openUrl(const KUrl&);
|
|
||||||
|
|
||||||
private Q_SLOTS:
|
|
||||||
void showContextMenu();
|
|
||||||
void showProperties();
|
|
||||||
void saveAs();
|
|
||||||
void showJobError(KJob*);
|
|
||||||
|
|
||||||
private:
|
|
||||||
DocumentView* mDocumentView;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace
|
|
||||||
|
|
||||||
#endif /* GVPART_H */
|
|
|
@ -1,22 +0,0 @@
|
||||||
<!DOCTYPE kpartgui>
|
|
||||||
<kpartgui name="GVPart" version="5">
|
|
||||||
<MenuBar>
|
|
||||||
<Menu name="file"><text>&File</text>
|
|
||||||
<Action name="file_save_as"/>
|
|
||||||
<Action name="file_show_properties"/>
|
|
||||||
</Menu>
|
|
||||||
<Menu name="view"><text>&View</text>
|
|
||||||
<Action name="view_actual_size"/>
|
|
||||||
<Action name="view_zoom_to_fit"/>
|
|
||||||
<Action name="view_zoom_in"/>
|
|
||||||
<Action name="view_zoom_out"/>
|
|
||||||
</Menu>
|
|
||||||
</MenuBar>
|
|
||||||
<ToolBar name="mainToolBar"><text>Main Toolbar</text>
|
|
||||||
<Action name="view_actual_size"/>
|
|
||||||
<Action name="view_zoom_to_fit"/>
|
|
||||||
<Action name="view_zoom_in"/>
|
|
||||||
<Action name="view_zoom_out"/>
|
|
||||||
</ToolBar>
|
|
||||||
</kpartgui>
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue