summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuigi Toscano <[email protected]>2017-08-03 01:30:15 +0200
committerLuigi Toscano <[email protected]>2017-08-03 01:30:15 +0200
commit75275cbcaf9a7a1308f4b62db1a02f3a766816a1 (patch)
tree413f02b8a88aad2af457cc71bc06a6de05d07580
parent0f17b66f1bde26378c79d922256b79aaeec71639 (diff)
Initial port to KF5
Mostly through the scripts from kde-dev-scripts/kf5 and few fixes to make it compile. It starts and basic operations are working (load files, create shapes, edit shapes, save HTML) but there is at least one piece of commented code that needs a proper port and in general more cleanup.
-rw-r--r--CMakeLists.txt61
-rw-r--r--arealistview.cpp6
-rw-r--r--doc/CMakeLists.txt2
-rw-r--r--drawzone.cpp15
-rw-r--r--drawzone.h2
-rw-r--r--imagemap.h2
-rw-r--r--imageslistview.cpp6
-rw-r--r--kimagemapeditor.cpp128
-rw-r--r--kimagemapeditor.h89
-rw-r--r--kimearea.h7
-rw-r--r--kimecommands.cpp2
-rw-r--r--kimecommands.h2
-rw-r--r--kimedialogs.cpp12
-rw-r--r--kimedialogs.h3
-rw-r--r--kimeshell.cpp17
-rw-r--r--kimeshell.h2
-rw-r--r--main.cpp69
-rw-r--r--mapslistview.cpp4
-rw-r--r--pics/16-apps-kimagemapeditor.png (renamed from pics/hi16-app-kimagemapeditor.png)bin730 -> 730 bytes
-rw-r--r--pics/22-actions-addpoint.png (renamed from pics/hi22-action-addpoint.png)bin424 -> 424 bytes
-rw-r--r--pics/22-actions-arrow.png (renamed from pics/hi22-action-arrow.png)bin402 -> 402 bytes
-rw-r--r--pics/22-actions-circle.png (renamed from pics/hi22-action-circle.png)bin476 -> 476 bytes
-rw-r--r--pics/22-actions-circle2.png (renamed from pics/hi22-action-circle2.png)bin482 -> 482 bytes
-rw-r--r--pics/22-actions-freehand.png (renamed from pics/hi22-action-freehand.png)bin447 -> 447 bytes
-rw-r--r--pics/22-actions-lower.png (renamed from pics/hi22-action-lower.png)bin322 -> 322 bytes
-rw-r--r--pics/22-actions-polygon.png (renamed from pics/hi22-action-polygon.png)bin414 -> 414 bytes
-rw-r--r--pics/22-actions-raise.png (renamed from pics/hi22-action-raise.png)bin323 -> 323 bytes
-rw-r--r--pics/22-actions-rectangle.png (renamed from pics/hi22-action-rectangle.png)bin333 -> 333 bytes
-rw-r--r--pics/22-actions-removepoint.png (renamed from pics/hi22-action-removepoint.png)bin393 -> 393 bytes
-rw-r--r--pics/32-apps-kimagemapeditor.png (renamed from pics/hi32-app-kimagemapeditor.png)bin2669 -> 2669 bytes
-rw-r--r--pics/48-apps-kimagemapeditor.png (renamed from pics/hi48-app-kimagemapeditor.png)bin4397 -> 4397 bytes
-rw-r--r--pics/CMakeLists.txt18
32 files changed, 237 insertions, 210 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7379a7d..714d078 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,14 +1,43 @@
project(kimagemapeditor)
-find_package(KDE4 REQUIRED)
-include (KDE4Defaults)
-include (MacroLibrary)
-
-add_definitions( ${QT_QTDBUS_DEFINITIONS} ${QT_DEFINITIONS} ${KDE4_DEFINITIONS})
-include_directories (${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${KDE4_INCLUDES})
+cmake_minimum_required (VERSION 2.8.12 FATAL_ERROR)
+set (QT_MIN_VERSION "5.7.0")
+set (KF5_MIN_VERSION "5.15.0")
+
+find_package(ECM ${KF5_MIN_VERSION} REQUIRED CONFIG)
+set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})
+
+find_package(Qt5 ${QT_MIN_VERSION} REQUIRED NO_MODULE COMPONENTS
+ Gui
+ Widgets
+)
+find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS
+ Config
+ ConfigWidgets
+ CoreAddons
+ Crash
+ DBusAddons
+ DocTools
+ GuiAddons
+ KHtml
+ Parts
+ I18n
+ WidgetsAddons
+ XmlGui
+ KDELibs4Support
+)
+
+include(FeatureSummary)
+include(ECMInstallIcons)
+include(KDEInstallDirs)
+include(KDECompilerSettings NO_POLICY_SCOPE)
+include(KDECMakeSettings)
+include(ECMOptionalAddSubdirectory)
+
+include_directories (${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} )
add_subdirectory( pics )
-macro_optional_add_subdirectory(doc)
+ecm_optional_add_subdirectory(doc)
set(libkimagemapeditorcommon_SRC
areacreator.cpp
@@ -21,7 +50,7 @@ set(libkimagemapeditorcommon_SRC
imageslistview.cpp
mapslistview.cpp
imagemapchoosedialog.cpp
- )
+)
########### next target ###############
@@ -29,11 +58,11 @@ set(libkimagemapeditorcommon_SRC
set(kimagemapeditor_bin_SRCS main.cpp kimeshell.cpp ${libkimagemapeditorcommon_SRC})
-kde4_add_executable(kimagemapeditor_bin ${kimagemapeditor_bin_SRCS})
+add_executable(kimagemapeditor_bin ${kimagemapeditor_bin_SRCS})
set_target_properties(kimagemapeditor_bin PROPERTIES OUTPUT_NAME kimagemapeditor)
-target_link_libraries(kimagemapeditor_bin ${KDE4_KHTML_LIBS} )
+target_link_libraries(kimagemapeditor_bin KF5::KHtml KF5::KDELibs4Support)
install(TARGETS kimagemapeditor_bin ${INSTALL_TARGETS_DEFAULT_ARGS} )
@@ -43,11 +72,10 @@ install(TARGETS kimagemapeditor_bin ${INSTALL_TARGETS_DEFAULT_ARGS} )
set(kimagemapeditor_PART_SRCS ${libkimagemapeditorcommon_SRC})
-kde4_add_plugin(kimagemapeditor WITH_PREFIX ${kimagemapeditor_PART_SRCS})
-
+add_library(kimagemapeditor MODULE ${kimagemapeditor_PART_SRCS})
-target_link_libraries(kimagemapeditor ${KDE4_KHTML_LIBS} )
+target_link_libraries(kimagemapeditor KF5::KHtml KF5::KDELibs4Support)
install(TARGETS kimagemapeditor DESTINATION ${PLUGIN_INSTALL_DIR})
@@ -57,7 +85,8 @@ install(TARGETS kimagemapeditor DESTINATION ${PLUGIN_INSTALL_DIR})
########### install files ###############
-install( FILES org.kde.kimagemapeditor.desktop DESTINATION ${XDG_APPS_INSTALL_DIR})
-install( FILES kimagemapeditorpart.desktop DESTINATION ${SERVICES_INSTALL_DIR})
-install( FILES kimagemapeditorui.rc kimagemapeditorpartui.rc DESTINATION ${DATA_INSTALL_DIR}/kimagemapeditor)
+install( FILES org.kde.kimagemapeditor.desktop DESTINATION ${KDE_INSTALL_APPDIR})
+install( FILES kimagemapeditorpart.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR})
+install( FILES kimagemapeditorui.rc kimagemapeditorpartui.rc DESTINATION ${KDE_INSTALL_KXMLGUI5DIR}/kimagemapeditor)
+feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)
diff --git a/arealistview.cpp b/arealistview.cpp
index 39df5f0..ec66ef3 100644
--- a/arealistview.cpp
+++ b/arealistview.cpp
@@ -15,16 +15,16 @@
* *
***************************************************************************/
-// QT
+// Qt
#include <QTreeWidget>
#include <qpushbutton.h>
#include <qtooltip.h>
-// KDE
+// KDE Frameworks
#include <kiconloader.h>
-#include <klocale.h>
+#include <klocalizedstring.h>
#include <kvbox.h>
// local
diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt
index 42c8994..ffc009c 100644
--- a/doc/CMakeLists.txt
+++ b/doc/CMakeLists.txt
@@ -1 +1 @@
-kde4_create_handbook(index.docbook INSTALL_DESTINATION ${HTML_INSTALL_DIR}/en SUBDIR kimagemapeditor)
+kdoctools_create_handbook(index.docbook INSTALL_DESTINATION ${KDE_INSTALL_DOCBUNDLEDIR}/en SUBDIR kimagemapeditor)
diff --git a/drawzone.cpp b/drawzone.cpp
index eecd454..c0bf76f 100644
--- a/drawzone.cpp
+++ b/drawzone.cpp
@@ -15,7 +15,7 @@
* *
***************************************************************************/
-// QT
+// Qt
#include <qbitmap.h>
#include <qpainter.h>
#include <qpixmap.h>
@@ -25,13 +25,14 @@
#include <QDragEnterEvent>
#include <QMouseEvent>
-// KDE
+// KDE Frameworks
#include <kdebug.h>
#include <kglobal.h>
-#include <kstandarddirs.h>
+
#include <kapplication.h>
#include <kmimetype.h>
#include <kundostack.h>
+#include <QStandardPaths>
// Local
#include "drawzone.h"
@@ -67,16 +68,16 @@ DrawZone::DrawZone(QWidget *parent,KImageMapEditor* _imageMapEditor)
rectangleCursor = createRectangleCursor();
circleCursor = createCircleCursor();
- QString path = KGlobal::dirs()->findResource( "data", "kimagemapeditor/polygoncursor.png" );
+ QString path = QStandardPaths::locate(QStandardPaths::GenericDataLocation, "kimagemapeditor/polygoncursor.png" );
polygonCursor = QCursor(QPixmap(path),8,8);
- path = KGlobal::dirs()->findResource( "data", "kimagemapeditor/freehandcursor.png" );
+ path = QStandardPaths::locate(QStandardPaths::GenericDataLocation, "kimagemapeditor/freehandcursor.png" );
freehandCursor = QCursor(QPixmap(path),8,8);
- path = KGlobal::dirs()->findResource( "data", "kimagemapeditor/addpointcursor.png" );
+ path = QStandardPaths::locate(QStandardPaths::GenericDataLocation, "kimagemapeditor/addpointcursor.png" );
addPointCursor = QCursor(QPixmap(path),8,8);
- path = KGlobal::dirs()->findResource( "data", "kimagemapeditor/removepointcursor.png" );
+ path = QStandardPaths::locate(QStandardPaths::GenericDataLocation, "kimagemapeditor/removepointcursor.png" );
removePointCursor = QCursor(QPixmap(path),8,8);
}
diff --git a/drawzone.h b/drawzone.h
index 89b4093..cdbdfe6 100644
--- a/drawzone.h
+++ b/drawzone.h
@@ -29,8 +29,6 @@
#include <QResizeEvent>
#include <QDropEvent>
-#include "kdeversion.h"
-
#include "kimagemapeditor.h"
class Area;
diff --git a/imagemap.h b/imagemap.h
index c64bc12..cbd0127 100644
--- a/imagemap.h
+++ b/imagemap.h
@@ -27,8 +27,6 @@
#include <QMouseEvent>
#include <QResizeEvent>
-#include "kdeversion.h"
-
/**
*@author Jan Schäfer
*/
diff --git a/imageslistview.cpp b/imageslistview.cpp
index f3744a9..673e4ea 100644
--- a/imageslistview.cpp
+++ b/imageslistview.cpp
@@ -15,12 +15,12 @@
* *
***************************************************************************/
-// QT
+// Qt
#include <QLinkedList>
-// KDE
-#include <klocale.h>
+// KDE Frameworks
+#include <klocalizedstring.h>
#include <kdebug.h>
// locale
diff --git a/kimagemapeditor.cpp b/kimagemapeditor.cpp
index d628998..6d715b8 100644
--- a/kimagemapeditor.cpp
+++ b/kimagemapeditor.cpp
@@ -18,33 +18,35 @@
#include <iostream>
#include <assert.h>
-// QT
-#include <QScrollArea>
-
+// Qt
+#include <QAction>
#include <qlayout.h>
-#include <QListWidget>
#include <qpushbutton.h>
-#include <qpixmap.h>
#include <qcombobox.h>
-#include <qsplitter.h>
+#include <qfontdatabase.h>
+#include <qfile.h>
#include <qfileinfo.h>
-#include <qtextstream.h>
+#include <QLinkedList>
+#include <QListWidget>
#include <QMenu>
-#include <qtooltip.h>
+#include <qpixmap.h>
#include <qpainter.h>
+#include <QScrollArea>
+#include <qsplitter.h>
+#include <QStandardPaths>
#include <qtabwidget.h>
-#include <qfontdatabase.h>
-#include <qfile.h>
-#include <QLinkedList>
+#include <QTextEdit>
+#include <qtextstream.h>
+#include <qtooltip.h>
-// KDE
+// KDE Frameworks
#include <kundostack.h>
#include <kdebug.h>
-#include <klocale.h>
-#include <kaction.h>
+#include <klocalizedstring.h>
#include <kstandardaction.h>
#include <kiconloader.h>
#include <kfiledialog.h>
+#include <kicon.h>
#include <kmessagebox.h>
#include <kapplication.h>
#include <kedittoolbar.h>
@@ -58,34 +60,34 @@
#include <ktoggleaction.h>
#include <krecentfilesaction.h>
#include <kxmlguiwindow.h>
+#include <KGenericFactory>
+#include <KSharedConfig>
// local
#include "kimagemapeditor.h"
#include "kimagemapeditor.moc"
#include "drawzone.h"
#include "kimedialogs.h"
#include "kimecommands.h"
-#include <kicon.h>
#include "areacreator.h"
#include "arealistview.h"
#include "imageslistview.h"
#include "mapslistview.h"
#include "kimecommon.h"
#include "imagemapchoosedialog.h"
+#include "version.h"
-#include <QTextEdit>
-
-#include <kparts/genericfactory.h>
-#include <kcomponentdata.h>
-
-// Factory code for KDE 3
-typedef KParts::GenericFactory<KImageMapEditor> KimeFactory;
+typedef KGenericFactory<KImageMapEditor> KimeFactory;
K_EXPORT_COMPONENT_FACTORY( libkimagemapeditor , KimeFactory )
KImageMapEditor::KImageMapEditor(QWidget *parentWidget,
QObject *parent, const QStringList & )
: KParts::ReadWritePart(parent)
{
- setComponentData( KimeFactory::componentData() );
+ KAboutData aboutData( "kimagemapeditor", i18n("KImageMapEditor"),
+ KIMAGEMAPEDITOR_VERSION, i18n( "An HTML imagemap editor" ),
+ KAboutLicense::GPL,
+ i18n("(c) 2001-2003 Jan Sch&auml;fer <email>[email protected]</email>"));
+ setComponentData(aboutData, false);
// KDockMainWindow* mainWidget;
@@ -249,17 +251,6 @@ void KImageMapEditor::init()
setImageActionsEnabled(false);
}
-KAboutData* KImageMapEditor::createAboutData()
-{
- KAboutData* aboutData =
- new KAboutData( "kimagemapeditor", 0, ki18n("KImageMapEditor"),
- "1.0", ki18n( "An HTML imagemap editor" ),
- KAboutData::License_GPL,
- ki18n("(c) 2001-2003 Jan Sch&auml;fer <email>[email protected]</email>"));
- return aboutData;
-}
-
-
void KImageMapEditor::setReadWrite(bool)
{
@@ -337,8 +328,11 @@ void KImageMapEditor::setModified(bool modified)
KConfig *KImageMapEditor::config()
{
+ /* TODO KF5
KSharedConfigPtr tmp = KimeFactory::componentData().config();
return tmp.data();
+ */
+ return new KConfig();
}
void KImageMapEditor::readConfig(const KConfigGroup &config) {
@@ -447,7 +441,7 @@ void KImageMapEditor::setupActions()
temp->setToolTip(i18n("Open new picture or HTML file"));
// File Open Recent
- recentFilesAction = KStandardAction::openRecent(this, SLOT(openURL(const KUrl&)),
+ recentFilesAction = KStandardAction::openRecent(this, SLOT(openURL(const QUrl&)),
actionCollection());
// File Save
temp =KStandardAction::save(this, SLOT(fileSave()), actionCollection());
@@ -483,7 +477,7 @@ void KImageMapEditor::setupActions()
// Edit Delete
- deleteAction = new KAction(KIcon("edit-delete"),
+ deleteAction = new QAction(KIcon("edit-delete"),
i18n("&Delete"), this);
actionCollection()->addAction("edit_delete", deleteAction );
connect(deleteAction, SIGNAL(triggered(bool) ), SLOT (slotDelete()));
@@ -498,7 +492,7 @@ void KImageMapEditor::setupActions()
_commandHistory->createRedoAction(actionCollection());
// Edit Properties
- areaPropertiesAction = new KAction(i18n("Pr&operties"), this);
+ areaPropertiesAction = new QAction(i18n("Pr&operties"), this);
actionCollection()->addAction("edit_properties", areaPropertiesAction );
connect(areaPropertiesAction, SIGNAL(triggered(bool)), SLOT(showTagEditor()));
areaPropertiesAction->setEnabled(false);
@@ -538,26 +532,26 @@ void KImageMapEditor::setupActions()
showAltAction->setText(i18n("Show Alt Tag"));
connect(showAltAction, SIGNAL(toggled(bool)),this, SLOT (slotShowAltTag(bool)));
- mapNameAction = new KAction(i18n("Map &Name..."), this);
+ mapNameAction = new QAction(i18n("Map &Name..."), this);
actionCollection()->addAction("map_name", mapNameAction );
connect(mapNameAction, SIGNAL(triggered(bool)), SLOT(mapEditName()));
- mapNewAction = new KAction(i18n("Ne&w Map..."), this);
+ mapNewAction = new QAction(i18n("Ne&w Map..."), this);
actionCollection()->addAction("map_new", mapNewAction );
connect(mapNewAction, SIGNAL(triggered(bool)), SLOT(mapNew()));
mapNewAction->setToolTip(i18n("Create a new map"));
- mapDeleteAction = new KAction(i18n("D&elete Map"), this);
+ mapDeleteAction = new QAction(i18n("D&elete Map"), this);
actionCollection()->addAction("map_delete", mapDeleteAction );
connect(mapDeleteAction, SIGNAL(triggered(bool)), SLOT(mapDelete()));
mapDeleteAction->setToolTip(i18n("Delete the current active map"));
- mapDefaultAreaAction = new KAction(i18n("Edit &Default Area..."), this);
+ mapDefaultAreaAction = new QAction(i18n("Edit &Default Area..."), this);
actionCollection()->addAction("map_defaultarea", mapDefaultAreaAction );
connect(mapDefaultAreaAction, SIGNAL(triggered(bool)), SLOT(mapDefaultArea()));
mapDefaultAreaAction->setToolTip(i18n("Edit the default area of the current active map"));
- temp = new KAction(i18n("&Preview"), this);
+ temp = new QAction(i18n("&Preview"), this);
actionCollection()->addAction("map_preview", temp );
connect(temp, SIGNAL(triggered(bool)), SLOT(mapPreview()));
temp->setToolTip(i18n("Show a preview"));
@@ -565,22 +559,22 @@ void KImageMapEditor::setupActions()
// IMAGE
i18n("&Image");
- imageAddAction = new KAction(i18n("Add Image..."), this);
+ imageAddAction = new QAction(i18n("Add Image..."), this);
actionCollection()->addAction("image_add", imageAddAction );
connect(imageAddAction, SIGNAL(triggered(bool)), SLOT(imageAdd()));
imageAddAction->setToolTip(i18n("Add a new image"));
- imageRemoveAction = new KAction(i18n("Remove Image"), this);
+ imageRemoveAction = new QAction(i18n("Remove Image"), this);
actionCollection()->addAction("image_remove", imageRemoveAction );
connect(imageRemoveAction, SIGNAL(triggered(bool)), SLOT(imageRemove()));
imageRemoveAction->setToolTip(i18n("Remove the current visible image"));
- imageUsemapAction = new KAction(i18n("Edit Usemap..."), this);
+ imageUsemapAction = new QAction(i18n("Edit Usemap..."), this);
actionCollection()->addAction("image_usemap", imageUsemapAction );
connect(imageUsemapAction, SIGNAL(triggered(bool)), SLOT(imageUsemap()));
imageUsemapAction->setToolTip(i18n("Edit the usemap tag of the current visible image"));
- temp = new KAction(i18n("Show &HTML"), this);
+ temp = new QAction(i18n("Show &HTML"), this);
actionCollection()->addAction("map_showhtml", temp );
connect(temp, SIGNAL(triggered(bool)), SLOT(mapShowHTML()));
@@ -652,64 +646,64 @@ void KImageMapEditor::setupActions()
"Click this to remove points from a polygon."));
drawingGroup->addAction(removePointAction);
- KAction *action = new KAction(i18n("Cancel Drawing"), this);
+ QAction *action = new QAction(i18n("Cancel Drawing"), this);
actionCollection()->addAction("canceldrawing", action );
connect(action, SIGNAL(triggered(bool)), SLOT( slotCancelDrawing() ));
action->setShortcut(QKeySequence(Qt::Key_Escape));
- moveLeftAction = new KAction(i18n("Move Left"), this);
+ moveLeftAction = new QAction(i18n("Move Left"), this);
actionCollection()->addAction("moveleft", moveLeftAction );
connect(moveLeftAction, SIGNAL(triggered(bool)),
SLOT( slotMoveLeft() ));
- moveLeftAction->setShortcut(KShortcut(QKeySequence(Qt::Key_Left)));
+ moveLeftAction->setShortcut(QKeySequence(Qt::Key_Left));
- moveRightAction = new KAction(i18n("Move Right"), this);
+ moveRightAction = new QAction(i18n("Move Right"), this);
actionCollection()->addAction("moveright", moveRightAction );
connect(moveRightAction, SIGNAL(triggered(bool)), SLOT( slotMoveRight() ));
moveRightAction->setShortcut(QKeySequence(Qt::Key_Right));
- moveUpAction = new KAction(i18n("Move Up"), this);
+ moveUpAction = new QAction(i18n("Move Up"), this);
actionCollection()->addAction("moveup", moveUpAction );
connect(moveUpAction, SIGNAL(triggered(bool)), SLOT( slotMoveUp() ));
moveUpAction->setShortcut(QKeySequence(Qt::Key_Up));
- moveDownAction = new KAction(i18n("Move Down"), this);
+ moveDownAction = new QAction(i18n("Move Down"), this);
actionCollection()->addAction("movedown", moveDownAction );
connect(moveDownAction, SIGNAL(triggered(bool)), SLOT( slotMoveDown() ));
moveDownAction->setShortcut(QKeySequence(Qt::Key_Down));
- increaseWidthAction = new KAction(i18n("Increase Width"), this);
+ increaseWidthAction = new QAction(i18n("Increase Width"), this);
actionCollection()->addAction("increasewidth", increaseWidthAction );
connect(increaseWidthAction, SIGNAL(triggered(bool)), SLOT( slotIncreaseWidth() ));
increaseWidthAction->setShortcut(QKeySequence(Qt::Key_Right + Qt::SHIFT));
- decreaseWidthAction = new KAction(i18n("Decrease Width"), this);
+ decreaseWidthAction = new QAction(i18n("Decrease Width"), this);
actionCollection()->addAction("decreasewidth", decreaseWidthAction );
connect(decreaseWidthAction, SIGNAL(triggered(bool)), SLOT( slotDecreaseWidth() ));
decreaseWidthAction->setShortcut(QKeySequence(Qt::Key_Left + Qt::SHIFT));
- increaseHeightAction = new KAction(i18n("Increase Height"), this);
+ increaseHeightAction = new QAction(i18n("Increase Height"), this);
actionCollection()->addAction("increaseheight", increaseHeightAction );
connect(increaseHeightAction, SIGNAL(triggered(bool)), SLOT( slotIncreaseHeight() ));
increaseHeightAction->setShortcut(QKeySequence(Qt::Key_Up + Qt::SHIFT));
- decreaseHeightAction = new KAction(i18n("Decrease Height"), this);
+ decreaseHeightAction = new QAction(i18n("Decrease Height"), this);
actionCollection()->addAction("decreaseheight", decreaseHeightAction );
connect(decreaseHeightAction, SIGNAL(triggered(bool)), SLOT( slotDecreaseHeight() ));
decreaseHeightAction->setShortcut(QKeySequence(Qt::Key_Down + Qt::SHIFT));
- toFrontAction = new KAction(i18n("Bring to Front"), this);
+ toFrontAction = new QAction(i18n("Bring to Front"), this);
actionCollection()->addAction("tofront", toFrontAction );
connect(toFrontAction, SIGNAL(triggered(bool)), SLOT( slotToFront() ));
- toBackAction = new KAction(i18n("Send to Back"), this);
+ toBackAction = new QAction(i18n("Send to Back"), this);
actionCollection()->addAction("toback", toBackAction );
connect(toBackAction, SIGNAL(triggered(bool)), SLOT( slotToBack() ));
- forwardOneAction = new KAction(KIcon("raise"), i18n("Bring Forward One"), this);
+ forwardOneAction = new QAction(KIcon("raise"), i18n("Bring Forward One"), this);
actionCollection()->addAction("forwardone", forwardOneAction );
connect(forwardOneAction, SIGNAL(triggered(bool) ), SLOT( slotForwardOne() ));
- backOneAction = new KAction(KIcon("lower"), i18n("Send Back One"), this);
+ backOneAction = new QAction(KIcon("lower"), i18n("Send Back One"), this);
actionCollection()->addAction("backone", backOneAction );
connect(backOneAction, SIGNAL(triggered(bool) ), SLOT( slotBackOne() ));
@@ -719,7 +713,7 @@ void KImageMapEditor::setupActions()
connect( areaListView->upBtn, SIGNAL(pressed()), forwardOneAction, SLOT(trigger()));
connect( areaListView->downBtn, SIGNAL(pressed()), backOneAction, SLOT(trigger()));
- action = new KAction(KIcon("configure"), i18n("Configure KImageMapEditor..."), this);
+ action = new QAction(KIcon("configure"), i18n("Configure KImageMapEditor..."), this);
actionCollection()->addAction("configure_kimagemapeditor", action );
connect(action, SIGNAL(triggered(bool) ), SLOT(slotShowPreferences()));
@@ -862,12 +856,6 @@ void KImageMapEditor::slotUpdateSelectionCoords( const QRect & r )
kapp->processEvents();
}
-KApplication* KImageMapEditor::app() const
-{
- return kapp;
-}
-
-
void KImageMapEditor::drawToCenter(QPainter* p, const QString & str, int y, int width) {
int xmid = width / 2;
@@ -968,7 +956,7 @@ QImage KImageMapEditor::getBackgroundImage() {
}
- path = KGlobal::dirs()->saveLocation( "data", "kimagemapeditor/" ) +filename;
+ path = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QLatin1Char('/') + "kimagemapeditor/" ) +filename;
kDebug() << "getBackgroundPic : save new image to : " << path;
pix.save(path,"PNG",100);
}
@@ -1602,7 +1590,7 @@ void KImageMapEditor::openFile(const KUrl & url) {
}
}
-bool KImageMapEditor::openURL(const KUrl & url) {
+bool KImageMapEditor::openURL(const QUrl & url) {
// If a local file does not exist
// we start with an empty file, so
// that we can return true here.
@@ -2794,7 +2782,7 @@ void KImageMapEditor::addImage(const KUrl & imgUrl) {
if (imgUrl.isEmpty())
return;
- QString relativePath ( toRelative(imgUrl, KUrl( url().directory() )).path() );
+ QString relativePath ( toRelative(imgUrl, KUrl( url().adjusted(QUrl::RemoveFilename).path() )).path() );
QString imgHtml = QString("<img src=\"")+relativePath+QString("\">");
ImageTag* imgTag = new ImageTag();
diff --git a/kimagemapeditor.h b/kimagemapeditor.h
index 43a6ff7..64b6758 100644
--- a/kimagemapeditor.h
+++ b/kimagemapeditor.h
@@ -26,12 +26,9 @@
#include <QPixmap>
#include <QTextStream>
+#include <KConfig>
+#include <KParts/ReadWritePart>
#include <kurl.h>
-#include <kparts/part.h>
-#include <kparts/browserextension.h>
-#include <kparts/factory.h>
-
-#include <kdeversion.h>
#include "kimearea.h"
@@ -111,12 +108,11 @@ typedef QList<HtmlElement*> HtmlContent;
class KSelectAction;
-class KAction;
+class QAction;
class KRecentFilesAction;
-class KAction;
+class QAction;
///class QListViewItem;
class KUndoStack;
-class KApplication;
class QTabWidget;
class AreaListView;
class ImagesListView;
@@ -142,7 +138,6 @@ public :
QObject *parent, const QStringList & args = QStringList());
virtual ~KImageMapEditor();
- static KAboutData *createAboutData();
static KConfig *config();
/**
@@ -178,8 +173,6 @@ public :
int showTagEditor(Area *);
KUndoStack *commandHistory() const;
- KApplication* app() const;
-
// Only refreshes the listView
void updateSelection() const;
@@ -262,49 +255,49 @@ private:
// Actions
//
KSelectAction* zoomAction;
- KAction *arrowAction;
- KAction *circleAction;
- KAction *rectangleAction;
- KAction *polygonAction;
- KAction *freehandAction;
- KAction *addPointAction;
- KAction *removePointAction;
-
- KAction *cutAction;
- KAction *deleteAction;
- KAction *copyAction;
- KAction *pasteAction;
- KAction *zoomInAction;
- KAction *zoomOutAction;
-
- KAction *mapNewAction;
- KAction *mapDeleteAction;
- KAction *mapNameAction;
- KAction *mapDefaultAreaAction;
-
- KAction *imageAddAction;
- KAction *imageRemoveAction;
- KAction *imageUsemapAction;
+ QAction *arrowAction;
+ QAction *circleAction;
+ QAction *rectangleAction;
+ QAction *polygonAction;
+ QAction *freehandAction;
+ QAction *addPointAction;
+ QAction *removePointAction;
+
+ QAction *cutAction;
+ QAction *deleteAction;
+ QAction *copyAction;
+ QAction *pasteAction;
+ QAction *zoomInAction;
+ QAction *zoomOutAction;
+
+ QAction *mapNewAction;
+ QAction *mapDeleteAction;
+ QAction *mapNameAction;
+ QAction *mapDefaultAreaAction;
+
+ QAction *imageAddAction;
+ QAction *imageRemoveAction;
+ QAction *imageUsemapAction;
KToggleAction *highlightAreasAction;
KToggleAction *showAltAction;
- KAction *areaPropertiesAction;
+ QAction *areaPropertiesAction;
- KAction *moveLeftAction;
- KAction *moveRightAction;
- KAction *moveUpAction;
- KAction *moveDownAction;
+ QAction *moveLeftAction;
+ QAction *moveRightAction;
+ QAction *moveUpAction;
+ QAction *moveDownAction;
- KAction *increaseWidthAction;
- KAction *decreaseWidthAction;
- KAction *increaseHeightAction;
- KAction *decreaseHeightAction;
+ QAction *increaseWidthAction;
+ QAction *decreaseWidthAction;
+ QAction *increaseHeightAction;
+ QAction *decreaseHeightAction;
- KAction *toFrontAction;
- KAction *toBackAction;
- KAction *forwardOneAction;
- KAction *backOneAction;
+ QAction *toFrontAction;
+ QAction *toBackAction;
+ QAction *forwardOneAction;
+ QAction *backOneAction;
KToggleAction* configureShowAreaListAction;
KToggleAction* configureShowMapListAction;
@@ -352,7 +345,7 @@ private:
void drawToCenter(QPainter* p, const QString & str, int y, int width);
public slots:
- virtual bool openURL(const KUrl & url);
+ virtual bool openURL(const QUrl & url);
void slotChangeStatusCoords(int x,int y);
void slotUpdateSelectionCoords();
void slotUpdateSelectionCoords( const QRect &);
diff --git a/kimearea.h b/kimearea.h
index b96c403..ff25182 100644
--- a/kimearea.h
+++ b/kimearea.h
@@ -18,17 +18,16 @@
#ifndef KIMEAREA_H
#define KIMEAREA_H
+#include <QHash>
#include <qrect.h>
#include <qpoint.h>
#include <QList>
-
#include <QPixmap>
#include <QLinkedList>
#include <QHashIterator>
#include <QTreeWidgetItem>
-#include <klocale.h>
-#include <qhash.h>
-#include "kdeversion.h"
+
+#include <klocalizedstring.h>
class QPainter;
class QPolygon;
diff --git a/kimecommands.cpp b/kimecommands.cpp
index 14833ae..e222f32 100644
--- a/kimecommands.cpp
+++ b/kimecommands.cpp
@@ -16,7 +16,7 @@
***************************************************************************/
#include <qstring.h>
#include <kdebug.h>
-#include <klocale.h>
+#include <klocalizedstring.h>
#include "kimagemapeditor.h"
#include "kimecommands.h"
diff --git a/kimecommands.h b/kimecommands.h
index 3d5d19c..9ba0c38 100644
--- a/kimecommands.h
+++ b/kimecommands.h
@@ -21,8 +21,6 @@
#include <qundostack.h>
-#include <kdeversion.h>
-
class KImageMapEditor;
class AreaSelection;
diff --git a/kimedialogs.cpp b/kimedialogs.cpp
index c7dbc34..fae2065 100644
--- a/kimedialogs.cpp
+++ b/kimedialogs.cpp
@@ -15,7 +15,7 @@
* *
***************************************************************************/
-// QT
+// Qt
#include <qcheckbox.h>
#include <qlayout.h>
#include <qlabel.h>
@@ -32,10 +32,10 @@
#include <QFrame>
#include <QVBoxLayout>
-// KDE
+// KDE Frameworks
#include <kiconloader.h>
#include <kfiledialog.h>
-#include <klocale.h>
+#include <klocalizedstring.h>
#include <kdebug.h>
#include <kapplication.h>
#include <khtmlview.h>
@@ -43,8 +43,8 @@
#include <ktemporaryfile.h>
#include <kpushbutton.h>
#include <kstandardguiitem.h>
-#include <kglobal.h>
#include <kvbox.h>
+#include <KSharedConfig>
// LOCAL
#include "kimedialogs.h"
@@ -610,14 +610,14 @@ PreferencesDialog::PreferencesDialog(QWidget *parent, KConfig* conf)
colorizeAreaChk = new QCheckBox(hbox);
colorizeAreaChk->setFixedWidth(60);
- colorizeAreaChk->setChecked(KGlobal::config()->readEntry("highlightareas",true));
+ colorizeAreaChk->setChecked(KSharedConfig::openConfig()->readEntry("highlightareas",true));
hbox= new QHBox(page);
(void)new QLabel(i18n("Show alternative text")+" ",hbox);
showAltChk = new QCheckBox(hbox);
showAltChk->setFixedWidth(60);
- showAltChk->setChecked(KGlobal::config()->readEntry("showalt",true));
+ showAltChk->setChecked(KSharedConfig::openConfig()->readEntry("showalt",true));
*/
connect(this,SIGNAL(okClicked()),this,SLOT(slotOk()));
connect(this,SIGNAL(applyClicked()),this,SLOT(slotApply()));
diff --git a/kimedialogs.h b/kimedialogs.h
index dbbf9ac..f436d44 100644
--- a/kimedialogs.h
+++ b/kimedialogs.h
@@ -18,6 +18,7 @@
#ifndef KIMEDIALOGS_H
#define KIMEDIALOGS_H
+#include <QGridLayout>
#include <QLabel>
#include <QLinkedList>
@@ -25,8 +26,6 @@
#include <kurl.h>
#include "kimagemapeditor.h"
-#include "kdeversion.h"
-
class QLineEdit;
class QSpinBox;
diff --git a/kimeshell.cpp b/kimeshell.cpp
index 5204c71..4ca484b 100644
--- a/kimeshell.cpp
+++ b/kimeshell.cpp
@@ -18,11 +18,11 @@
#include <iostream>
+#include <QAction>
#include <QDockWidget>
#include <QScrollArea>
-#include <kaction.h>
-#include <kstandarddirs.h>
+#include <kparts/guiactivateevent.h>
#include <kfiledialog.h>
#include <kmessagebox.h>
#include <kshortcutsdialog.h>
@@ -43,6 +43,7 @@
#include "kimeshell.h"
#include "kimeshell.moc"
#include <kactioncollection.h>
+#include <KSharedConfig>
KimeShell::KimeShell(const char * )
: KParts::MainWindow()
{
@@ -116,7 +117,7 @@ bool KimeShell::queryExit()
#ifdef __GNUC__
#warning what group is correct here? A random one?
#endif
- KConfigGroup cg( KGlobal::config(), QString() );
+ KConfigGroup cg( KSharedConfig::openConfig(), QString() );
saveProperties( cg );
return true;
@@ -205,7 +206,7 @@ void KimeShell::fileOpen()
void KimeShell::readConfig() {
- KSharedConfigPtr config = KGlobal::config();
+ KSharedConfigPtr config = KSharedConfig::openConfig();
readConfig(config->group("General Options") );
}
@@ -216,7 +217,7 @@ void KimeShell::readConfig(const KConfigGroup &) {
}
void KimeShell::writeConfig() {
- KConfigGroup config( KGlobal::config(), "General Options");
+ KConfigGroup config( KSharedConfig::openConfig(), "General Options");
writeConfig( config );
}
@@ -257,7 +258,8 @@ void KimeShell::optionsConfigureKeys() {
void KimeShell::optionsConfigureToolbars()
{
- saveMainWindowSettings(KGlobal::config()->group( autoSaveGroup()) );
+ KConfigGroup configGroup = KSharedConfig::openConfig()->group(autoSaveGroup());
+ saveMainWindowSettings(configGroup);
// use the standard toolbar editor
KEditToolBar dlg(factory());
@@ -268,7 +270,8 @@ void KimeShell::optionsConfigureToolbars()
void KimeShell::applyNewToolbarConfig()
{
- applyMainWindowSettings(KGlobal::config()->group( autoSaveGroup()) );
+ KConfigGroup configGroup = KSharedConfig::openConfig()->group(autoSaveGroup());
+ applyMainWindowSettings(configGroup);
}
diff --git a/kimeshell.h b/kimeshell.h
index 7cc8d1b..98d3b7b 100644
--- a/kimeshell.h
+++ b/kimeshell.h
@@ -19,6 +19,8 @@
#define KIMESHELL_H
#include <kparts/mainwindow.h>
+#include <KConfigGroup>
+#include <kurl.h>
class KImageMapEditor;
diff --git a/main.cpp b/main.cpp
index 1e0e6c3..68e81d0 100644
--- a/main.cpp
+++ b/main.cpp
@@ -15,54 +15,57 @@
* *
***************************************************************************/
-#include <kcmdlineargs.h>
-#include <kaboutdata.h>
-#include <klocale.h>
-#include <kapplication.h>
+#include <QApplication>
+#include <QCommandLineParser>
+#include <QCommandLineOption>
+
+#include <KAboutData>
+#include <KLocalizedString>
#include "kimeshell.h"
#include "version.h"
static const char *description =
I18N_NOOP("An HTML imagemap editor");
-// INSERT A DESCRIPTION FOR YOUR APPLICATION HERE
int main(int argc, char *argv[])
{
+ QApplication app(argc, argv);
+ KLocalizedString::setApplicationDomain("kimagemapeditor");
- KAboutData aboutData( "kimagemapeditor", 0, ki18n("KImageMapEditor"),
- KIMAGEMAPEDITOR_VERSION, ki18n(description), KAboutData::License_GPL,
- ki18n("(c) 2001-2007 Jan Schaefer"), KLocalizedString(), "http://kde.org/applications/development/kimagemapeditor/", "[email protected]");
- aboutData.addAuthor(ki18n("Jan Schaefer"),KLocalizedString(), "[email protected]");
- aboutData.addCredit(ki18n("Joerg Jaspert"),ki18n("For helping me with the Makefiles, and creating the Debian package"));
- aboutData.addCredit(ki18n("Aaron Seigo and Michael"),ki18n("For helping me fixing --enable-final mode"));
- aboutData.addCredit(ki18n("Antonio Crevillen"),ki18n("For the Spanish translation"));
- aboutData.addCredit(ki18n("Fabrice Mous"),ki18n("For the Dutch translation"));
- aboutData.addCredit(ki18n("Germain Chazot"),ki18n("For the French translation"));
- KCmdLineArgs::init( argc, argv, &aboutData );
-
- KCmdLineOptions options;
- options.add("c");
- options.add("stdout", ki18n("Write HTML-Code to stdout on exit"));
- options.add("+[File]", ki18n("File to open"));
- KCmdLineArgs::addCmdLineOptions( options ); // Add our own options.
-
+ KAboutData aboutData( "kimagemapeditor", i18n("KImageMapEditor"),
+ KIMAGEMAPEDITOR_VERSION, i18n(description), KAboutLicense::GPL,
+ i18n("(c) 2001-2007 Jan Schaefer"), QString(),
+ QStringLiteral("http://kde.org/applications/development/kimagemapeditor/"), QStringLiteral("[email protected]"));
+ aboutData.addAuthor(i18n("Jan Schaefer"),QString(), "[email protected]");
+ aboutData.addCredit(i18n("Joerg Jaspert"),i18n("For helping me with the Makefiles, and creating the Debian package"));
+ aboutData.addCredit(i18n("Aaron Seigo and Michael"),i18n("For helping me fixing --enable-final mode"));
+ aboutData.addCredit(i18n("Antonio Crevillen"),i18n("For the Spanish translation"));
+ aboutData.addCredit(i18n("Fabrice Mous"),i18n("For the Dutch translation"));
+ aboutData.addCredit(i18n("Germain Chazot"),i18n("For the French translation"));
+ QCommandLineParser parser;
+ aboutData.setupCommandLine(&parser);
+ KAboutData::setApplicationData(aboutData);
+ parser.addVersionOption();
+ parser.addHelpOption();
- KApplication a;
+ parser.addOption(QCommandLineOption(QStringList() << QLatin1String("c") << QLatin1String("stdout"), i18n("Write HTML-Code to stdout on exit")));
+ parser.addPositionalArgument(QLatin1String("[File]"), i18n("File to open"));
+ parser.process(app);
+ aboutData.processCommandLine(&parser);
- if (a.isSessionRestored())
+ if (app.isSessionRestored())
{
RESTORE(KimeShell);
}
else
{
- KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
- if ( args->count() == 0 )
+ if ( parser.positionalArguments().count() == 0 )
{
KimeShell *kimeShell = new KimeShell();
- kimeShell->setStdout(args->isSet("stdout"));
+ kimeShell->setStdout(parser.isSet("stdout"));
kimeShell->readConfig();
kimeShell->show();
kimeShell->openLastFile();
@@ -70,17 +73,17 @@ int main(int argc, char *argv[])
else
{
int i = 0;
- for (; i < args->count(); i++ )
+ for (; i < parser.positionalArguments().count(); i++ )
{
KimeShell *kimeShell = new KimeShell();
- kimeShell->setStdout(args->isSet("stdout"));
+ kimeShell->setStdout(parser.isSet("stdout"));
kimeShell->readConfig();
kimeShell->show();
- kimeShell->openFile(args->url(i));
+ kimeShell->openFile(parser.positionalArguments().at(i));
}
}
- args->clear();
- }
- return a.exec();
+ }
+
+ return app.exec();
}
diff --git a/mapslistview.cpp b/mapslistview.cpp
index 9ab7d0a..fbc55d9 100644
--- a/mapslistview.cpp
+++ b/mapslistview.cpp
@@ -16,8 +16,8 @@
***************************************************************************/
#include <QListWidget>
-// KDE
-#include <klocale.h>
+// KDE Frameworks
+#include <klocalizedstring.h>
#include <kdebug.h>
// locale
diff --git a/pics/hi16-app-kimagemapeditor.png b/pics/16-apps-kimagemapeditor.png
index 9903180..9903180 100644
--- a/pics/hi16-app-kimagemapeditor.png
+++ b/pics/16-apps-kimagemapeditor.png
Binary files differ
diff --git a/pics/hi22-action-addpoint.png b/pics/22-actions-addpoint.png
index 2e9a239..2e9a239 100644
--- a/pics/hi22-action-addpoint.png
+++ b/pics/22-actions-addpoint.png
Binary files differ
diff --git a/pics/hi22-action-arrow.png b/pics/22-actions-arrow.png
index bbae9a6..bbae9a6 100644
--- a/pics/hi22-action-arrow.png
+++ b/pics/22-actions-arrow.png
Binary files differ
diff --git a/pics/hi22-action-circle.png b/pics/22-actions-circle.png
index 7c9c4e9..7c9c4e9 100644
--- a/pics/hi22-action-circle.png
+++ b/pics/22-actions-circle.png
Binary files differ
diff --git a/pics/hi22-action-circle2.png b/pics/22-actions-circle2.png
index 90f1d28..90f1d28 100644
--- a/pics/hi22-action-circle2.png
+++ b/pics/22-actions-circle2.png
Binary files differ
diff --git a/pics/hi22-action-freehand.png b/pics/22-actions-freehand.png
index ceb0ec0..ceb0ec0 100644
--- a/pics/hi22-action-freehand.png
+++ b/pics/22-actions-freehand.png
Binary files differ
diff --git a/pics/hi22-action-lower.png b/pics/22-actions-lower.png
index 0142ef1..0142ef1 100644
--- a/pics/hi22-action-lower.png
+++ b/pics/22-actions-lower.png
Binary files differ
diff --git a/pics/hi22-action-polygon.png b/pics/22-actions-polygon.png
index 88015f4..88015f4 100644
--- a/pics/hi22-action-polygon.png
+++ b/pics/22-actions-polygon.png
Binary files differ
diff --git a/pics/hi22-action-raise.png b/pics/22-actions-raise.png
index 35fd49b..35fd49b 100644
--- a/pics/hi22-action-raise.png
+++ b/pics/22-actions-raise.png
Binary files differ
diff --git a/pics/hi22-action-rectangle.png b/pics/22-actions-rectangle.png
index b03a5c4..b03a5c4 100644
--- a/pics/hi22-action-rectangle.png
+++ b/pics/22-actions-rectangle.png
Binary files differ
diff --git a/pics/hi22-action-removepoint.png b/pics/22-actions-removepoint.png
index 49900b9..49900b9 100644
--- a/pics/hi22-action-removepoint.png
+++ b/pics/22-actions-removepoint.png
Binary files differ
diff --git a/pics/hi32-app-kimagemapeditor.png b/pics/32-apps-kimagemapeditor.png
index a4de6ee..a4de6ee 100644
--- a/pics/hi32-app-kimagemapeditor.png
+++ b/pics/32-apps-kimagemapeditor.png
Binary files differ
diff --git a/pics/hi48-app-kimagemapeditor.png b/pics/48-apps-kimagemapeditor.png
index 6f90940..6f90940 100644
--- a/pics/hi48-app-kimagemapeditor.png
+++ b/pics/48-apps-kimagemapeditor.png
Binary files differ
diff --git a/pics/CMakeLists.txt b/pics/CMakeLists.txt
index b568963..1f4fadf 100644
--- a/pics/CMakeLists.txt
+++ b/pics/CMakeLists.txt
@@ -1,4 +1,20 @@
install( FILES addpointcursor.png freehandcursor.png polygoncursor.png removepointcursor.png DESTINATION ${DATA_INSTALL_DIR}/kimagemapeditor)
-kde4_install_icons( ${ICON_INSTALL_DIR} )
+ecm_install_icons(ICONS
+ 16-apps-kimagemapeditor.png
+ 22-actions-addpoint.png
+ 22-actions-arrow.png
+ 22-actions-circle.png
+ 22-actions-circle2.png
+ 22-actions-freehand.png
+ 22-actions-lower.png
+ 22-actions-polygon.png
+ 22-actions-raise.png
+ 22-actions-rectangle.png
+ 22-actions-removepoint.png
+ 32-apps-kimagemapeditor.png
+ 48-apps-kimagemapeditor.png
+ DESTINATION ${ICON_INSTALL_DIR}
+ THEME hicolor
+)