Git commit 00e0f1086f56cee7567c779ad04f32c7d779e7aa by Inge Wallin. Committed on 14/11/2014 at 23:28. Pushed by ingwa into branch 'master'.
Kiten is now officially a KF5 based application. Squashed commit of the following: commit 072d1febae234b8ddf9d4985b304d4fc03270717 Author: Montel Laurent <montel at kde.org> Date: Mon Nov 3 21:13:03 2014 +0100 Remove not necessary code commit e06e7d8b5cb8ec4e1a7d50128d560c13607d7bd1 Author: Montel Laurent <montel at kde.org> Date: Sun Nov 2 07:43:32 2014 +0100 GENERIC_LIB_VERSION doesn't exist now => use own version (perhaps we need to fix it) commit 5b60129518851ce5d4c1105ceac02ba6df19c547 Author: Montel Laurent <montel at kde.org> Date: Sun Nov 2 07:41:53 2014 +0100 Migrate settings commit d3a732b1a3c3f3b756ee81c53222eefbe3d17e75 Author: Montel Laurent <montel at kde.org> Date: Sun Nov 2 07:38:26 2014 +0100 Use ki18n_wrap_ui to extract string commit 3304cad855663697905d7895f586f4aca1a750e9 Author: Montel Laurent <montel at kde.org> Date: Sun Nov 2 07:37:33 2014 +0100 Port to new reverse dns desktop commit 4a24d5e398536a73fd0328945bd96b352a2559b7 Author: Montel Laurent <montel at kde.org> Date: Sun Nov 2 07:36:05 2014 +0100 Convert to reverse dns desktop commit 4b1d553833c6412445a429b49598241015f2b365 Author: Montel Laurent <montel at kde.org> Date: Sun Nov 2 07:34:47 2014 +0100 Make it translate commit 8cac2e1cd035dc369780da2b3e6c8d7305d04803 Author: Montel Laurent <montel at kde.org> Date: Sun Nov 2 07:33:17 2014 +0100 Port to new connect api commit 84b819a2545d367c213c0194747f1a9187a1ee59 Author: Montel Laurent <montel at kde.org> Date: Sun Nov 2 07:30:57 2014 +0100 normalize signal/slot commit d8119a463c26cc01f19418cd5a636072fdfc881e Author: Montel Laurent <montel at kde.org> Date: Sun Nov 2 07:29:10 2014 +0100 convert to new connect api commit f482d9f49a505085f666ccb728f1925a17b630fc Author: Montel Laurent <montel at kde.org> Date: Sun Nov 2 07:27:23 2014 +0100 Remove not necessary includes moc commit 7eaa208e130ac72beb0f1ddc4dca88bb1919b90e Author: Jeremy Whiting <jpwhiting at kde.org> Date: Sat Oct 25 23:57:22 2014 -0600 Fix docbook to use 4.5 dtd and docbook 4.5. commit 20654ae024326ded02080d8734bd18d96e90f0de Author: Andreas Cord-Landwehr <cordlandwehr at kde.org> Date: Fri Oct 24 21:08:03 2014 +0200 Remove unneeded includes. commit 92571a0a5ece4489e226bd2a01a0727df3714647 Author: Andreas Cord-Landwehr <cordlandwehr at kde.org> Date: Fri Oct 24 21:01:18 2014 +0200 Remove unneeded include. commit 6118a5ca06e1b5390929f2d5cdce84c70a1e0c00 Author: Andreas Cord-Landwehr <cordlandwehr at kde.org> Date: Fri Oct 24 20:53:06 2014 +0200 Port away from kdemacros.h. commit 99c802cfadc0b215358c07a4e3be6350cdfd3d71 Author: Reza Fatahilah Shah <rshah0385 at kireihana.com> Date: Thu Sep 4 21:16:14 2014 +0900 Use single ecm_install_icons with multiple icon files commit ca9fa8f0e49087c6b63411cda9ff03b56d82e4af Author: Reza Fatahilah Shah <rshah0385 at kireihana.com> Date: Wed Sep 3 22:05:47 2014 +0900 Port to new ecm_install_icons syntax commit 435072a00af71d3902c17d24ee1f00b35956b841 Author: Reza Fatahilah Shah <rshah0385 at kireihana.com> Date: Wed Sep 3 21:03:07 2014 +0900 Clean forward declaration and remove unused headers commit 8542a2ec8ef82321929d7d9f8de130bd2de66694 Author: Reza Fatahilah Shah <rshah0385 at kireihana.com> Date: Wed Sep 3 20:36:16 2014 +0900 Port from KFilterDev to KCompressionDevice commit fae33e56f2e32f9bb8381791efc76ea39306a8a5 Author: Reza Fatahilah Shah <rshah0385 at kireihana.com> Date: Wed Sep 3 20:22:26 2014 +0900 Remove KDELibs4Support from CMakeLists.txt commit e86177821445b32be13d6e352ba61c2fb3da570c Author: Reza Fatahilah Shah <rshah0385 at kireihana.com> Date: Wed Sep 3 20:18:15 2014 +0900 Port KApplication::sessionConfig to KConfigGui::sessionConfig commit d02ea19443fb2ee30a34bb8e6db14a8cde4e33d0 Author: Reza Fatahilah Shah <rshah0385 at kireihana.com> Date: Wed Sep 3 20:13:04 2014 +0900 Port to QStandardPaths::writeableLocation for downloaded dictionary files commit 82f2eabf664e97909e51b63d5c132187b7a204dc Author: Reza Fatahilah Shah <rshah0385 at kireihana.com> Date: Mon Sep 1 21:50:51 2014 +0900 Use Qt::Key for shortcut commit 7d288968a6f255118e2f2628f32aef079900c656 Author: Reza Fatahilah Shah <rshah0385 at kireihana.com> Date: Mon Sep 1 21:16:58 2014 +0900 Port deprecated readConfig() and writeConfig() to load() and save() commit 9d0daf7ba567fe0fddd2a995543e1d87513e9bc3 Author: Reza Fatahilah Shah <rshah0385 at kireihana.com> Date: Sun Aug 31 11:59:36 2014 +0900 Use QWidgetAction for 'searchbox' action. commit 2bd700402d848f011cbbca1ccbf7a609289323a3 Author: Reza Fatahilah Shah <rshah0385 at kireihana.com> Date: Sat Aug 30 16:46:15 2014 +0900 Use KXMLGUI_INSTALL_DIR instead of DATA_INSTALL_DIR for .rc files commit 36ea9794ee36ae98a74457b4169d3e5b3f65687e Author: Reza Fatahilah Shah <rshah0385 at kireihana.com> Date: Fri Aug 29 23:02:01 2014 +0900 initial porting to frameworks 5 M +25 -6 CMakeLists.txt M +12 -7 app/CMakeLists.txt M +8 -10 app/configdictionaryselector.cpp M +2 -2 app/configdictionaryselector.h M +12 -22 app/configsortingpage.cpp M +1 -1 app/configsortingpage.h M +29 -30 app/configuredialog.cpp M +40 -41 app/dictionaryupdatemanager.cpp M +4 -4 app/dictionaryupdatemanager.h M +1 -1 app/entrylistmodel.cpp M +1 -3 app/entrylistview.cpp M +64 -78 app/kiten.cpp M +9 -10 app/kiten.h M +29 -21 app/main.cpp R +1 -0 app/org.kde.kiten.desktop [from: app/kiten.desktop - 099% similarity] M +7 -13 app/resultsview.cpp M +1 -7 app/resultsview.h M +15 -20 app/searchstringinput.cpp M +2 -3 app/searchstringinput.h M +1 -2 app/wordtype.cpp M +0 -1 app/wordtype.h M +10 -4 data/pics/CMakeLists.txt M +1 -1 doc/CMakeLists.txt M +1 -1 doc/index.docbook M +12 -7 kanjibrowser/CMakeLists.txt M +13 -16 kanjibrowser/kanjibrowser.cpp M +4 -4 kanjibrowser/kanjibrowserconfig.kcfg M +14 -20 kanjibrowser/kanjibrowserview.cpp M +4 -4 kanjibrowser/kanjibrowserview.h M +22 -18 kanjibrowser/main.cpp R +1 -0 kanjibrowser/org.kde.kitenkanjibrowser.desktop [from: kanjibrowser/kitenkanjibrowser.desktop - 096% similarity] M +13 -3 lib/CMakeLists.txt M +4 -8 lib/DictEdict/deinflection.cpp M +0 -1 lib/DictEdict/deinflection.h M +3 -8 lib/DictEdict/dictfileedict.cpp M +0 -2 lib/DictEdict/dictfileedict.h M +8 -14 lib/DictEdict/dictfilefieldselector.cpp M +2 -2 lib/DictEdict/entryedict.cpp M +6 -8 lib/DictEdict/indexededictfile.cpp M +2 -6 lib/DictEdict/linearedictfile.cpp M +3 -4 lib/DictKanjidic/dictfilekanjidic.cpp M +9 -9 lib/DictKanjidic/entrykanjidic.cpp M +6 -8 lib/dictionarymanager.cpp M +1 -1 lib/dictionarypreferencedialog.cpp M +3 -3 lib/dictquery.cpp M +2 -8 lib/entry.cpp M +0 -1 lib/entry.h M +2 -8 lib/entrylist.cpp M +0 -1 lib/historyptrlist.cpp M +6 -10 lib/kromajiedit.cpp M +2 -1 lib/libkitenexport.h M +13 -6 radselect/CMakeLists.txt M +6 -9 radselect/buttongrid.cpp M +22 -19 radselect/main.cpp M +2 -9 radselect/radical_selector.ui M +1 -4 radselect/radicalbutton.cpp M +15 -26 radselect/radselect.cpp M +19 -23 radselect/radselectview.cpp M +0 -1 radselect/radselectview.h http://commits.kde.org/kiten/00e0f1086f56cee7567c779ad04f32c7d779e7aa diff --git a/CMakeLists.txt b/CMakeLists.txt index 13fdbb5..118f46a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,13 +2,29 @@ project(kiten) # Check for cmake, same as minimum for KDE 4.0.0 -cmake_minimum_required( VERSION 2.4.5 ) +cmake_minimum_required( VERSION 2.8.12 ) -# Check for KDE 4 -find_package( KDE4 REQUIRED ) +#ECM setup +find_package(ECM REQUIRED NO_MODULE) +set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH}) + +find_package(Qt5 REQUIRED COMPONENTS Core Widgets) +find_package(KF5 REQUIRED COMPONENTS + Archive + Completion + Config + ConfigWidgets + CoreAddons + DocTools + I18n + KHtml + XmlGui) +include(KDEInstallDirs) +include(KDECompilerSettings) +include(KDECMakeSettings) +include(ECMInstallIcons) include( CheckIncludeFiles ) -include( KDE4Defaults ) -include_directories( ${KDE4_INCLUDES} ) +include(ECMGenerateHeaders) ## Make it easy for radselect and kiten to find libkiten headers include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/lib) @@ -19,6 +35,9 @@ check_include_files(stdint.h HAVE_STDINT_H) check_include_files(inttypes.h HAVE_INTTYPES_H) configure_file( config-kiten.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-kiten.h ) +add_definitions(-DTRANSLATION_DOMAIN=\"kiten\") + + ## Build each subdir add_subdirectory( app ) add_subdirectory( data/font ) @@ -30,7 +49,7 @@ add_subdirectory( radselect ) ## Build kitengen, a small index generator used by the kiten app set(kitengen_SRCS xjdxgen.c) -kde4_add_executable(kitengen ${kitengen_SRCS}) +add_executable(kitengen ${kitengen_SRCS}) target_link_libraries(kitengen ${QT_QTCORE_LIBRARY}) install( TARGETS kitengen ${INSTALL_TARGETS_DEFAULT_ARGS} ) install(FILES kiten.appdata.xml DESTINATION ${SHARE_INSTALL_PREFIX}/appdata/) diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt index f5b3549..34b73f0 100644 --- a/app/CMakeLists.txt +++ b/app/CMakeLists.txt @@ -12,27 +12,32 @@ set(kiten_bin_SRCS dictionaryupdatemanager.cpp wordtype.cpp ) -kde4_add_ui_files(kiten_bin_SRCS +ki18n_wrap_ui(kiten_bin_SRCS configdictselect.ui configfont.ui configlearn.ui configsearching.ui configsorting.ui ) -kde4_add_kcfg_files( kiten_bin_SRCS kitenconfig.kcfgc) +kconfig_add_kcfg_files( kiten_bin_SRCS kitenconfig.kcfgc) #kde4_add_app_icon(kiten_bin_SRCS "${KDE4_ICON_DIR}/oxygen/*/apps/kiten.png") #kde4_add_app_icon(kiten_bin_SRCS "${CMAKE_CURRENT_SOURCE_DIR}/../data/pics/ox*-apps-kiten.png") -kde4_add_app_icon(kiten_bin_SRCS "${CMAKE_CURRENT_SOURCE_DIR}/../data/pics/hi*-apps-kiten.png") +# # kde4_add_app_icon(kiten_bin_SRCS "${CMAKE_CURRENT_SOURCE_DIR}/../data/pics/hi*-apps-kiten.png") -kde4_add_executable(kiten_bin ${kiten_bin_SRCS}) +add_executable(kiten_bin ${kiten_bin_SRCS}) set_target_properties(kiten_bin PROPERTIES OUTPUT_NAME kiten IMPORT_PREFIX bin_) -target_link_libraries(kiten_bin ${KDE4_KHTML_LIBS} kiten) +target_link_libraries(kiten_bin + KF5::Archive + KF5::ConfigWidgets + KF5::I18n + KF5::KHtml + kiten) install( TARGETS kiten_bin ${INSTALL_TARGETS_DEFAULT_ARGS} ) ############ install files ############# -install( PROGRAMS kiten.desktop DESTINATION ${XDG_APPS_INSTALL_DIR} ) +install( PROGRAMS org.kde.kiten.desktop DESTINATION ${XDG_APPS_INSTALL_DIR} ) install( FILES kiten.kcfg DESTINATION ${KCFG_INSTALL_DIR} ) -install( FILES kitenui.rc DESTINATION ${DATA_INSTALL_DIR}/kiten ) +install( FILES kitenui.rc DESTINATION ${KXMLGUI_INSTALL_DIR}/kiten ) diff --git a/app/configdictionaryselector.cpp b/app/configdictionaryselector.cpp index 2e4e484..8b7c442 100644 --- a/app/configdictionaryselector.cpp +++ b/app/configdictionaryselector.cpp @@ -23,21 +23,19 @@ #include "configdictionaryselector.h" #include <KConfigSkeleton> -#include <KDebug> -#include <KFileDialog> +#include <QFileDialog> #include <QStringList> -#include <QTableWidget> ConfigDictionarySelector::ConfigDictionarySelector( const QString &dictionaryName, - QWidget *parent, KConfigSkeleton *config,Qt::WFlags f ) + QWidget *parent, KConfigSkeleton *config,Qt::WindowFlags f ) { setupUi( this ); _dictName = dictionaryName; _config = config; - connect( addButton, SIGNAL( clicked() ), this, SLOT( addDictSlot() ) ); - connect( delButton, SIGNAL( clicked() ), this, SLOT( deleteDictSlot() ) ); + connect(addButton, &QPushButton::clicked, this, &ConfigDictionarySelector::addDictSlot); + connect(delButton, &QPushButton::clicked, this, &ConfigDictionarySelector::deleteDictSlot); __useGlobal->setObjectName( QString( "kcfg_" + _dictName + "__useGlobal" ) ); } @@ -63,7 +61,7 @@ void ConfigDictionarySelector::updateWidgets() } } - _config->readConfig(); + _config->load(); fileList->clear(); foreach( const QString &it, names ) @@ -98,7 +96,7 @@ void ConfigDictionarySelector::updateSettings() //This feels distinctly hackish to me... :( _config->findItem( _dictName + "__NAMES" )->setProperty( names ); - _config->writeConfig(); + _config->save(); } void ConfigDictionarySelector::updateWidgetsDefault() @@ -123,7 +121,7 @@ void ConfigDictionarySelector::addDictSlot() { QTreeWidgetItem *item = fileList->topLevelItem( 0 ); - QString filename = KFileDialog::getOpenFileName( + QString filename = QFileDialog::getOpenFileName(0, QString(), item ? QFileInfo( item->text( 1 ) ).absolutePath().append( "/" ) : QString() ); QString name = QFileInfo( filename ).fileName(); @@ -154,4 +152,4 @@ void ConfigDictionarySelector::deleteDictSlot() } } -#include "configdictionaryselector.moc" + diff --git a/app/configdictionaryselector.h b/app/configdictionaryselector.h index 51d3edd..b15fcec 100644 --- a/app/configdictionaryselector.h +++ b/app/configdictionaryselector.h @@ -25,7 +25,7 @@ #include "ui_configdictselect.h" //From the UI file -#include <QWidget> //For the WFlags on the constructor +#include <QWidget> //For the WindowFlags on the constructor class KConfigSkeleton; class QString; @@ -39,7 +39,7 @@ class ConfigDictionarySelector : public QWidget, public Ui::configDictSelect explicit ConfigDictionarySelector( const QString &dictionaryName , QWidget *parent = 0 , KConfigSkeleton *iconfig = NULL - , Qt::WFlags f = 0 ); + , Qt::WindowFlags f = 0 ); public slots: void addDictSlot(); diff --git a/app/configsortingpage.cpp b/app/configsortingpage.cpp index 5373219..87fb966 100644 --- a/app/configsortingpage.cpp +++ b/app/configsortingpage.cpp @@ -22,7 +22,6 @@ #include <QCheckBox> #include <QListWidget> -#include <QMap> #include <QStringList> #include "dictionarymanager.h" @@ -31,7 +30,7 @@ ConfigSortingPage::ConfigSortingPage( QWidget *parent , KitenConfigSkeleton *config - ,Qt::WFlags f ) + ,Qt::WindowFlags f ) : QWidget( parent, f ) , _config( config ) { @@ -39,8 +38,7 @@ ConfigSortingPage::ConfigSortingPage( QWidget *parent _dictNames = DictionaryManager::listDictFileTypes(); //Setup the relationship between the checkbox and the dictionary sortlist - connect( kcfg_dictionary_enable, SIGNAL( clicked( bool ) ), - dictionary_order, SLOT( setEnabled( bool ) ) ); + connect(kcfg_dictionary_enable, &QCheckBox::clicked, dictionary_order, &KActionSelector::setEnabled); dictionary_order->setEnabled( _config->dictionary_enable() == "true" ); _fields.append( "Word/Kanji" ); @@ -50,23 +48,15 @@ ConfigSortingPage::ConfigSortingPage( QWidget *parent _fields += fieldListMap; //Make the connections to alert the main dialog when things change - connect( dictionary_order, SIGNAL( added( QListWidgetItem* ) ), - this, SIGNAL( widgetChanged() ) ); - connect( dictionary_order, SIGNAL( removed( QListWidgetItem* ) ), - this, SIGNAL( widgetChanged() ) ); - connect( dictionary_order, SIGNAL( movedUp( QListWidgetItem* ) ), - this, SIGNAL( widgetChanged() ) ); - connect( dictionary_order, SIGNAL( movedDown( QListWidgetItem* ) ), - this, SIGNAL( widgetChanged() ) ); - - connect( field_order, SIGNAL( added ( QListWidgetItem* ) ), - this, SIGNAL( widgetChanged() ) ); - connect( field_order, SIGNAL( removed( QListWidgetItem* ) ), - this, SIGNAL( widgetChanged() ) ); - connect( field_order, SIGNAL( movedUp( QListWidgetItem* ) ), - this, SIGNAL( widgetChanged() ) ); - connect( field_order, SIGNAL( movedDown( QListWidgetItem* ) ), - this, SIGNAL( widgetChanged() ) ); + connect(dictionary_order, &KActionSelector::added, this, &ConfigSortingPage::widgetChanged); + connect(dictionary_order, &KActionSelector::removed, this, &ConfigSortingPage::widgetChanged); + connect(dictionary_order, &KActionSelector::movedUp, this, &ConfigSortingPage::widgetChanged); + connect(dictionary_order, &KActionSelector::movedDown, this, &ConfigSortingPage::widgetChanged); + + connect(field_order, &KActionSelector::added, this, &ConfigSortingPage::widgetChanged); + connect(field_order, &KActionSelector::removed, this, &ConfigSortingPage::widgetChanged); + connect(field_order, &KActionSelector::movedUp, this, &ConfigSortingPage::widgetChanged); + connect(field_order, &KActionSelector::movedDown, this, &ConfigSortingPage::widgetChanged); } //Read from preferences and set widgets @@ -131,4 +121,4 @@ bool ConfigSortingPage::hasChanged() return false; } -#include "configsortingpage.moc" + diff --git a/app/configsortingpage.h b/app/configsortingpage.h index 540ee9f..7b832f0 100644 --- a/app/configsortingpage.h +++ b/app/configsortingpage.h @@ -35,7 +35,7 @@ class ConfigSortingPage : public QWidget, public Ui::configSorting public: explicit ConfigSortingPage( QWidget *parent = 0 , KitenConfigSkeleton *config = NULL - , Qt::WFlags f = 0 ); + , Qt::WindowFlags f = 0 ); public slots: bool hasChanged(); diff --git a/app/configuredialog.cpp b/app/configuredialog.cpp index bfd67ba..f32e6e9 100644 --- a/app/configuredialog.cpp +++ b/app/configuredialog.cpp @@ -23,10 +23,9 @@ #include "configuredialog.h" #include <KConfigDialog> -#include <KLocale> -#include <KTabWidget> +#include <KLocalizedString> -#include <QLayout> +#include <QTabWidget> #include <QString> #include <QStringList> #include <QWidget> @@ -79,8 +78,8 @@ ConfigureDialog::ConfigureDialog( QWidget *parent, KitenConfigSkeleton *config ) setHelp( QString(),"kiten" ); - connect( this, SIGNAL( widgetModified() ), - this, SLOT( updateConfiguration() ) ); + connect( this, SIGNAL(widgetModified()), + this, SLOT(updateConfiguration()) ); } void ConfigureDialog::updateConfiguration() @@ -95,21 +94,21 @@ ConfigureDialog::~ConfigureDialog() QWidget *ConfigureDialog::makeDictionaryFileSelectionPage( QWidget *parent , KitenConfigSkeleton *config ) { - KTabWidget *tabWidget = new KTabWidget( parent ); + QTabWidget *tabWidget = new QTabWidget( parent ); foreach( const QString &dict, config->dictionary_list() ) { QWidget *newTab = new ConfigDictionarySelector( dict, tabWidget, config ); if( newTab ) { - connect( newTab, SIGNAL( widgetChanged() ), - this, SIGNAL( widgetModified() ) ); - connect( this, SIGNAL( updateWidgetsSignal() ), - newTab, SLOT( updateWidgets() ) ); - connect( this, SIGNAL( updateWidgetsDefaultSignal() ), - newTab, SLOT( updateWidgetsDefault() ) ); - connect( this, SIGNAL( updateSettingsSignal() ), - newTab, SLOT( updateSettings() ) ); + connect( newTab, SIGNAL(widgetChanged()), + this, SIGNAL(widgetModified()) ); + connect( this, SIGNAL(updateWidgetsSignal()), + newTab, SLOT(updateWidgets()) ); + connect( this, SIGNAL(updateWidgetsDefaultSignal()), + newTab, SLOT(updateWidgetsDefault()) ); + connect( this, SIGNAL(updateSettingsSignal()), + newTab, SLOT(updateSettings()) ); tabWidget->addTab( newTab, dict ); } } @@ -123,19 +122,19 @@ QWidget *ConfigureDialog::makeDictionaryPreferencesPage( QWidget *parent QStringList dictTypes = DictionaryManager::listDictFileTypes(); - KTabWidget *tabWidget = new KTabWidget( parent ); + QTabWidget *tabWidget = new QTabWidget( parent ); QMap<QString,DictionaryPreferenceDialog*> dialogList = DictionaryManager::generatePreferenceDialogs( config, parent ); foreach( DictionaryPreferenceDialog *dialog, dialogList ) { - connect( this, SIGNAL( updateWidgetsSignal() ), - dialog, SLOT( updateWidgets() ) ); - connect( this, SIGNAL( updateWidgetsDefaultSignal() ), - dialog, SLOT( updateWidgetsDefault() ) ); - connect( this, SIGNAL( updateSettingsSignal() ), - dialog, SLOT( updateSettings() ) ); + connect( this, SIGNAL(updateWidgetsSignal()), + dialog, SLOT(updateWidgets()) ); + connect( this, SIGNAL(updateWidgetsDefaultSignal()), + dialog, SLOT(updateWidgetsDefault()) ); + connect( this, SIGNAL(updateSettingsSignal()), + dialog, SLOT(updateSettings()) ); tabWidget->addTab( dialog,dialog->name() ); } @@ -147,15 +146,15 @@ QWidget *ConfigureDialog::makeSortingPage( QWidget *parent, KitenConfigSkeleton { ConfigSortingPage *newPage = new ConfigSortingPage(parent,config); - connect( newPage, SIGNAL( widgetChanged() ), - this, SIGNAL( widgetModified() ) ); + connect( newPage, SIGNAL(widgetChanged()), + this, SIGNAL(widgetModified()) ); - connect( this, SIGNAL( updateWidgetsSignal() ), - newPage, SLOT( updateWidgets() ) ); - connect( this, SIGNAL( updateWidgetsDefaultSignal() ), - newPage, SLOT( updateWidgetsDefault() ) ); - connect( this, SIGNAL( updateSettingsSignal() ), - newPage, SLOT( updateSettings() ) ); + connect( this, SIGNAL(updateWidgetsSignal()), + newPage, SLOT(updateWidgets()) ); + connect( this, SIGNAL(updateWidgetsDefaultSignal()), + newPage, SLOT(updateWidgetsDefault()) ); + connect( this, SIGNAL(updateSettingsSignal()), + newPage, SLOT(updateSettings()) ); return newPage; } @@ -181,4 +180,4 @@ bool ConfigureDialog::isDefault() //Always show the defaults button.... perhaps make a workaround later } -#include "configuredialog.moc" + diff --git a/app/dictionaryupdatemanager.cpp b/app/dictionaryupdatemanager.cpp index 40e372d..78385a1 100644 --- a/app/dictionaryupdatemanager.cpp +++ b/app/dictionaryupdatemanager.cpp @@ -24,20 +24,21 @@ #include "kitenconfig.h" #include "kitenmacros.h" -#include <KAction> +#include <QAction> #include <KActionCollection> -#include <KDebug> -#include <KFilterDev> +#include <QDebug> +#include <KCompressionDevice> #include <KIO/Scheduler> #include <KIO/StoredTransferJob> -#include <KLocale> +#include <KLocalizedString> #include <KMessageBox> -#include <KStandardDirs> -#include <KUrl> +#include <QDir> +#include <QUrl> #include <QTemporaryFile> #include <QTextCodec> #include <QTextStream> +#include <QStandardPaths> // URL to the information file. #define INFO_URL "http://ftp.monash.edu.au/pub/nihongo/edicthdr.txt" @@ -54,22 +55,20 @@ DictionaryUpdateManager::DictionaryUpdateManager( Kiten *parent ) , _failed( QStringList() ) , _counter( 0 ) { - _actionUpdate = _parent->actionCollection()->add<KAction>( "update_dictionaries" ); + _actionUpdate = _parent->actionCollection()->add<QAction>( "update_dictionaries" ); _actionUpdate->setText( i18n( "Check for dictionary &updates" ) ); _actionUpdate->setShortcut( Qt::CTRL+Qt::Key_U ); - connect( _actionUpdate, SIGNAL( triggered() ), - this, SLOT( checkForUpdates() ) ); + connect(_actionUpdate, &QAction::triggered, this, &DictionaryUpdateManager::checkForUpdates); } void DictionaryUpdateManager::checkForUpdates() { - kDebug() << "Checking for EDICT & KANJIDIC updates." << endl; + qDebug() << "Checking for EDICT & KANJIDIC updates." << endl; // Download the information file we need to check // whether or not an update to our dictionaries is necessary. - KIO::StoredTransferJob *job = KIO::storedGet( KUrl( INFO_URL ) ); - connect( job, SIGNAL( result( KJob* ) ), - this, SLOT( checkInfoFile( KJob* ) ) ); + KIO::StoredTransferJob *job = KIO::storedGet( QUrl( INFO_URL ) ); + connect(job, &KIO::StoredTransferJob::result, this, &DictionaryUpdateManager::checkInfoFile); } void DictionaryUpdateManager::checkIfUpdateFinished() @@ -102,7 +101,7 @@ void DictionaryUpdateManager::checkInfoFile( KJob *job ) if( ! tempFile.open() ) { KMessageBox::sorry( 0, i18n( "Update canceled.\nCould not open file." ) ); - kDebug() << "Could not open tempFile." << endl; + qDebug() << "Could not open tempFile." << endl; tempFile.deleteLater(); job->deleteLater(); return; @@ -128,17 +127,16 @@ void DictionaryUpdateManager::checkInfoFile( KJob *job ) // Now we can check our dictionaries. // Connect to this signal to know when the update process is finished. - connect( this, SIGNAL( updateFinished() ), - this, SLOT( showUpdateResults() ) ); + connect(this, &DictionaryUpdateManager::updateFinished, this, &DictionaryUpdateManager::showUpdateResults); // This variable help us to know if we need to download any file. bool updates = false; // Iterate on each of our installed dictionaries. foreach( const QString &dict, _config->dictionary_list() ) { - QString filePath = KGlobal::dirs()->findResource( "data", QString( "kiten/" ) + dict.toLower() ); + QString filePath = QStandardPaths::locate(QStandardPaths::GenericDataLocation, QString( "kiten/" ) + dict.toLower() ); QFile file( filePath ); - kDebug() << "Local dictionary path:" << file.fileName() << endl; + qDebug() << "Local dictionary path:" << file.fileName() << endl; // Get the creation date for this dictionary. QDate localFileDate = getFileDate( file ); @@ -147,14 +145,14 @@ void DictionaryUpdateManager::checkInfoFile( KJob *job ) { // Add it to our 'failed to udate' list. _failed.append( dict.toUpper() ); - kDebug() << "Failed (invalid date):" << dict.toUpper() << endl; + qDebug() << "Failed (invalid date):" << dict.toUpper() << endl; continue; } else if( localFileDate == webFileDate ) { // Add it to our 'up to date' list. _succeeded.append( dict.toUpper() ); - kDebug() << "Success (up to date):" << dict.toUpper() << endl; + qDebug() << "Success (up to date):" << dict.toUpper() << endl; continue; } else @@ -185,18 +183,17 @@ void DictionaryUpdateManager::checkInfoFile( KJob *job ) void DictionaryUpdateManager::downloadDictionary( const QString &url ) { - kDebug() << "Download started!" << endl; + qDebug() << "Download started!" << endl; // Download dictionary. - KIO::StoredTransferJob *dictionaryJob = KIO::storedGet( KUrl( url ) ); - connect( dictionaryJob, SIGNAL( result( KJob* ) ), - this, SLOT( installDictionary( KJob* ) ) ); + KIO::StoredTransferJob *dictionaryJob = KIO::storedGet( QUrl( url ) ); + connect(dictionaryJob, &KIO::StoredTransferJob::result, this, &DictionaryUpdateManager::installDictionary); } QDate DictionaryUpdateManager::getFileDate( QFile &file ) { if( ! file.open( QIODevice::ReadOnly | QIODevice::Text ) ) { - kDebug() << "Could not open " << file.fileName() << endl; + qDebug() << "Could not open " << file.fileName() << endl; return QDate(); } @@ -231,7 +228,7 @@ QDate DictionaryUpdateManager::getFileDate( QFile &file ) file.close(); - kDebug() << "Date found:" << dateSection << "(" << file.fileName() << ")" << endl; + qDebug() << "Date found:" << dateSection << "(" << file.fileName() << ")" << endl; return QDate( year, month, day ); } @@ -244,14 +241,14 @@ void DictionaryUpdateManager::installDictionary( KJob *job ) KIO::StoredTransferJob *storedJob = static_cast<KIO::StoredTransferJob*>( job ); QByteArray data( storedJob->data() ); - QString url( storedJob->url().prettyUrl() ); + QString url( storedJob->url().toDisplayString() ); // What we actually downloaded was a GZIP file that we need to extract. // As there is no need to keep this file, we make it a temporary file. QTemporaryFile compressedFile; if( ! compressedFile.open() ) { - kDebug() << "Could not create the downloaded .gz file." << endl; + qDebug() << "Could not create the downloaded .gz file." << endl; _failed.append( url.contains( EDICT ) ? EDICT : KANJIDIC ); job->deleteLater(); checkIfUpdateFinished(); @@ -261,14 +258,15 @@ void DictionaryUpdateManager::installDictionary( KJob *job ) compressedFile.write( data ); compressedFile.close(); - kDebug() << "Dictionary download finished!" << endl; - kDebug() << "Extracting dictionary..." << endl; + qDebug() << "Dictionary download finished!" << endl; + qDebug() << "Extracting dictionary..." << endl; // Extract the GZIP file. - QIODevice *device = KFilterDev::deviceForFile( compressedFile.fileName(), "application/x-gzip" ); + //QIODevice *device = KFilterDev::deviceForFile( compressedFile.fileName(), "application/x-gzip" ); + KCompressionDevice *device = new KCompressionDevice(compressedFile.fileName(), KCompressionDevice::GZip); if( ! device->open( QIODevice::ReadOnly ) ) { - kDebug() << "Could not extract the dictionary file." << endl; + qDebug() << "Could not extract the dictionary file." << endl; _failed.append( url.contains( EDICT ) ? EDICT : KANJIDIC ); delete device; job->deleteLater(); @@ -282,13 +280,14 @@ void DictionaryUpdateManager::installDictionary( KJob *job ) // Reset the position where we are going to start reading the content. device->reset(); // Thanks to the above lines we can get the path to the correct file to be updated. - QString dictPath = KGlobal::dirs()->locateLocal( "data" - , QString( "kiten/" ) + fileName - , true ); - QFile dictionary( dictPath ); + QString dictPath = QStandardPaths::writableLocation( QStandardPaths::GenericDataLocation) + QString( "/kiten/" ); + QDir dir(dictPath); + dir.mkpath(dictPath); + + QFile dictionary( dictPath + fileName); if( ! dictionary.open( QIODevice::WriteOnly ) ) { - kDebug() << "Could not create the new dictionary file." << endl; + qDebug() << "Could not create the new dictionary file." << endl; _failed.append( fileName.toUpper() ); device->close(); delete device; @@ -307,14 +306,14 @@ void DictionaryUpdateManager::installDictionary( KJob *job ) // Check if we finished updating. checkIfUpdateFinished(); - kDebug() << "Successfully installed at:" << dictionary.fileName() << endl; + qDebug() << "Successfully installed at:" << dictionary.fileName() << endl; } void DictionaryUpdateManager::showUpdateResults() { // Avoid multiple calls to this slot. - disconnect( this, SIGNAL( updateFinished() ), - this, SLOT( showUpdateResults() ) ); + disconnect( this, SIGNAL(updateFinished()), + this, SLOT(showUpdateResults()) ); if( ! _succeeded.isEmpty() && _failed.isEmpty() ) { @@ -341,4 +340,4 @@ void DictionaryUpdateManager::showUpdateResults() _failed.clear(); } -#include "dictionaryupdatemanager.moc" + diff --git a/app/dictionaryupdatemanager.h b/app/dictionaryupdatemanager.h index a63f023..fb95960 100644 --- a/app/dictionaryupdatemanager.h +++ b/app/dictionaryupdatemanager.h @@ -25,7 +25,7 @@ #include <QFile> #include <QStringList> -class KAction; +class QAction; class KJob; class Kiten; class KitenConfigSkeleton; @@ -45,7 +45,7 @@ class DictionaryUpdateManager : public QObject * Constructor. * * @param parent pointer to the Kiten instance. This helps us to add - * KAction actions to the program. + * QAction actions to the program. */ explicit DictionaryUpdateManager( Kiten *parent ); @@ -113,7 +113,7 @@ class DictionaryUpdateManager : public QObject void downloadDictionary( const QString &url ); /** - * We need it to add a KAction action to the main toolbar. + * We need it to add a QAction action to the main toolbar. */ Kiten *_parent; /** @@ -124,7 +124,7 @@ class DictionaryUpdateManager : public QObject /** * Update action. */ - KAction *_actionUpdate; + QAction *_actionUpdate; /** * List of dictionaries already up to date. */ diff --git a/app/entrylistmodel.cpp b/app/entrylistmodel.cpp index adc7ec4..f1d5fc1 100644 --- a/app/entrylistmodel.cpp +++ b/app/entrylistmodel.cpp @@ -109,4 +109,4 @@ QVariant EntryListModel::data ( const QModelIndex & index, int role ) const return QVariant(); } -#include "entrylistmodel.moc" + diff --git a/app/entrylistview.cpp b/app/entrylistview.cpp index b271fe7..72a0435 100644 --- a/app/entrylistview.cpp +++ b/app/entrylistview.cpp @@ -23,8 +23,6 @@ #include "entrylistview.h" -#include <KDebug> - #include <QHeaderView> //These are the ratios for how much space the word and reading headers should @@ -49,4 +47,4 @@ void EntryListView::setEmptyModel() //TODO: implement me } -#include "entrylistview.moc" + diff --git a/app/kiten.cpp b/app/kiten.cpp index 7ab720b..ba5abf9 100644 --- a/app/kiten.cpp +++ b/app/kiten.cpp @@ -24,41 +24,32 @@ #include "kiten.h" -#include <KAction> #include <KActionCollection> -#include <KApplication> #include <KConfig> -#include <KConfigDialog> -#include <KDebug> -#include <kdeversion.h> +#include <KConfigGui> #include <KEditToolBar> -#include <KFileDialog> -#include <KGlobalAccel> -#include <KIconLoader> -#include <KLocale> +#include <KHTMLView> +#include <KLocalizedString> #include <KProcess> #include <KShortcutsDialog> #include <KStandardAction> -#include <KStandardDirs> #include <KStandardGuiItem> -#include <KStatusBar> -#include <KSystemTrayIcon> #include <KToggleAction> -#include <KToolBar> -#include <KUrl> #include <KXmlGuiWindow> +#include <QAction> #include <QApplication> -#include <QBoxLayout> #include <QClipboard> #include <QDockWidget> #include <QFile> #include <QList> #include <QPair> #include <QScrollBar> -#include <QTableWidget> -#include <QTextCodec> +#include <QStatusBar> +#include <QStandardPaths> +#include <QSystemTrayIcon> #include <QTimer> +#include <QVBoxLayout> #include "configuredialog.h" #include "dictionaryupdatemanager.h" @@ -79,14 +70,14 @@ Kiten::Kiten( QWidget *parent, const char *name ) , _radselect_proc( new KProcess( this ) ) , _kanjibrowser_proc( new KProcess( this ) ) { - _radselect_proc->setProgram( KStandardDirs::findExe( "kitenradselect" ) ); - _kanjibrowser_proc->setProgram( KStandardDirs::findExe( "kitenkanjibrowser" ) ); + _radselect_proc->setProgram( QStandardPaths::findExecutable( "kitenradselect" ) ); + _kanjibrowser_proc->setProgram( QStandardPaths::findExecutable( "kitenkanjibrowser" ) ); setStandardToolBarMenuEnabled( true ); setObjectName( QLatin1String( name ) ); /* Set up the config */ _config = KitenConfigSkeleton::self(); - _config->readConfig(); + _config->load(); /* Set up hot keys */ //KDE4 TODO @@ -97,8 +88,8 @@ Kiten::Kiten( QWidget *parent, const char *name ) , Qt::CTRL + Qt::ALT + Qt::Key_S , Qt::CTRL + Qt::ALT + Qt::Key_S , this - , SLOT( searchClipboardContents() ) ); - Accel->readSettings( KGlobal::config() ); + , SLOT(searchClipboardContents()) ); + Accel->readSettings( KSharedConfig::openConfig() ); Accel->updateConnections(); */ /* ResultsView is our main widget, displaying the results of a search */ @@ -124,31 +115,28 @@ Kiten::Kiten( QWidget *parent, const char *name ) _optionDialog = 0; /* Start the system tray icon. */ - _sysTrayIcon = new KSystemTrayIcon( windowIcon(), this ); + _sysTrayIcon = new QSystemTrayIcon( windowIcon(), this ); _sysTrayIcon->show(); /* Set things as they were (as told in the config) */ _autoSearchToggle->setChecked( _config->autosearch() ); _inputManager->setDefaultsFromConfig(); updateConfiguration(); - applyMainWindowSettings( KGlobal::config()->group( "kitenWindow" ) ); + applyMainWindowSettings( KSharedConfig::openConfig()->group( "kitenWindow" ) ); /* What happens when links are clicked or things are selected in the clipboard */ - connect( _mainView, SIGNAL( urlClicked( const QString& ) ), - SLOT( searchText( const QString& ) ) ); - connect( QApplication::clipboard(), SIGNAL( selectionChanged() ), - this, SLOT( searchClipboard() ) ); - connect( _inputManager, SIGNAL( search() ), - this, SLOT( searchFromEdit() ) ); - - connect( _mainView->view()->verticalScrollBar(), SIGNAL( valueChanged( int ) ), - this, SLOT( setCurrentScrollValue( int ) ) ); + connect(_mainView, &ResultsView::urlClicked, this, &Kiten::searchText); + connect( QApplication::clipboard(), SIGNAL(selectionChanged()), + this, SLOT(searchClipboard()) ); + connect(_inputManager, &SearchStringInput::search, this, &Kiten::searchFromEdit); + + connect( _mainView->view()->verticalScrollBar(), SIGNAL(valueChanged(int)), + this, SLOT(setCurrentScrollValue(int)) ); /* We need to know when to reload our dictionaries if the user updated them. */ - connect( _dictionaryUpdateManager, SIGNAL( updateFinished() ), - this, SLOT( loadDictionaries() ) ); + connect(_dictionaryUpdateManager, &DictionaryUpdateManager::updateFinished, this, &Kiten::loadDictionaries); /* See below for what else needs to be done */ - QTimer::singleShot( 10, this, SLOT( finishInit() ) ); + QTimer::singleShot( 10, this, SLOT(finishInit()) ); } // Destructor to clean up the little bits @@ -175,13 +163,13 @@ KitenConfigSkeleton* Kiten::getConfig() void Kiten::setupActions() { /* Add the basic quit/print/prefs actions, use the gui factory for keybindings */ - (void) KStandardAction::quit( this, SLOT( close() ), actionCollection() ); + (void) KStandardAction::quit( this, SLOT(close()), actionCollection() ); //Why the heck is KSA:print adding it's own toolbar!? // (void) KStandardAction::print(this, SLOT(print()), actionCollection()); - (void) KStandardAction::preferences( this, SLOT( slotConfigure() ), actionCollection() ); + (void) KStandardAction::preferences( this, SLOT(slotConfigure()), actionCollection() ); //old style cast seems needed here, (const QObject*) KStandardAction::keyBindings( (const QObject*)guiFactory() - , SLOT( configureShortcuts() ) + , SLOT(configureShortcuts()) , actionCollection() ); /* Setup the Go-to-learn-mode actions */ @@ -193,66 +181,63 @@ void Kiten::setupActions() // , SLOT(createEEdit()) // , actionCollection() // , "dict_editor"); - KAction *radselect = actionCollection()->addAction( "radselect" ); + QAction *radselect = actionCollection()->addAction( "radselect" ); radselect->setText( i18n( "Radical Selector" ) ); // radselect->setIcon( "edit-find" ); radselect->setShortcut( Qt::CTRL+Qt::Key_R ); - connect( radselect, SIGNAL( triggered() ), - this, SLOT( radicalSearch() ) ); + connect(radselect, &QAction::triggered, this, &Kiten::radicalSearch); - KAction *kanjibrowser = actionCollection()->addAction( "kanjibrowser" ); + QAction *kanjibrowser = actionCollection()->addAction( "kanjibrowser" ); kanjibrowser->setText( i18n( "Kanji Browser" ) ); kanjibrowser->setShortcut( Qt::CTRL+Qt::Key_K ); - connect( kanjibrowser, SIGNAL( triggered() ), - this, SLOT( kanjiBrowserSearch() ) ); + connect(kanjibrowser, &QAction::triggered, this, &Kiten::kanjiBrowserSearch); /* Setup the Search Actions and our custom Edit Box */ _inputManager = new SearchStringInput( this ); - KAction *searchButton = actionCollection()->addAction( "search" ); + QAction *searchButton = actionCollection()->addAction( "search" ); searchButton->setText( i18n( "S&earch" ) ); // Set the search button to search - connect( searchButton, SIGNAL( triggered() ), - this, SLOT( searchFromEdit() ) ); + connect(searchButton, &QAction::triggered, this, &Kiten::searchFromEdit); searchButton->setIcon( KStandardGuiItem::find().icon() ); // That's not it, that's "find as you type"... -// connect( Edit, SIGNAL( completion( const QString& ) ), -// this, SLOT( searchFromEdit() ) ); +// connect( Edit, SIGNAL(completion(QString)), +// this, SLOT(searchFromEdit()) ); /* Setup our widgets that handle preferences */ // deinfCB = new KToggleAction( i18n( "&Deinflect Verbs in Regular Search" ) // , 0 // , this -// , SLOT( kanjiDictChange() ) +// , SLOT(kanjiDictChange()) // , actionCollection() // , "deinf_toggle" ); _autoSearchToggle = actionCollection()->add<KToggleAction>( "autosearch_toggle" ); _autoSearchToggle->setText( i18n( "&Automatically Search Clipboard Selections" ) ); - _irAction = actionCollection()->add<KAction>( "search_in_results" ); + _irAction = actionCollection()->add<QAction>( "search_in_results" ); _irAction->setText( i18n( "Search &in Results" ) ); - connect( _irAction, SIGNAL( triggered() ), this, SLOT( searchInResults() ) ); + connect(_irAction, &QAction::triggered, this, &Kiten::searchInResults); - KAction *actionFocusResultsView; + QAction *actionFocusResultsView; actionFocusResultsView = actionCollection()->addAction( "focusresultview" , this - , SLOT( focusResultsView() ) ); - actionFocusResultsView->setShortcut( QString( "Escape" ) ); + , SLOT(focusResultsView()) ); + actionFocusResultsView->setShortcut( Qt::Key_Escape ); actionFocusResultsView->setText( i18n( "Focus result view" ) ); (void) KStandardAction::configureToolbars( this - , SLOT( configureToolBars() ) + , SLOT(configureToolBars()) , actionCollection() ); //TODO: this should probably be a standard action /* globalShortcutsAction = actionCollection()->addAction( "options_configure_global_keybinding" ); globalShortcutsAction->setText( i18n( "Configure &Global Shortcuts..." ) ); - connect( globalShortcutsAction, SIGNAL( triggered() ), this, SLOT( configureGlobalKeys() ) ); + connect( globalShortcutsAction, SIGNAL(triggered()), this, SLOT(configureGlobalKeys()) ); */ //TODO: implement this @@ -263,8 +248,8 @@ void Kiten::setupActions() //globalSearchAction->setGlobalShortcut(shrt); //FIXME: Why does this take ~50 seconds to return!? //connect(globalSearchAction, SIGNAL(triggered()), this, SLOT(searchOnTheSpot())); - _backAction = KStandardAction::back( this, SLOT( back() ), actionCollection() ); - _forwardAction = KStandardAction::forward( this, SLOT( forward() ), actionCollection() ); + _backAction = KStandardAction::back( this, SLOT(back()), actionCollection() ); + _forwardAction = KStandardAction::forward( this, SLOT(forward()), actionCollection() ); _backAction->setEnabled( false ); _forwardAction->setEnabled( false ); } @@ -308,7 +293,7 @@ void Kiten::finishInit() // the app group won't exist and we show demo if ( _config->initialSearch() ) { - if ( ! kapp->sessionConfig()->hasGroup( "app" ) ) + if ( ! KConfigGui::sessionConfig()->hasGroup( "app" ) ) { searchTextAndRaise( QString::fromUtf8( "??" ) ); //Note to future tinkerers... DO NOT EDIT OR TRANSLATE THAT @@ -331,9 +316,10 @@ void Kiten::focusResultsView() bool Kiten::queryClose() { _config->setAutosearch( _autoSearchToggle->isChecked() ); - _config->writeConfig(); + _config->save(); - saveMainWindowSettings( KGlobal::config()->group( "kitenWindow" ) ); + KConfigGroup configGroup = KSharedConfig::openConfig()->group( "kitenWindow" ); + saveMainWindowSettings( configGroup ); return true; } @@ -347,7 +333,7 @@ bool Kiten::queryClose() */ void Kiten::searchFromEdit() { - kDebug() << "SEARCH FROM EDIT CALLED"; + qDebug() << "SEARCH FROM EDIT CALLED"; DictQuery query = _inputManager->getSearchQuery(); if( query != _lastQuery ) { @@ -402,11 +388,11 @@ void Kiten::searchClipboard() searchTextAndRaise(clipboard); } - kDebug() << "Clipboard item is a substring (rejected)"; + qDebug() << "Clipboard item is a substring (rejected)"; } else { - kDebug() << "Clipboard entry too long"; + qDebug() << "Clipboard entry too long"; } } } @@ -544,7 +530,7 @@ void Kiten::displayResults( EntryList *results ) /* void Kiten::searchOnTheSpot() { - kDebug() << "On the spot search!\n"; + qDebug() << "On the spot search!\n"; } */ @@ -575,10 +561,9 @@ void Kiten::slotConfigure() //ConfigureDialog didn't find an instance of this dialog, so lets create it : _optionDialog = new ConfigureDialog( this, _config ); - connect( _optionDialog, SIGNAL( hidden() ), - this, SLOT( slotConfigureHide() ) ); - connect( _optionDialog, SIGNAL( settingsChanged( const QString& ) ), - this, SLOT( updateConfiguration() ) ); + connect( _optionDialog, SIGNAL(hidden()), + this, SLOT(slotConfigureHide()) ); + connect(_optionDialog, &ConfigureDialog::settingsChanged, this, &Kiten::updateConfiguration); _optionDialog->show(); } @@ -614,16 +599,18 @@ void Kiten::createEEdit() void Kiten::configureToolBars() { - saveMainWindowSettings( KGlobal::config()->group( "kitenWindow" ) ); + KConfigGroup configGroup = KSharedConfig::openConfig()->group( "kitenWindow" ); + saveMainWindowSettings( configGroup ); KEditToolBar dlg( actionCollection() ); - connect( &dlg, SIGNAL( newToolBarConfig()), SLOT( newToolBarConfig() ) ); + connect(&dlg, &KEditToolBar::newToolBarConfig, this, &Kiten::newToolBarConfig); dlg.exec(); } void Kiten::newToolBarConfig() { createGUI( "kitenui.rc" ); - applyMainWindowSettings( KGlobal::config()->group( "kitenWindow" ) ); + KConfigGroup configGroup = KSharedConfig::openConfig()->group( "kitenWindow" ); + applyMainWindowSettings( configGroup ); } /** Opens the dialog for configuring the global accelerator keys. */ @@ -681,7 +668,7 @@ void Kiten::loadDictionaries() //Update general options for the display manager (sorting by dict, etc) _dictionaryManager.loadSettings( *_config->config() ); - kDebug() << "Dictionaries loaded!" << endl; + qDebug() << "Dictionaries loaded!" << endl; } /** @@ -690,7 +677,6 @@ void Kiten::loadDictionaries() */ void Kiten::loadDictConfig( const QString &dictType ) { - KStandardDirs *dirs = KGlobal::dirs(); KConfigGroup group = _config->config()->group( "dicts_" + dictType.toLower() ); //A list of QPair's Name->Path @@ -699,7 +685,7 @@ void Kiten::loadDictConfig( const QString &dictType ) //If we need to load the global if( group.readEntry( "__useGlobal", true ) ) { - QString dictionary = dirs->findResource( "data", QString( "kiten/" ) + dictType.toLower() ); + QString dictionary = QStandardPaths::locate(QStandardPaths::GenericDataLocation, QString( "kiten/" ) + dictType.toLower()); dictionariesToLoad.append( qMakePair( dictType, dictionary ) ); } @@ -827,4 +813,4 @@ void Kiten::setCurrentScrollValue( int value ) _historyList.current()->setScrollValue( value ); } -#include "kiten.moc" + diff --git a/app/kiten.h b/app/kiten.h index c206b16..53199b6 100644 --- a/app/kiten.h +++ b/app/kiten.h @@ -32,15 +32,14 @@ #include "entry.h" #include "historyptrlist.h" -class KAction; +class QAction; class KGlobalAccel; class KListAction; class KProcess; -class KStatusBar; -class KSystemTrayIcon; +class QStatusBar; +class QSystemTrayIcon; class KToggleAction; class KitenConfigSkeleton; -class KitenEdit; class QDockWidget; @@ -118,7 +117,7 @@ class Kiten : public KXmlGuiWindow private: - KStatusBar *_statusBar; + QStatusBar *_statusBar; DictionaryManager _dictionaryManager; DictionaryUpdateManager *_dictionaryUpdateManager; SearchStringInput *_inputManager; @@ -127,9 +126,9 @@ class Kiten : public KXmlGuiWindow DictQuery _lastQuery; KToggleAction *_autoSearchToggle; KListAction *_historyAction; - KAction *_irAction; - KAction *_backAction; - KAction *_forwardAction; + QAction *_irAction; + QAction *_backAction; + QAction *_forwardAction; KProcess *_radselect_proc; KProcess *_kanjibrowser_proc; @@ -137,9 +136,9 @@ class Kiten : public KXmlGuiWindow QAction *_globalShortcutsAction; //ResultsView *detachedView; - KAction *_globalSearchAction; + QAction *_globalSearchAction; - KSystemTrayIcon *_sysTrayIcon; + QSystemTrayIcon *_sysTrayIcon; //Export list related: QDockWidget *_exportListDock; diff --git a/app/main.cpp b/app/main.cpp index c249dbd..4dda0a6 100644 --- a/app/main.cpp +++ b/app/main.cpp @@ -21,11 +21,11 @@ *****************************************************************************/ #include <KAboutData> -#include <KCmdLineArgs> -#include <KUniqueApplication> -#include <KXmlGuiWindow> - -#include <QtDBus> +#include <KLocalizedString> +#include <Kdelibs4ConfigMigrator> +#include <QApplication> +#include <QCommandLineParser> +#include <QDBusConnection> #include "kiten.h" @@ -38,29 +38,37 @@ int main( int argc, char *argv[] ) // qInstallMsgHandler(noMessageOutput); //Disable Qt Errors from showing // Copyright and author information - KAboutData aboutData( "kiten", 0, ki18n("Kiten"), "1.3", ki18n("Japanese Reference Tool"), - KAboutData::License_GPL_V2, ki18n("(c) 2001-2004, Jason Katz-Brown\n" + Kdelibs4ConfigMigrator migrate(QLatin1String("kiten")); + migrate.setConfigFiles(QStringList() << QLatin1String("kitenrc")); + migrate.setUiFiles(QStringList() << QLatin1String("kitenui.rc")); + migrate.migrate(); + + KAboutData aboutData( QStringLiteral("kiten"), i18n("Kiten"), QStringLiteral("1.3"), i18n("Japanese Reference Tool"), + KAboutLicense::GPL_V2, i18n("(c) 2001-2004, Jason Katz-Brown\n" "(c) 2006-2007, Eric Kjeldergaard\n" "(c) 2006-2008, Joseph Kerian\n" "(c) 2011, Daniel E. Moctezuma"), - KLocalizedString(), "http://edu.kde.org/kiten" ); + QString(), "http://edu.kde.org/kiten" ); - aboutData.addAuthor( ki18n("Jason Katz-Brown"), ki18n("Original author"), "jason at katzbrown.com" ); - aboutData.addCredit( ki18n("Jim Breen"), ki18n("Wrote xjdic, of which Kiten borrows code, and the xjdic index file generator.\nAlso is main author of edict and kanjidic, which Kiten essentially require."), "jwb at csse.monash.edu.au" ); - aboutData.addAuthor( ki18n("Neil Stevens"), ki18n("Code simplification, UI suggestions."), "neil at qualityassistant.com" ); - aboutData.addCredit( ki18n("David Vignoni"), ki18n("svg icon"), "david80v at tin.it"); - aboutData.addCredit( ki18n("Paul Temple"), ki18n("Porting to KConfig XT, bug fixing"), "paul.temple at gmx.net" ); - aboutData.addAuthor( ki18n("Joseph Kerian"), ki18n("KDE4 rewrite"), "jkerian at gmail.com" ); - aboutData.addAuthor( ki18n("Eric Kjeldergaard"), ki18n("KDE4 rewrite"), "kjelderg at gmail.com" ); - aboutData.addAuthor( ki18n("Daniel E. Moctezuma"), ki18n("Deinflection system improvements, Dictionary updates for EDICT and KANJIDIC, GUI Improvements, Kanji Browser, Bug fixes, Code polishing and simplification"), "democtezuma at gmail.com" ); + aboutData.addAuthor( i18n("Jason Katz-Brown"), i18n("Original author"), "jason at katzbrown.com" ); + aboutData.addCredit( i18n("Jim Breen"), i18n("Wrote xjdic, of which Kiten borrows code, and the xjdic index file generator.\nAlso is main author of edict and kanjidic, which Kiten essentially require."), "jwb at csse.monash.edu.au" ); + aboutData.addAuthor( i18n("Neil Stevens"), i18n("Code simplification, UI suggestions."), "neil at qualityassistant.com" ); + aboutData.addCredit( i18n("David Vignoni"), i18n("svg icon"), "david80v at tin.it"); + aboutData.addCredit( i18n("Paul Temple"), i18n("Porting to KConfig XT, bug fixing"), "paul.temple at gmx.net" ); + aboutData.addAuthor( i18n("Joseph Kerian"), i18n("KDE4 rewrite"), "jkerian at gmail.com" ); + aboutData.addAuthor( i18n("Eric Kjeldergaard"), i18n("KDE4 rewrite"), "kjelderg at gmail.com" ); + aboutData.addAuthor( i18n("Daniel E. Moctezuma"), i18n("Deinflection system improvements, Dictionary updates for EDICT and KANJIDIC, GUI Improvements, Kanji Browser, Bug fixes, Code polishing and simplification"), "democtezuma at gmail.com" ); aboutData.setOrganizationDomain( "kde.org" ); //Set this for the DBUS ID - KCmdLineArgs::init( argc, argv, &aboutData ); - - KCmdLineOptions options; - KCmdLineArgs::addCmdLineOptions( options ); // Add our own options. + QApplication app(argc, argv); + QCommandLineParser parser; + KAboutData::setApplicationData(aboutData); - KUniqueApplication app; + parser.addVersionOption(); + parser.addHelpOption(); + aboutData.setupCommandLine(&parser); + parser.process(app); + aboutData.processCommandLine(&parser); Kiten *kiten = new Kiten(); diff --git a/app/kiten.desktop b/app/org.kde.kiten.desktop similarity index 99% rename from app/kiten.desktop rename to app/org.kde.kiten.desktop index 1c2b396..b2a8680 100644 --- a/app/kiten.desktop +++ b/app/org.kde.kiten.desktop @@ -196,3 +196,4 @@ Terminal=false Type=Application Icon=kiten Categories=Qt;KDE;Education;Languages; +X-DBUS-ServiceName=org.kde.kiten diff --git a/app/resultsview.cpp b/app/resultsview.cpp index 43f1504..f67f8ed 100644 --- a/app/resultsview.cpp +++ b/app/resultsview.cpp @@ -25,16 +25,10 @@ #include "kitenconfig.h" -#include <KActionCollection> -#include <KActionMenu> #include <KColorScheme> -#include <KConfig> -#include <KLocale> -#include <KMenu> +#include <KHTMLView> /* Needed by ResultsView only */ -#include <QApplication> -#include <QPainter> #include <QScrollBar> ResultsView::ResultsView( QWidget *parent, const char *name ) @@ -48,14 +42,14 @@ ResultsView::ResultsView( QWidget *parent, const char *name ) // don't let ktextbrowser internally handle link clicks ////////setNotifyClick(true); - connect( view(), SIGNAL( finishedLayout() ), - this, SLOT( doScroll() ) ); + connect( view(), SIGNAL(finishedLayout()), + this, SLOT(doScroll()) ); } /** * As the name implies, it appends @param text to the printText */ -inline void ResultsView::append( const QString &text ) +void ResultsView::append( const QString &text ) { _printText.append( text ); } @@ -210,7 +204,7 @@ void ResultsView::setContents( const QString &text ) write( text ); end(); - kDebug() << "Set CSS to " << generateCSS(); + qDebug() << "Set CSS to " << generateCSS(); //KDE4 CHANGE setCursorPosition( 0,0 ); ////////ensureCursorVisible(); } @@ -227,9 +221,9 @@ bool ResultsView::urlSelected( const QString &url, const KParts::OpenUrlArguments& args, const KParts::BrowserArguments& browserArgs ) { - //kDebug() << nodeUnderMouse().parentNode().parentNode().parentNode().toHTML(); + //qDebug() << nodeUnderMouse().parentNode().parentNode().parentNode().toHTML(); emit urlClicked( url ); return KHTMLPart::urlSelected( url, button, state, _target, args, browserArgs ); } -#include "resultsview.moc" + diff --git a/app/resultsview.h b/app/resultsview.h index bf043b1..6bc8a25 100644 --- a/app/resultsview.h +++ b/app/resultsview.h @@ -23,14 +23,8 @@ #ifndef RESULTSVIEW_H #define RESULTSVIEW_H -#include <KAction> +#include <QAction> #include <KHTMLPart> -#include <KHTMLView> -#include <KLineEdit> -#include <KTextBrowser> -#include <KXmlGuiWindow> - -#include <QPointer> #include "entry.h" diff --git a/app/searchstringinput.cpp b/app/searchstringinput.cpp index 5e85047..d4ac9de 100644 --- a/app/searchstringinput.cpp +++ b/app/searchstringinput.cpp @@ -24,19 +24,14 @@ #include "kiten.h" #include "kitenconfig.h" -#include <KAction> #include <KActionCollection> -#include <KConfig> -#include <KDebug> -#include <kdeversion.h> -#include <KEditToolBar> #include <KHistoryComboBox> -#include <KLocale> +#include <KLocalizedString> #include <KSelectAction> -#include <KToggleAction> #include <KToolBar> -#include <QClipboard> +#include <QAction> +#include <QDebug> #include <QLineEdit> SearchStringInput::SearchStringInput( Kiten *parent ) @@ -72,25 +67,25 @@ SearchStringInput::SearchStringInput( Kiten *parent ) _actionTextInput->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ); updateFontFromConfig(); - _actionFocusInput = _parent->actionCollection()->addAction( "focusinputfield", this, SLOT( focusInput() ) ); - _actionFocusInput->setShortcut( QString( "Ctrl+L" ) ); + _actionFocusInput = _parent->actionCollection()->addAction( "focusinputfield", this, SLOT(focusInput()) ); + _actionFocusInput->setShortcut( Qt::CTRL+Qt::Key_L ); _actionFocusInput->setText( i18n( "Focus input field" ) ); - KAction *actionsearchbox = _parent->actionCollection()->addAction( "searchbox" ); + QWidgetAction *actionsearchbox = new QWidgetAction(this); actionsearchbox->setText( i18n( "Search Bar" ) ); - actionsearchbox->setDefaultWidget( _actionTextInput ); - + actionsearchbox->setDefaultWidget(_actionTextInput); + _parent->actionCollection()->addAction( "searchbox", actionsearchbox ); + if( ! _actionFilterRare || ! _actionSearchSection || ! _actionSelectWordType || ! actionsearchbox ) { - kError() << "Error creating user interface elements: " + qCritical() << "Error creating user interface elements: " << ! _actionFilterRare << ! _actionSearchSection << ! _actionSelectWordType << ! actionsearchbox; } //connect(actionTextInput, SIGNAL(returnPressed()), this, SIGNAL(search())); - connect( _actionTextInput, SIGNAL( activated( const QString& ) ), - this, SLOT( test() ) ); + connect(_actionTextInput, static_cast<void (KHistoryComboBox::*)(const QString &)>(&KHistoryComboBox::activated), this, &SearchStringInput::test); } void SearchStringInput::focusInput() @@ -125,7 +120,7 @@ void SearchStringInput::setDefaultsFromConfig() void SearchStringInput::setSearchQuery( const DictQuery &query ) { - kDebug() << "------------------------------Set Triggered"; + qDebug() << "------------------------------Set Triggered"; //First we set the various actions according to the query _actionFilterRare->setCurrentItem( query.getFilterType() ); _actionSearchSection->setCurrentItem( query.getMatchType() ); @@ -147,9 +142,9 @@ void SearchStringInput::setSearchQuery( const DictQuery &query ) void SearchStringInput::test() { - kDebug() << "test1"; + qDebug() << "test1"; emit search(); - kDebug() << "test2"; + qDebug() << "test2"; } void SearchStringInput::updateFontFromConfig() @@ -157,4 +152,4 @@ void SearchStringInput::updateFontFromConfig() _actionTextInput->setFont( KitenConfigSkeleton::self()->font() ); } -#include "searchstringinput.moc" + diff --git a/app/searchstringinput.h b/app/searchstringinput.h index 43e15ba..c00d0a8 100644 --- a/app/searchstringinput.h +++ b/app/searchstringinput.h @@ -24,10 +24,9 @@ #include "dictquery.h" -class KAction; +class QAction; class KHistoryComboBox; class KSelectAction; -class KToggleAction; class Kiten; class WordType; @@ -58,7 +57,7 @@ class SearchStringInput : public QObject KSelectAction *_actionSearchSection; KSelectAction *_actionSelectWordType; KHistoryComboBox *_actionTextInput; - KAction *_actionFocusInput; + QAction *_actionFocusInput; Kiten *_parent; }; diff --git a/app/wordtype.cpp b/app/wordtype.cpp index 129a670..bf9e868 100644 --- a/app/wordtype.cpp +++ b/app/wordtype.cpp @@ -23,7 +23,6 @@ #include "entry.h" #include <KComboBox> -#include <KDebug> WordType::WordType( QWidget *parent ) : KComboBox( parent ) @@ -35,4 +34,4 @@ WordType::WordType( QWidget *parent ) // addItems( Entry::WordTypesPretty()->uniqueKeys() ); } -#include "wordtype.moc" + diff --git a/app/wordtype.h b/app/wordtype.h index 904f3e8..33a7af4 100644 --- a/app/wordtype.h +++ b/app/wordtype.h @@ -23,7 +23,6 @@ #ifndef WORDTYPE_H #define WORDTYPE_H -#include <KAction> #include <KComboBox> #include <QWidget> diff --git a/data/pics/CMakeLists.txt b/data/pics/CMakeLists.txt index 79dc91e..bd516d0 100644 --- a/data/pics/CMakeLists.txt +++ b/data/pics/CMakeLists.txt @@ -5,10 +5,16 @@ ########### install files ############### -kde4_install_icons( ${ICON_INSTALL_DIR} ) - - - +ecm_install_icons( ICONS + hi22-apps-kiten.png + hi16-apps-kiten.png + hi32-apps-kiten.png + hi48-apps-kiten.png + hi64-apps-kiten.png + hi128-apps-kiten.png + hisc-apps-kiten.svgz + DESTINATION ${ICON_INSTALL_DIR} + THEME hicolor) #original Makefile.am contents follow: diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt index 36db279..da58b46 100644 --- a/doc/CMakeLists.txt +++ b/doc/CMakeLists.txt @@ -1,4 +1,4 @@ ########### install files ############### # # -kde4_create_handbook(index.docbook INSTALL_DESTINATION ${HTML_INSTALL_DIR}/en SUBDIR kiten) +kdoctools_create_handbook(index.docbook INSTALL_DESTINATION ${HTML_INSTALL_DIR}/en SUBDIR kiten) diff --git a/doc/index.docbook b/doc/index.docbook index 5d563d5..00cc694 100644 --- a/doc/index.docbook +++ b/doc/index.docbook @@ -1,5 +1,5 @@ <?xml version="1.0" ?> -<!DOCTYPE book PUBLIC "-//KDE//DTD DocBook XML V4.2-Based Variant V1.1//EN" "dtd/kdex.dtd" [ +<!DOCTYPE book PUBLIC "-//KDE//DTD DocBook XML V4.5-Based Variant V1.1//EN" "dtd/kdedbx45.dtd" [ <!ENTITY kappname "&kiten;"> <!ENTITY package "kdeedu"> <!ENTITY % addindex "IGNORE"> diff --git a/kanjibrowser/CMakeLists.txt b/kanjibrowser/CMakeLists.txt index b0ceb30..ca69e21 100644 --- a/kanjibrowser/CMakeLists.txt +++ b/kanjibrowser/CMakeLists.txt @@ -6,16 +6,21 @@ set(kanjibrowser_bin_SRCS main.cpp ) -kde4_add_ui_files(kanjibrowser_bin_SRCS kanjibrowserview.ui preferences.ui) -kde4_add_kcfg_files(kanjibrowser_bin_SRCS kanjibrowserconfig.kcfgc) +ki18n_wrap_ui(kanjibrowser_bin_SRCS kanjibrowserview.ui preferences.ui) +kconfig_add_kcfg_files(kanjibrowser_bin_SRCS kanjibrowserconfig.kcfgc) -kde4_add_app_icon(kanjibrowser_bin_SRCS "${CMAKE_CURRENT_SOURCE_DIR}/../data/pics/hi*-apps-kiten.png") +# # kde4_add_app_icon(kanjibrowser_bin_SRCS "${CMAKE_CURRENT_SOURCE_DIR}/../data/pics/hi*-apps-kiten.png") -kde4_add_executable(kanjibrowser_bin ${kanjibrowser_bin_SRCS}) +add_executable(kanjibrowser_bin ${kanjibrowser_bin_SRCS}) set_target_properties(kanjibrowser_bin PROPERTIES OUTPUT_NAME kitenkanjibrowser) -target_link_libraries(kanjibrowser_bin ${KDE4_KDEUI_LIBS} kiten) +target_link_libraries(kanjibrowser_bin + kiten + Qt5::Widgets + KF5::Completion + KF5::I18n + KF5::XmlGui) install( TARGETS kanjibrowser_bin ${INSTALL_TARGETS_DEFAULT_ARGS} ) ############## install files #################### -install( PROGRAMS kitenkanjibrowser.desktop DESTINATION ${XDG_APPS_INSTALL_DIR} ) -install( FILES kanjibrowserui.rc DESTINATION ${DATA_INSTALL_DIR}/kitenkanjibrowser ) +install( PROGRAMS org.kde.kitenkanjibrowser.desktop DESTINATION ${XDG_APPS_INSTALL_DIR} ) +install( FILES kanjibrowserui.rc DESTINATION ${KXMLGUI_INSTALL_DIR}/kitenkanjibrowser ) diff --git a/kanjibrowser/kanjibrowser.cpp b/kanjibrowser/kanjibrowser.cpp index 79f7a02..23d4e6f 100644 --- a/kanjibrowser/kanjibrowser.cpp +++ b/kanjibrowser/kanjibrowser.cpp @@ -27,12 +27,12 @@ #include "kanjibrowserview.h" #include "kitenmacros.h" +#include <QStatusBar> + #include <KActionCollection> -#include <KApplication> #include <KConfigDialog> +#include <KLocalizedString> #include <KStandardAction> -#include <KStandardDirs> -#include <KStatusBar> KanjiBrowser::KanjiBrowser() : KXmlGuiWindow() @@ -40,17 +40,16 @@ KanjiBrowser::KanjiBrowser() { // Read the configuration file. _config = KanjiBrowserConfigSkeleton::self(); - _config->readConfig(); + _config->load(); statusBar()->show(); // Add some actions. - KStandardAction::quit( kapp, SLOT( quit() ), actionCollection() ); - KStandardAction::preferences( this, SLOT( showPreferences() ), actionCollection() ); + KStandardAction::quit( this, SLOT(close()), actionCollection() ); + KStandardAction::preferences( this, SLOT(showPreferences()), actionCollection() ); _view = new KanjiBrowserView( this->parentWidget() ); - connect( _view, SIGNAL( statusBarChanged( const QString&) ), - this, SLOT( changeStatusBar( const QString& ) ) ); + connect(_view, &KanjiBrowserView::statusBarChanged, this, &KanjiBrowser::changeStatusBar); // Load the necessary information and setup the view. loadKanji(); @@ -80,10 +79,9 @@ void KanjiBrowser::loadKanji() return; } - kDebug() << "Loading kanji..." << endl; + qDebug() << "Loading kanji..." << endl; - QString dictionary = KGlobal::dirs()->findResource( "data" - , "kiten/kanjidic" ); + QString dictionary = QStandardPaths::locate(QStandardPaths::GenericDataLocation, "kiten/kanjidic"); _dictFileKanjidic = new DictFileKanjidic(); _dictFileKanjidic->loadSettings(); _dictFileKanjidic->loadDictionary( dictionary, KANJIDIC ); @@ -133,8 +131,8 @@ void KanjiBrowser::loadKanji() // Sort them. qSort( gradeList ); qSort( strokeList ); - kDebug() << "Max. grade:" << gradeList.last() << endl; - kDebug() << "Max. stroke count:" << strokeList.last() << endl; + qDebug() << "Max. grade:" << gradeList.last() << endl; + qDebug() << "Max. stroke count:" << strokeList.last() << endl; // Finaly setup the view. _view->setupView( this, kanjiList, gradeList, strokeList ); @@ -153,9 +151,8 @@ void KanjiBrowser::showPreferences() KConfigDialog *dialog = new KConfigDialog( this, "settings", KanjiBrowserConfigSkeleton::self() ); dialog->addPage( preferences, i18n( "Settings" ), "help-contents" ); - connect( dialog, SIGNAL( settingsChanged( const QString& ) ), - _view, SLOT( loadSettings() ) ); + connect(dialog, &KConfigDialog::settingsChanged, _view, &KanjiBrowserView::loadSettings); dialog->show(); } -#include "kanjibrowser.moc" + diff --git a/kanjibrowser/kanjibrowserconfig.kcfg b/kanjibrowser/kanjibrowserconfig.kcfg index a733068..8ecf5e1 100644 --- a/kanjibrowser/kanjibrowserconfig.kcfg +++ b/kanjibrowser/kanjibrowserconfig.kcfg @@ -4,14 +4,14 @@ xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0 http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" > <include>kfontrequester.h</include> - <include>kglobalsettings.h</include> + <include>QFontDatabase</include> <include>qfont.h</include> <kcfgfile name="kitenkanjibrowserrc"/> <group name="Options"> <entry key="kanjiListFont" type="Font"> <code> - QFont kanjiListFnt = KGlobalSettings::generalFont(); + QFont kanjiListFnt = QFontDatabase::systemFont(QFontDatabase::GeneralFont); kanjiListFnt.setPointSize( 24 ); </code> <default>kanjiListFnt</default> @@ -23,7 +23,7 @@ <entry key="kanaFont" type="Font"> <code> - QFont kanaFnt = KGlobalSettings::generalFont(); + QFont kanaFnt = QFontDatabase::systemFont(QFontDatabase::GeneralFont); kanaFnt.setPointSize( 22 ); </code> <default>kanaFnt</default> @@ -31,7 +31,7 @@ <entry key="labelFont" type="Font"> <code> - QFont labelFnt = KGlobalSettings::generalFont(); + QFont labelFnt = QFontDatabase::systemFont(QFontDatabase::GeneralFont); labelFnt.setPointSize( 22 ); labelFnt.setWeight( QFont::Bold ); </code> diff --git a/kanjibrowser/kanjibrowserview.cpp b/kanjibrowser/kanjibrowserview.cpp index 33b23b9..67635c3 100644 --- a/kanjibrowser/kanjibrowserview.cpp +++ b/kanjibrowser/kanjibrowserview.cpp @@ -27,10 +27,10 @@ #include "kanjibrowser.h" #include "kanjibrowserconfig.h" -#include <KAction> +#include <QAction> +#include <QDebug> #include <KActionCollection> -#include <KConfigSkeleton> -#include <KDebug> +#include <KLocalizedString> #include <KMessageBox> KanjiBrowserView::KanjiBrowserView( QWidget *parent ) @@ -229,8 +229,8 @@ void KanjiBrowserView::setupView( KanjiBrowser *parent { if( kanji.isEmpty() || kanjiGrades.isEmpty() || strokeCount.isEmpty() ) { - kDebug() << "One or more of our lists are empty (kanji, grades, strokes)." << endl; - kDebug() << "Could not load the view properly." << endl; + qDebug() << "One or more of our lists are empty (kanji, grades, strokes)." << endl; + qDebug() << "Could not load the view properly." << endl; KMessageBox::error( this, i18n( "Could not load the necessary kanji information." ) ); return; } @@ -240,7 +240,7 @@ void KanjiBrowserView::setupView( KanjiBrowser *parent _gradeList = kanjiGrades; _strokesList = strokeCount; - KAction *goToKanjiList = _parent->actionCollection()->addAction( "kanji_list" ); + QAction *goToKanjiList = _parent->actionCollection()->addAction( "kanji_list" ); goToKanjiList->setText( i18n( "Kanji &List" ) ); _goToKanjiInfo = _parent->actionCollection()->addAction( "kanji_info" ); @@ -267,18 +267,12 @@ void KanjiBrowserView::setupView( KanjiBrowser *parent _strokes->addItem( i18np( "%1 stroke", "%1 strokes", stroke ) ); } - connect( _grades, SIGNAL( currentIndexChanged( int ) ), - this, SLOT( changeGrade( int ) ) ); - connect( _strokes, SIGNAL( currentIndexChanged( int ) ), - this, SLOT( changeStrokeCount( int ) ) ); - connect( _kanjiList, SIGNAL( itemClicked( QListWidgetItem* ) ), - this, SLOT( searchKanji( QListWidgetItem* ) ) ); - connect( _kanjiList, SIGNAL( itemClicked( QListWidgetItem* ) ), - _goToKanjiInfo, SIGNAL( triggered() ) ); - connect( goToKanjiList, SIGNAL( triggered() ), - this, SLOT( changeToListPage() ) ); - connect( _goToKanjiInfo, SIGNAL( triggered() ), - this, SLOT( changeToInfoPage() ) ); + connect(_grades, static_cast<void (KComboBox::*)(int)>(&KComboBox::currentIndexChanged), this, &KanjiBrowserView::changeGrade); + connect(_strokes, static_cast<void (KComboBox::*)(int)>(&KComboBox::currentIndexChanged), this, &KanjiBrowserView::changeStrokeCount); + connect(_kanjiList, &QListWidget::itemClicked, this, &KanjiBrowserView::searchKanji); + connect(_kanjiList, &QListWidget::itemClicked, _goToKanjiInfo, &QAction::triggered); + connect(goToKanjiList, &QAction::triggered, this, &KanjiBrowserView::changeToListPage); + connect(_goToKanjiInfo, &QAction::triggered, this, &KanjiBrowserView::changeToInfoPage); // Set the current grade (Grade 1). _grades->setCurrentIndex( 1 ); @@ -288,7 +282,7 @@ void KanjiBrowserView::setupView( KanjiBrowser *parent _strokes->setCurrentIndex( 1 ); _strokes->setCurrentIndex( NoStrokeLimit ); - kDebug() << "Initial setup succeeded!" << endl; + qDebug() << "Initial setup succeeded!" << endl; } void KanjiBrowserView::showKanjiInformation( const EntryKanjidic *kanji ) @@ -375,4 +369,4 @@ void KanjiBrowserView::showKanjiInformation( const EntryKanjidic *kanji ) _kanjiInformation->setHtml( text ); } -#include "kanjibrowserview.moc" + diff --git a/kanjibrowser/kanjibrowserview.h b/kanjibrowser/kanjibrowserview.h index 3902d56..04d97e3 100644 --- a/kanjibrowser/kanjibrowserview.h +++ b/kanjibrowser/kanjibrowserview.h @@ -24,7 +24,7 @@ #include "ui_kanjibrowserview.h" class EntryKanjidic; -class KAction; +class QAction; class KanjiBrowser; class QListWidgetItem; @@ -44,7 +44,7 @@ class KanjiBrowserView : public QWidget, private Ui::KanjiBrowserView /** * Initial setup. * - * @param parent parent to which we are going to add some KActions + * @param parent parent to which we are going to add some QActions * @param kanji hash containing kanji with its grades and number of strokes * @param kanjiGrades sorted list of grades found in KANJIDIC * @param strokeCount sorted list of strokes found in KANJIDIC @@ -138,13 +138,13 @@ class KanjiBrowserView : public QWidget, private Ui::KanjiBrowserView }; /** - * We need this as we are going to add some KActions to it. + * We need this as we are going to add some QActions to it. */ KanjiBrowser *_parent; /** * We need to update this action's text from different functions. */ - KAction *_goToKanjiInfo; + QAction *_goToKanjiInfo; /** * Keep track of the current kanji being displayed in the Kanji Information page. */ diff --git a/kanjibrowser/main.cpp b/kanjibrowser/main.cpp index dee2ff0..9d55899 100644 --- a/kanjibrowser/main.cpp +++ b/kanjibrowser/main.cpp @@ -18,11 +18,11 @@ * Boston, MA 02110-1301, USA. * *****************************************************************************/ -#include <KAboutData> -#include <KCmdLineArgs> -#include <KLocale> -#include <KUniqueApplication> +#include <QApplication> +#include <KAboutData> +#include <KLocalizedString> +#include <Kdelibs4ConfigMigrator> #include "kanjibrowser.h" static const char description[] = I18N_NOOP( "Kiten's Kanji Browser, a KDE Japanese Reference Tool" ); @@ -30,25 +30,29 @@ static const char version[] = "1.0"; int main( int argc, char **argv ) { - KAboutData about( "kitenkanjibrowser" - , "kiten" - , ki18n( "kitenkanjibrowser" ) - , version - , ki18n( description ) - , KAboutData::License_GPL_V2 - , ki18n( "(C) 2011 Daniel E. Moctezuma" ) - , KLocalizedString() - , "http://edu.kde.org/kiten" + Kdelibs4ConfigMigrator migrate(QLatin1String("kitenkanjibrowser")); + migrate.setConfigFiles(QStringList() << QLatin1String("kitenkanjibrowserrc")); + migrate.setUiFiles(QStringList() << QLatin1String("kanjibrowserui.rc")); + migrate.migrate(); + + KAboutData about( QStringLiteral("kitenkanjibrowser") + , i18n( "kitenkanjibrowser" ) + , QStringLiteral("1.0") + , i18n( description ) + , KAboutLicense::GPL_V2 + , i18n( "(C) 2011 Daniel E. Moctezuma" ) + , QString() + , QStringLiteral("http://edu.kde.org/kiten") , "democtezuma at gmail.com" ); - about.addAuthor( ki18n( "Daniel E. Moctezuma" ) - , KLocalizedString() + about.addAuthor( i18n( "Daniel E. Moctezuma" ) + , QString() , "democtezuma at gmail.com" ); about.setOrganizationDomain( "kde.org" ); about.setProgramIconName( "kiten" ); - KCmdLineArgs::init( argc, argv, &about ); - - KUniqueApplication app; + QApplication app(argc, argv); + KAboutData::setApplicationData(about); + if( app.isSessionRestored() ) { RESTORE( KanjiBrowser ); diff --git a/kanjibrowser/kitenkanjibrowser.desktop b/kanjibrowser/org.kde.kitenkanjibrowser.desktop similarity index 96% rename from kanjibrowser/kitenkanjibrowser.desktop rename to kanjibrowser/org.kde.kitenkanjibrowser.desktop index e3384d2..82c9c9c 100644 --- a/kanjibrowser/kitenkanjibrowser.desktop +++ b/kanjibrowser/org.kde.kitenkanjibrowser.desktop @@ -43,3 +43,4 @@ Type=Application Icon=kiten NoDisplay=true Categories=Qt;KDE;Education;Languages; +X-DBUS-ServiceName=org.kde.kitenkanjibrowser diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index 6675f3e..b8a4cf0 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -1,4 +1,6 @@ ############# kitenlib ################# +set(KITEN_LIB_VERSION "5.0.0") +set(KITEN_LIB_SOVERSION "5") set(edict_SRCS DictEdict/deinflection.cpp DictEdict/dictfileedict.cpp @@ -21,9 +23,17 @@ set(kiten_LIB_SRCS kromajiedit.cpp ${dictionary_SRCS}) -kde4_add_library(kiten SHARED ${kiten_LIB_SRCS}) -target_link_libraries(kiten ${KDE4_KDEUI_LIBS}) -set_target_properties(kiten PROPERTIES VERSION ${GENERIC_LIB_VERSION} SOVERSION ${GENERIC_LIB_SOVERSION}) +add_library(kiten SHARED ${kiten_LIB_SRCS}) +target_link_libraries(kiten + Qt5::Core + Qt5::Widgets + KF5::Completion + KF5::ConfigCore + KF5::ConfigGui + KF5::CoreAddons + KF5::I18n + KF5::WidgetsAddons) +set_target_properties(kiten PROPERTIES VERSION ${KITEN_LIB_VERSION} SOVERSION ${KITEN_LIB_SOVERSION}) install( TARGETS kiten ${INSTALL_TARGETS_DEFAULT_ARGS}) ############ install headers ############# diff --git a/lib/DictEdict/deinflection.cpp b/lib/DictEdict/deinflection.cpp index 2679dd0..4c797c9 100644 --- a/lib/DictEdict/deinflection.cpp +++ b/lib/DictEdict/deinflection.cpp @@ -28,15 +28,13 @@ #include "entryedict.h" #include "entrylist.h" -#include <KDebug> -#include <KLocale> +#include <KLocalizedString> #include <KMessageBox> -#include <KStandardDirs> #include <QFile> #include <QHash> #include <QList> -#include <QRegExp> +#include <QStandardPaths> #include <QString> #include <QTextCodec> #include <QTextStream> @@ -170,10 +168,8 @@ bool Deinflection::load() conjugationList = new QList<Conjugation>; - QString vconj; - KStandardDirs *dirs = KGlobal::dirs(); - vconj = dirs->findResource( "data", "kiten/vconj" ); - + QString vconj = QStandardPaths::locate(QStandardPaths::GenericDataLocation, "kiten/vconj"); + //Find the file if ( vconj.isEmpty() ) { diff --git a/lib/DictEdict/deinflection.h b/lib/DictEdict/deinflection.h index 330f38b..d344555 100644 --- a/lib/DictEdict/deinflection.h +++ b/lib/DictEdict/deinflection.h @@ -24,7 +24,6 @@ #ifndef KITEN_DEINFLECTION_H #define KITEN_DEINFLECTION_H -#include <QStringList> #include "dictfile.h" diff --git a/lib/DictEdict/dictfileedict.cpp b/lib/DictEdict/dictfileedict.cpp index fe5348e..acfa40f 100644 --- a/lib/DictEdict/dictfileedict.cpp +++ b/lib/DictEdict/dictfileedict.cpp @@ -23,15 +23,10 @@ #include "dictfileedict.h" -#include <KApplication> #include <KConfig> #include <KConfigSkeleton> -#include <KDebug> -#include <KGlobal> -#include <KProcess> -#include <KStandardDirs> -#include <QByteArray> +#include <QDebug> #include <QFile> #include <QString> #include <QTextCodec> @@ -92,7 +87,7 @@ EntryList *DictFileEdict::doSearch( const DictQuery &query ) return new EntryList(); } - kDebug()<< "Search from : " << getName(); + qDebug()<< "Search from : " << getName(); QString firstChoice = query.getWord(); if( firstChoice.length() == 0 ) @@ -133,7 +128,7 @@ EntryList *DictFileEdict::doSearch( const DictQuery &query ) EntryList *results = new EntryList(); foreach( const QString &it, preliminaryResults ) { -// kDebug() << "result: " << it << endl; +// qDebug() << "result: " << it << endl; Entry *result = makeEntry( it ); EntryEdict *resultEdict = static_cast<EntryEdict*>( result ); if( result->matchesQuery( query ) && resultEdict->matchesWordType( query ) ) diff --git a/lib/DictEdict/dictfileedict.h b/lib/DictEdict/dictfileedict.h index bc03de3..a2f6b8a 100644 --- a/lib/DictEdict/dictfileedict.h +++ b/lib/DictEdict/dictfileedict.h @@ -31,7 +31,6 @@ #include "libkitenexport.h" #include "linearedictfile.h" -#include <QFile> #include <QMap> #include <sys/types.h> @@ -42,7 +41,6 @@ class DictionaryPreferenceDialog; class EntryEdict; class KConfigSkeleton; class KConfigSkeletonItem; -class QByteArray; class QString; class QStringList; diff --git a/lib/DictEdict/dictfilefieldselector.cpp b/lib/DictEdict/dictfilefieldselector.cpp index 0d6e7b0..242ff24 100644 --- a/lib/DictEdict/dictfilefieldselector.cpp +++ b/lib/DictEdict/dictfilefieldselector.cpp @@ -22,10 +22,8 @@ #include <KActionSelector> #include <KConfigSkeleton> -#include <KLocale> +#include <KLocalizedString> -#include <QFrame> -#include <QLayout> #include <QListWidget> #include <QString> #include <QStringList> @@ -56,14 +54,10 @@ DictFileFieldSelector::DictFileFieldSelector( KConfigSkeleton *config, m_completeList.append( "Meaning" ); //Make connections - connect( m_listView, SIGNAL( added( QListWidgetItem* ) ) - , this, SLOT( settingChanged() ) ); - connect( m_listView, SIGNAL( removed( QListWidgetItem* ) ), - this, SLOT( settingChanged() ) ); - connect( m_listView, SIGNAL( movedUp( QListWidgetItem* ) ), - this, SLOT( settingChanged() ) ); - connect( m_listView, SIGNAL( movedDown( QListWidgetItem* ) ), - this, SLOT( settingChanged() ) ); + connect(m_listView, &KActionSelector::added, this, &DictFileFieldSelector::settingChanged); + connect(m_listView, &KActionSelector::removed, this, &DictFileFieldSelector::settingChanged); + connect(m_listView, &KActionSelector::movedUp, this, &DictFileFieldSelector::settingChanged); + connect(m_listView, &KActionSelector::movedDown, this, &DictFileFieldSelector::settingChanged); m_config = config; updateWidgets(); @@ -99,7 +93,7 @@ void DictFileFieldSelector::readFromPrefs() , itemName , *new QStringList() ) , itemName ); - m_config->readConfig(); + m_config->load(); selectedList = m_config->findItem( itemName )->property().toStringList(); } @@ -165,7 +159,7 @@ void DictFileFieldSelector::writeToPrefs() } item->setProperty( theList ); - m_config->writeConfig(); + m_config->save(); } -#include "dictfilefieldselector.moc" + diff --git a/lib/DictEdict/entryedict.cpp b/lib/DictEdict/entryedict.cpp index abfbbae..dcedd5f 100644 --- a/lib/DictEdict/entryedict.cpp +++ b/lib/DictEdict/entryedict.cpp @@ -25,7 +25,7 @@ #include "dictfileedict.h" #include "kitenmacros.h" -#include <KDebug> +#include <QDebug> #include <KLocalizedString> #define QSTRINGLISTCHECK(x) (x==NULL?QStringList():*x) @@ -395,7 +395,7 @@ QString EntryEdict::toHTML() const else if( field == "Word/Kanji" ) result += HTMLWord()+' '; else if( field == "Meaning" ) result += HTMLMeanings()+' '; else if( field == "Reading" ) result += HTMLReadings()+' '; - else kDebug() << "Unknown field: " << field; + else qDebug() << "Unknown field: " << field; } if( isCommon() ) diff --git a/lib/DictEdict/indexededictfile.cpp b/lib/DictEdict/indexededictfile.cpp index 4c9ac87..4df8456 100644 --- a/lib/DictEdict/indexededictfile.cpp +++ b/lib/DictEdict/indexededictfile.cpp @@ -21,14 +21,12 @@ #include "indexededictfile.h" -#include <KApplication> -#include <KDebug> -#include <KGlobal> +#include <QApplication> #include <KProcess> -#include <KStandardDirs> #include <QFile> #include <QFileInfo> +#include <QStandardPaths> #include <QString> #include <QTextCodec> #include <QVector> @@ -57,13 +55,13 @@ IndexedEdictFile::~IndexedEdictFile() bool IndexedEdictFile::buildIndex() { KProcess proc; - proc << KStandardDirs::findExe("kitengen") << m_dictFile.fileName() << m_indexFile.fileName(); + proc << QStandardPaths::findExecutable("kitengen") << m_dictFile.fileName() << m_indexFile.fileName(); proc.start(); proc.waitForStarted(); do { - KApplication::processEvents(); + QApplication::processEvents(); } while( proc.waitForFinished( 5000 ) ); //FIXME: This just cuts the index generator off after 5 sec //FIXME: Check for the result of this operation @@ -309,8 +307,8 @@ bool IndexedEdictFile::loadFile( const QString &fileName ) } m_dictPtr = static_cast<unsigned char*>( MAP_FAILED ); - m_indexFile.setFileName( KGlobal::dirs()->saveLocation( "data", "kiten/xjdx/", true ) - + QFileInfo( fileName ).baseName() + ".xjdx" ); + m_indexFile.setFileName( QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QLatin1Char('/') + "kiten/xjdx/" + + QFileInfo( fileName ).baseName() + ".xjdx" ); m_indexPtr = static_cast<uint32_t*>( MAP_FAILED ); if( ! m_indexFile.exists() ) { diff --git a/lib/DictEdict/linearedictfile.cpp b/lib/DictEdict/linearedictfile.cpp index bbd1273..b03eef0 100644 --- a/lib/DictEdict/linearedictfile.cpp +++ b/lib/DictEdict/linearedictfile.cpp @@ -21,13 +21,9 @@ #include "linearedictfile.h" -#include <KApplication> -#include <KDebug> -#include <KGlobal> -#include <KProcess> -#include <KStandardDirs> #include <QFile> +#include <QDebug> #include <QTextCodec> LinearEdictFile::LinearEdictFile() @@ -58,7 +54,7 @@ QVector<QString> LinearEdictFile::findMatches( const QString &searchString ) con bool LinearEdictFile::loadFile( const QString& filename ) { - kDebug() << "Loading edict from " << filename << endl; + qDebug() << "Loading edict from " << filename << endl; //if already loaded if ( ! m_edict.isEmpty() ) diff --git a/lib/DictKanjidic/dictfilekanjidic.cpp b/lib/DictKanjidic/dictfilekanjidic.cpp index 55e9eeb..6b3f753 100644 --- a/lib/DictKanjidic/dictfilekanjidic.cpp +++ b/lib/DictKanjidic/dictfilekanjidic.cpp @@ -29,9 +29,8 @@ #include "kitenmacros.h" #include <KConfigSkeleton> -#include <KDebug> -#include <KGlobal> +#include <QDebug> #include <QFile> #include <QTextCodec> @@ -108,7 +107,7 @@ EntryList* DictFileKanjidic::doSearch( const DictQuery &query ) return new EntryList(); } - kDebug() << "Search from:" << getName() << endl; + qDebug() << "Search from:" << getName() << endl; QString searchQuery = query.getWord(); if( searchQuery.length() == 0 ) { @@ -175,7 +174,7 @@ bool DictFileKanjidic::loadDictionary( const QString &file, const QString &name return false; } - kDebug() << "Loading kanjidic from:" << file << endl; + qDebug() << "Loading kanjidic from:" << file << endl; QTextStream fileStream( &dictionary ); fileStream.setCodec( QTextCodec::codecForName( "eucJP" ) ); diff --git a/lib/DictKanjidic/entrykanjidic.cpp b/lib/DictKanjidic/entrykanjidic.cpp index 43f44f7..6f5fe67 100644 --- a/lib/DictKanjidic/entrykanjidic.cpp +++ b/lib/DictKanjidic/entrykanjidic.cpp @@ -26,8 +26,8 @@ #include "dictfilekanjidic.h" #include "kitenmacros.h" -#include <KLocale> -#include <KDebug> +#include <KLocalizedString> +#include <QDebug> #define QSTRINGLISTCHECK(x) (x==NULL?QStringList():*x) @@ -149,7 +149,7 @@ QString EntryKanjidic::getStrokesCount() const QString EntryKanjidic::HTMLExtendedInfo( const QString &field ) const { - //kDebug() << field; + //qDebug() << field; return QString( "<span class=\"ExtendedInfo\">%1: %2</span>" ) .arg( field ) .arg( ExtendedInfo[ field ] ); @@ -220,7 +220,7 @@ bool EntryKanjidic::loadEntry( const QString &entryLine ) else break; \ } - // kDebug() << "LOADSTRING: '" << stringToLoad << "'"; + // qDebug() << "LOADSTRING: '" << stringToLoad << "'"; /* We can start looping at 8 because we have guarantees about the initial data. This loop is used because the kanjidic format allows the data @@ -231,7 +231,7 @@ bool EntryKanjidic::loadEntry( const QString &entryLine ) ichar = entryLine.at( i ); curString = ""; - switch( ichar.toAscii() ) + switch( ichar.unicode() ) { case ' ': /* as far as I can tell, there is no real rule forcing only 1 space so @@ -352,7 +352,7 @@ bool EntryKanjidic::loadEntry( const QString &entryLine ) ichar = entryLine.at( i ); } INCI -// kDebug() << "Meaning's curString: '" << curString << "'"; +// qDebug() << "Meaning's curString: '" << curString << "'"; Meanings.append( curString ); break; case 'T': /* a reading that is used in names for T1, radical names for T2 */ @@ -421,7 +421,7 @@ bool EntryKanjidic::loadEntry( const QString &entryLine ) break; default: /* either a character we don't address or a problem...we should ignore it */ -// kDebug() << "hit default in kanji parser. Unicode: '" << ichar.unicode() << "'"; +// qDebug() << "hit default in kanji parser. Unicode: '" << ichar.unicode() << "'"; /* This should detect unicode kana */ // Hiragana 0x3040 - 0x309F, Katakana: 0x30A0 - 0x30FF @@ -456,7 +456,7 @@ bool EntryKanjidic::loadEntry( const QString &entryLine ) break; } } -// kDebug() << "Parsed: '"<<Word<<"' ("<<Readings.join("^")<<") \""<< +// qDebug() << "Parsed: '"<<Word<<"' ("<<Readings.join("^")<<") \""<< // Meanings.join("|")<<"\ and " <<ExtendedInfo.keys() << " from :"<<entryLine<<endl; return true; @@ -478,7 +478,7 @@ QString EntryKanjidic::toHTML() const foreach( const QString &field, QSTRINGLISTCHECK( DictFileKanjidic::displayFields ) ) { - //kDebug() << "Display: "<<field; + //qDebug() << "Display: "<<field; if( field == "--NewLine--" ) result += "<br>"; else if( field == "Word/Kanji" ) result += HTMLWord() + ' '; else if( field == "Meaning" ) result += HTMLMeanings() + ' '; diff --git a/lib/dictionarymanager.cpp b/lib/dictionarymanager.cpp index ce2e65e..407ae5d 100644 --- a/lib/dictionarymanager.cpp +++ b/lib/dictionarymanager.cpp @@ -28,12 +28,10 @@ #include "entrylist.h" #include "kitenmacros.h" -#include <KDebug> -#include <KGlobal> #include <KConfig> #include <KConfigSkeleton> -#include <QFile> +#include <QDebug> #include <QString> /* Includes to handle various types of dictionaries @@ -118,12 +116,12 @@ bool DictionaryManager::addDictionary( const QString &file if( ! newDict->loadDictionary( file, name ) ) { - kDebug() << "Dictionary load FAILED: " << newDict->getName(); + qDebug() << "Dictionary load FAILED: " << newDict->getName(); delete newDict; return false; } - kDebug() << "Dictionary Loaded : " << newDict->getName(); + qDebug() << "Dictionary Loaded : " << newDict->getName(); d->dictManagers.insert( name, newDict ); return true; } @@ -158,7 +156,7 @@ EntryList *DictionaryManager::doSearch( const DictQuery &query ) const // None specified, search all foreach( DictFile *it, d->dictManagers ) { - kDebug() << "Searching in " << it->getName() << "dictionary." << endl; + qDebug() << "Searching in " << it->getName() << "dictionary." << endl; EntryList *temp = it->doSearch( query ); if( temp ) { @@ -185,8 +183,8 @@ EntryList *DictionaryManager::doSearch( const DictQuery &query ) const } ret->setQuery( query ); //Store the query for later use. - kDebug() << "From query: '" << query.toString() << "' Found " << ret->count() << " results"; - kDebug() << "Incoming match type: " << query.getMatchType() << " Outgoing: " << ret->getQuery().getMatchType(); + qDebug() << "From query: '" << query.toString() << "' Found " << ret->count() << " results"; + qDebug() << "Incoming match type: " << query.getMatchType() << " Outgoing: " << ret->getQuery().getMatchType(); return ret; } diff --git a/lib/dictionarypreferencedialog.cpp b/lib/dictionarypreferencedialog.cpp index c78945e..aa2fc71 100644 --- a/lib/dictionarypreferencedialog.cpp +++ b/lib/dictionarypreferencedialog.cpp @@ -37,4 +37,4 @@ QString DictionaryPreferenceDialog::name() const return m_name; } -#include "dictionarypreferencedialog.moc" + diff --git a/lib/dictquery.cpp b/lib/dictquery.cpp index 6f393c1..326346d 100644 --- a/lib/dictquery.cpp +++ b/lib/dictquery.cpp @@ -28,7 +28,7 @@ TODO: Add features to limit the number of hits on a per-search basis. #include "dictquery.h" -#include <KDebug> +#include <QDebug> #include <QString> #include <QStringList> @@ -359,11 +359,11 @@ DictQuery &DictQuery::operator=( const QString &str ) break; case DictQuery::Mixed: - kWarning() << "DictQuery: String parsing error - mixed type"; + qWarning() << "DictQuery: String parsing error - mixed type"; break; case DictQuery::ParseError: - kWarning() << "DictQuery: String parsing error"; + qWarning() << "DictQuery: String parsing error"; break; } } diff --git a/lib/entry.cpp b/lib/entry.cpp index be3893f..a7c37dc 100644 --- a/lib/entry.cpp +++ b/lib/entry.cpp @@ -24,14 +24,8 @@ #include "entry.h" #include "dictquery.h" -#include <KDebug> -#include <KLocale> -#include <KMessageBox> -#include <KStandardDirs> - -#include <QFileInfo> -#include <QRegExp> -#include <QTextCodec> +#include <KLocalizedString> + #include <iostream> #include <cassert> diff --git a/lib/entry.h b/lib/entry.h index 0c0626e..3259387 100644 --- a/lib/entry.h +++ b/lib/entry.h @@ -25,7 +25,6 @@ #define KITEN_ENTRY_H #include <QHash> -#include <QList> #include <QStringList> #include "libkitenexport.h" diff --git a/lib/entrylist.cpp b/lib/entrylist.cpp index cd3bf32..e33fcc3 100644 --- a/lib/entrylist.cpp +++ b/lib/entrylist.cpp @@ -23,14 +23,8 @@ #include "entrylist.h" -#include <KDebug> -#include <KLocale> -#include <KMessageBox> -#include <KStandardDirs> - -#include <QFileInfo> -#include <QRegExp> -#include <QTextCodec> +#include <KLocalizedString> + #include <sys/mman.h> diff --git a/lib/historyptrlist.cpp b/lib/historyptrlist.cpp index 1e4ed0e..fadb542 100644 --- a/lib/historyptrlist.cpp +++ b/lib/historyptrlist.cpp @@ -24,7 +24,6 @@ #include "entrylist.h" #include <QList> -#include <QMutableListIterator> class HistoryPtrList::Private { diff --git a/lib/kromajiedit.cpp b/lib/kromajiedit.cpp index d19d874..4ac7e80 100644 --- a/lib/kromajiedit.cpp +++ b/lib/kromajiedit.cpp @@ -21,18 +21,15 @@ #include "kromajiedit.h" -#include <KDebug> -#include <KLocale> +#include <KLocalizedString> #include <KMessageBox> -#include <KStandardDirs> #include <QAction> #include <QApplication> -#include <QByteArray> #include <QFile> #include <QKeyEvent> -#include <QMap> #include <QMenu> +#include <QStandardPaths> #include <QTextCodec> #include <QTextStream> @@ -41,8 +38,7 @@ KRomajiEdit::KRomajiEdit( QWidget *parent, const char *name ) { m_kana = "unset"; - KStandardDirs *dirs = KGlobal::dirs(); - QString romkana = dirs->findResource( "data", "kiten/romkana.cnv" ); + QString romkana = QStandardPaths::locate(QStandardPaths::GenericDataLocation, "kiten/romkana.cnv"); if ( romkana.isNull() ) { KMessageBox::error( 0, i18n( "Romaji information file not installed, so Romaji conversion cannot be used." ) ); @@ -138,8 +134,8 @@ QMenu *KRomajiEdit::createPopupMenu() temp->setChecked( false ); } - connect( group, SIGNAL( triggered( QAction* ) ), - SLOT( setKana( QAction* ) ) ); + connect( group, SIGNAL(triggered(QAction*)), + SLOT(setKana(QAction*)) ); emit aboutToShowContextMenu( menu ); return menu; @@ -340,4 +336,4 @@ void KRomajiEdit::setKana( QAction *action ) } } -#include "kromajiedit.moc" + diff --git a/lib/libkitenexport.h b/lib/libkitenexport.h index d520f5b..8bf784f 100644 --- a/lib/libkitenexport.h +++ b/lib/libkitenexport.h @@ -21,7 +21,8 @@ #ifndef KITEN_LIBKITENEXPORT_H #define KITEN_LIBKITENEXPORT_H -#include <kdemacros.h> +#define KDE_EXPORT __attribute__ ((visibility("default"))) +#define KDE_IMPORT __attribute__ ((visibility("default"))) #if defined Q_OS_WIN # ifndef KITEN_EXPORT diff --git a/radselect/CMakeLists.txt b/radselect/CMakeLists.txt index 0d21a8f..96d3464 100644 --- a/radselect/CMakeLists.txt +++ b/radselect/CMakeLists.txt @@ -10,17 +10,24 @@ set(radselect_bin_SRCS radselect.cpp radselectview.cpp ) -kde4_add_ui_files(radselect_bin_SRCS radical_selector.ui radselectprefdialog.ui) -kde4_add_kcfg_files(radselect_bin_SRCS radselectconfig.kcfgc) +ki18n_wrap_ui(radselect_bin_SRCS radical_selector.ui radselectprefdialog.ui) +kconfig_add_kcfg_files(radselect_bin_SRCS radselectconfig.kcfgc) #kde4_add_app_icon(radselect_bin_SRCS "${CMAKE_INSTALL_PREFIX}/share/icons/oxygen/*/apps/kiten.png") -kde4_add_app_icon(radselect_bin_SRCS "${CMAKE_CURRENT_SOURCE_DIR}/../data/pics/hi*-apps-kiten.png") +# # kde4_add_app_icon(radselect_bin_SRCS "${CMAKE_CURRENT_SOURCE_DIR}/../data/pics/hi*-apps-kiten.png") -kde4_add_executable(radselect_bin ${radselect_bin_SRCS}) +add_executable(radselect_bin ${radselect_bin_SRCS}) set_target_properties(radselect_bin PROPERTIES OUTPUT_NAME kitenradselect) -target_link_libraries(radselect_bin ${KDE4_KDEUI_LIBS} kiten) +target_link_libraries(radselect_bin + kiten + Qt5::Core + Qt5::Widgets + KF5::ConfigWidgets + KF5::CoreAddons + KF5::I18n + KF5::XmlGui) install( TARGETS radselect_bin ${INSTALL_TARGETS_DEFAULT_ARGS} ) ############## install files #################### install( PROGRAMS kitenradselect.desktop DESTINATION ${XDG_APPS_INSTALL_DIR} ) -install( FILES radselectui.rc DESTINATION ${DATA_INSTALL_DIR}/kitenradselect ) +install( FILES radselectui.rc DESTINATION ${KXMLGUI_INSTALL_DIR}/kitenradselect ) diff --git a/radselect/buttongrid.cpp b/radselect/buttongrid.cpp index fed877d..5da5fc2 100644 --- a/radselect/buttongrid.cpp +++ b/radselect/buttongrid.cpp @@ -31,13 +31,10 @@ #include "radicalbutton.h" -#include <KDebug> -#include <KLocale> +#include <KLocalizedString> -#include <QFontMetrics> #include <QGridLayout> #include <QLabel> -#include <QSize> #include <QString> #include <QWidget> @@ -94,10 +91,10 @@ void ButtonGrid::buildRadicalButtons() RadicalButton *button = new RadicalButton( *it, this ); grid->addWidget( button, row_index++, column_index ); //Bind slots/signals for this button - connect( button, SIGNAL( userClicked( const QString&, RadicalButton::ButtonStatus ) ), - this, SLOT( radicalClicked( const QString&, RadicalButton::ButtonStatus ) ) ); - connect( this, SIGNAL( clearButtonSelections() ), - button, SLOT( resetButton() ) ); + connect( button, SIGNAL(userClicked(QString,RadicalButton::ButtonStatus)), + this, SLOT(radicalClicked(QString,RadicalButton::ButtonStatus)) ); + connect( this, SIGNAL(clearButtonSelections()), + button, SLOT(resetButton()) ); //Add this button to our list m_buttons.insert( *it, button ); @@ -209,4 +206,4 @@ void ButtonGrid::updateButtons() } } -#include "buttongrid.moc" + diff --git a/radselect/main.cpp b/radselect/main.cpp index d1e5775..824eecf 100644 --- a/radselect/main.cpp +++ b/radselect/main.cpp @@ -18,11 +18,11 @@ * Boston, MA 02110-1301, USA. * *****************************************************************************/ +#include <QApplication> +#include <QCommandLineParser> + #include <KAboutData> -#include <KCmdLineArgs> -#include <KLocale> -#include <KUniqueApplication> -#include <KMessageBox> +#include <KLocalizedString> #include "radselect.h" @@ -31,20 +31,23 @@ static const char version[] = "0.1"; int main( int argc, char **argv ) { - KAboutData about( "kitenradselect", "kiten", ki18n("kitenradselect"), version, - ki18n(description), KAboutData::License_GPL, - ki18n("(C) 2005 Joseph Kerian"), KLocalizedString(), 0, "jkerian at gmail.com" ); - about.addAuthor( ki18n("Joseph Kerian"), KLocalizedString(), "jkerian at gmail.com" ); + KAboutData about( QStringLiteral("kitenradselect"), i18n("kitenradselect"), QStringLiteral("0.1"), + i18n(description), KAboutLicense::GPL, + i18n("(C) 2005 Joseph Kerian"), QString(), QString(), "jkerian at gmail.com" ); + about.addAuthor( i18n("Joseph Kerian"), QString(), "jkerian at gmail.com" ); about.setOrganizationDomain("kde.org"); //For DBus domain about.setProgramIconName("kiten"); - KCmdLineArgs::init( argc, argv, &about ); - - KCmdLineOptions options; - options.add( "+[Search_String]", ki18n( "Initial Search String from Kiten" ) ); - KCmdLineArgs::addCmdLineOptions( options ); - - KUniqueApplication app; + QApplication app(argc, argv); + QCommandLineParser parser; + KAboutData::setApplicationData(about); + + parser.addVersionOption(); + parser.addHelpOption(); + about.setupCommandLine(&parser); + parser.addPositionalArgument("Search_String", i18n( "Initial Search String from Kiten" )); + parser.process(app); + about.processCommandLine(&parser); // see if we are starting with session management if ( app.isSessionRestored() ) @@ -54,17 +57,17 @@ int main( int argc, char **argv ) else { // no session.. just start up normally - KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); RadSelect *widget = new RadSelect(); widget->show(); - if ( args->count() >= 1 ) + if ( parser.positionalArguments().count() >= 1 ) { - widget->loadSearchString( args->arg( 0 ) ); + const QStringList args = parser.positionalArguments(); + widget->loadSearchString( args.first() ); } - args->clear(); + } return app.exec(); diff --git a/radselect/radical_selector.ui b/radselect/radical_selector.ui index 2e75acf..6dddf0f 100644 --- a/radselect/radical_selector.ui +++ b/radselect/radical_selector.ui @@ -118,7 +118,7 @@ </widget> </item> <item> - <widget class="KIntSpinBox" name="strokes_low"> + <widget class="QSpinBox" name="strokes_low"> <property name="sizePolicy"> <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> <horstretch>0</horstretch> @@ -138,7 +138,7 @@ </widget> </item> <item> - <widget class="KIntSpinBox" name="strokes_high"> + <widget class="QSpinBox" name="strokes_high"> <property name="sizePolicy"> <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> <horstretch>0</horstretch> @@ -196,13 +196,6 @@ </item> </layout> </widget> - <customwidgets> - <customwidget> - <class>KIntSpinBox</class> - <extends>QSpinBox</extends> - <header>knuminput.h</header> - </customwidget> - </customwidgets> <tabstops> <tabstop>clear_button</tabstop> <tabstop>selected_radicals</tabstop> diff --git a/radselect/radicalbutton.cpp b/radselect/radicalbutton.cpp index 83ffcc9..e3c9c6b 100644 --- a/radselect/radicalbutton.cpp +++ b/radselect/radicalbutton.cpp @@ -20,9 +20,6 @@ #include "radicalbutton.h" -#include <KApplication> -#include <KStyle> - #include <QMouseEvent> #include <QPushButton> #include <QString> @@ -145,4 +142,4 @@ QSize RadicalButton::sizeHint() const return minimumSizeHint(); } -#include "radicalbutton.moc" + diff --git a/radselect/radselect.cpp b/radselect/radselect.cpp index 797ce11..e5f6ceb 100644 --- a/radselect/radselect.cpp +++ b/radselect/radselect.cpp @@ -25,24 +25,13 @@ #include "ui_radselectprefdialog.h" -#include <KAction> #include <KActionCollection> -#include <KApplication> #include <KConfig> #include <KConfigDialog> -#include <KEditToolBar> -#include <KFileDialog> -#include <KGlobal> -#include <KHistoryComboBox> -#include <KIO/NetAccess> -#include <KIcon> -#include <KIconLoader> -#include <KLocale> +#include <KLocalizedString> #include <KStandardAction> #include <KStandardShortcut> -#include <KStatusBar> -#include <KToggleAction> -#include <kdeversion.h> +#include <QStatusBar> #include <QDragEnterEvent> #include <QDropEvent> @@ -57,9 +46,9 @@ RadSelect::RadSelect() setCentralWidget( m_view ); //This is the main widget setObjectName( QLatin1String( "radselect" ) ); - KStandardAction::quit( kapp, SLOT( quit() ), actionCollection() ); - KStandardAction::preferences( this, SLOT( optionsPreferences() ), actionCollection() ); - KStandardAction::keyBindings( (const QObject*)guiFactory(), SLOT( configureShortcuts() ), actionCollection() ); + KStandardAction::quit( this, SLOT(close()), actionCollection() ); + KStandardAction::preferences( this, SLOT(optionsPreferences()), actionCollection() ); + KStandardAction::keyBindings( (const QObject*)guiFactory(), SLOT(configureShortcuts()), actionCollection() ); statusBar()->show(); // Apply the create the main window and ask the mainwindow to @@ -69,12 +58,12 @@ RadSelect::RadSelect() setupGUI( Default, "radselectui.rc" ); // allow the view to change the statusbar - connect( m_view, SIGNAL( signalChangeStatusbar( const QString& ) ), - this, SLOT( changeStatusbar( const QString& ) ) ); + connect( m_view, SIGNAL(signalChangeStatusbar(QString)), + this, SLOT(changeStatusbar(QString)) ); if( ! QDBusConnection::sessionBus().isConnected() ) { - kDebug() << "Session Bus not found!!" << endl; + qDebug() << "Session Bus not found!!" << endl; m_dbusInterface = 0; } else @@ -84,8 +73,8 @@ RadSelect::RadSelect() } // connect the search signal from the m_view with our dcop routines - connect( m_view, SIGNAL( kanjiSelected( const QStringList& ) ), - this, SLOT( sendSearch( const QStringList& ) ) ); + connect( m_view, SIGNAL(kanjiSelected(QStringList)), + this, SLOT(sendSearch(QStringList)) ); } RadSelect::~RadSelect() @@ -109,7 +98,7 @@ void RadSelect::dragEnterEvent( QDragEnterEvent *event ) void RadSelect::dropEvent( QDropEvent *event ) { - QByteArray qba= event->encodedData( "text/plain" ); + QByteArray qba = event->mimeData()->data("text/plain"); if ( qba.size() > 0 ) { loadSearchString( qba ); @@ -139,8 +128,8 @@ void RadSelect::optionsPreferences() Ui::radselectprefdialog layout; layout.setupUi( preferences ); dialog->addPage( preferences, i18n( "Settings" ), "help-contents" ); - connect( dialog, SIGNAL( settingsChanged( const QString& ) ), - m_view, SLOT( loadSettings() ) ); + connect( dialog, SIGNAL(settingsChanged(QString)), + m_view, SLOT(loadSettings()) ); dialog->show(); } @@ -179,9 +168,9 @@ void RadSelect::sendSearch( const QStringList& kanji ) , m_currentQuery.toString() ); if( reply.type() == QDBusMessage::ErrorMessage ) { - kDebug() << "QDBus Error: " << reply.signature() << "<eoe>"; + qDebug() << "QDBus Error: " << reply.signature() << "<eoe>"; } } } -#include "radselect.moc" + diff --git a/radselect/radselectview.cpp b/radselect/radselectview.cpp index fb49c2b..4ba7d2a 100644 --- a/radselect/radselectview.cpp +++ b/radselect/radselectview.cpp @@ -29,9 +29,8 @@ #include "buttongrid.h" #include "radselectconfig.h" -#include <KStandardDirs> #include <KMessageBox> -#include <KDebug> +#include <KLocalizedString> #include <QApplication> #include <QClipboard> @@ -40,8 +39,6 @@ #include <QListWidgetItem> #include <QPushButton> #include <QString> -#include <QStringList> -#include <QTimer> #include <QWidget> RadSelectView::RadSelectView( QWidget *parent ) @@ -51,8 +48,7 @@ RadSelectView::RadSelectView( QWidget *parent ) setupUi( this ); m_radicalInfo = 0L; //Load the radical information - KStandardDirs *dirs = KGlobal::dirs(); - QString radkfilename = dirs->findResource( "data", "kiten/radkfile" ); + QString radkfilename = QStandardPaths::locate(QStandardPaths::GenericDataLocation, "kiten/radkfile"); if ( radkfilename.isNull() ) { KMessageBox::error( 0, i18n( "Kanji radical information does not seem to " @@ -75,29 +71,29 @@ RadSelectView::RadSelectView( QWidget *parent ) //== Now we connect all our signals == //Connect our radical grid to our adding method - connect( m_buttongrid, SIGNAL( possibleKanji( const QList<Kanji>& ) ), - this, SLOT( listPossibleKanji( const QList<Kanji>& ) ) ); + connect( m_buttongrid, SIGNAL(possibleKanji(QList<Kanji>)), + this, SLOT(listPossibleKanji(QList<Kanji>)) ); //Connect the results selection to our logic - connect( selected_radicals, SIGNAL( itemClicked( QListWidgetItem* ) ), - this, SLOT( kanjiClicked( QListWidgetItem* ) ) ); - connect( selected_radicals, SIGNAL( itemDoubleClicked( QListWidgetItem* ) ), - this, SLOT( kanjiDoubleClicked( QListWidgetItem* ) ) ); + connect( selected_radicals, SIGNAL(itemClicked(QListWidgetItem*)), + this, SLOT(kanjiClicked(QListWidgetItem*)) ); + connect( selected_radicals, SIGNAL(itemDoubleClicked(QListWidgetItem*)), + this, SLOT(kanjiDoubleClicked(QListWidgetItem*)) ); //Connect our stroke limit actions - connect( strokes_low, SIGNAL( valueChanged( int ) ), - this, SLOT( strokeLimitChanged( int ) ) ); - connect( strokes_high, SIGNAL( valueChanged( int ) ), - this, SLOT( strokeLimitChanged( int ) ) ); + connect( strokes_low, SIGNAL(valueChanged(int)), + this, SLOT(strokeLimitChanged(int)) ); + connect( strokes_high, SIGNAL(valueChanged(int)), + this, SLOT(strokeLimitChanged(int)) ); //Connect statusbar updates - connect( m_buttongrid, SIGNAL( signalChangeStatusbar( const QString& ) ), - this, SIGNAL( signalChangeStatusbar( const QString& ) ) ); + connect( m_buttongrid, SIGNAL(signalChangeStatusbar(QString)), + this, SIGNAL(signalChangeStatusbar(QString)) ); //Connect our clear button - connect( clear_button, SIGNAL( clicked() ), - this, SLOT( clearSearch() ) ); + connect( clear_button, SIGNAL(clicked()), + this, SLOT(clearSearch()) ); // copy text from copied_line (QLineEdit) to clipboard - connect( copy_button, SIGNAL( clicked() ), - this, SLOT( toClipboard() ) ); + connect( copy_button, SIGNAL(clicked()), + this, SLOT(toClipboard()) ); loadSettings(); } @@ -244,4 +240,4 @@ void RadSelectView::toClipboard() cb->setText( copied_line->text(), QClipboard::Selection ); } -#include "radselectview.moc" + diff --git a/radselect/radselectview.h b/radselect/radselectview.h index d3791e4..8f4acd7 100644 --- a/radselect/radselectview.h +++ b/radselect/radselectview.h @@ -25,7 +25,6 @@ #include "ui_radical_selector.h" #include <QList> -#include <QSet> #include <QWidget> class ButtonGrid;