[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [kget/kf5_port] /: Port KGet to KF5
From: Lukas Appelhans <l.appelhans () gmx ! de>
Date: 2014-10-10 15:23:34
Message-ID: E1Xcc2Y-0006hH-Uz () scm ! kde ! org
[Download RAW message or body]
Git commit 5a8d19b6821a887291a2e57b5e9f2ab4ba606f08 by Lukas Appelhans.
Committed on 26/09/2014 at 16:33.
Pushed by lappelhans into branch 'kf5_port'.
Port KGet to KF5
M +103 -98 CMakeLists.txt
M +5 -13 conf/dlggroups.ui
M +2 -1 conf/dlgwebinterface.cpp
M +1 -1 conf/dlgwebinterface.h
M +5 -4 conf/integrationpreferences.cpp
M +4 -3 conf/pluginselector.cpp
M +2 -2 conf/pluginselector.h
M +4 -2 conf/preferencesdialog.cpp
M +1 -1 conf/settings.kcfgc
M +7 -7 conf/transfersgroupwidget.cpp
M +2 -2 core/basedialog.cpp
M +37 -37 core/datasourcefactory.cpp
M +14 -14 core/datasourcefactory.h
M +1 -1 core/download.cpp
M +6 -6 core/download.h
M +6 -7 core/filedeleter.cpp
M +3 -3 core/filedeleter.h
M +6 -4 core/filedeleter_p.h
M +34 -34 core/filemodel.cpp
M +19 -19 core/filemodel.h
M +2 -2 core/keydownloader.cpp
M +71 -70 core/kget.cpp
M +16 -15 core/kget.h
M +2 -2 core/kgetkjobadapter.cpp
M +7 -9 core/linkimporter.cpp
M +3 -3 core/linkimporter.h
M +7 -7 core/mostlocalurl.cpp
M +8 -8 core/mostlocalurl.h
M +3 -3 core/nepomukcontroller.cpp
M +3 -3 core/nepomukcontroller.h
M +5 -5 core/nepomukhandler.cpp
M +1 -1 core/nepomukhandler.h
M +4 -4 core/plugin/transferfactory.cpp
M +4 -4 core/plugin/transferfactory.h
M +6 -6 core/transfer.cpp
M +14 -14 core/transfer.h
M +1 -1 core/transferdatasource.cpp
M +6 -6 core/transferdatasource.h
M +2 -2 core/transfergroup.cpp
M +4 -4 core/transfergroup.h
M +10 -10 core/transferhandler.h
M +4 -467 core/transferhistorystore.cpp
A +158 -0 core/transferhistorystore_sqlite.cpp [License: GPL (v2+)]
A +254 -0 core/transferhistorystore_xml.cpp [License: GPL (v2+)]
M +3 -3 core/transfertreemodel.cpp
M +4 -5 core/transfertreemodel.h
M +62 -62 core/urlchecker.cpp
M +27 -27 core/urlchecker.h
M +4 -4 core/verificationmodel.cpp
M +22 -22 core/verifier.cpp
M +6 -6 core/verifier.h
M +10 -5 dbus/dbuskgetwrapper.cpp
M +2 -2 dbus/dbustransferwrapper.cpp
M +1 -1 dbus/dbusverifierwrapper.cpp
M +1 -1 doc/CMakeLists.txt
M +2 -1 extensions/CMakeLists.txt
M +3 -3 extensions/konqueror/CMakeLists.txt
M +2 -2 extensions/konqueror/kget_plug_in.cpp
M +7 -4 kget_export.h
M +5 -4 main.cpp
M +77 -75 mainwindow.cpp
M +1 -1 mainwindow.h
M +1 -1 transfer-plugins/CMakeLists.txt
M +5 -5 transfer-plugins/checksumsearch/CMakeLists.txt
M +1 -1 transfer-plugins/checksumsearch/checksumsearchsettings.kcfgc
M +8 -8 transfer-plugins/checksumsearch/checksumsearchtransferdatasource.h
M +4 -2 transfer-plugins/checksumsearch/dlgchecksumsearch.cpp
M +1 -0 transfer-plugins/checksumsearch/dlgchecksumsearch.h
M +1 -1 transfer-plugins/kio/CMakeLists.txt
M +13 -13 transfer-plugins/kio/transferKio.cpp
M +6 -6 transfer-plugins/kio/transferKio.h
M +3 -0 transfer-plugins/kio/transferKioFactory.cpp
M +6 -6 transfer-plugins/metalink/CMakeLists.txt
M +22 -22 transfer-plugins/metalink/abstractmetalink.cpp
M +10 -10 transfer-plugins/metalink/abstractmetalink.h
M +1 -1 transfer-plugins/metalink/dlgmetalink.cpp
M +1 -1 transfer-plugins/metalink/metalinksettings.kcfgc
M +9 -9 transfer-plugins/metalink/metalinkxml.cpp
M +3 -3 transfer-plugins/metalink/metalinkxml.h
M +5 -5 transfer-plugins/mirrorsearch/CMakeLists.txt
M +6 -3 transfer-plugins/mirrorsearch/dlgmirrorsearch.cpp
M +1 -0 transfer-plugins/mirrorsearch/dlgmirrorsearch.h
M +5 -5 transfer-plugins/mirrorsearch/mirrors.cpp
M +5 -5 transfer-plugins/mirrorsearch/mirrors.h
M +1 -1 transfer-plugins/mirrorsearch/mirrorsearchsettings.kcfgc
M +5 -5 transfer-plugins/mmsthreads/CMakeLists.txt
M +1 -1 transfer-plugins/mmsthreads/dlgmms.cpp
M +1 -1 transfer-plugins/mmsthreads/mmssettings.kcfgc
M +5 -5 transfer-plugins/mmsthreads/mmstransfer.cpp
M +5 -5 transfer-plugins/multisegmentkio/CMakeLists.txt
M +1 -2 transfer-plugins/multisegmentkio/dlgmultisegkio.cpp
M +3 -3 transfer-plugins/multisegmentkio/multisegkiodatasource.cpp
M +2 -2 transfer-plugins/multisegmentkio/multisegkiodatasource.h
M +1 -1 transfer-plugins/multisegmentkio/multisegkiosettings.kcfgc
M +4 -4 transfer-plugins/multisegmentkio/segment.cpp
M +4 -4 transfer-plugins/multisegmentkio/segment.h
M +24 -24 transfer-plugins/multisegmentkio/transfermultisegkio.cpp
M +10 -10 transfer-plugins/multisegmentkio/transfermultisegkio.h
M +5 -5 ui/droptarget.cpp
M +1 -1 ui/groupsettingsdialog.cpp
M +1 -0 ui/history/transferhistory.cpp
M +1 -1 ui/history/transferhistorycategorizedview.cpp
M +3 -3 ui/history/transferhistoryitemdelegate.cpp
M +2 -1 ui/icons/CMakeLists.txt
M +4 -3 ui/linkview/kget_linkview.cpp
M +1 -1 ui/linkview/kget_linkview.h
M +2 -0 ui/metalinkcreator/dragdlg.cpp
M +2 -3 ui/metalinkcreator/filehandler.cpp
M +3 -3 ui/metalinkcreator/filehandler.h
M +1 -1 ui/metalinkcreator/localemodels.h
M +9 -8 ui/metalinkcreator/metalinkcreator.cpp
M +1 -1 ui/metalinkcreator/metalinker.cpp
M +17 -17 ui/mirror/mirrormodel.cpp
M +7 -7 ui/mirror/mirrormodel.h
M +6 -4 ui/mirror/mirrorsettings.cpp
M +2 -2 ui/mirror/mirrorsettings.h
M +66 -66 ui/newtransferdialog.cpp
M +12 -12 ui/newtransferdialog.h
M +4 -4 ui/renamefile.cpp
M +2 -1 ui/renamefile.h
M +7 -6 ui/signaturedlg.cpp
M +2 -2 ui/signaturedlg.h
M +4 -4 ui/transferdetails.cpp
M +9 -8 ui/transfersettingsdialog.cpp
M +1 -1 ui/transfersview.cpp
M +2 -2 ui/transfersviewdelegate.cpp
M +2 -1 ui/tray.cpp
M +3 -3 ui/verificationdialog.cpp
M +2 -2 ui/verificationdialog.h
M +1 -1 ui/viewscontainer.h
http://commits.kde.org/kget/5a8d19b6821a887291a2e57b5e9f2ab4ba606f08
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3f77f59..dd63533 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,53 +1,64 @@
project(kget)
-if(NOT INSIDE_KDENETWORK)
- message("Not building inside KDENetwork, loading KDE CMake Macros.")
-
- find_package(KDE4 REQUIRED)
-
- include(KDE4Defaults)
- include(MacroLibrary)
-
- include(CheckIncludeFile)
- include(CheckIncludeFiles)
- include(CheckSymbolExists)
- include(CheckFunctionExists)
- include(CheckLibraryExists)
- include(CheckPrototypeExists)
- include(CheckTypeSize)
-
- set(CMAKE_REQUIRED_DEFINITIONS ${_KDE4_PLATFORM_DEFINITIONS})
- if(WIN32)
- set(CMAKE_REQUIRED_LIBRARIES ${KDEWIN32_LIBRARIES})
- set(CMAKE_REQUIRED_INCLUDES ${KDEWIN32_INCLUDES})
- endif(WIN32)
- add_definitions(${QT_DEFINITIONS} ${QT_QTDBUS_DEFINITIONS} ${KDE4_DEFINITIONS})
- add_definitions(-DQT_USE_FAST_CONCATENATION -DQT_USE_FAST_OPERATOR_PLUS)
- include_directories(${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${KDE4_INCLUDES})
-endif(NOT INSIDE_KDENETWORK)
+cmake_minimum_required(VERSION 2.8.12)
+
+find_package(ECM REQUIRED NO_MODULE)
+
+set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR} \
"${CMAKE_SOURCE_DIR}/cmake") +
+find_package(Qt5 5.2.0 REQUIRED CONFIG COMPONENTS Widgets Test Network Xml DBus Sql \
Test) +include(KDEInstallDirs)
+include(KDECMakeSettings)
+include(KDECompilerSettings)
+include(ECMInstallIcons)
+include(ECMMarkAsTest)
+include(GenerateExportHeader)
+
+find_package(KF5 REQUIRED WidgetsAddons CoreAddons Solid Wallet
+ Config DBusAddons I18n ConfigWidgets \
Notifications KIO KDELibs4Support IconThemes KCMUtils NotifyConfig) +
+#TODO: Check if we need all the dependencies
+
+#include(CheckIncludeFile)
+#include(CheckIncludeFiles)
+#include(CheckSymbolExists)
+#include(CheckFunctionExists)
+#include(CheckLibraryExists)
+#include(CheckPrototypeExists)
+#include(CheckTypeSize)
+
+#set(CMAKE_REQUIRED_DEFINITIONS ${_KDE4_PLATFORM_DEFINITIONS})
+if(WIN32)
+ set(CMAKE_REQUIRED_LIBRARIES ${KDEWIN32_LIBRARIES})
+ set(CMAKE_REQUIRED_INCLUDES ${KDEWIN32_INCLUDES})
+endif(WIN32)
+#add_definitions(${QT_DEFINITIONS} ${QT_QTDBUS_DEFINITIONS} ${KDE4_DEFINITIONS})
+#add_definitions(-DQT_USE_FAST_CONCATENATION -DQT_USE_FAST_OPERATOR_PLUS)
+include_directories(${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${KDE4_INCLUDES})
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules \
${CMAKE_MODULE_PATH})
-macro_optional_find_package(NepomukCore)
-macro_log_feature(NepomukCore_FOUND "NepomukCore" "Semantic Desktop" \
"http://nepomuk.kde.org" FALSE "" "Nepomuk is needed for the integration into KGet") \
+find_package(NepomukCore QUIET) +set_package_properties(NepomukCore_FOUND PROPERTIES \
DESCRIPTION "Semantic Desktop" URL "http://nepomuk.kde.org" TYPE OPTIONAL PURPOSE \
"Nepomuk is needed for the integration into KGet")
-macro_optional_find_package(NepomukWidgets)
-macro_log_feature(NepomukWidgets_FOUND "NepomukWidgets" "Semantic Desktop" \
"http://nepomuk.kde.org" FALSE "" "Nepomuk is needed for the integration into KGet") \
+find_package(NepomukWidgets QUIET) +set_package_properties(NepomukWidgets_FOUND \
PROPERTIES DESCRIPTION "Semantic Desktop" URL "http://nepomuk.kde.org" TYPE OPTIONAL \
PURPOSE "Nepomuk is needed for the integration into KGet")
-macro_optional_find_package(Sqlite)
-macro_log_feature(SQLITE_FOUND "SQLite" "SQLite is a Binary-Database" "" FALSE "" \
"Needed for the SQLite-Backend of the KGet-History and the Kopete-Statistic-Plugin") \
+find_package(Sqlite QUIET) +set_package_properties(SQLITE_FOUND PROPERTIES \
DESCRIPTION "SQLite is a Binary-Database" TYPE RECOMMENDED PURPOSE "Needed for the \
SQLite-Backend of the KGet-History")
-macro_optional_find_package(QCA2)
-macro_log_feature(QCA2_FOUND "QCA2" "Qt Cryptographic Architecture" \
"http://delta.affinix.com/qca" FALSE "2.0.0" "Needed for the KGet bittorrent-plugin \
and some Kopete plugins") +find_package(QCA2 QUIET)
+set_package_properties(QCA2_FOUND PROPERTIES DESCRIPTION "Qt Cryptographic \
Architecture" TYPE RECOMMENDED URL "http://delta.affinix.com/qca" PURPOSE "Needed for \
the KGet bittorrent-plugin") +#TODO: Check for version "2.0.0"
-macro_optional_find_package(QGpgme)
-macro_log_feature(QGPGME_FOUND "QGpgME" "The QGpgME library" "http://www.kde.org" \
FALSE "" "QGpgME is required to have signature verifying support in KGet.") \
+find_package(QGpgme QUIET) +set_package_properties(QGPGME_FOUND PROPERTIES \
DESCRIPTION "The QGpgME library" TYPE RECOMMENDED PURPOSE "QGpgME is required to have \
signature verifying support in KGet.")
-macro_optional_find_package(KTorrent)
-macro_log_feature(LIBKTORRENT_FOUND "libktorrent" "Backend Library of KTorrent" \
"http://ktorrent.org" FALSE "" "Needed to build KGet bittorrent support.") \
+find_package(KTorrent QUIET) +set_package_properties(LIBKTORRENT_FOUND PROPERTIES \
DESCRIPTION "Backend Library of KTorrent" TYPE RECOMMENDED PURPOSE "Needed to build \
KGet bittorrent support.")
-macro_optional_find_package(LibMms)
-macro_log_feature(LIBMMS_FOUND "libmms" "Library to read mms streams" \
"http://libmms.sourceforge.net" FALSE "" "Needed to build KGet mms support.") \
+find_package(LibMms QUIET) +set_package_properties(LIBMMS_FOUND PROPERTIES \
DESCRIPTION "Library to read mms streams" TYPE RECOMMENDED PURPOSE "Needed to build \
KGet mms support.")
set(kget_adaptor_SRCS
dbus/dbuskgetwrapper.cpp
@@ -57,43 +68,43 @@ set(kget_adaptor_SRCS
# core/transfertreemodel.cpp
# )
-add_definitions(-DKDE_DEFAULT_DEBUG_AREA=5001)
+#add_definitions(-DKDE_DEFAULT_DEBUG_AREA=5001) //TODO: PORT THIS!!
if(CMAKE_BUILD_TYPE MATCHES debugfull)
add_definitions(-DDEBUG)
endif(CMAKE_BUILD_TYPE MATCHES debugfull)
-if (NepomukCore_FOUND AND NepomukWidgets_FOUND)
- find_package(Soprano)
- find_package(SharedDesktopOntologies 0.4)
-endif (NepomukCore_FOUND AND NepomukWidgets_FOUND)
-if(SharedDesktopOntologies_FOUND)
- set(HAVE_NEPOMUK SharedDesktopOntologies_FOUND)
- include_directories(
- ${SOPRANO_INCLUDE_DIR}
- ${NEPOMUK_CORE_INCLUDE_DIR}
- ${NEPOMUK_WIDGETS_INCLUDE_DIR}
- )
- add_definitions(-DHAVE_NEPOMUK)
- add_definitions(-DDISABLE_NEPOMUK_LEGACY)
- include(NepomukAddOntologyClasses)
-endif(SharedDesktopOntologies_FOUND)
-
-if(QCA2_FOUND)
- add_definitions(-DHAVE_QCA2)
- include_directories(
- ${QCA2_INCLUDE_DIR}
- )
-endif(QCA2_FOUND)
-
-if(QGPGME_FOUND)
- find_package(Boost REQUIRED)
- add_definitions(-DHAVE_QGPGME)
- include_directories(
- ${Boost_INCLUDE_DIRS}
- ${QGPGME_INCLUDE_DIR}
- )
-endif(QGPGME_FOUND)
+#if (NepomukCore_FOUND AND NepomukWidgets_FOUND)
+# find_package(Soprano)
+# find_package(SharedDesktopOntologies 0.4)
+#endif (NepomukCore_FOUND AND NepomukWidgets_FOUND)
+#if(SharedDesktopOntologies_FOUND)
+# set(HAVE_NEPOMUK SharedDesktopOntologies_FOUND)
+# include_directories(
+# ${SOPRANO_INCLUDE_DIR}
+# ${NEPOMUK_CORE_INCLUDE_DIR}
+# ${NEPOMUK_WIDGETS_INCLUDE_DIR}
+# )
+# add_definitions(-DHAVE_NEPOMUK)
+# add_definitions(-DDISABLE_NEPOMUK_LEGACY)
+# include(NepomukAddOntologyClasses)
+#endif(SharedDesktopOntologies_FOUND)
+
+#if(QCA2_FOUND)
+# add_definitions(-DHAVE_QCA2)
+# include_directories(
+# ${QCA2_INCLUDE_DIR}
+# )
+#endif(QCA2_FOUND)
+
+#if(QGPGME_FOUND)
+# find_package(Boost REQUIRED)
+# add_definitions(-DHAVE_QGPGME)
+# include_directories(
+# ${Boost_INCLUDE_DIRS}
+# ${QGPGME_INCLUDE_DIR}
+# )
+#endif(QGPGME_FOUND)
add_subdirectory(conf)
add_subdirectory(core)
@@ -102,16 +113,16 @@ add_subdirectory(transfer-plugins)
add_subdirectory(extensions)
add_subdirectory(sounds)
add_subdirectory(desktop)
-add_subdirectory(plasma)
+#add_subdirectory(plasma) TODO PORT TO KF5/QML
add_subdirectory(tests)
add_subdirectory(doc)
-macro_optional_find_package(KDE4Workspace)
-macro_log_feature(KDE4WORKSPACE_FOUND "KDE4Workspace" "KDE4 workspace libraries, \
part of kdebase-workspace" "http://www.kde.org" FALSE "" "Allows 'shutdown after \
downloads completed' in kget")
-if(KDE4WORKSPACE_FOUND)
- add_definitions(-DHAVE_KWORKSPACE)
- include_directories(${KDE4WORKSPACE_INCLUDE_DIR})
-endif(KDE4WORKSPACE_FOUND)
+#macro_optional_find_package(KDE4Workspace)
+#macro_log_feature(KDE4WORKSPACE_FOUND "KDE4Workspace" "KDE4 workspace libraries, \
part of kdebase-workspace" "http://www.kde.org" FALSE "" "Allows 'shutdown after \
downloads completed' in kget") +#if(KDE4WORKSPACE_FOUND)
+# add_definitions(-DHAVE_KWORKSPACE)
+# include_directories(${KDE4WORKSPACE_INCLUDE_DIR})
+#endif(KDE4WORKSPACE_FOUND)
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}
@@ -152,6 +163,8 @@ set(kgetcore_SRCS
core/bitset.cpp
core/download.cpp
core/transferhistorystore.cpp
+ core/transferhistorystore_xml.cpp
+ core/transferhistorystore_sqlite.cpp
core/linkimporter.cpp
dbus/dbustransferwrapper.cpp
dbus/dbusverifierwrapper.cpp
@@ -175,23 +188,17 @@ if(HAVE_NEPOMUK)
core/nepomukhandler.cpp
core/nepomukcontroller.cpp
)
-
- NEPOMUK2_ADD_ONTOLOGY_CLASSES(
- kgetcore_SRCS
- ONTOLOGIES
- ${CMAKE_CURRENT_SOURCE_DIR}/kget_history.trig
- )
endif (HAVE_NEPOMUK)
-kde4_add_kcfg_files(kgetcore_SRCS conf/settings.kcfgc)
+kconfig_add_kcfg_files(kgetcore_SRCS conf/settings.kcfgc)
-qt4_add_dbus_adaptor(kgetcore_SRCS dbus/org.kde.kget.transfer.xml \
dbus/dbustransferwrapper.h DBusTransferWrapper)
-qt4_add_dbus_adaptor(kgetcore_SRCS dbus/org.kde.kget.verifier.xml \
dbus/dbusverifierwrapper.h DBusVerifierWrapper) +qt5_add_dbus_adaptor(kgetcore_SRCS \
dbus/org.kde.kget.transfer.xml dbus/dbustransferwrapper.h DBusTransferWrapper) \
+qt5_add_dbus_adaptor(kgetcore_SRCS dbus/org.kde.kget.verifier.xml \
dbus/dbusverifierwrapper.h DBusVerifierWrapper)
-kde4_add_library(kgetcore SHARED ${kgetcore_SRCS})
+add_library(kgetcore SHARED ${kgetcore_SRCS})
-target_link_libraries(kgetcore ${KDE4_KIO_LIBS} ${KDE4_SOLID_LIBS})
+target_link_libraries(kgetcore Qt5::Core Qt5::Widgets Qt5::Sql Qt5::Network \
Qt5::DBus KF5::DBusAddons KF5::I18n KF5::CoreAddons KF5::IconThemes \
KF5::KDELibs4Support)
if (KDE4WORKSPACE_FOUND)
target_link_libraries(kgetcore ${KDE4WORKSPACE_KWORKSPACE_LIBS})
@@ -262,12 +269,12 @@ set(kget_SRCS ${kget_adaptor_SRCS} \
${kget_transfer_adaptor_SRCS} mainwindow.cpp
main.cpp
- extensions/webinterface/httpserver.cpp
+ #extensions/webinterface/httpserver.cpp
)
-qt4_add_dbus_adaptor(kget_SRCS dbus/org.kde.kget.main.xml dbus/dbuskgetwrapper.h \
DBusKGetWrapper) +qt5_add_dbus_adaptor(kget_SRCS dbus/org.kde.kget.main.xml \
dbus/dbuskgetwrapper.h DBusKGetWrapper)
-kde4_add_ui_files(kget_SRCS
+qt5_wrap_ui(kget_SRCS
conf/dlgadvanced.ui
conf/dlgappearance.ui
conf/dlggroups.ui
@@ -296,11 +303,11 @@ kde4_add_ui_files(kget_SRCS
ui/signaturedlg.ui
)
-kde4_add_app_icon(kget_SRCS "ui/icons/hi*-apps-kget.png")
+#kde4_add_app_icon(kget_SRCS "ui/icons/hi*-apps-kget.png")
-kde4_add_executable(kget ${kget_SRCS})
+add_executable(kget ${kget_SRCS})
-target_link_libraries(kget ${QT_QTTEST_LIBRARY} ${KDE4_KDEUI_LIBRARY} \
${KDE4_KIO_LIBRARY} ${KDE4_KCMUTILS_LIBRARY} kgetcore ${KDE4_KNOTIFYCONFIG_LIBS}) \
+target_link_libraries(kget Qt5::Core Qt5::Widgets Qt5::Sql Qt5::Network Qt5::DBus \
Qt5::Test KF5::Wallet KF5::DBusAddons KF5::I18n KF5::CoreAddons KF5::IconThemes \
KF5::KCMUtils KF5::NotifyConfig KF5::KDELibs4Support kgetcore) if(QCA2_FOUND)
target_link_libraries(kget ${QCA2_LIBRARIES})
endif(QCA2_FOUND)
@@ -321,6 +328,4 @@ if (HAVE_NEPOMUK)
install(FILES kget_history.trig \
${CMAKE_CURRENT_BINARY_DIR}/kget_history.ontology DESTINATION \
${CMAKE_INSTALL_PREFIX}/share/ontology/kde) endif (HAVE_NEPOMUK)
-if (NOT INSIDE_KDENETWORK)
- macro_display_feature_log()
-endif ()
+feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)
\ No newline at end of file
diff --git a/conf/dlggroups.ui b/conf/dlggroups.ui
index afd52d8..d4be237 100644
--- a/conf/dlggroups.ui
+++ b/conf/dlggroups.ui
@@ -44,30 +44,27 @@
<item>
<layout class="QHBoxLayout" name="layout">
<item>
- <widget class="KPushButton" name="add"/>
+ <widget class="QPushButton" name="add"/>
</item>
<item>
- <widget class="KPushButton" name="rename">
+ <widget class="QPushButton" name="rename">
<property name="text">
<string>Rename</string>
</property>
</widget>
</item>
<item>
- <widget class="KPushButton" name="remove"/>
+ <widget class="QPushButton" name="remove"/>
</item>
<item>
<widget class="KIconButton" name="selectIcon">
<property name="text">
<string>Select Icon...</string>
</property>
- <property name="iconSize">
- <number>16</number>
- </property>
</widget>
</item>
<item>
- <widget class="KPushButton" name="configure"/>
+ <widget class="QPushButton" name="configure"/>
</item>
</layout>
</item>
@@ -77,12 +74,7 @@
<customwidget>
<class>KIconButton</class>
<extends>QPushButton</extends>
- <header>kicondialog.h</header>
- </customwidget>
- <customwidget>
- <class>KPushButton</class>
- <extends>QPushButton</extends>
- <header>kpushbutton.h</header>
+ <header location="global">kiconbutton.h</header>
</customwidget>
<customwidget>
<class>TransfersGroupTree</class>
diff --git a/conf/dlgwebinterface.cpp b/conf/dlgwebinterface.cpp
index 108fd20..6f9b845 100644
--- a/conf/dlgwebinterface.cpp
+++ b/conf/dlgwebinterface.cpp
@@ -13,9 +13,10 @@
#include "settings.h"
#include <KMessageBox>
+#include <KLocale>
#include <kwallet.h>
-DlgWebinterface::DlgWebinterface(KDialog *parent)
+DlgWebinterface::DlgWebinterface(QDialog *parent)
: QWidget(parent),
m_wallet(0)
{
diff --git a/conf/dlgwebinterface.h b/conf/dlgwebinterface.h
index c5b45f9..47a5782 100644
--- a/conf/dlgwebinterface.h
+++ b/conf/dlgwebinterface.h
@@ -24,7 +24,7 @@ class DlgWebinterface : public QWidget, public Ui::DlgWebinterface
Q_OBJECT
public:
- DlgWebinterface(KDialog *parent = 0);
+ DlgWebinterface(QDialog *parent = 0);
~DlgWebinterface();
signals:
diff --git a/conf/integrationpreferences.cpp b/conf/integrationpreferences.cpp
index bd4f6fe..da72715 100644
--- a/conf/integrationpreferences.cpp
+++ b/conf/integrationpreferences.cpp
@@ -22,6 +22,7 @@
#include "settings.h"
#include <KConfigDialog>
+#include <KLocale>
IntegrationPreferences::IntegrationPreferences(KConfigDialog *parent, \
Qt::WindowFlags f) : QWidget(parent, f)
@@ -29,16 +30,16 @@ IntegrationPreferences::IntegrationPreferences(KConfigDialog \
*parent, Qt::Window ui.setupUi(this);
//AutoPaste stuff
- ui.type->addItem(KIcon("list-add"), i18n("Include"), AutoPasteModel::Include);
- ui.type->addItem(KIcon("list-remove"), i18n("Exclude"), \
AutoPasteModel::Exclude); + ui.type->addItem(QIcon::fromTheme("list-add"), \
i18n("Include"), AutoPasteModel::Include); + \
ui.type->addItem(QIcon::fromTheme("list-remove"), i18n("Exclude"), \
AutoPasteModel::Exclude);
ui.patternSyntax->addItem(i18n("Escape sequences"), AutoPasteModel::Wildcard);
ui.patternSyntax->addItem(i18n("Regular expression"), AutoPasteModel::RegExp);
ui.add->setGuiItem(KStandardGuiItem::add());
ui.remove->setGuiItem(KStandardGuiItem::remove());
- ui.increase->setIcon(KIcon("arrow-up"));
- ui.decrease->setIcon(KIcon("arrow-down"));
+ ui.increase->setIcon(QIcon::fromTheme("arrow-up"));
+ ui.decrease->setIcon(QIcon::fromTheme("arrow-down"));
m_model = new AutoPasteModel(this);
m_model->load();
diff --git a/conf/pluginselector.cpp b/conf/pluginselector.cpp
index 1bebfb8..d1934da 100644
--- a/conf/pluginselector.cpp
+++ b/conf/pluginselector.cpp
@@ -16,14 +16,15 @@
#include <KLocale>
#include <KPluginInfo>
#include <KSharedConfig>
-#include <KDialog>
+#include <QDialog>
-PluginSelector::PluginSelector(KDialog * parent)
+PluginSelector::PluginSelector(QDialog * parent)
: KPluginSelector(parent)
{
KService::List offers = KServiceTypeTrader::self()->query("KGet/Plugin");
- addPlugins(KPluginInfo::fromServices(offers), KPluginSelector::ReadConfigFile, \
i18n("Plugins"), "Service", KGlobal::config()); + //TODO: POrt this
+ //addPlugins(KPluginInfo::fromServices(offers), KPluginSelector::ReadConfigFile, \
i18n("Plugins"), "Service", KGlobal::config());
load();
diff --git a/conf/pluginselector.h b/conf/pluginselector.h
index 888a027..ee39f73 100644
--- a/conf/pluginselector.h
+++ b/conf/pluginselector.h
@@ -12,13 +12,13 @@
#include <KPluginSelector>
-class KDialog;
+class QDialog;
class PluginSelector : public KPluginSelector
{
Q_OBJECT
public:
- PluginSelector(KDialog * parent);
+ PluginSelector(QDialog * parent);
~PluginSelector();
private slots:
diff --git a/conf/preferencesdialog.cpp b/conf/preferencesdialog.cpp
index 56f3a50..ebe26d2 100644
--- a/conf/preferencesdialog.cpp
+++ b/conf/preferencesdialog.cpp
@@ -22,6 +22,8 @@
#include <klocale.h>
#include <ktabwidget.h>
+#include <kconfigdialog.h>
+#include <kconfigskeleton.h>
PreferencesDialog::PreferencesDialog(QWidget * parent, KConfigSkeleton * skeleton)
: KConfigDialog(parent, "preferences", skeleton)
@@ -86,12 +88,12 @@ PreferencesDialog::PreferencesDialog(QWidget * parent, \
KConfigSkeleton * skeleto
void PreferencesDialog::disableApplyButton()
{
- enableButtonApply(false);
+ button(QDialogButtonBox::Apply)->setEnabled(false);
}
void PreferencesDialog::enableApplyButton()
{
- enableButtonApply(true);
+ button(QDialogButtonBox::Apply)->setEnabled(true);
}
void PreferencesDialog::slotToggleAfterFinishAction(int state)
diff --git a/conf/settings.kcfgc b/conf/settings.kcfgc
index 026ecf5..8d687d5 100644
--- a/conf/settings.kcfgc
+++ b/conf/settings.kcfgc
@@ -2,4 +2,4 @@ ClassName=Settings
File=kget.kcfg
Mutators=true
Singleton=true
-Visibility=KDE_EXPORT
+Visibility=Q_DECL_EXPORT
diff --git a/conf/transfersgroupwidget.cpp b/conf/transfersgroupwidget.cpp
index 84d618e..439f4da 100644
--- a/conf/transfersgroupwidget.cpp
+++ b/conf/transfersgroupwidget.cpp
@@ -33,11 +33,11 @@ TransfersGroupWidget::TransfersGroupWidget(QWidget *parent)
ui.treeView->header()->hideSection(TransferTreeModel::Size);
ui.treeView->header()->hideSection(TransferTreeModel::Speed);
- ui.add->setGuiItem(KStandardGuiItem::add());
- ui.remove->setGuiItem(KStandardGuiItem::remove());
- ui.configure->setGuiItem(KStandardGuiItem::Configure);
- ui.rename->setIcon(KIcon("edit-rename"));
- ui.selectIcon->setIcon(KIcon("preferences-desktop-icons"));
+ //ui.add->setGuiItem(KStandardGuiItem::add());
+ //ui.remove->setGuiItem(KStandardGuiItem::remove());
+ //ui.configure->setGuiItem(KStandardGuiItem::Configure);//TODO: Port
+ ui.rename->setIcon(QIcon::fromTheme("edit-rename"));
+ ui.selectIcon->setIcon(QIcon::fromTheme("preferences-desktop-icons"));
connect(ui.add, SIGNAL(clicked()), ui.treeView, SLOT(addGroup()));
connect(ui.remove, SIGNAL(clicked()), ui.treeView, SLOT(deleteSelectedGroup()));
@@ -61,8 +61,8 @@ void TransfersGroupWidget::slotSelectionChanged()
ui.selectIcon->setEnabled(somethingSelected);
if (somethingSelected && !KGet::selectedTransferGroups().isEmpty()) {
- ui.selectIcon->setIcon(KIcon(KGet::selectedTransferGroups().first()->iconName()));
+ ui.selectIcon->setIcon(QIcon::fromTheme(KGet::selectedTransferGroups().first()->iconName()));
} else {
- ui.selectIcon->setIcon(KIcon("preferences-desktop-icons"));
+ ui.selectIcon->setIcon(QIcon::fromTheme("preferences-desktop-icons"));
}
}
diff --git a/core/basedialog.cpp b/core/basedialog.cpp
index c021f45..7a03d41 100644
--- a/core/basedialog.cpp
+++ b/core/basedialog.cpp
@@ -24,7 +24,7 @@ KGetSaveSizeDialog::KGetSaveSizeDialog(const QByteArray &name, \
QWidget *parent, : KDialog(parent, flags),
m_name("Size" + name)
{
- const QSize size = \
KGlobal::config()->group("Geometry").readEntry(m_name.constData(), QSize()); + \
const QSize size;// = \
KGlobal::config()->group("Geometry").readEntry(m_name.constData(), QSize()); //TODO: \
Port this file if (size.isValid()) {
resize(size);
}
@@ -33,6 +33,6 @@ KGetSaveSizeDialog::KGetSaveSizeDialog(const QByteArray &name, \
QWidget *parent, KGetSaveSizeDialog::~KGetSaveSizeDialog()
{
const QString name = QString("Size_") + metaObject()->className();
- KGlobal::config()->group("Geometry").writeEntry(m_name.constData(), size());
+ //KGlobal::config()->group("Geometry").writeEntry(m_name.constData(), size());
}
diff --git a/core/datasourcefactory.cpp b/core/datasourcefactory.cpp
index cb7378e..d901c84 100644
--- a/core/datasourcefactory.cpp
+++ b/core/datasourcefactory.cpp
@@ -36,7 +36,7 @@
const int SPEEDTIMER = 1000;//1 second...
-DataSourceFactory::DataSourceFactory(QObject *parent, const KUrl &dest, \
KIO::filesize_t size, KIO::fileoffset_t segSize) \
+DataSourceFactory::DataSourceFactory(QObject *parent, const QUrl &dest, \
KIO::filesize_t size, KIO::fileoffset_t segSize) : QObject(parent),
m_capabilities(0),
m_dest(dest),
@@ -216,7 +216,7 @@ void DataSourceFactory::start()
//create all dirs needed
QDir dir;
- dir.mkpath(m_dest.directory());
+ dir.mkpath(m_dest.adjusted(QUrl::RemoveFilename).toString());
if (checkLocalFile()) {
if (!m_putJob) {
m_putJob = KIO::open(m_dest, QIODevice::WriteOnly | \
QIODevice::ReadOnly); @@ -272,8 +272,8 @@ void DataSourceFactory::start()
//check if the filesystem supports a file of m_size
const static KIO::filesize_t maxFatSize = 4294967295;
if (m_size > maxFatSize) {
- KMountPoint::Ptr mountPoint = \
KMountPoint::currentMountPoints().findByPath(m_dest.directory());
- if (!mountPoint.isNull()) {
+ KMountPoint::Ptr mountPoint = \
KMountPoint::currentMountPoints().findByPath(m_dest.adjusted(QUrl::RemoveFilename).toString());
+ if (!mountPoint) {
if (mountPoint->mountType() == "vfat") {//TODO check what is \
reported on Windows for vfat stop();
KMessageBox::error(0, i18n("Filesize is larger than maximum file \
size supported by VFAT."), i18n("Error")); @@ -282,7 +282,7 @@ void \
DataSourceFactory::start() }
}
- QFile::resize(m_dest.pathOrUrl(), m_size);//TODO should we keep that?
+ QFile::resize(m_dest.toString(), m_size);//TODO should we keep that?
m_speedTimer->start();
foreach (TransferDataSource *source, m_sources) {
@@ -370,21 +370,21 @@ void DataSourceFactory::setDoDownload(bool doDownload)
}
}
-void DataSourceFactory::addMirror(const KUrl &url, int numParalellConnections)
+void DataSourceFactory::addMirror(const QUrl &url, int numParalellConnections)
{
addMirror(url, true, numParalellConnections, false);
}
-void DataSourceFactory::addMirror(const KUrl &url, bool used, int \
numParalellConnections) +void DataSourceFactory::addMirror(const QUrl &url, bool \
used, int numParalellConnections) {
addMirror(url, used, numParalellConnections, true);
}
-void DataSourceFactory::addMirror(const KUrl &url, bool used, int \
numParalellConnections, bool usedDefined) +void DataSourceFactory::addMirror(const \
QUrl &url, bool used, int numParalellConnections, bool usedDefined) {
if (!url.isValid() || url.isEmpty())
{
- kDebug(5001) << "Url is not useable: " << url.pathOrUrl();
+ kDebug(5001) << "Url is not useable: " << url.toString();
return;
}
if (numParalellConnections <= 0)
@@ -425,7 +425,7 @@ void DataSourceFactory::addMirror(const KUrl &url, bool used, int \
numParalellCon
TransferDataSource *source = KGet::createTransferDataSource(url, \
QDomElement(), this); if (source)
{
- kDebug(5001) << "Successfully created a TransferDataSource for " \
<< url.pathOrUrl() << this; + kDebug(5001) << "Successfully \
created a TransferDataSource for " << url.toString() << this;
//url might have been an unused Mirror, so remove it in any case
const int index = m_unusedUrls.indexOf(url);
@@ -448,7 +448,7 @@ void DataSourceFactory::addMirror(const KUrl &url, bool used, int \
numParalellCon
connect(source, \
SIGNAL(data(KIO::fileoffset_t,QByteArray,bool&)), this, \
SLOT(slotWriteData(KIO::fileoffset_t,QByteArray,bool&)));
connect(source, \
SIGNAL(freeSegments(TransferDataSource*,QPair<int,int>)), this, \
SLOT(slotFreeSegments(TransferDataSource*,QPair<int,int>)));
connect(source, SIGNAL(log(QString,Transfer::LogLevel)), this, \
SIGNAL(log(QString,Transfer::LogLevel)));
- connect(source, SIGNAL(urlChanged(KUrl, KUrl)), this, \
SLOT(slotUrlChanged(KUrl, KUrl))); + connect(source, \
SIGNAL(urlChanged(QUrl, QUrl)), this, SLOT(slotUrlChanged(QUrl, QUrl)));
slotUpdateCapabilities();
@@ -462,7 +462,7 @@ void DataSourceFactory::addMirror(const KUrl &url, bool used, int \
numParalellCon }
else
{
- kDebug(5001) << "A TransferDataSource could not be created for " \
<< url.pathOrUrl(); + kDebug(5001) << "A TransferDataSource could \
not be created for " << url.toString(); }
}
else if (usedDefined)
@@ -493,14 +493,14 @@ void DataSourceFactory::addMirror(const KUrl &url, bool used, \
int numParalellCon }
}
-void DataSourceFactory::slotUrlChanged(const KUrl &old, const KUrl &newUrl)
+void DataSourceFactory::slotUrlChanged(const QUrl &old, const QUrl &newUrl)
{
TransferDataSource * ds = m_sources.take(old);
m_sources[newUrl] = ds;
emit dataSourceFactoryChange(Transfer::Tc_Source | Transfer::Tc_FileName);
}
-void DataSourceFactory::removeMirror(const KUrl &url)
+void DataSourceFactory::removeMirror(const QUrl &url)
{
kDebug(5001) << "Removing mirror: " << url;
if (m_sources.contains(url))
@@ -535,13 +535,13 @@ void DataSourceFactory::removeMirror(const KUrl &url)
}
}
-void DataSourceFactory::setMirrors(const QHash<KUrl, QPair<bool, int> > &mirrors)
+void DataSourceFactory::setMirrors(const QHash<QUrl, QPair<bool, int> > &mirrors)
{
//first remove the not set DataSources
- QList<KUrl> oldUrls = m_sources.keys();
- QList<KUrl> newUrls = mirrors.keys();
+ QList<QUrl> oldUrls = m_sources.keys();
+ QList<QUrl> newUrls = mirrors.keys();
- foreach (const KUrl &url, oldUrls)
+ foreach (const QUrl &url, oldUrls)
{
if (!newUrls.contains(url))
{
@@ -554,20 +554,20 @@ void DataSourceFactory::setMirrors(const QHash<KUrl, \
QPair<bool, int> > &mirrors m_unusedConnections.clear();
//second modify the existing DataSources and add the new ones
- QHash<KUrl, QPair<bool, int> >::const_iterator it;
- QHash<KUrl, QPair<bool, int> >::const_iterator itEnd = mirrors.constEnd();
+ QHash<QUrl, QPair<bool, int> >::const_iterator it;
+ QHash<QUrl, QPair<bool, int> >::const_iterator itEnd = mirrors.constEnd();
for (it = mirrors.constBegin(); it != itEnd; ++it)
{
addMirror(it.key(), it.value().first, it.value().second, true);
}
}
-QHash<KUrl, QPair<bool, int> > DataSourceFactory::mirrors() const
+QHash<QUrl, QPair<bool, int> > DataSourceFactory::mirrors() const
{
- QHash<KUrl, QPair<bool, int> > mirrors;
+ QHash<QUrl, QPair<bool, int> > mirrors;
- QHash<KUrl, TransferDataSource*>::const_iterator it;
- QHash<KUrl, TransferDataSource*>::const_iterator itEnd = m_sources.constEnd();
+ QHash<QUrl, TransferDataSource*>::const_iterator it;
+ QHash<QUrl, TransferDataSource*>::const_iterator itEnd = m_sources.constEnd();
for (it = m_sources.constBegin(); it != itEnd; ++it) {
mirrors[it.key()] = QPair<bool, int>(true, (*it)->paralellSegments());
}
@@ -582,8 +582,8 @@ QHash<KUrl, QPair<bool, int> > DataSourceFactory::mirrors() const
bool DataSourceFactory::assignNeeded() const
{
bool assignNeeded = true;
- QHash<KUrl, TransferDataSource*>::const_iterator it;
- QHash<KUrl, TransferDataSource*>::const_iterator itEnd = m_sources.constEnd();
+ QHash<QUrl, TransferDataSource*>::const_iterator it;
+ QHash<QUrl, TransferDataSource*>::const_iterator itEnd = m_sources.constEnd();
for (it = m_sources.constBegin(); it != itEnd; ++it) {
if ((*it)->currentSegments()) {
//at least one TransferDataSource is still running, so no assign needed
@@ -615,7 +615,7 @@ void DataSourceFactory::brokenSegments(TransferDataSource \
*source, const QPair<i void DataSourceFactory::broken(TransferDataSource *source, \
TransferDataSource::Error error) {
kDebug(5001) << source << "is broken with error" << error;
- const QString url = source->sourceUrl().pathOrUrl();
+ const QString url = source->sourceUrl().toString();
removeMirror(source->sourceUrl());
@@ -820,7 +820,7 @@ void DataSourceFactory::slotPutJobDestroyed(QObject *job)
m_putJob = 0;
}
-bool DataSourceFactory::setNewDestination(const KUrl &newDestination)
+bool DataSourceFactory::setNewDestination(const QUrl &newDestination)
{
m_newDest = newDestination;
if (m_newDest.isValid() && (m_newDest != m_dest))
@@ -836,10 +836,10 @@ bool DataSourceFactory::setNewDestination(const KUrl \
&newDestination) }
return true;
- } else if (QFile::exists(m_dest.pathOrUrl())) {
+ } else if (QFile::exists(m_dest.toString())) {
//create all dirs needed
QDir dir;
- dir.mkpath(m_newDest.directory());
+ dir.mkpath(m_newDest.adjusted(QUrl::RemoveFilename).toString());
m_statusBeforeMove = m_status;
stop();
@@ -929,8 +929,8 @@ void DataSourceFactory::slotRepair(const QList<KIO::fileoffset_t> \
&offsets, KIO: m_prevDownloadedSizes.append(m_downloadedSize);
//remove all current mirrors and readd the first unused mirror
- const QList<KUrl> mirrors = m_sources.keys();//FIXME only remove the mirrors of \
the broken segments?! --> for that m_assignedChunks would need to be \
saved was well
- foreach (const KUrl &mirror, mirrors)
+ const QList<QUrl> mirrors = m_sources.keys();//FIXME only remove the mirrors of \
the broken segments?! --> for that m_assignedChunks would need to be saved was well + \
foreach (const QUrl &mirror, mirrors) {
removeMirror(mirror);
}
@@ -965,7 +965,7 @@ void DataSourceFactory::load(const QDomElement *element)
//only try to load values if they haven't been set
if (m_dest.isEmpty())
{
- m_dest = KUrl(e.attribute("dest"));
+ m_dest = QUrl(e.attribute("dest"));
}
verifier()->load(e);
@@ -1045,7 +1045,7 @@ void DataSourceFactory::load(const QDomElement *element)
for (int i = 0; i < urls.count(); ++i)
{
const QDomElement urlElement = urls.at(i).toElement();
- const KUrl url = KUrl(urlElement.text());
+ const QUrl url = QUrl(urlElement.text());
const int connections = urlElement.attribute("numParalellSegments").toInt();
addMirror(url, true, connections, true);
}
@@ -1055,7 +1055,7 @@ void DataSourceFactory::load(const QDomElement *element)
for (int i = 0; i < unusedUrls.count(); ++i)
{
const QDomElement urlElement = unusedUrls.at(i).toElement();
- const KUrl url = KUrl(urlElement.text());
+ const QUrl url = QUrl(urlElement.text());
const int connections = urlElement.attribute("numParalellSegments").toInt();
addMirror(url, false, connections, true);
}
@@ -1177,8 +1177,8 @@ void DataSourceFactory::save(const QDomElement &element)
//set the used urls
QDomElement urls = doc.createElement("urls");
- QHash<KUrl, TransferDataSource*>::const_iterator it;
- QHash<KUrl, TransferDataSource*>::const_iterator itEnd = m_sources.constEnd();
+ QHash<QUrl, TransferDataSource*>::const_iterator it;
+ QHash<QUrl, TransferDataSource*>::const_iterator itEnd = m_sources.constEnd();
for (it = m_sources.constBegin(); it != itEnd; ++it) {
QDomElement url = doc.createElement("url");
const QDomText text = doc.createTextNode(it.key().url());
diff --git a/core/datasourcefactory.h b/core/datasourcefactory.h
index fb54897..43ecde0 100644
--- a/core/datasourcefactory.h
+++ b/core/datasourcefactory.h
@@ -45,7 +45,7 @@ class KGET_EXPORT DataSourceFactory : public QObject
* find the filesize
* @note when you want to load a datasourcefactory you do not have to \
specify the url and segSize
*/
- explicit DataSourceFactory(QObject *parent, const KUrl &dest = KUrl(), \
KIO::filesize_t size = 0, KIO::fileoffset_t segSize = 512000); + explicit \
DataSourceFactory(QObject *parent, const QUrl &dest = QUrl(), KIO::filesize_t size = \
0, KIO::fileoffset_t segSize = 512000);
~DataSourceFactory();
@@ -73,7 +73,7 @@ class KGET_EXPORT DataSourceFactory : public QObject
ulong currentSpeed() const {return m_speed;}
ulong percent() const {return m_percent;}
- KUrl dest() const {return m_dest;}
+ QUrl dest() const {return m_dest;}
/**
* The maximum number of mirrors that will be used for downloading, default \
is 3 @@ -97,7 +97,7 @@ class KGET_EXPORT DataSourceFactory : public QObject
* to the new value, so to change the number of paralell connections of a \
mirror you are already
* using simply call addMirror again
*/
- void addMirror(const KUrl &url, bool used, int numParalellConnections = 1);
+ void addMirror(const QUrl &url, bool used, int numParalellConnections = 1);
/**
* Add a mirror that can be used for downloading, if it will be used depends \
if maxMirrorsUsed @@ -109,7 +109,7 @@ class KGET_EXPORT DataSourceFactory : public \
QObject
* to the new value, so to change the number of paralell connections of a \
mirror you are already
* using simply call addMirror again
*/
- void addMirror(const KUrl &url, int numParalellConnections = 1);
+ void addMirror(const QUrl &url, int numParalellConnections = 1);
/**
* Does not use the specified mirror for downloading the file
@@ -117,7 +117,7 @@ class KGET_EXPORT DataSourceFactory : public QObject
* otherwise nohting will happen
* @param url the mirror that should not be used anymore
*/
- void removeMirror(const KUrl &url);
+ void removeMirror(const QUrl &url);
/**
* Sets the mirrors that should be used/not used for downloading
@@ -125,13 +125,13 @@ class KGET_EXPORT DataSourceFactory : public QObject
* (minimum is 1)
* @note if you want the download to work at least one entry should be set \
to true
*/
- void setMirrors(const QHash<KUrl, QPair<bool, int> > &mirrors);
+ void setMirrors(const QHash<QUrl, QPair<bool, int> > &mirrors);
/**
* Return all mirrors, where bool defines if the mirror is used,
* while in defines the number of paralell connections for that mirror
*/
- QHash<KUrl, QPair<bool, int> > mirrors() const;
+ QHash<QUrl, QPair<bool, int> > mirrors() const;
/**
* Returns whether the datasourcefactory should download the file or not,
@@ -147,7 +147,7 @@ class KGET_EXPORT DataSourceFactory : public QObject
*/
void setDoDownload(bool doDownload);
- bool setNewDestination(const KUrl &newDest);
+ bool setNewDestination(const QUrl &newDest);
Job::Status status() const {return m_status;}
@@ -223,7 +223,7 @@ class KGET_EXPORT DataSourceFactory : public QObject
void slotFinishedDownload(TransferDataSource *source, KIO::filesize_t size);
- void slotUrlChanged(const KUrl &, const KUrl &);
+ void slotUrlChanged(const QUrl &, const QUrl &);
private:
/**
@@ -232,7 +232,7 @@ class KGET_EXPORT DataSourceFactory : public QObject
* @param usedDefined true if the user defined used, otherwise false,
* needed to know if m_maxMirrorsUsed should be changed or not
*/
- void addMirror(const KUrl &url, bool used, int numParalellConnections, bool \
usedDefined); + void addMirror(const QUrl &url, bool used, int \
numParalellConnections, bool usedDefined);
/**
* Checks if an assign is needed, i.e. there are no (running) \
TransferDataSources, @@ -248,8 +248,8 @@ class KGET_EXPORT DataSourceFactory : public \
QObject
private:
Transfer::Capabilities m_capabilities;
- KUrl m_dest;
- KUrl m_newDest;
+ QUrl m_dest;
+ QUrl m_newDest;
KIO::filesize_t m_size;
KIO::filesize_t m_downloadedSize;
QList<KIO::filesize_t> m_prevDownloadedSizes;
@@ -303,8 +303,8 @@ class KGET_EXPORT DataSourceFactory : public QObject
bool m_sizeFoundOnFinish;
int m_maxMirrorsUsed;
- QHash<KUrl, TransferDataSource*> m_sources;
- QList<KUrl> m_unusedUrls;
+ QHash<QUrl, TransferDataSource*> m_sources;
+ QList<QUrl> m_unusedUrls;
QList<int> m_unusedConnections;
QTimer *m_speedTimer;
Job::Status m_status;
diff --git a/core/download.cpp b/core/download.cpp
index 9f0eeb9..db9386c 100644
--- a/core/download.cpp
+++ b/core/download.cpp
@@ -14,7 +14,7 @@
#include <KDebug>
-Download::Download(const KUrl &srcUrl, const KUrl &destUrl)
+Download::Download(const QUrl &srcUrl, const QUrl &destUrl)
: m_srcUrl(srcUrl),
m_destUrl(destUrl)
{
diff --git a/core/download.h b/core/download.h
index 6314515..7c3e1c6 100644
--- a/core/download.h
+++ b/core/download.h
@@ -16,7 +16,7 @@
#include <QObject>
#include <QByteArray>
-#include <KUrl>
+#include <QUrl>
#include <kio/job.h>
@@ -24,11 +24,11 @@ class KGET_EXPORT Download : public QObject
{
Q_OBJECT
public:
- Download(const KUrl &srcUrl, const KUrl &destUrl);
+ Download(const QUrl &srcUrl, const QUrl &destUrl);
~Download();
Q_SIGNALS:
- void finishedSuccessfully(KUrl dest, QByteArray data);
+ void finishedSuccessfully(QUrl dest, QByteArray data);
void finishedWithError();
private slots:
@@ -37,9 +37,9 @@ class KGET_EXPORT Download : public QObject
private:
KIO::TransferJob *m_copyJob;
- KUrl m_srcUrl;
- KUrl m_destUrl;
- KUrl m_destFile;
+ QUrl m_srcUrl;
+ QUrl m_destUrl;
+ QUrl m_destFile;
QByteArray m_data;
};
diff --git a/core/filedeleter.cpp b/core/filedeleter.cpp
index 36d21fe..8d4a17b 100644
--- a/core/filedeleter.cpp
+++ b/core/filedeleter.cpp
@@ -20,7 +20,7 @@
#include "filedeleter.h"
#include "filedeleter_p.h"
-K_GLOBAL_STATIC(FileDeleter, fileDeleter)
+Q_GLOBAL_STATIC(FileDeleter, fileDeleter)
FileDeleter::Private::Private()
: QObject(0)
@@ -31,14 +31,14 @@ FileDeleter::Private::~Private()
{
}
-bool FileDeleter::Private::isFileBeingDeleted(const KUrl &dest) const
+bool FileDeleter::Private::isFileBeingDeleted(const QUrl &dest) const
{
return m_jobs.contains(dest);
}
-KJob *FileDeleter::Private::deleteFile(const KUrl &dest, QObject *receiver, const \
char *method) +KJob *FileDeleter::Private::deleteFile(const QUrl &dest, QObject \
*receiver, const char *method) {
- QHash<KUrl, KJob*>::iterator it = m_jobs.find(dest);
+ QHash<QUrl, KJob*>::iterator it = m_jobs.find(dest);
if (it == m_jobs.end()) {
KJob *job = KIO::del(dest, KIO::HideProgressInfo);
it = m_jobs.insert(dest, job);
@@ -70,15 +70,14 @@ FileDeleter::~FileDeleter()
delete d;
}
-KJob *FileDeleter::deleteFile(const KUrl &dest, QObject *receiver, const char \
*method) +KJob *FileDeleter::deleteFile(const QUrl &dest, QObject *receiver, const \
char *method) {
return fileDeleter->d->deleteFile(dest, receiver, method);
}
-bool FileDeleter::isFileBeingDeleted(const KUrl &dest)
+bool FileDeleter::isFileBeingDeleted(const QUrl &dest)
{
return fileDeleter->d->isFileBeingDeleted(dest);
}
#include "filedeleter.moc"
-#include "filedeleter_p.moc"
diff --git a/core/filedeleter.h b/core/filedeleter.h
index 4bf24e8..a648bb4 100644
--- a/core/filedeleter.h
+++ b/core/filedeleter.h
@@ -23,7 +23,7 @@
#include "kget_export.h"
class KJob;
-class KUrl;
+class QUrl;
class QObject;
/**
@@ -48,12 +48,12 @@ class KGET_EXPORT FileDeleter
* @return the KJob that has been created
* @note only use the returned job to create connections yourself, not to \
modify it!
*/
- static KJob *deleteFile(const KUrl &dest, QObject *receiver = 0, const char \
*method = 0); + static KJob *deleteFile(const QUrl &dest, QObject *receiver = \
0, const char *method = 0);
/**
* @return true if dest is being deleted
*/
- static bool isFileBeingDeleted(const KUrl &dest);
+ static bool isFileBeingDeleted(const QUrl &dest);
private:
class Private;
diff --git a/core/filedeleter_p.h b/core/filedeleter_p.h
index 6faa3c3..1f3cdde 100644
--- a/core/filedeleter_p.h
+++ b/core/filedeleter_p.h
@@ -20,8 +20,10 @@
#ifndef FILEDELETER_P_H
#define FILEDELETER_P_H
+#include "filedeleter.h"
+
#include <KIO/DeleteJob>
-#include <KUrl>
+#include <QUrl>
#include <QtCore/QHash>
#include <QtCore/QObject>
@@ -33,15 +35,15 @@ class FileDeleter::Private : QObject
Private();
~Private();
- KJob *deleteFile(const KUrl &dest, QObject *receiver, const char *method);
+ KJob *deleteFile(const QUrl &dest, QObject *receiver, const char *method);
- bool isFileBeingDeleted(const KUrl &dest) const;
+ bool isFileBeingDeleted(const QUrl &dest) const;
public Q_SLOTS:
void slotResult(KJob *job);
private:
- QHash<KUrl, KJob*> m_jobs;
+ QHash<QUrl, KJob*> m_jobs;
};
#endif // FILEDELETER_P_H
diff --git a/core/filemodel.cpp b/core/filemodel.cpp
index 59b0a34..1761d69 100644
--- a/core/filemodel.cpp
+++ b/core/filemodel.cpp
@@ -22,7 +22,7 @@
#include "signature.h"
#include "verifier.h"
-#include <KIcon>
+#include <QIcon>
#include <KLocale>
#include <KMimeType>
@@ -83,9 +83,9 @@ QVariant FileItem::data(int column, int role) const
{
if (m_mimeType.isNull()) {
if (isFile()) {
- m_mimeType = KIcon(KMimeType::iconNameForUrl(KUrl(m_name)));
+ m_mimeType = \
QIcon::fromTheme(KMimeType::iconNameForUrl(QUrl(m_name))); } else {
- m_mimeType = KIcon("folder");
+ m_mimeType = QIcon::fromTheme("folder");
}
}
@@ -111,28 +111,28 @@ QVariant FileItem::data(int column, int role) const
if (role == Qt::DecorationRole) {
switch (m_checkusmVerified) {
case Verifier::Verified:
- return KIcon("dialog-ok");
+ return QIcon::fromTheme("dialog-ok");
case Verifier::NotVerified:
- return KIcon("dialog-error");
+ return QIcon::fromTheme("dialog-error");
case Verifier::NoResult:
default:
- return KIcon();
+ return QIcon::fromTheme(QString());
}
}
} else if (column == FileItem::SignatureVerified) {//TODO implement all cases
if (role == Qt::DecorationRole) {
switch (m_signatureVerified) {
case Signature::Verified:
- return KIcon("dialog-ok");
+ return QIcon::fromTheme("dialog-ok");
case Signature::VerifiedInformation:
- return KIcon("dialog-information");
+ return QIcon::fromTheme("dialog-information");
case Signature::VerifiedWarning:
- return KIcon("dialog-warning");
+ return QIcon::fromTheme("dialog-warning");
case Signature::NotVerified:
- return KIcon("dialog-error");
+ return QIcon::fromTheme("dialog-error");
case Signature::NoResult:
default:
- return KIcon();
+ return QIcon::fromTheme(QString());
}
}
}
@@ -274,7 +274,7 @@ void FileItem::addSize(KIO::fileoffset_t size, FileModel *model)
}
-FileModel::FileModel(const QList<KUrl> &files, const KUrl &destDirectory, QObject \
*parent) +FileModel::FileModel(const QList<QUrl> &files, const QUrl &destDirectory, \
QObject *parent) : QAbstractItemModel(parent),
m_destDirectory(destDirectory),
m_checkStateChanged(false)
@@ -290,14 +290,14 @@ FileModel::~FileModel()
delete m_rootItem;
}
-void FileModel::setupModelData(const QList<KUrl> &files)
+void FileModel::setupModelData(const QList<QUrl> &files)
{
- QString destDirectory = m_destDirectory.pathOrUrl();
+ QString destDirectory = m_destDirectory.toString();
- foreach (const KUrl &file, files)
+ foreach (const QUrl &file, files)
{
FileItem *parent = m_rootItem;
- QStringList directories = file.pathOrUrl().remove(destDirectory).split('/', \
QString::SkipEmptyParts); + QStringList directories = \
file.toString().remove(destDirectory).split('/', QString::SkipEmptyParts); FileItem \
*child = 0; while (directories.count())
{
@@ -461,7 +461,7 @@ QModelIndex FileModel::index(int row, int column, const \
QModelIndex &parent) con }
}
-QModelIndex FileModel::index(const KUrl &file, int column)
+QModelIndex FileModel::index(const QUrl &file, int column)
{
FileItem *item = getItem(file);
if (!item)
@@ -529,22 +529,22 @@ void FileModel::changeData(int row, int column, FileItem *item, \
bool finished) emit dataChanged(index, index);
if (finished) {
- const KUrl file = getUrl(index);
+ const QUrl file = getUrl(index);
emit fileFinished(file);
}
}
-void FileModel::setDirectory(const KUrl &newDirectory)
+void FileModel::setDirectory(const QUrl &newDirectory)
{
m_destDirectory = newDirectory;
m_itemCache.clear();
}
-KUrl FileModel::getUrl(const QModelIndex &index)
+QUrl FileModel::getUrl(const QModelIndex &index)
{
if (!index.isValid()) {
- return KUrl();
+ return QUrl();
}
const QModelIndex file = index.sibling(index.row(), FileItem::File);
@@ -552,12 +552,12 @@ KUrl FileModel::getUrl(const QModelIndex &index)
return getUrl(static_cast<FileItem*>(file.internalPointer()));
}
-KUrl FileModel::getUrl(FileItem *item)
+QUrl FileModel::getUrl(FileItem *item)
{
const QString path = getPath(item);
const QString name = item->data(FileItem::File, Qt::DisplayRole).toString();
- KUrl url = m_destDirectory;
- url.addPath(path + name);
+ QUrl url = m_destDirectory;
+ url.setPath(m_destDirectory.toString() + path + name);
return url;
}
@@ -575,17 +575,17 @@ QString FileModel::getPath(FileItem *item)
return path;
}
-FileItem *FileModel::getItem(const KUrl &file)
+FileItem *FileModel::getItem(const QUrl &file)
{
if (m_itemCache.contains(file))
{
return m_itemCache[file];
}
- QString destDirectory = m_destDirectory.pathOrUrl();
+ QString destDirectory = m_destDirectory.toString();
FileItem *item = m_rootItem;
- QStringList directories = file.pathOrUrl().remove(destDirectory).split('/', \
QString::SkipEmptyParts); + QStringList directories = \
file.toString().remove(destDirectory).split('/', QString::SkipEmptyParts); while \
(directories.count()) {
QString part = directories.takeFirst();
@@ -619,7 +619,7 @@ FileItem *FileModel::getItem(const KUrl &file)
return item;
}
-bool FileModel::downloadFinished(const KUrl &file)
+bool FileModel::downloadFinished(const QUrl &file)
{
FileItem *item = getItem(file);
if (item)
@@ -659,14 +659,14 @@ void FileModel::rename(const QModelIndex &file, const QString \
&newName) return;
}
- //Find out the old and the new KUrl
+ //Find out the old and the new QUrl
QString oldName = file.data(Qt::DisplayRole).toString();
QString path = getPath(item);
- KUrl oldUrl = m_destDirectory;
- oldUrl.addPath(path + oldName);
- KUrl newUrl = m_destDirectory;
- newUrl.addPath(path + newName);
+ QUrl oldUrl = m_destDirectory;
+ oldUrl.setPath(m_destDirectory.toString() + path + oldName);
+ QUrl newUrl = m_destDirectory;
+ newUrl.setPath(m_destDirectory.toString() + path + newName);
m_itemCache.remove(oldUrl);
@@ -675,7 +675,7 @@ void FileModel::rename(const QModelIndex &file, const QString \
&newName) emit rename(oldUrl, newUrl);
}
-void FileModel::renameFailed(const KUrl &beforeRename, const KUrl &afterRename)
+void FileModel::renameFailed(const QUrl &beforeRename, const QUrl &afterRename)
{
Q_UNUSED(beforeRename)
Q_UNUSED(afterRename)
diff --git a/core/filemodel.h b/core/filemodel.h
index bce5efc..f7afcff 100644
--- a/core/filemodel.h
+++ b/core/filemodel.h
@@ -23,14 +23,14 @@
#include "kget_export.h"
#include "transfer.h"
-#include <KUrl>
+#include <QUrl>
#include <QAbstractItemModel>
#include <QList>
#include <QVariant>
#include <kio/global.h>
-#include <KIcon>
+#include <QIcon>
class FileModel;
@@ -82,7 +82,7 @@ class KGET_EXPORT FileItem
private:
QList<FileItem*> m_childItems;
- mutable KIcon m_mimeType;
+ mutable QIcon m_mimeType;
QString m_name;
Qt::CheckState m_state;
Job::Status m_status;
@@ -105,7 +105,7 @@ class KGET_EXPORT FileModel : public QAbstractItemModel
friend class FileItem;
public:
- FileModel(const QList<KUrl> &files, const KUrl &destDirectory, QObject \
*parent = 0); + FileModel(const QList<QUrl> &files, const QUrl &destDirectory, \
QObject *parent = 0); ~FileModel();
QVariant data(const QModelIndex &index, int role) const;
@@ -113,7 +113,7 @@ class KGET_EXPORT FileModel : public QAbstractItemModel
Qt::ItemFlags flags(const QModelIndex &index) const;
QVariant headerData(int section, Qt::Orientation orientation, int role = \
Qt::DisplayRole) const;
QModelIndex index(int row, int column, const QModelIndex &parent = \
QModelIndex()) const;
- QModelIndex index(const KUrl &file, int column);
+ QModelIndex index(const QUrl &file, int column);
QModelIndex parent(const QModelIndex &index) const;
int rowCount(const QModelIndex &parent = QModelIndex()) const;
int columnCount(const QModelIndex &parent = QModelIndex()) const;
@@ -131,14 +131,14 @@ class KGET_EXPORT FileModel : public QAbstractItemModel
* The url on the filesystem (no check if the file exists yet!) of index,
* it can be a folder or file
*/
- KUrl getUrl(const QModelIndex &index);
+ QUrl getUrl(const QModelIndex &index);
/**
* Set the url to the directory the files are stored in, the filemodel \
stores
* its entries as relative path to the base directory
* @param newDirectory the base directory for the model
*/
- void setDirectory(const KUrl &newDirectory);
+ void setDirectory(const QUrl &newDirectory);
/**
* Set a custom status text for status
@@ -148,14 +148,14 @@ class KGET_EXPORT FileModel : public QAbstractItemModel
/**
* Set a custom status icon for status
- * @note KIcon() removes the custom icon for status
+ * @note QIcon() removes the custom icon for status
*/
- void setCustomStatusIcon(Job::Status status, const KIcon &icon);
+ void setCustomStatusIcon(Job::Status status, const QIcon &icon);
/**
* Checks if the download for file has been finished
*/
- bool downloadFinished(const KUrl &file);
+ bool downloadFinished(const QUrl &file);
/**
* Returns true if the index represents a file
@@ -175,18 +175,18 @@ class KGET_EXPORT FileModel : public QAbstractItemModel
void stopWatchCheckState();
Q_SIGNALS:
- void rename(const KUrl &oldUrl, const KUrl &newUrl);
+ void rename(const QUrl &oldUrl, const QUrl &newUrl);
void checkStateChanged();
- void fileFinished(const KUrl &file);
+ void fileFinished(const QUrl &file);
private:
- void setupModelData(const QList<KUrl> &files);
+ void setupModelData(const QList<QUrl> &files);
/**
* The url on the filesystem (no check if the file exists yet!) of item,
* it can be a folder or file
*/
- KUrl getUrl(FileItem *item);
+ QUrl getUrl(FileItem *item);
/**
* Get the path of item
@@ -199,20 +199,20 @@ class KGET_EXPORT FileModel : public QAbstractItemModel
/**
* Get the item of the corresponding url
*/
- FileItem *getItem(const KUrl &file);
+ FileItem *getItem(const QUrl &file);
void changeData(int row, int column, FileItem *item, bool fileFinished = \
false);
private slots:
- void renameFailed(const KUrl &beforeRename, const KUrl &afterRename);
+ void renameFailed(const QUrl &beforeRename, const QUrl &afterRename);
private:
FileItem *m_rootItem;
- KUrl m_destDirectory;
+ QUrl m_destDirectory;
QList<QVariant> m_header;
bool m_checkStateChanged;
- QHash<KUrl, FileItem*> m_itemCache; //used to make getItem faster
+ QHash<QUrl, FileItem*> m_itemCache; //used to make getItem faster
/**
* Stores links to all files
@@ -220,7 +220,7 @@ class KGET_EXPORT FileModel : public QAbstractItemModel
QList<FileItem*> m_files;
QHash<Job::Status, QString> m_customStatusTexts;
- QHash<Job::Status, KIcon> m_customStatusIcons;
+ QHash<Job::Status, QIcon> m_customStatusIcons;
};
#endif
diff --git a/core/keydownloader.cpp b/core/keydownloader.cpp
index 5efad12..bd37f7f 100644
--- a/core/keydownloader.cpp
+++ b/core/keydownloader.cpp
@@ -100,8 +100,8 @@ void KeyDownloader::downloadKey(QString fingerprint, Signature \
*sig, bool mirror m_downloading.insert(fingerprint, sig);
}
- KUrl url(mirror);
- url.addPath("pks/lookup");
+ QUrl url;
+ url.setPath(mirror + "pks/lookup");
url.setQuery("op=get&options=mr&search=" + fingerprint);
url.setPort(11371);
diff --git a/core/kget.cpp b/core/kget.cpp
index bc5c8ff..8023a33 100644
--- a/core/kget.cpp
+++ b/core/kget.cpp
@@ -66,7 +66,7 @@
#endif
-KGet::TransferData::TransferData(const KUrl &source, const KUrl &destination, const \
QString& group, bool doStart, const QDomElement *element) \
+KGet::TransferData::TransferData(const QUrl &source, const QUrl &destination, const \
QString& group, bool doStart, const QDomElement *element) : src(source),
dest(destination),
groupName(group),
@@ -176,14 +176,14 @@ QStringList KGet::transferGroupNames()
return names;
}
-TransferHandler * KGet::addTransfer(KUrl srcUrl, QString destDir, QString \
suggestedFileName, // krazy:exclude=passbyvalue +TransferHandler * \
KGet::addTransfer(QUrl srcUrl, QString destDir, QString suggestedFileName, // \
krazy:exclude=passbyvalue QString groupName, bool start)
{
srcUrl = mostLocalUrl(srcUrl);
// Note: destDir may actually be a full path to a file :-(
kDebug(5001) << "Source:" << srcUrl.url() << ", dest: " << destDir << ", sugg \
file: " << suggestedFileName << endl;
- KUrl destUrl; // the final destination, including filename
+ QUrl destUrl; // the final destination, including filename
if ( srcUrl.isEmpty() )
{
@@ -210,9 +210,9 @@ TransferHandler * KGet::addTransfer(KUrl srcUrl, QString destDir, \
QString sugges
} else {
// check whether destDir is actually already the path to a file
- KUrl targetUrl = KUrl(destDir);
- QString directory = targetUrl.directory(KUrl::ObeyTrailingSlash);
- QString fileName = targetUrl.fileName(KUrl::ObeyTrailingSlash);
+ QUrl targetUrl = QUrl(destDir);
+ QString directory = targetUrl.adjusted(QUrl::RemoveFilename).toString();
+ QString fileName = targetUrl.fileName(QUrl::PrettyDecoded);
if (QFileInfo(directory).isDir() && !fileName.isEmpty()) {
destDir = directory;
suggestedFileName = fileName;
@@ -222,11 +222,11 @@ TransferHandler * KGet::addTransfer(KUrl srcUrl, QString \
destDir, QString sugges if (suggestedFileName.isEmpty())
{
confirmDestination = true;
- suggestedFileName = srcUrl.fileName(KUrl::ObeyTrailingSlash);
+ suggestedFileName = srcUrl.fileName(QUrl::PrettyDecoded);
if (suggestedFileName.isEmpty())
{
// simply use the full url as filename
- suggestedFileName = KUrl::toPercentEncoding( srcUrl.prettyUrl(), "/" );
+ suggestedFileName = QUrl::toPercentEncoding( srcUrl.toDisplayString(), \
"/" ); }
}
@@ -239,22 +239,21 @@ TransferHandler * KGet::addTransfer(KUrl srcUrl, QString \
destDir, QString sugges if (destUrl.isEmpty())
return 0;
- destDir = destUrl.directory(KUrl::ObeyTrailingSlash);
+ destDir = destUrl.adjusted(QUrl::RemoveFilename).toString();
} while (!isValidDestDirectory(destDir));
} else {
- destUrl = KUrl();
- destUrl.setDirectory(destDir);
- destUrl.addPath(suggestedFileName);
+ destUrl = QUrl();
+ destUrl.setPath(destDir + suggestedFileName);
}
destUrl = getValidDestUrl(destUrl, srcUrl);
- if (destUrl == KUrl())
+ if (destUrl == QUrl())
return 0;
TransferHandler *transfer = createTransfer(srcUrl, destUrl, groupName, start);
if (transfer) {
KGet::showNotification(m_mainWindow, "added",
- i18n("<p>The following transfer has been added to \
the download list:</p><p style=\"font-size: small;\">%1</p>", \
transfer->source().pathOrUrl()), + i18n("<p>The \
following transfer has been added to the download list:</p><p style=\"font-size: \
small;\">%1</p>", transfer->source().toString()), "kget", i18n("Download added"));
}
@@ -268,8 +267,8 @@ QList<TransferHandler*> KGet::addTransfers(const \
QList<QDomElement> &elements, c foreach(const QDomElement &e, elements) {
//We need to read these attributes now in order to know which transfer
//plugin to use.
- KUrl srcUrl = KUrl(e.attribute("Source"));
- KUrl destUrl = KUrl(e.attribute("Dest"));
+ QUrl srcUrl = QUrl(e.attribute("Source"));
+ QUrl destUrl = QUrl(e.attribute("Dest"));
data << TransferData(srcUrl, destUrl, groupName, false, &e);
kDebug(5001) << "src=" << srcUrl << " dest=" << destUrl << " group=" << \
groupName; @@ -278,12 +277,12 @@ QList<TransferHandler*> KGet::addTransfers(const \
QList<QDomElement> &elements, c return createTransfers(data);
}
-const QList<TransferHandler *> KGet::addTransfer(KUrl::List srcUrls, QString \
destDir, QString groupName, bool start) +const QList<TransferHandler *> \
KGet::addTransfer(QList<QUrl> srcUrls, QString destDir, QString groupName, bool \
start) {
- KUrl::List urlsToDownload;
+ QList<QUrl> urlsToDownload;
- KUrl::List::Iterator it = srcUrls.begin();
- KUrl::List::Iterator itEnd = srcUrls.end();
+ QList<QUrl>::iterator it = srcUrls.begin();
+ QList<QUrl>::iterator itEnd = srcUrls.end();
QList<TransferHandler *> addedTransfers;
@@ -309,7 +308,7 @@ const QList<TransferHandler *> KGet::addTransfer(KUrl::List \
srcUrls, QString des return addedTransfers;
}
- KUrl destUrl;
+ QUrl destUrl;
// multiple files -> ask for directory, not for every single filename
if (!isValidDestDirectory(destDir))//TODO: Move that after the for-loop
@@ -330,9 +329,9 @@ const QList<TransferHandler *> KGet::addTransfer(KUrl::List \
srcUrls, QString des groupName = list.first()->name();
}
}
- destUrl = getValidDestUrl(KUrl(destDir), *it);
+ destUrl = getValidDestUrl(QUrl(destDir), *it);
- if (destUrl == KUrl())
+ if (destUrl == QUrl())
continue;
data << TransferData(*it, destUrl, groupName, start);
@@ -340,9 +339,9 @@ const QList<TransferHandler *> KGet::addTransfer(KUrl::List \
srcUrls, QString des
QList<TransferHandler*> transfers = createTransfers(data);
if (!transfers.isEmpty()) {
- QString urls = transfers[0]->source().pathOrUrl();
+ QString urls = transfers[0]->source().toString();
for (int i = 1; i < transfers.count(); ++i) {
- urls += '\n' + transfers[i]->source().pathOrUrl();
+ urls += '\n' + transfers[i]->source().toString();
}
QString message;
@@ -515,7 +514,7 @@ void KGet::load( QString filename ) // krazy:exclude=passbyvalue
QString tmpFile;
//Try to save the transferlist to a temporary location
- if(!KIO::NetAccess::download(KUrl(filename), tmpFile, 0)) {
+ if(!KIO::NetAccess::download(QUrl(filename), tmpFile, 0)) {
if (m_transferTreeModel->transferGroups().isEmpty()) //Create the default \
group addGroup(i18n("My Downloads"));
return;
@@ -596,7 +595,7 @@ void KGet::save( QString filename, bool plain ) // \
krazy:exclude=passbyvalue if (plain) {
QTextStream out(&file);
foreach(TransferHandler *handler, allTransfers()) {
- out << handler->source().prettyUrl() << endl;
+ out << handler->source().toString() << endl;
}
}
else {
@@ -677,7 +676,7 @@ QList<TransferGroupHandler*> KGet::allTransferGroups()
return transfergroups;
}
-TransferHandler * KGet::findTransfer(const KUrl &src)
+TransferHandler * KGet::findTransfer(const QUrl &src)
{
Transfer *transfer = KGet::m_transferTreeModel->findTransfer(src);
if (transfer)
@@ -727,7 +726,7 @@ void KGet::settingsChanged()
m_scheduler->settingsChanged();
}
-QList<TransferGroupHandler*> KGet::groupsFromExceptions(const KUrl &filename)
+QList<TransferGroupHandler*> KGet::groupsFromExceptions(const QUrl &filename)
{
QList<TransferGroupHandler*> handlers;
foreach (TransferGroupHandler * handler, allTransferGroups()) {
@@ -740,7 +739,7 @@ QList<TransferGroupHandler*> KGet::groupsFromExceptions(const \
KUrl &filename) return handlers;
}
-bool KGet::matchesExceptions(const KUrl &sourceUrl, const QStringList &patterns)
+bool KGet::matchesExceptions(const QUrl &sourceUrl, const QStringList &patterns)
{
foreach (const QString &pattern, patterns) {
const QString trimmedPattern = pattern.trimmed();
@@ -852,7 +851,7 @@ KGet::~KGet()
#endif
}
-TransferHandler * KGet::createTransfer(const KUrl &src, const KUrl &dest, const \
QString& groupName, +TransferHandler * KGet::createTransfer(const QUrl &src, const \
QUrl &dest, const QString& groupName, bool start, const QDomElement * e)
{
QList<TransferHandler*> transfer = createTransfers(QList<TransferData>() << \
TransferData(src, dest, groupName, start, e)); @@ -928,7 +927,7 @@ \
QList<TransferHandler*> KGet::createTransfers(const QList<TransferData> &dataIte \
return handlers;//TODO implement error message if it is 0, or should the addTransfers \
stuff do that, in case if the numer of returned items does not match the number of \
sent data? }
-TransferDataSource * KGet::createTransferDataSource(const KUrl &src, const \
QDomElement &type, QObject *parent) +TransferDataSource * \
KGet::createTransferDataSource(const QUrl &src, const QDomElement &type, QObject \
*parent) {
kDebug(5001);
@@ -953,12 +952,12 @@ QString KGet::generalDestDir(bool preferXDGDownloadDir)
return dir;
}
-KUrl KGet::urlInputDialog()
+QUrl KGet::urlInputDialog()
{
QString newtransfer;
bool ok = false;
- KUrl clipboardUrl = \
KUrl(QApplication::clipboard()->text(QClipboard::Clipboard).trimmed()); + QUrl \
clipboardUrl = QUrl(QApplication::clipboard()->text(QClipboard::Clipboard).trimmed());
if (clipboardUrl.isValid())
newtransfer = clipboardUrl.url();
@@ -970,16 +969,16 @@ KUrl KGet::urlInputDialog()
if (!ok)
{
//user pressed cancel
- return KUrl();
+ return QUrl();
}
- KUrl src = KUrl(newtransfer);
+ QUrl src = QUrl(newtransfer);
if(src.isValid())
return src;
else
ok = false;
}
- return KUrl();
+ return QUrl();
}
QString KGet::destDirInputDialog()
@@ -990,38 +989,40 @@ QString KGet::destDirInputDialog()
return destDir;
}
-KUrl KGet::destFileInputDialog(QString destDir, const QString& suggestedFileName) // \
krazy:exclude=passbyvalue +QUrl KGet::destFileInputDialog(QString destDir, const \
QString& suggestedFileName) // krazy:exclude=passbyvalue {
if (destDir.isEmpty())
destDir = generalDestDir();
// Use the destination name if not empty...
- KUrl startLocation(destDir);
+ QUrl startLocation;
if (!suggestedFileName.isEmpty()) {
- startLocation.addPath(suggestedFileName);
+ startLocation.setPath(destDir + suggestedFileName);
+ } else {
+ startLocation.setPath(destDir);
}
- KUrl destUrl = KFileDialog::getSaveUrl(startLocation, QString(), m_mainWindow, \
i18n("Save As")); + QUrl destUrl = KFileDialog::getSaveUrl(startLocation, \
QString(), m_mainWindow, i18n("Save As")); if (!destUrl.isEmpty()) {
- Settings::setLastDirectory(destUrl.directory(KUrl::ObeyTrailingSlash));
+ Settings::setLastDirectory(destUrl.adjusted(QUrl::RemoveFilename).toString());
}
return destUrl;
}
-bool KGet::isValidSource(const KUrl &source)
+bool KGet::isValidSource(const QUrl &source)
{
// Check if the URL is well formed
if (!source.isValid()) {
KGet::showNotification(m_mainWindow, "error",
- i18n("Malformed URL:\n%1", source.prettyUrl()));
+ i18n("Malformed URL:\n%1", source.toString()));
return false;
}
// Check if the URL contains the protocol
- if (source.protocol().isEmpty()){
+ if (source.scheme().isEmpty()){
KGet::showNotification(m_mainWindow, "error",
- i18n("Malformed URL, protocol missing:\n%1", \
source.prettyUrl())); + i18n("Malformed URL, protocol \
missing:\n%1", source.toString()));
return false;
}
@@ -1032,7 +1033,7 @@ bool KGet::isValidSource(const KUrl &source)
if (transfer->status() == Job::Finished) {
// transfer is finished, ask if we want to download again
if (KMessageBox::questionYesNoCancel(0,
- i18n("You have already completed a download from the location: \
\n\n%1\n\nDownload it again?", source.prettyUrl()), + i18n("You \
have already completed a download from the location: \n\n%1\n\nDownload it again?", \
source.toString()), i18n("Download it again?"), KStandardGuiItem::yes(),
KStandardGuiItem::no(), KStandardGuiItem::cancel())
== KMessageBox::Yes) {
@@ -1045,7 +1046,7 @@ bool KGet::isValidSource(const KUrl &source)
}
else {
if (KMessageBox::warningYesNoCancel(0,
- i18n("You have a download in progress from the location: \
\n\n%1\n\nDelete it and download again?", source.prettyUrl()), + \
i18n("You have a download in progress from the location: \n\n%1\n\nDelete it and \
download again?", source.toString()),
i18n("Delete it and download again?"), KStandardGuiItem::yes(),
KStandardGuiItem::no(), KStandardGuiItem::cancel())
== KMessageBox::Yes) {
@@ -1066,9 +1067,9 @@ bool KGet::isValidDestDirectory(const QString & destDir)
kDebug(5001) << destDir;
if (!QFileInfo(destDir).isDir())
{
- if (QFileInfo(KUrl(destDir).directory()).isWritable())
+ if (QFileInfo(QUrl(destDir).adjusted(QUrl::RemoveFilename).toString()).isWritable())
return (!destDir.isEmpty());
- if (!QFileInfo(KUrl(destDir).directory()).isWritable() && \
!destDir.isEmpty()) + if \
(!QFileInfo(QUrl(destDir).adjusted(QUrl::RemoveFilename).toString()).isWritable() && \
!destDir.isEmpty()) KMessageBox::error(0, i18n("Directory is not writable"));
}
else
@@ -1081,21 +1082,21 @@ bool KGet::isValidDestDirectory(const QString & destDir)
return false;
}
-KUrl KGet::getValidDestUrl(const KUrl& destDir, const KUrl &srcUrl)
+QUrl KGet::getValidDestUrl(const QUrl& destDir, const QUrl &srcUrl)
{
kDebug() << "Source Url" << srcUrl << "Destination" << destDir;
if ( !isValidDestDirectory(destDir.toLocalFile()) )
- return KUrl();
+ return QUrl();
- KUrl destUrl = destDir;
+ QUrl destUrl = destDir;
if (QFileInfo(destUrl.toLocalFile()).isDir())
{
QString filename = srcUrl.fileName();
if (filename.isEmpty())
- filename = KUrl::toPercentEncoding( srcUrl.prettyUrl(), "/" );
- destUrl.adjustPath( KUrl::AddTrailingSlash );
- destUrl.setFileName( filename );
+ filename = QUrl::toPercentEncoding( srcUrl.toString(), "/" );
+ destUrl.adjusted( QUrl::RemoveFilename );
+ destUrl.setPath(destUrl.path() + filename);
}
Transfer * existingTransferDest = \
m_transferTreeModel->findTransferByDestination(destUrl); @@ -1112,17 +1113,17 @@ KUrl \
KGet::getValidDestUrl(const KUrl& destDir, const KUrl &srcUrl) \
KGet::delTransfer(existingTransferDest->handler()); //start = true;
} else
- return KUrl();
+ return QUrl();
} else {
dlg = new KIO::RenameDialog( m_mainWindow, i18n("You are already \
downloading the same file"/*, destUrl.prettyUrl()*/), srcUrl,
- destUrl, KIO::M_MULTI );
+ destUrl, KIO::RenameDialog_MultipleItems );
}
} else if (srcUrl == destUrl) {
dlg = new KIO::RenameDialog(m_mainWindow, i18n("File already exists"), \
srcUrl,
- destUrl, KIO::M_MULTI);
+ destUrl, KIO::RenameDialog_MultipleItems);
} else if (destUrl.isLocalFile() && QFile::exists(destUrl.toLocalFile())) {
dlg = new KIO::RenameDialog( m_mainWindow, i18n("File already exists"), \
srcUrl,
- destUrl, KIO::M_OVERWRITE );
+ destUrl, KIO::RenameDialog_Overwrite ); \
}
if (dlg) {
@@ -1132,7 +1133,7 @@ KUrl KGet::getValidDestUrl(const KUrl& destDir, const KUrl \
&srcUrl) destUrl = dlg->newDestUrl();
else {
delete(dlg);
- return KUrl();
+ return QUrl();
}
delete(dlg);
@@ -1174,7 +1175,7 @@ void KGet::loadPlugins()
//members of this class (why?), such as the m_transferFactories list.
QList<KGetPlugin *> pluginList;
- const KConfigGroup plugins = KConfigGroup(KGlobal::config(), "Plugins");
+ /*const KConfigGroup plugins = KConfigGroup(KGlobal::config(), "Plugins");
foreach (KService::Ptr service, services)
{
@@ -1201,7 +1202,7 @@ void KGet::loadPlugins()
kDebug(5001) << "Error loading TransferFactory plugin ("
<< service->library() << ")";
}
- }
+ }*/
foreach (KGetPlugin *plugin, pluginList)
{
@@ -1255,7 +1256,7 @@ KGetPlugin * KGet::createPluginFromService( const KService::Ptr \
&service ) return plugin;
}
-bool KGet::safeDeleteFile( const KUrl& url )
+bool KGet::safeDeleteFile( const QUrl& url )
{
if ( url.isLocalFile() )
{
@@ -1263,7 +1264,7 @@ bool KGet::safeDeleteFile( const KUrl& url )
if ( info.isDir() )
{
KGet::showNotification(m_mainWindow, "notification",
- i18n("Not deleting\n%1\nas it is a directory.", \
url.prettyUrl()), + i18n("Not deleting\n%1\nas it \
is a directory.", url.toString()), "dialog-info");
return false;
}
@@ -1273,7 +1274,7 @@ bool KGet::safeDeleteFile( const KUrl& url )
else
KGet::showNotification(m_mainWindow, "notification",
- i18n("Not deleting\n%1\nas it is not a local file.", \
url.prettyUrl()), + i18n("Not deleting\n%1\nas it is \
not a local file.", url.toString()), "dialog-info");
return false;
}
@@ -1281,7 +1282,7 @@ bool KGet::safeDeleteFile( const KUrl& url )
KNotification *KGet::showNotification(QWidget *parent, const QString &eventType,
const QString &text, const QString &icon, const QString \
&title, const KNotification::NotificationFlags &flags) {
- return KNotification::event(eventType, title, text, \
KIcon(icon).pixmap(KIconLoader::SizeMedium), parent, flags); + return \
KNotification::event(eventType, title, text, \
QIcon::fromTheme(icon).pixmap(KIconLoader::SizeMedium), parent, flags); }
GenericObserver::GenericObserver(QObject *parent)
@@ -1385,11 +1386,11 @@ void \
GenericObserver::transfersChangedEvent(QMap<TransferHandler*, \
Transfer::Cha
"kget", i18n("Download completed"));
} else if (transfer->status() == Job::Running) {
KGet::showNotification(KGet::m_mainWindow, "started",
- i18n("<p>The following transfer has been \
started:</p><p style=\"font-size: small;\">%1</p>", transfer->source().pathOrUrl()), \
+ i18n("<p>The following transfer has been \
started:</p><p style=\"font-size: small;\">%1</p>", transfer->source().toString()), \
"kget", i18n("Download started"));
} else if (transfer->status() == Job::Aborted && transfer->error().type \
!= Job::AutomaticRetry) { KNotification * notification = \
KNotification::event("error", i18n("Error"), i18n("<p>There has been an error in the \
following transfer:</p><p style=\"font-size: small;\">%1</p>"
- "<p>The error message is:</p><p \
style=\"font-size: small;\">%2</p>", transfer->source().pathOrUrl(), \
transfer->error().text), + "<p>The error \
message is:</p><p style=\"font-size: small;\">%2</p>", transfer->source().toString(), \
transfer->error().text),
transfer->error().pixmap, \
KGet::m_mainWindow, KNotification::CloseOnTimeout); if (transfer->error().type == \
Job::ManualSolve) { m_notifications.insert(notification, transfer);
@@ -1483,7 +1484,7 @@ void GenericObserver::slotResolveTransferError()
KNotification * notification = static_cast<KNotification*>(QObject::sender());
if (notification) {
TransferHandler * handler = m_notifications[notification];
- kDebug() << "Resolve error for" << handler->source().pathOrUrl() << "with \
id" << handler->error().id; + kDebug() << "Resolve error for" << \
handler->source().toString() << "with id" << handler->error().id; \
handler->resolveError(handler->error().id); m_notifications.remove(notification);
}
diff --git a/core/kget.h b/core/kget.h
index dd0921e..2923412 100644
--- a/core/kget.h
+++ b/core/kget.h
@@ -23,6 +23,7 @@
#include <kactioncollection.h>
#include <KNotification>
#include <ktabwidget.h>
+#include <klocalizedstring.h>
#include <Solid/Networking>
#include <QtXml/QDomElement>
@@ -135,7 +136,7 @@ class KGET_EXPORT KGet
* @param start Specifies if the newly added transfers should be started.
* If the group queue is already in a running state, this flag does nothing
*/
- static TransferHandler * addTransfer(KUrl srcUrl, QString destDir = \
QString(), QString suggestedFileName = QString(), + static TransferHandler * \
addTransfer(QUrl srcUrl, QString destDir = QString(), QString suggestedFileName = \
QString(),
QString groupName = QString(), bool \
start = false);
/**
@@ -157,7 +158,7 @@ class KGET_EXPORT KGet
* @param start Specifies if the newly added transfers should be started.
* If the group queue is already in a running state, this flag does nothing
*/
- static const QList<TransferHandler *> addTransfer(KUrl::List srcUrls, \
QString destDir = QString(), + static const QList<TransferHandler *> \
addTransfer(QList<QUrl> srcUrls, QString destDir = QString(),
QString groupName = \
QString(), bool start=false);
/**
@@ -279,7 +280,7 @@ class KGET_EXPORT KGet
* Get the transfer with the given url
* @param src the url
*/
- static TransferHandler * findTransfer(const KUrl &src);
+ static TransferHandler * findTransfer(const QUrl &src);
/**
* Get the group with the given name
@@ -301,12 +302,12 @@ class KGET_EXPORT KGet
/**
* @return a list of the groups assigned to the filename of a transfer
*/
- static QList<TransferGroupHandler*> groupsFromExceptions(const KUrl \
&filename); + static QList<TransferGroupHandler*> groupsFromExceptions(const \
QUrl &filename);
/**
* Returns true if sourceUrl matches any of the patterns
*/
- static bool matchesExceptions(const KUrl &sourceUrl, const QStringList \
&patterns); + static bool matchesExceptions(const QUrl &sourceUrl, const \
QStringList &patterns);
/**
* Scans for all the available plugins and creates the proper
@@ -317,7 +318,7 @@ class KGET_EXPORT KGet
* this is only needed when creating a "special" TransferDataSource like the \
search for Urls
* you can set additional information and the TransferDataSource will use it \
if it can
*/
- static TransferDataSource * createTransferDataSource(const KUrl &src, const \
QDomElement &type = QDomElement(), QObject *parent = 0); + static \
TransferDataSource * createTransferDataSource(const QUrl &src, const QDomElement \
&type = QDomElement(), QObject *parent = 0);
/**
* Sets the global download limit
@@ -388,21 +389,21 @@ class KGET_EXPORT KGet
* @param groupName the group name
* @param start Specifies if the newly added transfers should be started.
*/
- static TransferHandler * createTransfer(const KUrl &src, const KUrl &dest, \
const QString& groupName = QString(), bool start = false, const QDomElement * e = 0); \
+ static TransferHandler * createTransfer(const QUrl &src, const QUrl &dest, \
const QString& groupName = QString(), bool start = false, const QDomElement * e = 0); \
/**
* Creates multiple transfers with transferData
*/
static QList<TransferHandler*> createTransfers(const QList<TransferData> \
&transferData);
- static KUrl urlInputDialog();
+ static QUrl urlInputDialog();
static QString destDirInputDialog();
- static KUrl destFileInputDialog(QString destDir = QString(), const QString& \
suggestedFileName = QString()); + static QUrl destFileInputDialog(QString \
destDir = QString(), const QString& suggestedFileName = QString());
- static bool isValidSource(const KUrl &source);
+ static bool isValidSource(const QUrl &source);
static bool isValidDestDirectory(const QString& destDir);
- static KUrl getValidDestUrl(const KUrl& destDir, const KUrl &srcUrl);
+ static QUrl getValidDestUrl(const QUrl& destDir, const QUrl &srcUrl);
//Plugin-related functions
static KGetPlugin * createPluginFromService( const KService::Ptr &service );
@@ -423,7 +424,7 @@ class KGET_EXPORT KGet
* is a directory or if it is not local it returns false and shows a
* warning message.
*/
- static bool safeDeleteFile( const KUrl& url );
+ static bool safeDeleteFile( const QUrl& url );
//Interview models
static TransferTreeModel * m_transferTreeModel;
@@ -454,10 +455,10 @@ class KGET_EXPORT KGet
class KGET_EXPORT KGet::TransferData
{
public:
- TransferData(const KUrl &src, const KUrl &dest, const QString &groupName = \
QString(), bool start = false, const QDomElement *e = 0); + TransferData(const \
QUrl &src, const QUrl &dest, const QString &groupName = QString(), bool start = \
false, const QDomElement *e = 0);
- KUrl src;
- KUrl dest;
+ QUrl src;
+ QUrl dest;
QString groupName;
bool start;
const QDomElement *e;
diff --git a/core/kgetkjobadapter.cpp b/core/kgetkjobadapter.cpp
index 22e623f..360e567 100644
--- a/core/kgetkjobadapter.cpp
+++ b/core/kgetkjobadapter.cpp
@@ -43,8 +43,8 @@ unsigned long KGetKJobAdapter::percent() const
void KGetKJobAdapter::slotUpdateDescription()
{
emit description(this, i18n("KGet Transfer"),
- qMakePair(QString("source"), \
m_transferHandler->source().prettyUrl()),
- qMakePair(QString("destination"), \
m_transferHandler->dest().prettyUrl())); + \
qMakePair(QString("source"), m_transferHandler->source().toString()), + \
qMakePair(QString("destination"), m_transferHandler->dest().toString()));
emitSpeed(m_transferHandler->downloadSpeed());
setProcessedAmount(KJob::Bytes, processedAmount(KJob::Bytes));
diff --git a/core/linkimporter.cpp b/core/linkimporter.cpp
index 6f3d2b2..733539b 100644
--- a/core/linkimporter.cpp
+++ b/core/linkimporter.cpp
@@ -30,7 +30,7 @@
// static QString REGULAR_EXPRESSION = \
"((http|https|ftp|ftps)+([\\:\\w\\d:#@%/;$()~_?\\+-=\\\\.&])*)"; static QString \
REGULAR_EXPRESSION = \
"(\\w+[:]//)?(((([\\w-]+[.]){1,}(ac|ad|ae|af|ag|ai|al|am|an|ao|aq|ar|as|at|au|aw|az|ba \
|bb|bd|be|bf|bg|bh|bi|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|c \
n|co|com|cr|cs|cu|cv|cx|cy|cz|de|dj|dk|dm|do|dz|ec|edu|ee|eg|eh|er|es|et|eu|fi|fj|fk|f \
m|fo|fr|ga|gd|ge|gf|gg|gh|gi|gl|gm|gn|gov|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id \
|ie|il|im|in|int|io|iq|ir|is|it|je|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc| \
li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|mg|mh|mil|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|mv|mw|mx|m \
y|mz|na|nc|ne|net|nf|ng|ni|nl|no|np|nr|nt|nu|nz|om|org|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|p \
s|pt|pw|py|qa|re|ro|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|sv|st|sy|sz|tc| \
td|tf|tg|th|tj|tk|tm|tn|to|tp|tr|tt|tv|tw|tz|ua|ug|uk|um|us|uy|uz|va|vc|ve|vg|vi|vn|vu \
|wf|ws|ye|yt|yu|za|zm|zw|aero|biz|coop|info|museum|name|pro|travel))|([0-9]+[.][0-9]+[.][0-9]+[.][0-9]+)))([:][0-9]*)?([?/][\\w~#\\-;%?@&=/.+]*)?(?!\\w)";
-LinkImporter::LinkImporter(const KUrl &url, QObject *parent) : QThread(parent),
+LinkImporter::LinkImporter(const QUrl &url, QObject *parent) : QThread(parent),
m_url(url),
m_transfers(),
m_tempFile()
@@ -61,27 +61,25 @@ void LinkImporter::checkClipboard(const QString \
&clipboardContent)
regexPos += rx.matchedLength();
}
-
- emit finished();
}
void LinkImporter::run()
{
if(!m_url.isLocalFile() && !m_tempFile.isEmpty()) {
- slotReadFile(KUrl(m_tempFile));
+ slotReadFile(QUrl(m_tempFile));
}
else {
slotReadFile(m_url);
}
- emit finished();
+ quit();
}
void LinkImporter::copyRemoteFile()
{
m_tempFile = QString("%1/%2.tmp").arg(QDir::tempPath()).arg("importer_aux");
- KUrl aux(m_tempFile);
+ QUrl aux(m_tempFile);
KIO::CopyJob *job = KIO::copy(m_url, aux, KIO::HideProgressInfo);
QMap<QString, QString> metaData;
@@ -131,12 +129,12 @@ void LinkImporter::slotReadFile(const QUrl &url)
void LinkImporter::addTransfer(QString &link)
{
- KUrl auxUrl;
+ QUrl auxUrl;
if (link.contains("://")) {
- auxUrl = KUrl(link);
+ auxUrl = QUrl(link);
} else {
- auxUrl = KUrl(QString("http://") + link);
+ auxUrl = QUrl(QString("http://") + link);
}
if(!link.isEmpty() && auxUrl.isValid() && m_transfers.indexOf(link) < 0 &&
diff --git a/core/linkimporter.h b/core/linkimporter.h
index 6109b61..4befe30 100644
--- a/core/linkimporter.h
+++ b/core/linkimporter.h
@@ -15,7 +15,7 @@
#include <QList>
#include <QThread>
-#include <KUrl>
+#include <QUrl>
class KLocalizedString;
@@ -26,7 +26,7 @@ class KGET_EXPORT LinkImporter : public QThread
{
Q_OBJECT
public:
- LinkImporter(const KUrl &source, QObject *parent);
+ LinkImporter(const QUrl &source, QObject *parent);
LinkImporter(QObject *parent);
~LinkImporter();
@@ -67,7 +67,7 @@ private:
void addTransfer(QString &link);
private:
- KUrl m_url;
+ QUrl m_url;
QList <QString> m_transfers;
QString m_tempFile;
};
diff --git a/core/mostlocalurl.cpp b/core/mostlocalurl.cpp
index a7ad9e9..b35b01f 100644
--- a/core/mostlocalurl.cpp
+++ b/core/mostlocalurl.cpp
@@ -24,10 +24,10 @@
#include <KDebug>
#include <KIO/NetAccess>
-KUrl mostLocalUrl(const KUrl &url)
+QUrl mostLocalUrl(const QUrl &url)
{
kDebug(5001);
- const QString protocol = url.protocol();
+ const QString protocol = url.scheme();
foreach (TransferFactory *factory, KGet::factories()) {
if (factory->addsProtocols().contains(protocol)) {
return url;
@@ -38,23 +38,23 @@ KUrl mostLocalUrl(const KUrl &url)
return KIO::NetAccess::mostLocalUrl(url, 0);
}
-MostLocalUrlJob *mostLocalUrlJob(const KUrl &url)
+MostLocalUrlJob *mostLocalUrlJob(const QUrl &url)
{
return new MostLocalUrlJob(url);
}
-MostLocalUrlJob::MostLocalUrlJob(const KUrl& url)
+MostLocalUrlJob::MostLocalUrlJob(const QUrl& url)
: KIO::Job(),
m_url(url)
{
}
-KUrl MostLocalUrlJob::url()
+QUrl MostLocalUrlJob::url()
{
return m_url;
}
-KUrl MostLocalUrlJob::mostLocalUrl() const
+QUrl MostLocalUrlJob::mostLocalUrl() const
{
return m_mostLocalUrl;
}
@@ -62,7 +62,7 @@ KUrl MostLocalUrlJob::mostLocalUrl() const
void MostLocalUrlJob::start()
{
bool startJob = true;
- const QString protocol = m_url.protocol();
+ const QString protocol = m_url.scheme();
foreach (TransferFactory *factory, KGet::factories()) {
if (factory->addsProtocols().contains(protocol)) {
startJob = false;
diff --git a/core/mostlocalurl.h b/core/mostlocalurl.h
index dc5eadb..7e0fbc4 100644
--- a/core/mostlocalurl.h
+++ b/core/mostlocalurl.h
@@ -22,7 +22,7 @@
#include "kget_export.h"
#include <KIO/Job>
-#include <KUrl>
+#include <QUrl>
/**
* NOTE this implementation does KIO::mostLocalUrl on any url whose protocol
@@ -40,12 +40,12 @@ class MostLocalUrlJob;
/**
* Synchronous
*/
-KGET_EXPORT KUrl mostLocalUrl(const KUrl &url);
+KGET_EXPORT QUrl mostLocalUrl(const QUrl &url);
/**
* Asynchronous
*/
-KGET_EXPORT MostLocalUrlJob *mostLocalUrlJob(const KUrl &url);
+KGET_EXPORT MostLocalUrlJob *mostLocalUrlJob(const QUrl &url);
/**
* Job for asynchronously getting the most local url, do not use directly, but use
@@ -55,22 +55,22 @@ class KGET_EXPORT MostLocalUrlJob : public KIO::Job
{
Q_OBJECT
public:
- MostLocalUrlJob(const KUrl &url);
+ MostLocalUrlJob(const QUrl &url);
virtual void start();
- KUrl url();
+ QUrl url();
/**
* Call this in the slot connected to result.
*/
- KUrl mostLocalUrl() const;
+ QUrl mostLocalUrl() const;
protected:
virtual void slotResult(KJob *job);
private:
- KUrl m_url;
- KUrl m_mostLocalUrl;
+ QUrl m_url;
+ QUrl m_mostLocalUrl;
};
#endif
diff --git a/core/nepomukcontroller.cpp b/core/nepomukcontroller.cpp
index 6380e75..7968b19 100644
--- a/core/nepomukcontroller.cpp
+++ b/core/nepomukcontroller.cpp
@@ -71,7 +71,7 @@ void NepomukController::addTags(const QList<QUrl> &uris, const \
QList<Nepomuk2::T
Nepomuk2::addProperty(uris, Soprano::Vocabulary::NAO::hasTag(), tagUris);
}
-void NepomukController::removeResource(const QList<KUrl> &uris)
+void NepomukController::removeResource(const QList<QUrl> &uris)
{
QMutexLocker locker(&m_mutex);
m_uris << uris;
@@ -93,11 +93,11 @@ void NepomukController::run()
{
while (continueToRun()) {
m_mutex.lock();
- QList<KUrl> uris = m_uris;
+ QList<QUrl> uris = m_uris;
m_uris.clear();
m_mutex.unlock();
- foreach (const KUrl &uri, uris) {
+ foreach (const QUrl &uri, uris) {
if (!QFile::exists(uri.path())) {
Nepomuk2::Resource resource(uri, \
Nepomuk2::Vocabulary::NFO::FileDataObject()); resource.remove();
diff --git a/core/nepomukcontroller.h b/core/nepomukcontroller.h
index 7c5281a..504dae7 100644
--- a/core/nepomukcontroller.h
+++ b/core/nepomukcontroller.h
@@ -27,7 +27,7 @@
#include <QtCore/QMutex>
#include <QtCore/QThread>
-#include <KUrl>
+#include <QUrl>
class KJob;
@@ -58,7 +58,7 @@ class KGET_EXPORT NepomukController : public QThread
* @note This assumes that uris points to local files and only removes the \
resource if those
* files do not exist anymore
*/
- void removeResource(const QList<KUrl> &uris);
+ void removeResource(const QList<QUrl> &uris);
protected:
void run();
@@ -69,7 +69,7 @@ class KGET_EXPORT NepomukController : public QThread
private:
QMutex m_mutex;
- QList<KUrl> m_uris;
+ QList<QUrl> m_uris;
private slots:
void nepomukError(KJob * job);
diff --git a/core/nepomukhandler.cpp b/core/nepomukhandler.cpp
index a8c068f..2678e20 100644
--- a/core/nepomukhandler.cpp
+++ b/core/nepomukhandler.cpp
@@ -38,18 +38,18 @@ NepomukHandler::~NepomukHandler()
KFileItemList NepomukHandler::fileItems() const
{
KFileItemList fileItems;
- foreach (const KUrl &destination, m_transfer->files()) {
+ foreach (const QUrl &destination, m_transfer->files()) {
fileItems << KFileItem(KFileItem::Unknown, KFileItem::Unknown, destination, \
true); }
return fileItems;
}
-void NepomukHandler::setProperties(const QList<QPair<QUrl, Nepomuk2::Variant> > \
&properties, const QList<KUrl> &files) +void NepomukHandler::setProperties(const \
QList<QPair<QUrl, Nepomuk2::Variant> > &properties, const QList<QUrl> &files) {
- QList<KUrl> usedFiles = (files.isEmpty() ? m_transfer->files() : files);
+ QList<QUrl> usedFiles = (files.isEmpty() ? m_transfer->files() : files);
QList<QUrl> fileUrls;
- foreach(const KUrl &usedFile, usedFiles) {
+ foreach(const QUrl &usedFile, usedFiles) {
fileUrls.push_back(usedFile);
}
@@ -60,7 +60,7 @@ void NepomukHandler::saveFileProperties()
{
QList<QUrl> destinations;
- foreach(const KUrl &url, m_transfer->files()) {
+ foreach(const QUrl &url, m_transfer->files()) {
destinations.push_back(url);
}
diff --git a/core/nepomukhandler.h b/core/nepomukhandler.h
index b51feda..52fbbcb 100644
--- a/core/nepomukhandler.h
+++ b/core/nepomukhandler.h
@@ -34,7 +34,7 @@ class KGET_EXPORT NepomukHandler : public QObject
/**
* Sets properties to a list of files, if the list is empty m_destinations \
is used
*/
- void setProperties(const QList<QPair<QUrl, Nepomuk2::Variant> > &properties, \
const QList<KUrl> &files = QList<KUrl>()); + void setProperties(const \
QList<QPair<QUrl, Nepomuk2::Variant> > &properties, const QList<QUrl> &files = \
QList<QUrl>());
void saveFileProperties();
diff --git a/core/plugin/transferfactory.cpp b/core/plugin/transferfactory.cpp
index 389667e..8733e4a 100644
--- a/core/plugin/transferfactory.cpp
+++ b/core/plugin/transferfactory.cpp
@@ -23,7 +23,7 @@ TransferFactory::TransferFactory(QObject *parent, const \
QVariantList &args)
}
-Transfer * TransferFactory::createTransfer(const KUrl &srcUrl, const KUrl &destUrl,
+Transfer * TransferFactory::createTransfer(const QUrl &srcUrl, const QUrl &destUrl,
TransferGroup * parent,
Scheduler * scheduler,
const QDomElement * n)
@@ -47,7 +47,7 @@ QWidget * TransferFactory::createDetailsWidget(TransferHandler * \
transfer) return 0;
}
-KDialog * TransferFactory::createNewTransferDialog(const KUrl &srcUrl, const QString \
&suggestedFileName, TransferGroupHandler * defaultGroup) +KDialog * \
TransferFactory::createNewTransferDialog(const QUrl &srcUrl, const QString \
&suggestedFileName, TransferGroupHandler * defaultGroup) {
Q_UNUSED(srcUrl)
Q_UNUSED(suggestedFileName)
@@ -61,7 +61,7 @@ const QList<KAction *> TransferFactory::actions(TransferHandler \
*handler) return QList<KAction *>();
}
-TransferDataSource * TransferFactory::createTransferDataSource(const KUrl &srcUrl, \
const QDomElement &type, QObject *parent) +TransferDataSource * \
TransferFactory::createTransferDataSource(const QUrl &srcUrl, const QDomElement \
&type, QObject *parent) {
Q_UNUSED(srcUrl)
Q_UNUSED(type)
@@ -69,7 +69,7 @@ TransferDataSource * \
TransferFactory::createTransferDataSource(const KUrl &srcUr return 0;
}
-bool TransferFactory::isSupported(const KUrl &url) const
+bool TransferFactory::isSupported(const QUrl &url) const
{
Q_UNUSED(url)
return false;
diff --git a/core/plugin/transferfactory.h b/core/plugin/transferfactory.h
index a223213..45b2203 100644
--- a/core/plugin/transferfactory.h
+++ b/core/plugin/transferfactory.h
@@ -55,7 +55,7 @@ class KGET_EXPORT TransferFactory : public KGetPlugin
public:
TransferFactory(QObject *parent, const QVariantList &args);
- virtual Transfer * createTransfer( const KUrl &srcUrl, const KUrl &destUrl,
+ virtual Transfer * createTransfer( const QUrl &srcUrl, const QUrl &destUrl,
TransferGroup * parent,
Scheduler * scheduler,
const QDomElement * n = 0 );
@@ -65,13 +65,13 @@ class KGET_EXPORT TransferFactory : public KGetPlugin
virtual QWidget * createDetailsWidget(TransferHandler * transfer);
- virtual KDialog * createNewTransferDialog(const KUrl &srcUrl, const QString \
&suggestedFileName = QString(), TransferGroupHandler * defaultGroup = 0); + \
virtual KDialog * createNewTransferDialog(const QUrl &srcUrl, const QString \
&suggestedFileName = QString(), TransferGroupHandler * defaultGroup = 0);
virtual const QList<KAction *> actions(TransferHandler *handler = 0);
virtual void settingsChanged() {}
- virtual bool isSupported(const KUrl &url) const;
+ virtual bool isSupported(const QUrl &url) const;
/**
* Returns a list of protocols for which the TransferFactory adds support.
@@ -84,7 +84,7 @@ class KGET_EXPORT TransferFactory : public KGetPlugin
* Returns a Data Source. needed for Transfers Containers if any.
* default implementation returns 0
*/
- virtual TransferDataSource * createTransferDataSource(const KUrl &srcUrl, \
const QDomElement &type, QObject *parent); + virtual TransferDataSource * \
createTransferDataSource(const QUrl &srcUrl, const QDomElement &type, QObject \
*parent); };
#endif
diff --git a/core/transfer.cpp b/core/transfer.cpp
index b4de613..f2d6552 100644
--- a/core/transfer.cpp
+++ b/core/transfer.cpp
@@ -45,7 +45,7 @@ const StatusStrings STATUSTEXTS[] = {
const QStringList STATUSICONS = QStringList() << "media-playback-start" << \
"view-history" << "process-stop" << "dialog-error" << "dialog-ok" << \
"media-playback-start" << "media-playback-pause";
Transfer::Transfer(TransferGroup * parent, TransferFactory * factory,
- Scheduler * scheduler, const KUrl & source, const KUrl & dest,
+ Scheduler * scheduler, const QUrl & source, const QUrl & dest,
const QDomElement * e)
: Job(scheduler, parent),
m_source(source), m_dest(dest),
@@ -105,7 +105,7 @@ void Transfer::setNepomukHandler(NepomukHandler *handler)
}
#endif //HAVE_NEPOMUK
-bool Transfer::setDirectory(const KUrl& newDirectory)
+bool Transfer::setDirectory(const QUrl& newDirectory)
{
Q_UNUSED(newDirectory)
@@ -132,11 +132,11 @@ int Transfer::averageDownloadSpeed() const
return 0;
}
-QHash<KUrl, QPair<bool, int> > Transfer::availableMirrors(const KUrl &file) const
+QHash<QUrl, QPair<bool, int> > Transfer::availableMirrors(const QUrl &file) const
{
Q_UNUSED(file)
- QHash<KUrl, QPair<bool, int> > available;
+ QHash<QUrl, QPair<bool, int> > available;
available[m_source] = QPair<bool, int>(true, 1);
return available;
}
@@ -252,8 +252,8 @@ void Transfer::load(const QDomElement *element)
const QDomElement e = *element;
- m_source = KUrl(e.attribute("Source"));
- m_dest = KUrl(e.attribute("Dest"));
+ m_source = QUrl(e.attribute("Source"));
+ m_dest = QUrl(e.attribute("Dest"));
m_totalSize = e.attribute("TotalSize").toULongLong();
m_downloadedSize = e.attribute("DownloadedSize").toULongLong();
diff --git a/core/transfer.h b/core/transfer.h
index 029651f..2a54d6f 100644
--- a/core/transfer.h
+++ b/core/transfer.h
@@ -17,8 +17,8 @@
#include <QPixmap>
#include <QTime>
+#include <QUrl>
-#include <kurl.h>
#include <kio/global.h>
class QDomElement;
@@ -100,7 +100,7 @@ class KGET_EXPORT Transfer : public Job
typedef int ChangesFlags;
Transfer(TransferGroup * parent, TransferFactory * factory,
- Scheduler * scheduler, const KUrl & src, const KUrl & dest,
+ Scheduler * scheduler, const QUrl & src, const QUrl & dest,
const QDomElement * e = 0);
virtual ~Transfer();
@@ -143,27 +143,27 @@ class KGET_EXPORT Transfer : public Job
* if not defined all files of a download are going to be repaird
* @return true if a repair started, false if it was not nescessary
*/
- virtual bool repair(const KUrl &file = KUrl()) {Q_UNUSED(file) return \
false;} + virtual bool repair(const QUrl &file = QUrl()) {Q_UNUSED(file) \
return false;}
- const KUrl & source() const {return m_source;}
- const KUrl & dest() const {return m_dest;}
+ const QUrl & source() const {return m_source;}
+ const QUrl & dest() const {return m_dest;}
/**
* @returns all files of this transfer
*/
- virtual QList<KUrl> files() const {return QList<KUrl>() << m_dest;}
+ virtual QList<QUrl> files() const {return QList<QUrl>() << m_dest;}
/**
* @returns the directory the Transfer will be stored to
*/
- virtual KUrl directory() const {return m_dest.upUrl();}
+ virtual QUrl directory() const {return m_dest.path();} //FIXME: Does this \
work?
/**
* Move the download to the new destination
* @param newDirectory is a directory where the download should be stored
* @returns true if newDestination can be used
*/
- virtual bool setDirectory(const KUrl &newDirectory);
+ virtual bool setDirectory(const QUrl &newDirectory);
//Transfer status
KIO::filesize_t totalSize() const {return m_totalSize;}
@@ -190,14 +190,14 @@ class KGET_EXPORT Transfer : public Job
* to the mirror
* @param file the file for which the availableMirrors should be get
*/
- virtual QHash<KUrl, QPair<bool, int> > availableMirrors(const KUrl &file) \
const; + virtual QHash<QUrl, QPair<bool, int> > availableMirrors(const QUrl \
&file) const;
/**
* Set the mirrors, int the number of paralell connections to the mirror
* bool if the mirror should be used
* @param file the file for which the availableMirrors should be set
*/
- virtual void setAvailableMirrors(const KUrl &file, const QHash<KUrl, \
QPair<bool, int> > &mirrors) {Q_UNUSED(file) Q_UNUSED(mirrors)} + virtual void \
setAvailableMirrors(const QUrl &file, const QHash<QUrl, QPair<bool, int> > &mirrors) \
{Q_UNUSED(file) Q_UNUSED(mirrors)}
/**
* Set the Transfer's UploadLimit
@@ -280,13 +280,13 @@ class KGET_EXPORT Transfer : public Job
* @param file for which to get the verifier
* @return Verifier that allows you to add checksums manually verify a file \
etc.
*/
- virtual Verifier * verifier(const KUrl &file) {Q_UNUSED(file) return 0;}
+ virtual Verifier * verifier(const QUrl &file) {Q_UNUSED(file) return 0;}
/**
* @param file for which to get the signature
* @return Signature that allows you to add signatures and verify them
*/
- virtual Signature * signature(const KUrl &file) {Q_UNUSED(file) return 0;}
+ virtual Signature * signature(const QUrl &file) {Q_UNUSED(file) return 0;}
#ifdef HAVE_NEPOMUK
/**
@@ -353,8 +353,8 @@ class KGET_EXPORT Transfer : public Job
virtual void setSpeedLimits(int uploadLimit, int downloadLimit) \
{Q_UNUSED(uploadLimit) Q_UNUSED(downloadLimit) }
// --- Transfer information ---
- KUrl m_source;
- KUrl m_dest;
+ QUrl m_source;
+ QUrl m_dest;
QStringList m_log;
KIO::filesize_t m_totalSize;
diff --git a/core/transferdatasource.cpp b/core/transferdatasource.cpp
index 5bdb935..fb94826 100644
--- a/core/transferdatasource.cpp
+++ b/core/transferdatasource.cpp
@@ -12,7 +12,7 @@
#include <kdebug.h>
-TransferDataSource::TransferDataSource(const KUrl &srcUrl, QObject *parent)
+TransferDataSource::TransferDataSource(const QUrl &srcUrl, QObject *parent)
: QObject(parent),
m_sourceUrl(srcUrl),
m_speed(0),
diff --git a/core/transferdatasource.h b/core/transferdatasource.h
index c0761d2..f1f7a96 100644
--- a/core/transferdatasource.h
+++ b/core/transferdatasource.h
@@ -27,7 +27,7 @@ class KGET_EXPORT TransferDataSource : public QObject
{
Q_OBJECT
public:
- TransferDataSource(const KUrl &srcUrl, QObject *parent);
+ TransferDataSource(const QUrl &srcUrl, QObject *parent);
virtual ~TransferDataSource();
enum Error
@@ -73,7 +73,7 @@ class KGET_EXPORT TransferDataSource : public QObject
*/
virtual QPair<int, int> removeConnection();
- KUrl sourceUrl() const {return m_sourceUrl;}//TODO
+ QUrl sourceUrl() const {return m_sourceUrl;}//TODO
/**
* returns the current speed of this data source
@@ -171,9 +171,9 @@ class KGET_EXPORT TransferDataSource : public QObject
/**
* Returns data in the forms of URL List
- * @param data in form of KUrl list
+ * @param data in form of QUrl list
*/
- void data(const QList<KUrl> &data);
+ void data(const QList<QUrl> &data);
/**
* Returns found checksums with their type
@@ -227,7 +227,7 @@ class KGET_EXPORT TransferDataSource : public QObject
/**
* Emitted when the filename of a url changes, e.g. when a link redirects
*/
- void urlChanged(const KUrl &old, const KUrl &newUrl);
+ void urlChanged(const QUrl &old, const QUrl &newUrl);
protected:
/**
@@ -239,7 +239,7 @@ class KGET_EXPORT TransferDataSource : public QObject
virtual void slotSpeed(ulong speed) {Q_UNUSED(speed)}
protected:
- KUrl m_sourceUrl;
+ QUrl m_sourceUrl;
ulong m_speed;
KIO::filesize_t m_supposedSize;
int m_paralellSegments;
diff --git a/core/transfergroup.cpp b/core/transfergroup.cpp
index c94cabd..2793ed8 100644
--- a/core/transfergroup.cpp
+++ b/core/transfergroup.cpp
@@ -158,7 +158,7 @@ void TransferGroup::move(Transfer * transfer, Transfer * after)
JobQueue::move(transfer, after);
}
-Transfer * TransferGroup::findTransfer(const KUrl &src)
+Transfer * TransferGroup::findTransfer(const QUrl &src)
{
iterator it = begin();
iterator itEnd = end();
@@ -172,7 +172,7 @@ Transfer * TransferGroup::findTransfer(const KUrl &src)
return 0;
}
-Transfer *TransferGroup::findTransferByDestination(const KUrl &dest)
+Transfer *TransferGroup::findTransferByDestination(const QUrl &dest)
{
iterator it = begin();
iterator itEnd = end();
diff --git a/core/transfergroup.h b/core/transfergroup.h
index 0e97297..daab5d3 100644
--- a/core/transfergroup.h
+++ b/core/transfergroup.h
@@ -13,9 +13,9 @@
#define GROUP_H
#include <QRegExp>
+#include <QIcon>
#include <kio/netaccess.h>
-#include <KIcon>
#include <KDebug>
#include "jobqueue.h"
@@ -136,7 +136,7 @@ class KGET_EXPORT TransferGroup : public JobQueue
* @return the transfer pointer if the transfer has been found. Otherwise
* it returns 0
*/
- Transfer * findTransfer(const KUrl &src);
+ Transfer * findTransfer(const QUrl &src);
/**
* Finds the first transfer with destination dest
@@ -145,7 +145,7 @@ class KGET_EXPORT TransferGroup : public JobQueue
*
* @return the transfer pointer if the transfer has been found, else return \
0
*/
- Transfer *findTransferByDestination(const KUrl &dest);
+ Transfer *findTransferByDestination(const QUrl &dest);
/**
* @returns the Job in the queue at the given index i
@@ -275,7 +275,7 @@ class KGET_EXPORT TransferGroup : public JobQueue
/**
* @return the group's icon
*/
- QPixmap pixmap() {return KIcon(m_iconName).pixmap(32);}
+ QPixmap pixmap() {return QIcon::fromTheme(m_iconName).pixmap(32);}
/**
* @return the handler associated with this group
diff --git a/core/transferhandler.h b/core/transferhandler.h
index 597cac0..d1457a8 100644
--- a/core/transferhandler.h
+++ b/core/transferhandler.h
@@ -80,7 +80,7 @@ class KGET_EXPORT TransferHandler : public Handler
* if not defined all files of a download are going to be repaird
* @return true if a repair started, false if it was not nescessary
*/
- bool repair(const KUrl &file = KUrl()) {return m_transfer->repair(file);}
+ bool repair(const QUrl &file = QUrl()) {return m_transfer->repair(file);}
/**
* @return the transfer's group handler
@@ -90,29 +90,29 @@ class KGET_EXPORT TransferHandler : public Handler
/**
* @return the source url
*/
- const KUrl & source() const {return m_transfer->source();}
+ const QUrl & source() const {return m_transfer->source();}
/**
* @return the dest url
*/
- const KUrl & dest() const {return m_transfer->dest();}
+ const QUrl & dest() const {return m_transfer->dest();}
/**
* @returns all files of this transfer
*/
- QList<KUrl> files() const {return m_transfer->files();}
+ QList<QUrl> files() const {return m_transfer->files();}
/**
* @returns the directory the Transfer will be stored to
*/
- KUrl directory() const {return m_transfer->directory();}
+ QUrl directory() const {return m_transfer->directory();}
/**
* Move the download to the new destination
* @param newDirectory is a directory where the download should be stored
* @returns true if newDestination can be used
*/
- bool setDirectory(const KUrl &newDirectory) {return \
m_transfer->setDirectory(newDirectory);} + bool setDirectory(const QUrl \
&newDirectory) {return m_transfer->setDirectory(newDirectory);}
/**
* The mirrors that are available
@@ -120,14 +120,14 @@ class KGET_EXPORT TransferHandler : public Handler
* to the mirror
* @param file the file for which the availableMirrors should be get
*/
- QHash<KUrl, QPair<bool, int> > availableMirrors(const KUrl &file) const \
{return m_transfer->availableMirrors(file);} + QHash<QUrl, QPair<bool, int> > \
availableMirrors(const QUrl &file) const {return m_transfer->availableMirrors(file);} \
/**
* Set the mirrors, int the number of paralell connections to the mirror
* bool if the mirror should be used
* @param file the file for which the availableMirrors should be set
*/
- void setAvailableMirrors(const KUrl &file, const QHash<KUrl, QPair<bool, \
int> > &mirrors) {m_transfer->setAvailableMirrors(file, mirrors);} + void \
setAvailableMirrors(const QUrl &file, const QHash<QUrl, QPair<bool, int> > &mirrors) \
{m_transfer->setAvailableMirrors(file, mirrors);}
/**
* @return the total size of the transfer in bytes
@@ -275,13 +275,13 @@ class KGET_EXPORT TransferHandler : public Handler
* @param file for which to get the verifier
* @return Verifier that allows you to add checksums manually verify a file \
etc.
*/
- virtual Verifier * verifier(const KUrl &file) {return \
m_transfer->verifier(file);} + virtual Verifier * verifier(const QUrl &file) \
{return m_transfer->verifier(file);}
/**
* @param file for which to get the signature
* @return Signature that allows you to add signatures and verify them
*/
- virtual Signature * signature(const KUrl &file) {return \
m_transfer->signature(file);} + virtual Signature * signature(const QUrl \
&file) {return m_transfer->signature(file);}
#ifdef HAVE_NEPOMUK
/**
diff --git a/core/transferhistorystore.cpp b/core/transferhistorystore.cpp
index b7dd5e5..42921ae 100644
--- a/core/transferhistorystore.cpp
+++ b/core/transferhistorystore.cpp
@@ -10,6 +10,9 @@
*/
#include "core/transferhistorystore.h"
#include "core/transferhistorystore_xml_p.h"
+#ifdef HAVE_SQLITE
+#include "core/transferhistorystore_sqlite_p.h"
+#endif
#include "core/transfer.h"
#include "settings.h"
@@ -20,25 +23,6 @@
#include <QThread>
#include <QTimer>
-#ifdef HAVE_SQLITE
- #include "core/transferhistorystore_sqlite_p.h"
- #include <QSqlDatabase>
- #include <QSqlError>
- #include <QSqlQuery>
- #include <QSqlRecord>
-#endif
-
-#ifdef HAVE_NEPOMUK
- #include <core/transferhistorystore_nepomuk_p.h>
- #include <historyitem.h>
-
- #include <Soprano/Vocabulary/RDF>
- #include <Nepomuk2/Variant>
- #include <Nepomuk2/Query/QueryServiceClient>
- #include <Nepomuk2/Query/ResourceTypeTerm>
- #include <Nepomuk2/Query/Result>
-#endif
-
#include <KDebug>
#include <kio/global.h>
#include <KLocale>
@@ -50,7 +34,7 @@ TransferHistoryItem::TransferHistoryItem() : QObject()
TransferHistoryItem::TransferHistoryItem(const Transfer &transfer) : QObject()
{
- setDest(transfer.dest().pathOrUrl());
+ setDest(transfer.dest().toString());
setSource(transfer.source().url());
setSize(transfer.totalSize());
setDateTime(QDateTime::currentDateTime());
@@ -167,451 +151,4 @@ TransferHistoryStore *TransferHistoryStore::getStore()
}
}
-XmlStore::SaveThread::SaveThread(QObject *parent, const QString &url, const \
QList<TransferHistoryItem> &list) : QThread(parent),
- m_url(url),
- m_items(list),
- m_item()
-{
-}
-
-XmlStore::SaveThread::SaveThread(QObject *parent, const QString &url, const \
TransferHistoryItem &item) : QThread(parent),
- m_url(url),
- m_items(),
- m_item(item)
-{
-}
-
-void XmlStore::SaveThread::run()
-{
- QFile file(m_url);
- QDomDocument *doc;
- QDomElement root;
-
- if (!file.exists())
- {
- doc = new QDomDocument("Transfers");
- root = doc->createElement("Transfers");
- doc->appendChild(root);
- }
- else
- {
- doc = new QDomDocument();
- doc->setContent(&file);
- file.close();
- root = doc->documentElement();
- doc->appendChild(root);
- }
-
- QDomElement e = doc->createElement("Transfer");
- root.appendChild(e);
-
- e.setAttribute("Source", m_item.source());
- e.setAttribute("Dest", m_item.dest());
- e.setAttribute("Time", QDateTime::currentDateTime().toTime_t());
- e.setAttribute("Size", QString::number(m_item.size()));
- e.setAttribute("State", QString::number(m_item.state()));
-
- if (file.open(QFile::WriteOnly | QFile::Truncate)) {
- QTextStream stream( &file );
- doc->save( stream, 0 );
- file.close();
- }
- delete doc;
-}
-
-XmlStore::DeleteThread::DeleteThread(QObject *parent, const QString &url, const \
TransferHistoryItem &item) : QThread(parent),
- m_url(url),
- m_item(item),
- m_items()
-{
-}
-
-void XmlStore::DeleteThread::run()
-{
- QDomDocument doc("tempHistory");
- QFile file(m_url);
-
- QString error;
- int line;
- int column;
-
- if (!doc.setContent(&file, &error, &line, &column))
- {
- kDebug(5001) << "Error1" << error << line << column;
- return;
- }
- file.close();
-
- QDomElement root = doc.documentElement();
-
- QDomNodeList list = root.elementsByTagName("Transfer");
-
- int nItems = list.length();
-
- for (int i = 0 ; i < nItems ; i++) {
- QDomElement element = list.item(i).toElement();
-
- if(QString::compare(element.attribute("Source"), m_item.source()) == 0) {
- root.removeChild(element);
- }
- else {
- TransferHistoryItem item;
- item.setDest(element.attribute("Dest"));
- item.setSource(element.attribute("Source"));
- item.setSize(element.attribute("Size").toInt());
- item.setDateTime(QDateTime::fromTime_t(element.attribute("Time").toUInt()));
- item.setState(element.attribute("State").toInt());
- m_items << item;
- }
- }
-
- if (file.open(QFile::WriteOnly | QFile::Truncate)) {
- QTextStream stream( &file );
- doc.save(stream, 0);
- file.close();
- doc.clear();
- }
-}
-
-XmlStore::LoadThread::LoadThread(QObject *parent, const QString &url) : \
QThread(parent),
- m_url(url)
-{
-}
-
-void XmlStore::LoadThread::run()
-{
- qRegisterMetaType<TransferHistoryItem>("TransferHistoryItem");
- QDomDocument doc("tempHistory");
- QFile file(m_url);
-
- QString error;
- int line;
- int column;
- int total;
-
- if (!doc.setContent(&file, &error, &line, &column))
- {
- kDebug(5001) << "Error1" << error << line << column;
- file.close();
- return;
- }
-
- QDomElement root = doc.documentElement();
- total = root.childNodes().size();
-
- QDomNodeList list = root.elementsByTagName("Transfer");
-
- int nItems = list.length();
-
- for (int i = 0 ; i < nItems ; i++)
- {
- QDomElement dom = list.item(i).toElement();
-
- TransferHistoryItem item;
- item.setDest(dom.attribute("Dest"));
- item.setSource(dom.attribute("Source"));
- item.setSize(dom.attribute("Size").toInt());
- item.setDateTime(QDateTime::fromTime_t(dom.attribute("Time").toUInt()));
- item.setState(dom.attribute("State").toInt());
-
- emit elementLoaded(i, total, item);
- }
- doc.clear();
- file.close();
-}
-
-XmlStore::XmlStore(const QString &url) : TransferHistoryStore(),
- m_storeUrl(url),
- m_loadThread(0),
- m_saveThread(0),
- m_deleteThread(0)
-{
-}
-
-XmlStore::~XmlStore()
-{
- if(m_loadThread && m_loadThread->isRunning()) {
- m_loadThread->terminate();
- }
-
- if(m_saveThread && m_saveThread->isRunning()) {
- m_saveThread->terminate();
- }
-
- if(m_deleteThread && m_deleteThread->isRunning()) {
- m_deleteThread->terminate();
- }
-
- delete m_loadThread;
- delete m_saveThread;
- delete m_deleteThread;
-}
-
-void XmlStore::load()
-{
- m_items.clear();
- // TODO: only load if necessary
- m_loadThread = new XmlStore::LoadThread(this, m_storeUrl);
-
- connect(m_loadThread, SIGNAL(finished()), SIGNAL(loadFinished()));
- connect(m_loadThread, SIGNAL(elementLoaded(int,int,TransferHistoryItem)),
- SIGNAL(elementLoaded(int,int,TransferHistoryItem)));
- connect(m_loadThread, SIGNAL(elementLoaded(int,int,TransferHistoryItem)),
- SLOT(slotLoadElement(int,int,TransferHistoryItem)));
- m_loadThread->start();
-}
-
-void XmlStore::clear()
-{
- QFile::remove(m_storeUrl);
-}
-
-void XmlStore::saveItem(const TransferHistoryItem &item)
-{
- m_saveThread = new XmlStore::SaveThread(this, m_storeUrl, item);
-
- connect(m_saveThread, SIGNAL(finished()), SIGNAL(saveFinished()));
- connect(m_saveThread, SIGNAL(elementLoaded(int,int,TransferHistoryItem)),
- SIGNAL(elementLoaded(int,int,TransferHistoryItem)));
- m_saveThread->start();
-}
-
-void XmlStore::deleteItem(const TransferHistoryItem &item)
-{
- Q_UNUSED(item)
-
- m_deleteThread = new XmlStore::DeleteThread(this, m_storeUrl, item);
-
- connect(m_deleteThread, SIGNAL(finished()), SLOT(slotDeleteElement()));
-
- m_deleteThread->start();
-}
-
-void XmlStore::slotLoadElement(int number, int total, const TransferHistoryItem \
&item)
-{
- Q_UNUSED(number)
- Q_UNUSED(total)
- m_items.append(item);
-}
-
-void XmlStore::slotDeleteElement()
-{
- m_items.clear();
- m_items << m_deleteThread->items();
-
- emit loadFinished();
-}
-
-#ifdef HAVE_SQLITE
-SQLiteStore::SQLiteStore(const QString &database) : TransferHistoryStore(),
- m_dbName(database),
- m_sql()
-{
-}
-
-SQLiteStore::~SQLiteStore()
-{
- if (m_sql.isOpen()) {
- m_sql.close();
- }
-}
-
-void SQLiteStore::load()
-{
- m_items.clear();
- if (sql().open()) {
- if (!sql().tables().contains("transfer_history_item")) {
- createTables();
- }
-
- QSqlQuery query = sql().exec("SELECT * FROM transfer_history_item");
-
- if (query.lastError().isValid()) {
- kDebug(5001) << query.lastError().text();
- }
- else {
- QSqlRecord rec = query.record();
-
- while (query.next()) {
- TransferHistoryItem item;
- item.setDest(query.value(rec.indexOf("dest")).toString());
- item.setSource(query.value(rec.indexOf("source")).toString());
- item.setState(query.value(rec.indexOf("state")).toInt());
- item.setDateTime(QDateTime::fromTime_t(query.value(rec.indexOf("time")).toUInt()));
- item.setSize(query.value(rec.indexOf("size")).toInt());
-
- m_items << item;
- emit elementLoaded(query.at(), query.size(), item);
- }
- }
- }
-
- sql().close();
-
- emit loadFinished();
-}
-
-void SQLiteStore::clear()
-{
- QFile::remove(m_dbName);
-}
-
-void SQLiteStore::saveItem(const TransferHistoryItem &item)
-{
- saveItems(QList<TransferHistoryItem>() << item);
-}
-
-void SQLiteStore::saveItems(const QList<TransferHistoryItem> &items)
-{
- if (sql().open()) {
- if (!sql().tables().contains("transfer_history_item")) {
- createTables();
- }
-
- if (!sql().transaction()) {
- kWarning(5001) << "Could not establish a transaction, might be slow.";
- }
-
- foreach (const TransferHistoryItem &item, items) {
- QSqlQuery query = sql().exec("insert into transfer_history_item(source, \
dest, size, time, state)"
- "values ('"+item.source()+"', '"+item.dest()+"', "
- + QString::number(item.size()) + ", "
- + QString::number(item.dateTime().toTime_t()) + ", \
'"
- + QString::number(item.state())+"')");
-
- if (query.lastError().isValid()) {
- kDebug(5001) << query.lastError().text();
- }
- m_items << item;
- }
-
- if (!sql().commit()) {
- kWarning(5001) << "Could not commit changes.";
- }
- }
- sql().close();
-
- emit saveFinished();
-}
-
-void SQLiteStore::deleteItem(const TransferHistoryItem &item)
-{
- if (sql().open()) {
- if (!sql().tables().contains("transfer_history_item")) {
- createTables();
- }
-
- QSqlQuery query = sql().exec("delete from transfer_history_item where "
- " source = '" + item.source() + "';");
-
- if (query.lastError().isValid()) {
- kDebug(5001) << query.lastError().text();
- }
-
- sql().commit();
- m_items.removeAll(item);
- }
- sql().close();
-
- emit deleteFinished();
-}
-
-QSqlDatabase SQLiteStore::sql()
-{
- if (!m_sql.isValid()) {
- m_sql = QSqlDatabase::addDatabase("QSQLITE");
- m_sql.setDatabaseName(m_dbName);
- }
-
- return m_sql;
-}
-
-void SQLiteStore::createTables()
-{
- QSqlQuery query = sql().exec("CREATE TABLE transfer_history_item(dest VARCHAR \
NOT NULL, "
- "source VARCHAR NOT NULL, size int NOT NULL, time \
int not null, "
- "state int, PRIMARY KEY(dest, source));");
-
- if (query.lastError().isValid()) {
- kDebug(5001) << query.lastError().text();
- }
-}
-#endif
-
-#ifdef HAVE_NEPOMUK
-NepomukStore::NepomukStore(const QString &database)
- : TransferHistoryStore()
-{
- Q_UNUSED(database)
-}
-
-NepomukStore::~NepomukStore()
-{
-}
-
-void NepomukStore::load()
-{
- Nepomuk2::Query::QueryServiceClient * queryService = new \
Nepomuk2::Query::QueryServiceClient(this);
- Nepomuk2::Query::ResourceTypeTerm \
historyTypeTerm((Nepomuk2::Types::Class(Nepomuk2::HistoryItem::resourceTypeUri())));
- Nepomuk2::Query::Query historyQuery(historyTypeTerm);
-
- connect(queryService, SIGNAL(newEntries(const QList<Nepomuk2::Query::Result>&)), \
this, SLOT(loadResult(const QList<Nepomuk2::Query::Result>&)));
- connect(queryService, SIGNAL(finishedListing()), this, SIGNAL(loadFinished()));
- queryService->query(historyQuery);
-}
-
-void NepomukStore::loadResult(const QList<Nepomuk2::Query::Result>& entries)
-{
- int newItemsCount = m_items.count() + entries.count();
-
- for (int i = 0; i != entries.count(); i++) {
- Nepomuk2::HistoryItem current = entries.at(i).resource();
- TransferHistoryItem item;
-
- item.setDest(current.destination());
- item.setSource(current.source());
- item.setState(current.state());
- item.setDateTime(current.dateTime());
- item.setSize(current.size());
- m_items << item;
-
- emit elementLoaded(m_items.count(), newItemsCount, item);
- }
-}
-
-void NepomukStore::clear()
-{
- for(int i = 0; i < m_items.count(); i++) {
- deleteItem(m_items.at(i));
- }
-
- m_items.clear();
-}
-
-void NepomukStore::saveItem(const TransferHistoryItem &item)
-{
- Nepomuk2::HistoryItem historyItem(item.source());
-
- historyItem.addType(Nepomuk2::HistoryItem::resourceTypeUri());
- historyItem.setDestination(item.dest());
- historyItem.setSource(item.source());
- historyItem.setState(item.state());
- historyItem.setSize(item.size());
- historyItem.setDateTime(item.dateTime());
-}
-
-void NepomukStore::deleteItem(const TransferHistoryItem &item)
-{
- Nepomuk2::HistoryItem historyItem(item.source());
- historyItem.remove();
-}
-#endif
-
#include "transferhistorystore.moc"
-#include "transferhistorystore_xml_p.moc"
-#ifdef HAVE_SQLITE
- #include "transferhistorystore_sqlite_p.moc"
-#endif
-#ifdef HAVE_NEPOMUK
- #include "transferhistorystore_nepomuk_p.moc"
-#endif
diff --git a/core/transferhistorystore_sqlite.cpp \
b/core/transferhistorystore_sqlite.cpp new file mode 100644
index 0000000..1a09e2f
--- /dev/null
+++ b/core/transferhistorystore_sqlite.cpp
@@ -0,0 +1,158 @@
+/* This file is part of the KDE project
+
+ Copyright (C) 2007 by Lukas Appelhans <l.appelhans@gmx.de>
+ Copyright (C) 2008 by Javier Goday <jgoday@gmail.com>
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+*/
+
+#ifdef HAVE_SQLITE
+#include "core/transferhistorystore_sqlite_p.h"
+#include <QSqlDatabase>
+#include <QSqlError>
+#include <QSqlQuery>
+#include <QSqlRecord>
+
+#include <QFile>
+
+#include <KDebug>
+
+SQLiteStore::SQLiteStore(const QString &database) : TransferHistoryStore(),
+ m_dbName(database),
+ m_sql()
+{
+}
+
+SQLiteStore::~SQLiteStore()
+{
+ if (m_sql.isOpen()) {
+ m_sql.close();
+ }
+}
+
+void SQLiteStore::load()
+{
+ m_items.clear();
+ if (sql().open()) {
+ if (!sql().tables().contains("transfer_history_item")) {
+ createTables();
+ }
+
+ QSqlQuery query = sql().exec("SELECT * FROM transfer_history_item");
+
+ if (query.lastError().isValid()) {
+ kDebug(5001) << query.lastError().text();
+ }
+ else {
+ QSqlRecord rec = query.record();
+
+ while (query.next()) {
+ TransferHistoryItem item;
+ item.setDest(query.value(rec.indexOf("dest")).toString());
+ item.setSource(query.value(rec.indexOf("source")).toString());
+ item.setState(query.value(rec.indexOf("state")).toInt());
+ item.setDateTime(QDateTime::fromTime_t(query.value(rec.indexOf("time")).toUInt()));
+ item.setSize(query.value(rec.indexOf("size")).toInt());
+
+ m_items << item;
+ emit elementLoaded(query.at(), query.size(), item);
+ }
+ }
+ }
+
+ sql().close();
+
+ emit loadFinished();
+}
+
+void SQLiteStore::clear()
+{
+ QFile::remove(m_dbName);
+}
+
+void SQLiteStore::saveItem(const TransferHistoryItem &item)
+{
+ saveItems(QList<TransferHistoryItem>() << item);
+}
+
+void SQLiteStore::saveItems(const QList<TransferHistoryItem> &items)
+{
+ if (sql().open()) {
+ if (!sql().tables().contains("transfer_history_item")) {
+ createTables();
+ }
+
+ if (!sql().transaction()) {
+ kWarning(5001) << "Could not establish a transaction, might be slow.";
+ }
+
+ foreach (const TransferHistoryItem &item, items) {
+ QSqlQuery query = sql().exec("insert into transfer_history_item(source, \
dest, size, time, state)" + "values \
('"+item.source()+"', '"+item.dest()+"', " + + \
QString::number(item.size()) + ", " + + \
QString::number(item.dateTime().toTime_t()) + ", '" + \
+ QString::number(item.state())+"')"); +
+ if (query.lastError().isValid()) {
+ kDebug(5001) << query.lastError().text();
+ }
+ m_items << item;
+ }
+
+ if (!sql().commit()) {
+ kWarning(5001) << "Could not commit changes.";
+ }
+ }
+ sql().close();
+
+ emit saveFinished();
+}
+
+void SQLiteStore::deleteItem(const TransferHistoryItem &item)
+{
+ if (sql().open()) {
+ if (!sql().tables().contains("transfer_history_item")) {
+ createTables();
+ }
+
+ QSqlQuery query = sql().exec("delete from transfer_history_item where "
+ " source = '" + item.source() + "';");
+
+ if (query.lastError().isValid()) {
+ kDebug(5001) << query.lastError().text();
+ }
+
+ sql().commit();
+ m_items.removeAll(item);
+ }
+ sql().close();
+
+ emit deleteFinished();
+}
+
+QSqlDatabase SQLiteStore::sql()
+{
+ if (!m_sql.isValid()) {
+ m_sql = QSqlDatabase::addDatabase("QSQLITE");
+ m_sql.setDatabaseName(m_dbName);
+ }
+
+ return m_sql;
+}
+
+void SQLiteStore::createTables()
+{
+ QSqlQuery query = sql().exec("CREATE TABLE transfer_history_item(dest VARCHAR \
NOT NULL, " + "source VARCHAR NOT NULL, size int NOT \
NULL, time int not null, " + "state int, PRIMARY \
KEY(dest, source));"); +
+ if (query.lastError().isValid()) {
+ kDebug(5001) << query.lastError().text();
+ }
+}
+
+#endif
+
diff --git a/core/transferhistorystore_xml.cpp b/core/transferhistorystore_xml.cpp
new file mode 100644
index 0000000..46cc8c2
--- /dev/null
+++ b/core/transferhistorystore_xml.cpp
@@ -0,0 +1,254 @@
+/* This file is part of the KDE project
+
+ Copyright (C) 2007 - 2014 by Lukas Appelhans <l.appelhans@gmx.de>
+ Copyright (C) 2008 by Javier Goday <jgoday@gmail.com>
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+*/
+#include "core/transferhistorystore_xml_p.h"
+
+#include <QDomDocument>
+#include <QFile>
+#include <QTextStream>
+
+#include <KDebug>
+
+XmlStore::SaveThread::SaveThread(QObject *parent, const QString &url, const \
QList<TransferHistoryItem> &list) : QThread(parent), + m_url(url),
+ m_items(list),
+ m_item()
+{
+}
+
+XmlStore::SaveThread::SaveThread(QObject *parent, const QString &url, const \
TransferHistoryItem &item) : QThread(parent), + m_url(url),
+ m_items(),
+ m_item(item)
+{
+}
+
+void XmlStore::SaveThread::run()
+{
+ QFile file(m_url);
+ QDomDocument *doc;
+ QDomElement root;
+
+ if (!file.exists())
+ {
+ doc = new QDomDocument("Transfers");
+ root = doc->createElement("Transfers");
+ doc->appendChild(root);
+ }
+ else
+ {
+ doc = new QDomDocument();
+ doc->setContent(&file);
+ file.close();
+ root = doc->documentElement();
+ doc->appendChild(root);
+ }
+
+ QDomElement e = doc->createElement("Transfer");
+ root.appendChild(e);
+
+ e.setAttribute("Source", m_item.source());
+ e.setAttribute("Dest", m_item.dest());
+ e.setAttribute("Time", QDateTime::currentDateTime().toTime_t());
+ e.setAttribute("Size", QString::number(m_item.size()));
+ e.setAttribute("State", QString::number(m_item.state()));
+
+ if (file.open(QFile::WriteOnly | QFile::Truncate)) {
+ QTextStream stream( &file );
+ doc->save( stream, 0 );
+ file.close();
+ }
+ delete doc;
+}
+
+XmlStore::DeleteThread::DeleteThread(QObject *parent, const QString &url, const \
TransferHistoryItem &item) : QThread(parent), + m_url(url),
+ m_item(item),
+ m_items()
+{
+}
+
+void XmlStore::DeleteThread::run()
+{
+ QDomDocument doc("tempHistory");
+ QFile file(m_url);
+
+ QString error;
+ int line;
+ int column;
+
+ if (!doc.setContent(&file, &error, &line, &column))
+ {
+ kDebug(5001) << "Error1" << error << line << column;
+ return;
+ }
+ file.close();
+
+ QDomElement root = doc.documentElement();
+
+ QDomNodeList list = root.elementsByTagName("Transfer");
+
+ int nItems = list.length();
+
+ for (int i = 0 ; i < nItems ; i++) {
+ QDomElement element = list.item(i).toElement();
+
+ if(QString::compare(element.attribute("Source"), m_item.source()) == 0) {
+ root.removeChild(element);
+ }
+ else {
+ TransferHistoryItem item;
+ item.setDest(element.attribute("Dest"));
+ item.setSource(element.attribute("Source"));
+ item.setSize(element.attribute("Size").toInt());
+ item.setDateTime(QDateTime::fromTime_t(element.attribute("Time").toUInt()));
+ item.setState(element.attribute("State").toInt());
+ m_items << item;
+ }
+ }
+
+ if (file.open(QFile::WriteOnly | QFile::Truncate)) {
+ QTextStream stream( &file );
+ doc.save(stream, 0);
+ file.close();
+ doc.clear();
+ }
+}
+
+XmlStore::LoadThread::LoadThread(QObject *parent, const QString &url) : \
QThread(parent), + m_url(url)
+{
+}
+
+void XmlStore::LoadThread::run()
+{
+ qRegisterMetaType<TransferHistoryItem>("TransferHistoryItem");
+ QDomDocument doc("tempHistory");
+ QFile file(m_url);
+
+ QString error;
+ int line;
+ int column;
+ int total;
+
+ if (!doc.setContent(&file, &error, &line, &column))
+ {
+ kDebug(5001) << "Error1" << error << line << column;
+ file.close();
+ return;
+ }
+
+ QDomElement root = doc.documentElement();
+ total = root.childNodes().size();
+
+ QDomNodeList list = root.elementsByTagName("Transfer");
+
+ int nItems = list.length();
+
+ for (int i = 0 ; i < nItems ; i++)
+ {
+ QDomElement dom = list.item(i).toElement();
+
+ TransferHistoryItem item;
+ item.setDest(dom.attribute("Dest"));
+ item.setSource(dom.attribute("Source"));
+ item.setSize(dom.attribute("Size").toInt());
+ item.setDateTime(QDateTime::fromTime_t(dom.attribute("Time").toUInt()));
+ item.setState(dom.attribute("State").toInt());
+
+ emit elementLoaded(i, total, item);
+ }
+ doc.clear();
+ file.close();
+}
+
+XmlStore::XmlStore(const QString &url) : TransferHistoryStore(),
+ m_storeUrl(url),
+ m_loadThread(0),
+ m_saveThread(0),
+ m_deleteThread(0)
+{
+}
+
+XmlStore::~XmlStore()
+{
+ if(m_loadThread && m_loadThread->isRunning()) {
+ m_loadThread->terminate();
+ }
+
+ if(m_saveThread && m_saveThread->isRunning()) {
+ m_saveThread->terminate();
+ }
+
+ if(m_deleteThread && m_deleteThread->isRunning()) {
+ m_deleteThread->terminate();
+ }
+
+ delete m_loadThread;
+ delete m_saveThread;
+ delete m_deleteThread;
+}
+
+void XmlStore::load()
+{
+ m_items.clear();
+ // TODO: only load if necessary
+ m_loadThread = new XmlStore::LoadThread(this, m_storeUrl);
+
+ connect(m_loadThread, SIGNAL(finished()), SIGNAL(loadFinished()));
+ connect(m_loadThread, SIGNAL(elementLoaded(int,int,TransferHistoryItem)),
+ SIGNAL(elementLoaded(int,int,TransferHistoryItem)));
+ connect(m_loadThread, SIGNAL(elementLoaded(int,int,TransferHistoryItem)),
+ SLOT(slotLoadElement(int,int,TransferHistoryItem)));
+ m_loadThread->start();
+}
+
+void XmlStore::clear()
+{
+ QFile::remove(m_storeUrl);
+}
+
+void XmlStore::saveItem(const TransferHistoryItem &item)
+{
+ m_saveThread = new XmlStore::SaveThread(this, m_storeUrl, item);
+
+ connect(m_saveThread, SIGNAL(finished()), SIGNAL(saveFinished()));
+ connect(m_saveThread, SIGNAL(elementLoaded(int,int,TransferHistoryItem)),
+ SIGNAL(elementLoaded(int,int,TransferHistoryItem)));
+ m_saveThread->start();
+}
+
+void XmlStore::deleteItem(const TransferHistoryItem &item)
+{
+ Q_UNUSED(item)
+
+ m_deleteThread = new XmlStore::DeleteThread(this, m_storeUrl, item);
+
+ connect(m_deleteThread, SIGNAL(finished()), SLOT(slotDeleteElement()));
+
+ m_deleteThread->start();
+}
+
+void XmlStore::slotLoadElement(int number, int total, const TransferHistoryItem \
&item) +{
+ Q_UNUSED(number)
+ Q_UNUSED(total)
+ m_items.append(item);
+}
+
+void XmlStore::slotDeleteElement()
+{
+ m_items.clear();
+ m_items << m_deleteThread->items();
+
+ emit loadFinished();
+}
+
+#include "transferhistorystore_xml.moc"
diff --git a/core/transfertreemodel.cpp b/core/transfertreemodel.cpp
index dea2662..5d0dc2f 100644
--- a/core/transfertreemodel.cpp
+++ b/core/transfertreemodel.cpp
@@ -104,7 +104,7 @@ QVariant TransferModelItem::data(int role) const
//store the icon for speed improvements, KIconLoader should make \
sure, that //the icon data gets shared
if (m_mimeType.isNull()) {
- m_mimeType = \
KIcon(KMimeType::iconNameForUrl(m_transferHandler->dest().url())); + \
m_mimeType = QIcon::fromTheme(KMimeType::iconNameForUrl(m_transferHandler->dest().url()));
}
return m_mimeType;
@@ -464,7 +464,7 @@ TransferGroup * TransferTreeModel::findGroup(const QString & \
groupName) return 0;
}
-Transfer * TransferTreeModel::findTransfer(const KUrl &src)
+Transfer * TransferTreeModel::findTransfer(const QUrl &src)
{
/*foreach (TransferGroup * group, transferGroups())
{
@@ -480,7 +480,7 @@ Transfer * TransferTreeModel::findTransfer(const KUrl &src)
return 0;
}
-Transfer *TransferTreeModel::findTransferByDestination(const KUrl &dest)
+Transfer *TransferTreeModel::findTransferByDestination(const QUrl &dest)
{
/*foreach (TransferGroup * group, transferGroups())
{
diff --git a/core/transfertreemodel.h b/core/transfertreemodel.h
index 6717a13..2e82e33 100644
--- a/core/transfertreemodel.h
+++ b/core/transfertreemodel.h
@@ -17,14 +17,13 @@
#include <QList>
#include <QtCore/QMimeData>
#include <QtCore/QWeakPointer>
+#include <QUrl>
#include "../kget_export.h"
#include "core/transfer.h"
#include "core/transfergroup.h"
#include "core/handler.h"
-class KUrl;
-
class TransferGroupHandler;
class TransferGroup;
class TransferHandler;
@@ -86,7 +85,7 @@ class KGET_EXPORT TransferModelItem : public ModelItem
private:
TransferHandler * m_transferHandler;
- mutable KIcon m_mimeType;
+ mutable QIcon m_mimeType;
};
class KGET_EXPORT GroupModelItem : public ModelItem
@@ -144,8 +143,8 @@ class KGET_EXPORT TransferTreeModel : public QStandardItemModel
QList<TransferGroup *> transferGroups();
TransferGroup * findGroup(const QString & groupName);
- Transfer * findTransfer(const KUrl &src);
- Transfer * findTransferByDestination(const KUrl &dest);
+ Transfer * findTransfer(const QUrl &src);
+ Transfer * findTransferByDestination(const QUrl &dest);
Transfer * findTransferByDBusObjectPath(const QString & dbusObjectPath);
void postDataChangedEvent(TransferHandler * transfer);
diff --git a/core/urlchecker.cpp b/core/urlchecker.cpp
index 4fc0f55..6d04c1d 100644
--- a/core/urlchecker.cpp
+++ b/core/urlchecker.cpp
@@ -1,5 +1,5 @@
/***************************************************************************
-* Copyright (C) 2007-2009 Lukas Appelhans <l.appelhans@gmx.de> *
+* Copyright (C) 2007-2014 Lukas Appelhans <l.appelhans@gmx.de> *
* Copyright (C) 2008 Dario Freddi <drf54321@gmail.com> *
* Copyright (C) 2010 Matthias Fuchs <mat69@gmx.net> *
* *
@@ -34,6 +34,7 @@
#include <QtCore/QFileInfo>
#include <QtGui/QCheckBox>
#include <QtGui/QHBoxLayout>
+#include <QtGui/QLabel>
#include <KDialogButtonBox>
#include <KIO/RenameDialog>
@@ -104,20 +105,20 @@ UrlChecker::~UrlChecker()
struct lessThan
{
- bool operator()(const KUrl &lhs, const KUrl &rhs) const
+ bool operator()(const QUrl &lhs, const QUrl &rhs) const
{
return lhs.url() < rhs.url();
}
};
-void UrlChecker::removeDuplicates(KUrl::List &urls)
+void UrlChecker::removeDuplicates(QList<QUrl> &urls)
{
std::sort(urls.begin(), urls.end(), lessThan());//sort the urls, to find \
duplicates fast urls.erase(std::unique(urls.begin(), urls.end(),
- boost::bind(&KUrl::equals, _1, _2, KUrl::CompareWithoutTrailingSlash \
| KUrl::AllowEmptyPath)), urls.end()); + boost::bind(&QUrl::matches, \
_1, _2, QUrl::StripTrailingSlash | QUrl::NormalizePathSegments)), urls.end()); }
-UrlChecker::UrlError UrlChecker::checkUrl(const KUrl &url, const UrlChecker::UrlType \
type, bool showNotification) +UrlChecker::UrlError UrlChecker::checkUrl(const QUrl \
&url, const UrlChecker::UrlType type, bool showNotification) {
switch (type) {
case Source:
@@ -131,12 +132,12 @@ UrlChecker::UrlError UrlChecker::checkUrl(const KUrl &url, \
const UrlChecker::Url return NoError;
}
-bool UrlChecker::wouldOverwrite(const KUrl &source, const KUrl &dest)
+bool UrlChecker::wouldOverwrite(const QUrl &source, const QUrl &dest)
{
return (dest.isLocalFile() && QFile::exists(dest.toLocalFile()) && source != \
dest && !FileDeleter::isFileBeingDeleted(dest)); }
-UrlChecker::UrlError UrlChecker::checkSource(const KUrl &src, bool showNotification)
+UrlChecker::UrlError UrlChecker::checkSource(const QUrl &src, bool showNotification)
{
//NOTE hasPath is not used, as this would dissallow adresses like \
http://www.kde.org/ as there is no path UrlError error = NoError;
@@ -146,7 +147,7 @@ UrlChecker::UrlError UrlChecker::checkSource(const KUrl &src, \
bool showNotificat if ((error == NoError) && !src.isValid()) {
error = Invalid;
}
- if ((error == NoError) && src.protocol().isEmpty()){
+ if ((error == NoError) && src.scheme().isEmpty()){
error = NoProtocol;
}
/*if ((error == NoError) && !src.hasHost()) {//FIXME deactivated to allow \
file://....metalink etc @@ -158,12 +159,12 @@ UrlChecker::UrlError \
UrlChecker::checkSource(const KUrl &src, bool showNotificat
KGet::showNotification(KGet::m_mainWindow, "error", message(src, Source, \
error)); }
- //TODO also check sourceUrl.url() != KUrl(sourceUrl.url()).fileName() as in \
NewTransferDialog::setSource? + //TODO also check sourceUrl.url() != \
QUrl(sourceUrl.url()).fileName() as in NewTransferDialog::setSource?
return error;
}
-UrlChecker::UrlError UrlChecker::checkDestination(const KUrl &destination, bool \
showNotification) +UrlChecker::UrlError UrlChecker::checkDestination(const QUrl \
&destination, bool showNotification) {
UrlError error = NoError;
@@ -173,12 +174,12 @@ UrlChecker::UrlError UrlChecker::checkDestination(const KUrl \
&destination, bool
if (error == NoError) {
//not supposed to be a folder
- QFileInfo fileInfo(destination.pathOrUrl());
+ QFileInfo fileInfo(destination.toString());
if (!destination.isValid() || fileInfo.isDir()) {
error = Invalid;
}
- if ((error == NoError) && !QFileInfo(destination.directory()).isWritable()) \
{ + if ((error == NoError) && \
!QFileInfo(destination.adjusted(QUrl::RemoveFilename).toString()).isWritable()) { \
error = NotWriteable; }
}
@@ -192,11 +193,11 @@ UrlChecker::UrlError UrlChecker::checkDestination(const KUrl \
&destination, bool }
-UrlChecker::UrlError UrlChecker::checkFolder(const KUrl &folder, bool \
showNotification) +UrlChecker::UrlError UrlChecker::checkFolder(const QUrl &folder, \
bool showNotification) {
UrlError error = NoError;
- const QString destDir = folder.pathOrUrl();
+ const QString destDir = folder.toString();
if (folder.isEmpty() || destDir.isEmpty()) {
error = Empty;
}
@@ -222,24 +223,23 @@ UrlChecker::UrlError UrlChecker::checkFolder(const KUrl \
&folder, bool showNotifi return error;
}
-KUrl UrlChecker::destUrl(const KUrl &destOrFolder, const KUrl &source, const QString \
&fileName) +QUrl UrlChecker::destUrl(const QUrl &destOrFolder, const QUrl &source, \
const QString &fileName) {
- KUrl dest = destOrFolder;
+ QUrl dest = destOrFolder;
if (QFileInfo(dest.toLocalFile()).isDir()) {
QString usedFileName = (fileName.isEmpty() ? source.fileName() : fileName);
if (usedFileName.isEmpty()) {
- usedFileName = KUrl::toPercentEncoding(source.prettyUrl(), "/");
+ usedFileName = QUrl::toPercentEncoding(source.toString(), "/");
}
- dest.adjustPath(KUrl::AddTrailingSlash);
- dest.setFileName(usedFileName);
+ dest = dest.adjusted(QUrl::RemoveFilename).toString() + usedFileName;
} else if (!fileName.isEmpty()) {
- dest.setFileName(fileName);
+ dest.setPath(dest.adjusted(QUrl::RemoveFilename).toString() + fileName);
}
return dest;
}
-TransferHandler *UrlChecker::existingTransfer(const KUrl &url, const \
UrlChecker::UrlType type, UrlChecker::UrlWarning *warning) +TransferHandler \
*UrlChecker::existingTransfer(const QUrl &url, const UrlChecker::UrlType type, \
UrlChecker::UrlWarning *warning) {
UrlWarning temp;
UrlWarning &warn = (warning ? (*warning) : temp);
@@ -255,7 +255,7 @@ TransferHandler *UrlChecker::existingTransfer(const KUrl &url, \
const UrlChecker: }
}
-TransferHandler *UrlChecker::existingSource(const KUrl &source, \
UrlChecker::UrlWarning &warning) +TransferHandler *UrlChecker::existingSource(const \
QUrl &source, UrlChecker::UrlWarning &warning) {
// Check if a transfer with the same url already exists
Transfer *transfer = KGet::m_transferTreeModel->findTransfer(source);
@@ -270,7 +270,7 @@ TransferHandler *UrlChecker::existingSource(const KUrl &source, \
UrlChecker::UrlW return (transfer ? transfer->handler() : 0);
}
-TransferHandler *UrlChecker::existingDestination(const KUrl &url, \
UrlChecker::UrlWarning &warning) +TransferHandler \
*UrlChecker::existingDestination(const QUrl &url, UrlChecker::UrlWarning &warning) {
Transfer *transfer = KGet::m_transferTreeModel->findTransferByDestination(url);
if (transfer) {
@@ -279,7 +279,7 @@ TransferHandler *UrlChecker::existingDestination(const KUrl &url, \
UrlChecker::Ur } else {
warning = ExistingTransfer;
}
- } else if (QFile::exists(url.pathOrUrl())) {
+ } else if (QFile::exists(url.toString())) {
warning = ExistingFile;
}
@@ -287,7 +287,7 @@ TransferHandler *UrlChecker::existingDestination(const KUrl &url, \
UrlChecker::Ur }
-QString UrlChecker::message(const KUrl &url, const UrlChecker::UrlType type, const \
UrlChecker::UrlError error) +QString UrlChecker::message(const QUrl &url, const \
UrlChecker::UrlType type, const UrlChecker::UrlError error) {
if (url.isEmpty()) {
if (type == Folder) {
@@ -329,7 +329,7 @@ QString UrlChecker::message(const KUrl &url, const \
UrlChecker::UrlType type, con }
}
} else {
- const QString urlString = url.prettyUrl();
+ const QString urlString = url.toString();
if (type == Folder) {
switch (error) {
case Empty:
@@ -373,7 +373,7 @@ QString UrlChecker::message(const KUrl &url, const \
UrlChecker::UrlType type, con return QString();
}
-QString UrlChecker::message(const KUrl &url, const UrlChecker::UrlType type, const \
UrlChecker::UrlWarning warning) +QString UrlChecker::message(const QUrl &url, const \
UrlChecker::UrlType type, const UrlChecker::UrlWarning warning) {
if (url.isEmpty()) {
if (type == Destination) {
@@ -401,7 +401,7 @@ QString UrlChecker::message(const KUrl &url, const \
UrlChecker::UrlType type, con }
}
} else {
- const QString urlString = url.prettyUrl();
+ const QString urlString = url.toString();
if (type == Destination) {
switch (warning) {
case ExistingFile:
@@ -429,20 +429,20 @@ QString UrlChecker::message(const KUrl &url, const \
UrlChecker::UrlType type, con return QString();
}
-QString UrlChecker::message(const KUrl::List &urls, const UrlChecker::UrlType type, \
const UrlChecker::UrlError error) +QString UrlChecker::message(const QList<QUrl> \
&urls, const UrlChecker::UrlType type, const UrlChecker::UrlError error) {
QString urlsString;
if (!urls.isEmpty()) {
- urlsString = urls.first().prettyUrl();
+ urlsString = urls.first().toString();
for (int i = 1; i < urls.count(); ++i) {
- urlsString += '\n' + urls[i].prettyUrl();
+ urlsString += '\n' + urls[i].toString();
}
urlsString = QString("<p style=\"font-size: \
small;\">\%1</p>").arg(urlsString); }
if (urls.isEmpty()) {
if ((type == Folder) || (type == Destination)) {
- return message(KUrl(), type, error);
+ return message(QUrl(), type, error);
}
if (type == Source) {
switch (error) {
@@ -478,13 +478,13 @@ QString UrlChecker::message(const KUrl::List &urls, const \
UrlChecker::UrlType ty return QString();
}
-QString UrlChecker::message(const KUrl::List &urls, const UrlChecker::UrlType type, \
const UrlChecker::UrlWarning warning) +QString UrlChecker::message(const QList<QUrl> \
&urls, const UrlChecker::UrlType type, const UrlChecker::UrlWarning warning) {
QString urlsString;
if (!urls.isEmpty()) {
- urlsString = urls.first().prettyUrl();
+ urlsString = urls.first().toString();
for (int i = 1; i < urls.count(); ++i) {
- urlsString += '\n' + urls[i].prettyUrl();
+ urlsString += '\n' + urls[i].toString();
}
urlsString = QString("<p style=\"font-size: \
small;\">\%1</p>").arg(urlsString); }
@@ -541,14 +541,14 @@ QString UrlChecker::message(const KUrl::List &urls, const \
UrlChecker::UrlType ty }
-KUrl::List UrlChecker::hasExistingTransferMessages(const KUrl::List &urls, const \
UrlChecker::UrlType type) +QList<QUrl> UrlChecker::hasExistingTransferMessages(const \
QList<QUrl> &urls, const UrlChecker::UrlType type) {
UrlWarning warning;
- QHash<UrlWarning, QList<QPair<KUrl, TransferHandler*> > > splitWarnings;
- KUrl::List urlsToDownload;
+ QHash<UrlWarning, QList<QPair<QUrl, TransferHandler*> > > splitWarnings;
+ QList<QUrl> urlsToDownload;
//collect all errors
- foreach(const KUrl &url, urls) {
+ foreach(const QUrl &url, urls) {
TransferHandler *transfer = existingTransfer(url, type, &warning);
if (transfer) {
splitWarnings[warning] << qMakePair(url, transfer);
@@ -558,15 +558,15 @@ KUrl::List UrlChecker::hasExistingTransferMessages(const \
KUrl::List &urls, const }
//First ask about unfinished existing transfers
- QList<QPair<KUrl, TransferHandler*> >::const_iterator it;
- QList<QPair<KUrl, TransferHandler*> >::const_iterator itEnd;
+ QList<QPair<QUrl, TransferHandler*> >::const_iterator it;
+ QList<QPair<QUrl, TransferHandler*> >::const_iterator itEnd;
QList<UrlWarning> orderOfExecution;
QList<TransferHandler*> toDelete;
orderOfExecution << ExistingTransfer << ExistingFinishedTransfer;
for (int i = 0; i < orderOfExecution.count(); ++i) {
warning = orderOfExecution[i];
if (splitWarnings.contains(warning)) {
- QList<QPair<KUrl, TransferHandler*> > existing = splitWarnings[warning];
+ QList<QPair<QUrl, TransferHandler*> > existing = splitWarnings[warning];
itEnd = existing.constEnd();
bool isYesAll = false;
bool isNoAll = false;
@@ -621,7 +621,7 @@ void UrlChecker::removeTransfers(const QList<TransferHandler*> \
&toRemove) }
-int UrlChecker::hasExistingDialog(const KUrl &url, const UrlChecker::UrlType type, \
const UrlChecker::UrlWarning warning) +int UrlChecker::hasExistingDialog(const QUrl \
&url, const UrlChecker::UrlType type, const UrlChecker::UrlWarning warning) {
QWidget *parent = KGet::m_mainWindow;
@@ -694,7 +694,7 @@ void UrlChecker::setType(UrlChecker::UrlType type)
m_type = type;
}
-UrlChecker::UrlError UrlChecker::addUrl(const KUrl &url)
+UrlChecker::UrlError UrlChecker::addUrl(const QUrl &url)
{
const UrlError error = checkUrl(url, m_type);
if (error == NoError) {
@@ -706,10 +706,10 @@ UrlChecker::UrlError UrlChecker::addUrl(const KUrl &url)
return error;
}
-bool UrlChecker::addUrls(const KUrl::List &urls)
+bool UrlChecker::addUrls(const QList<QUrl> &urls)
{
bool worked = true;
- foreach (const KUrl &url, urls) {
+ foreach (const QUrl &url, urls) {
const UrlError error = addUrl(url);
if (error != NoError) {
worked = false;
@@ -724,13 +724,13 @@ void UrlChecker::existingTransfers()
m_correctUrls = hasExistingTransferMessages(correctUrls(), m_type);
}
-KUrl UrlChecker::checkExistingFile(const KUrl &source, const KUrl &destination)
+QUrl UrlChecker::checkExistingFile(const QUrl &source, const QUrl &destination)
{
- KUrl newDestination = destination;
+ QUrl newDestination = destination;
//any url is ignored
if (m_cancle) {
- return KUrl();
+ return QUrl();
}
if (Settings::filesOverwrite()) {
@@ -746,7 +746,7 @@ KUrl UrlChecker::checkExistingFile(const KUrl &source, const KUrl \
&destination)
///in the following cases no dialog needs to be shown
if (m_skipAll) { //only existing are ignored
- return KUrl();
+ return QUrl();
} else if (m_overwriteAll) {
FileDeleter::deleteFile(newDestination);
return newDestination;
@@ -778,15 +778,15 @@ KUrl UrlChecker::checkExistingFile(const KUrl &source, const \
KUrl &destination) m_autoRenameAll = true;
return newDestination;
case KIO::R_SKIP:
- return KUrl();
+ return QUrl();
case KIO::R_AUTO_SKIP:
m_skipAll = true;
- return KUrl();
+ return QUrl();
case KIO::R_CANCEL:
m_cancle = true;
- return KUrl();
+ return QUrl();
default:
- return KUrl();
+ return QUrl();
}
}
@@ -794,17 +794,17 @@ KUrl UrlChecker::checkExistingFile(const KUrl &source, const \
KUrl &destination) }
-KUrl::List UrlChecker::correctUrls() const
+QList<QUrl> UrlChecker::correctUrls() const
{
return m_correctUrls;
}
-KUrl::List UrlChecker::errorUrls() const
+QList<QUrl> UrlChecker::errorUrls() const
{
- KUrl::List urls;
+ QList<QUrl> urls;
- QHash<UrlChecker::UrlError, KUrl::List>::const_iterator it;
- QHash<UrlChecker::UrlError, KUrl::List>::const_iterator itEnd = \
m_splitErrorUrls.constEnd(); + QHash<UrlChecker::UrlError, \
QList<QUrl>>::const_iterator it; + QHash<UrlChecker::UrlError, \
QList<QUrl>>::const_iterator itEnd = m_splitErrorUrls.constEnd(); for (it = \
m_splitErrorUrls.constBegin(); it != itEnd; ++it) { urls << (*it);
}
@@ -812,15 +812,15 @@ KUrl::List UrlChecker::errorUrls() const
return urls;
}
-QHash<UrlChecker::UrlError, KUrl::List> UrlChecker::splitErrorUrls() const
+QHash<UrlChecker::UrlError, QList<QUrl>> UrlChecker::splitErrorUrls() const
{
return m_splitErrorUrls;
}
void UrlChecker::displayErrorMessages()
{
- QHash<UrlChecker::UrlError, KUrl::List>::const_iterator it;
- QHash<UrlChecker::UrlError, KUrl::List>::const_iterator itEnd = \
m_splitErrorUrls.constEnd(); + QHash<UrlChecker::UrlError, \
QList<QUrl>>::const_iterator it; + QHash<UrlChecker::UrlError, \
QList<QUrl>>::const_iterator itEnd = m_splitErrorUrls.constEnd(); for (it = \
m_splitErrorUrls.constBegin(); it != itEnd; ++it) { QString m;
if (it->count() > 1) {
diff --git a/core/urlchecker.h b/core/urlchecker.h
index 9f3b476..6a76edf 100644
--- a/core/urlchecker.h
+++ b/core/urlchecker.h
@@ -22,7 +22,7 @@
#include "../kget_export.h"
-#include <KUrl>
+#include <QUrl>
class Transfer;
class TransferHandler;
@@ -53,7 +53,7 @@ class KGET_EXPORT UrlChecker
/**
* Removes duplicates of a list of urls
*/
- static void removeDuplicates(KUrl::List &urls);
+ static void removeDuplicates(QList<QUrl> &urls);
//NOTE only first found error is reported, i.e. NotWriteable before \
ExistingFile if both are the case enum UrlError {
@@ -95,25 +95,25 @@ class KGET_EXPORT UrlChecker
* directly
* @see checkExisting
*/
- static UrlError checkUrl(const KUrl &url, const UrlType type, bool \
showNotification = false); + static UrlError checkUrl(const QUrl &url, const \
UrlType type, bool showNotification = false);
/**
* Convenience method of checkUrl
* @param showNotification true shows a notification if an error is found
*/
- static UrlError checkSource(const KUrl &source, bool showNotification = \
false); + static UrlError checkSource(const QUrl &source, bool \
showNotification = false);
/**
* Convenience method of checkUrl
* @param showNotification true shows a notification if an error is found
*/
- static UrlError checkDestination(const KUrl &destination, bool \
showNotification = false); + static UrlError checkDestination(const QUrl \
&destination, bool showNotification = false);
/**
* Convenience method of checkUrl
* @param showNotification true shows a notification if an error is found
*/
- static UrlError checkFolder(const KUrl &folder, bool showNotification = \
false); + static UrlError checkFolder(const QUrl &folder, bool \
showNotification = false);
/**
* Checks if source is local and exists already
@@ -124,7 +124,7 @@ class KGET_EXPORT UrlChecker
* Also keep in mind that false will be returned if dest is being removed
* at the moment. Avoid to ask a user twice in worst case.
*/
- static bool wouldOverwrite(const KUrl &source, const KUrl &dest);
+ static bool wouldOverwrite(const QUrl &source, const QUrl &dest);
/**
* Checks if there is an existing transfer for url with type
@@ -136,12 +136,12 @@ class KGET_EXPORT UrlChecker
* Keep in mind, that the same transfers could be found via Source and \
Destination!
* @see checkUrl
*/
- static TransferHandler *existingTransfer(const KUrl &url, const UrlType \
type, UrlWarning *warning = 0); + static TransferHandler \
*existingTransfer(const QUrl &url, const UrlType type, UrlWarning *warning = 0);
/**
* @note UrlType folder is not supported, the result then is undefined!
*/
- static KUrl::List hasExistingTransferMessages(const KUrl::List &urls, const \
UrlType type); + static QList<QUrl> hasExistingTransferMessages(const \
QList<QUrl> &urls, const UrlType type);
/**
* Get a describing message for UrlError
@@ -150,7 +150,7 @@ class KGET_EXPORT UrlChecker
* @note this method does no checks, it only creates messages based on the \
error code
* @see checkUrl
*/
- static QString message(const KUrl &url, const UrlType type, const UrlError \
error); + static QString message(const QUrl &url, const UrlType type, const \
UrlError error);
/**
* Get a describing message for UrlWarning
@@ -159,19 +159,19 @@ class KGET_EXPORT UrlChecker
* @note this method does no checks, it only creates messages based on the \
warning code
* @see existingTransfer fileExists
*/
- static QString message(const KUrl &url, const UrlType type, const UrlWarning \
warning); + static QString message(const QUrl &url, const UrlType type, const \
UrlWarning warning);
/**
* Convenience method for multiple urls (urls can be empty)
* @see message
*/
- static QString message(const KUrl::List &urls, const UrlType type, const \
UrlError error); + static QString message(const QList<QUrl> &urls, const \
UrlType type, const UrlError error);
/**
* Convenience method for multiple urls (urls can be empty)
* @see message
*/
- static QString message(const KUrl::List &urls, const UrlType type, const \
UrlWarning warning); + static QString message(const QList<QUrl> &urls, const \
UrlType type, const UrlWarning warning);
/**
* Takes an url to a source and an url to either the destination or a folder
@@ -183,7 +183,7 @@ class KGET_EXPORT UrlChecker
* @note no checkUrl check happens!
* @see checkUrl
*/
- static KUrl destUrl(const KUrl &destOrFolder, const KUrl &source, const \
QString &fileName = QString()); + static QUrl destUrl(const QUrl \
&destOrFolder, const QUrl &source, const QString &fileName = QString());
///Non static methods following
@@ -209,7 +209,7 @@ class KGET_EXPORT UrlChecker
* urls in correctUrls() and the others in errorUrls() and
* splitErrorUrls()
*/
- UrlError addUrl(const KUrl &url);
+ UrlError addUrl(const QUrl &url);
/**
* Does checkUrl for a list of urls.
@@ -220,7 +220,7 @@ class KGET_EXPORT UrlChecker
* splitErrorUrls()
* @see addUrl
*/
- bool addUrls(const KUrl::List &urls);
+ bool addUrls(const QList<QUrl> &urls);
/**
* Displays error messages for the collected urls if any are needed
@@ -231,7 +231,7 @@ class KGET_EXPORT UrlChecker
* Returns the correct urls collected with the last call to urlCollectErrors
* @see urlCollectErrors
*/
- KUrl::List correctUrls() const;
+ QList<QUrl> correctUrls() const;
/**
* Checks all correctUrls() if there are existing Transfers
@@ -256,14 +256,14 @@ class KGET_EXPORT UrlChecker
* should not be downloaded
* @see clear
*/
- KUrl checkExistingFile(const KUrl &source, const KUrl &destination);
+ QUrl checkExistingFile(const QUrl &source, const QUrl &destination);
/**
* Returns all wrong urls
* @note the oder of the urls is not guaranteed to be the same as it \
initially was
* @see urlCollectErrors splitErrorUrls existingTransfers
*/
- KUrl::List errorUrls()const;
+ QList<QUrl> errorUrls()const;
/**
* Returns all wrong urls collected with the last call to urlCollectErrors
@@ -271,12 +271,12 @@ class KGET_EXPORT UrlChecker
* @note urls without an error (UrlError == None) are not included
* @see urlCollectErrors correctUrls errorUrls existingTransfers
*/
- QHash<UrlError, KUrl::List> splitErrorUrls() const;
+ QHash<UrlError, QList<QUrl>> splitErrorUrls() const;
private:
- static TransferHandler *existingSource(const KUrl &url, UrlWarning \
&warning);
- static TransferHandler *existingDestination(const KUrl &url, UrlWarning \
&warning);
- static int hasExistingDialog(const KUrl &url, const UrlChecker::UrlType \
type, const UrlWarning warning);//TODO description --> returncode etc.! + \
static TransferHandler *existingSource(const QUrl &url, UrlWarning &warning); + \
static TransferHandler *existingDestination(const QUrl &url, UrlWarning &warning); + \
static int hasExistingDialog(const QUrl &url, const UrlChecker::UrlType type, const \
UrlWarning warning);//TODO description --> returncode etc.!
static void removeTransfers(const QList<TransferHandler*> &toRemove);
enum ExistingDialogReturn {
@@ -293,11 +293,11 @@ class KGET_EXPORT UrlChecker
private:
UrlType m_type;
- KUrl::List m_correctUrls;
- QHash<UrlError, KUrl::List> m_splitErrorUrls;
+ QList<QUrl> m_correctUrls;
+ QHash<UrlError, QList<QUrl>> m_splitErrorUrls;
- QHash<UrlWarning, QPair<KUrl, Transfer*> > m_existingTransfers;
- KUrl::List m_nonExistingUrls;
+ QHash<UrlWarning, QPair<QUrl, Transfer*> > m_existingTransfers;
+ QList<QUrl> m_nonExistingUrls;
//Existing files stuff
bool m_cancle;
diff --git a/core/verificationmodel.cpp b/core/verificationmodel.cpp
index b13826d..755693e 100644
--- a/core/verificationmodel.cpp
+++ b/core/verificationmodel.cpp
@@ -23,7 +23,7 @@
#include <QtCore/QStringList>
#include <KDebug>
-#include <KIcon>
+#include <QIcon>
#include <KLocale>
struct VerificationModelPrivate
@@ -62,12 +62,12 @@ QVariant VerificationModel::data(const QModelIndex &index, int \
role) const if (role == Qt::DecorationRole) {
switch (status) {
case Verifier::Verified:
- return KIcon("dialog-ok");
+ return QIcon::fromTheme("dialog-ok");
case Verifier::NotVerified:
- return KIcon("dialog-close");
+ return QIcon::fromTheme("dialog-close");
case Verifier::NoResult:
default:
- return KIcon();
+ return QIcon::fromTheme(QString());
}
} else if (role == Qt::EditRole) {
return status;
diff --git a/core/verifier.cpp b/core/verifier.cpp
index bab1590..81f7bfd 100644
--- a/core/verifier.cpp
+++ b/core/verifier.cpp
@@ -68,14 +68,14 @@ QString VerifierPrivate::calculatePartialChecksum(QFile *file, \
const QString &ty QCA::Hash hash(type);
//it can be that QCA2 does not support md5, e.g. when Qt is compiled locally
- KMD5 md5Hash;
+ QCryptographicHash md5Hash(QCryptographicHash::Md5);
const bool useMd5 = (type == MD5);
#else //NO QCA2
if (type != MD5)
{
return QString();
}
- KMD5 hash;
+ QCryptographicHash hash(QCryptographicHash::Md5);
#endif //HAVE_QCA2
//we only read 512kb each time, to save RAM
@@ -84,7 +84,7 @@ QString VerifierPrivate::calculatePartialChecksum(QFile *file, \
const QString &ty
if (!numData && !dataRest)
{
- QString();
+ return QString();
}
int k = 0;
@@ -103,12 +103,12 @@ QString VerifierPrivate::calculatePartialChecksum(QFile *file, \
const QString &ty QByteArray data = file->read(PARTSIZE);
#ifdef HAVE_QCA2
if (useMd5) {
- md5Hash.update(data);
+ md5Hash.addData(data);
} else {
hash.update(data);
}
#else //NO QCA2
- hash.update(data);
+ hash.addData(data);
#endif //HAVE_QCA2
}
@@ -123,19 +123,19 @@ QString VerifierPrivate::calculatePartialChecksum(QFile *file, \
const QString &ty QByteArray data = file->read(dataRest);
#ifdef HAVE_QCA2
if (useMd5) {
- md5Hash.update(data);
+ md5Hash.addData(data);
} else {
hash.update(data);
}
#else //NO QCA2
- hash.update(data);
+ hash.addData(data);
#endif //HAVE_QCA2
}
#ifdef HAVE_QCA2
- return (useMd5 ? QString(md5Hash.hexDigest()) : \
QString(QCA::arrayToHex(hash.final().toByteArray()))); + return (useMd5 ? \
QString(md5Hash.result()) : QString(QCA::arrayToHex(hash.final().toByteArray()))); \
#else //NO QCA2
- return QString(hash.hexDigest());
+ return QString(hash.result());
#endif //HAVE_QCA2
}
@@ -160,7 +160,7 @@ QStringList \
VerifierPrivate::orderChecksumTypes(Verifier::ChecksumStrength stren return \
checksumTypes; }
-Verifier::Verifier(const KUrl &dest, QObject *parent)
+Verifier::Verifier(const QUrl &dest, QObject *parent)
: QObject(parent),
d(new VerifierPrivate(this))
{
@@ -179,7 +179,7 @@ Verifier::Verifier(const KUrl &dest, QObject *parent)
qRegisterMetaType<QList<KIO::fileoffset_t> >("QList<KIO::fileoffset_t>");
d->model = new VerificationModel();
- connect(&d->thread, SIGNAL(verified(QString,bool,KUrl)), this, \
SLOT(changeStatus(QString,bool))); + connect(&d->thread, \
SIGNAL(verified(QString,bool,QUrl)), this, \
SLOT(changeStatus(QString,bool)));
connect(&d->thread, \
SIGNAL(brokenPieces(QList<KIO::fileoffset_t>,KIO::filesize_t)), this, \
SIGNAL(brokenPieces(QList<KIO::fileoffset_t>,KIO::filesize_t))); }
@@ -193,12 +193,12 @@ QString Verifier::dBusObjectPath() const
return d->dBusObjectPath;
}
-KUrl Verifier::destination() const
+QUrl Verifier::destination() const
{
return d->dest;
}
-void Verifier::setDestination(const KUrl &destination)
+void Verifier::setDestination(const QUrl &destination)
{
d->dest = destination;
}
@@ -278,7 +278,7 @@ QString Verifier::cleanChecksumType(const QString &type)
bool Verifier::isVerifyable() const
{
- return QFile::exists(d->dest.pathOrUrl()) && d->model->rowCount();
+ return QFile::exists(d->dest.toString()) && d->model->rowCount();
}
bool Verifier::isVerifyable(const QModelIndex &index) const
@@ -288,7 +288,7 @@ bool Verifier::isVerifyable(const QModelIndex &index) const
{
row = index.row();
}
- if (QFile::exists(d->dest.pathOrUrl()) && (row >= 0) && (row < \
d->model->rowCount())) + if (QFile::exists(d->dest.toString()) && (row >= 0) && \
(row < d->model->rowCount())) {
return true;
}
@@ -395,7 +395,7 @@ void Verifier::brokenPieces() const
d->thread.findBrokenPieces(pair.first, checksums, length, d->dest);
}
-QString Verifier::checksum(const KUrl &dest, const QString &type, bool *abortPtr)
+QString Verifier::checksum(const QUrl &dest, const QString &type, bool *abortPtr)
{
QStringList supported = supportedVerficationTypes();
if (!supported.contains(type))
@@ -403,16 +403,16 @@ QString Verifier::checksum(const KUrl &dest, const QString \
&type, bool *abortPtr return QString();
}
- QFile file(dest.pathOrUrl());
+ QFile file(dest.toString());
if (!file.open(QIODevice::ReadOnly))
{
return QString();
}
if (type == VerifierPrivate::MD5) {
- KMD5 hash;
- hash.update(file);
- QString final = QString(hash.hexDigest());
+ QCryptographicHash hash(QCryptographicHash::Md5);
+ hash.addData(&file);
+ QString final = QString(hash.result());
file.close();
return final;
}
@@ -445,7 +445,7 @@ QString Verifier::checksum(const KUrl &dest, const QString &type, \
bool *abortPtr return QString();
}
-PartialChecksums Verifier::partialChecksums(const KUrl &dest, const QString &type, \
KIO::filesize_t length, bool *abortPtr) +PartialChecksums \
Verifier::partialChecksums(const QUrl &dest, const QString &type, KIO::filesize_t \
length, bool *abortPtr) {
QStringList checksums;
@@ -455,7 +455,7 @@ PartialChecksums Verifier::partialChecksums(const KUrl &dest, \
const QString &typ return PartialChecksums();
}
- QFile file(dest.pathOrUrl());
+ QFile file(dest.toString());
if (!file.open(QIODevice::ReadOnly))
{
return PartialChecksums();
diff --git a/core/verifier.h b/core/verifier.h
index d964b20..da89226 100644
--- a/core/verifier.h
+++ b/core/verifier.h
@@ -21,7 +21,7 @@
#define VERIFIER_H
#include <kio/global.h>
-#include <KUrl>
+#include <QUrl>
#include <QtCore/QModelIndex>
#include <QtCore/QHash>
@@ -70,7 +70,7 @@ class KGET_EXPORT Verifier : public QObject
Q_OBJECT
public:
- explicit Verifier(const KUrl &dest, QObject *parent = 0);
+ explicit Verifier(const QUrl &dest, QObject *parent = 0);
~Verifier();
enum VerificationStatus
@@ -92,8 +92,8 @@ class KGET_EXPORT Verifier : public QObject
*/
QString dBusObjectPath() const;
- KUrl destination() const;
- void setDestination(const KUrl &destination);//TODO handle the case when \
m_thread is working, while the file gets moved + QUrl destination() const;
+ void setDestination(const QUrl &destination);//TODO handle the case when \
m_thread is working, while the file gets moved
VerificationStatus status() const;
@@ -128,7 +128,7 @@ class KGET_EXPORT Verifier : public QObject
* Creates the checksum type of the file dest
* @param abortPtr makes it possible to abort the calculation of the \
checksum from another thread
*/
- static QString checksum(const KUrl &dest, const QString &type, bool \
*abortPtr); + static QString checksum(const QUrl &dest, const QString &type, \
bool *abortPtr);
/**
* Create partial checksums of type for file dest
@@ -136,7 +136,7 @@ class KGET_EXPORT Verifier : public QObject
* @note the length of the partial checksum (if not defined = 0) is not less \
than 512 kb
* and there won't be more partial checksums than 101
*/
- static PartialChecksums partialChecksums(const KUrl &dest, const QString \
&type, KIO::filesize_t length = 0, bool *abortPtr = 0); + static \
PartialChecksums partialChecksums(const QUrl &dest, const QString &type, \
KIO::filesize_t length = 0, bool *abortPtr = 0);
/**
* @note only call verify() when this function returns true
diff --git a/dbus/dbuskgetwrapper.cpp b/dbus/dbuskgetwrapper.cpp
index 57f0dfb..a4f04ef 100644
--- a/dbus/dbuskgetwrapper.cpp
+++ b/dbus/dbuskgetwrapper.cpp
@@ -39,7 +39,7 @@ DBusKGetWrapper::DBusKGetWrapper(MainWindow *parent)
m_mainWindow(parent)
{
foreach (TransferHandler *handler, KGet::allTransfers()) {
- m_transfers[handler] = qMakePair(handler->source().pathOrUrl(), \
handler->dBusObjectPath()); + m_transfers[handler] = \
qMakePair(handler->source().toString(), handler->dBusObjectPath()); }
TransferTreeModel *model = KGet::model();
@@ -56,9 +56,11 @@ QStringList DBusKGetWrapper::addTransfer(const QString& src, const \
QString& dest {
QStringList dBusPaths;
-
+ QList<QUrl> urls;
+ foreach (const QString &s, src.split(";"))
+ urls.append(QUrl(s));
// split src for the case it is a QStringList (e.g. from konqueror plugin)
- QList<TransferHandler*> addedTransfers = KGet::addTransfer(src.split(';'), dest, \
QString(), start); + QList<TransferHandler*> addedTransfers = \
KGet::addTransfer(urls, dest, QString(), start);
foreach (TransferHandler *handler, addedTransfers) {
dBusPaths.append(handler->dBusObjectPath());
@@ -82,7 +84,10 @@ bool DBusKGetWrapper::delTransfer(const QString& dbusObjectPath)
void DBusKGetWrapper::showNewTransferDialog(const QStringList &urls)
{
- NewTransferDialogHandler::showNewTransferDialog(urls);
+ QList<QUrl> qurls;
+ foreach (const QString &s, urls)
+ qurls.append(QUrl(s));
+ NewTransferDialogHandler::showNewTransferDialog(qurls);
}
bool DBusKGetWrapper::dropTargetVisible() const
@@ -123,7 +128,7 @@ void DBusKGetWrapper::slotTransfersAdded(const \
QList<TransferHandler*> &transfer QStringList urls;
QStringList objectPaths;
foreach (TransferHandler *transfer, transfers) {
- const QString url = transfer->source().pathOrUrl();
+ const QString url = transfer->source().toString();
const QString objectPath = transfer->dBusObjectPath();
urls << url;
objectPaths << objectPath;
diff --git a/dbus/dbustransferwrapper.cpp b/dbus/dbustransferwrapper.cpp
index 88147fb..4011823 100644
--- a/dbus/dbustransferwrapper.cpp
+++ b/dbus/dbustransferwrapper.cpp
@@ -61,12 +61,12 @@ QString DBusTransferWrapper::groupName() const
QString DBusTransferWrapper::source() const
{
- return m_transfer->source().pathOrUrl();
+ return m_transfer->source().toString();
}
QString DBusTransferWrapper::dest() const
{
- return m_transfer->dest().pathOrUrl();
+ return m_transfer->dest().toString();
}
bool DBusTransferWrapper::setDirectory(const QString &directory)
diff --git a/dbus/dbusverifierwrapper.cpp b/dbus/dbusverifierwrapper.cpp
index c904f67..56854d8 100644
--- a/dbus/dbusverifierwrapper.cpp
+++ b/dbus/dbusverifierwrapper.cpp
@@ -35,7 +35,7 @@ DBusVerifierWrapper::~DBusVerifierWrapper()
QString DBusVerifierWrapper::destination() const
{
- return m_verifier->destination().pathOrUrl();
+ return m_verifier->destination().toString();
}
void DBusVerifierWrapper::addChecksum(const QString &type, const QString &hash)
diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt
index 90a3b36..a627fc5 100644
--- a/doc/CMakeLists.txt
+++ b/doc/CMakeLists.txt
@@ -1,2 +1,2 @@
########### install files ###############
-kde4_create_handbook(index.docbook INSTALL_DESTINATION ${HTML_INSTALL_DIR}/en SUBDIR \
kget) +kdoctools_create_handbook(index.docbook INSTALL_DESTINATION \
${HTML_INSTALL_DIR}/en SUBDIR kget)
diff --git a/extensions/CMakeLists.txt b/extensions/CMakeLists.txt
index d8a632a..4302527 100644
--- a/extensions/CMakeLists.txt
+++ b/extensions/CMakeLists.txt
@@ -1,2 +1,3 @@
add_subdirectory(konqueror)
-add_subdirectory(webinterface)
+#add_subdirectory(webinterface)
+#TODO: Port this to KDE5
\ No newline at end of file
diff --git a/extensions/konqueror/CMakeLists.txt \
b/extensions/konqueror/CMakeLists.txt index f7bf090..073d9bf 100644
--- a/extensions/konqueror/CMakeLists.txt
+++ b/extensions/konqueror/CMakeLists.txt
@@ -4,11 +4,11 @@ set(kget_browser_integration_SRCS
kget_plug_in.cpp
)
-QT4_ADD_DBUS_INTERFACE(kget_browser_integration_SRCS \
../../dbus/org.kde.kget.main.xml kget_interface ) \
+QT5_ADD_DBUS_INTERFACE(kget_browser_integration_SRCS \
../../dbus/org.kde.kget.main.xml kget_interface )
-kde4_add_plugin(kget_browser_integration ${kget_browser_integration_SRCS})
+add_library(kget_browser_integration MODULE ${kget_browser_integration_SRCS})
-target_link_libraries(kget_browser_integration ${KDE4_KHTML_LIBS} \
${KDE4_KIO_LIBRARY}) +target_link_libraries(kget_browser_integration \
${KDE4_KDECORE_LIBS})
install(TARGETS kget_browser_integration DESTINATION ${PLUGIN_INSTALL_DIR})
diff --git a/extensions/konqueror/kget_plug_in.cpp \
b/extensions/konqueror/kget_plug_in.cpp index 011a14b..b89ffd6 100644
--- a/extensions/konqueror/kget_plug_in.cpp
+++ b/extensions/konqueror/kget_plug_in.cpp
@@ -206,7 +206,7 @@ void KGetPlugin::getLinks(bool selectedOnly)
attr = QL1S("src");
else if (element.hasAttribute(QL1S("data")))
attr = QL1S("data");
- const KUrl resolvedUrl (baseUrl.resolved(element.attribute(attr)));
+ const QUrl resolvedUrl (baseUrl.resolved(element.attribute(attr)));
// Only select valid and non-local links for download...
if (resolvedUrl.isValid() && !resolvedUrl.isLocalFile() && \
!resolvedUrl.host().isEmpty()) { if (element.hasAttribute(QL1S("type")))
@@ -227,7 +227,7 @@ void KGetPlugin::getLinks(bool selectedOnly)
\
KParts::FileInfoExtension::AllItems); const KFileItemList items = \
fileinfoExtn->queryFor(mode); Q_FOREACH(const KFileItem& item, items) {
- const KUrl url = item.url();
+ const QUrl url = item.url();
// Only select valid and non local links for download...
if (item.isReadable() && item.isFile() && !item.isLocalFile() && \
!url.host().isEmpty()) { if (item.mimetype().isEmpty())
diff --git a/kget_export.h b/kget_export.h
index 551e7a0..8f5f380 100644
--- a/kget_export.h
+++ b/kget_export.h
@@ -38,11 +38,14 @@
* }
*/
#define KGET_EXPORT_PLUGIN( classname ) \
- K_PLUGIN_FACTORY( KGetFactory, registerPlugin< classname >(); ) \
- K_EXPORT_PLUGIN( KGetFactory("classname") )
+ K_PLUGIN_FACTORY( KGetFactory, registerPlugin< classname >(); )
+
+ /*\
+ K_EXPORT_PLUGIN( KGetFactory("classname") )*/
#define KGET_EXPORT_PLUGIN_CONFIG( classname ) \
- K_PLUGIN_FACTORY( KGetFactory, registerPlugin< classname >(); ) \
- K_EXPORT_PLUGIN( KGetFactory( "classname" ) )
+ K_PLUGIN_FACTORY( KGetFactory, registerPlugin< classname >(); )
+ /*\
+ K_EXPORT_PLUGIN( KGetFactory( "classname" ) )*/
#endif
diff --git a/main.cpp b/main.cpp
index d1f023d..90f59a8 100644
--- a/main.cpp
+++ b/main.cpp
@@ -15,6 +15,7 @@
#include <kcmdlineargs.h>
#include <kuniqueapplication.h>
#include <kstandarddirs.h>
+#include <k4aboutdata.h>
#include "core/kget.h"
#include "dbus/dbuskgetwrapper.h"
@@ -100,11 +101,11 @@ private:
int main(int argc, char *argv[])
{
- KAboutData aboutData("kget", 0, ki18n("KGet"),
- QByteArray("2." + QByteArray::number(KDE_VERSION_MINOR) + \
'.' + QByteArray::number(KDE_VERSION_RELEASE)), + K4AboutData aboutData("kget", 0, \
ki18n("KGet"), + QByteArray("2.95.0"),//+ \
QByteArray::number(KDE_VERSION_MINOR) + '.' + \
QByteArray::number(KDE_VERSION_RELEASE)), ki18n("An advanced download manager for \
KDE"),
- KAboutData::License_GPL,
- ki18n("(C) 2005 - 2012, The KGet developers\n"
+ K4AboutData::License_GPL,
+ ki18n("(C) 2005 - 2014, The KGet developers\n"
"(C) 2001 - 2002, Patrick Charbonnier\n"
"(C) 2002, Carsten Pfeiffer\n"
"(C) 1998 - 2000, Matej Koss"),
diff --git a/mainwindow.cpp b/mainwindow.cpp
index 1767466..5981527 100644
--- a/mainwindow.cpp
+++ b/mainwindow.cpp
@@ -52,11 +52,12 @@
#include <kicon.h>
#include <kactionmenu.h>
#include <KSelectAction>
-#include <krun.h>
+#include <KRun>
#include <kicondialog.h>
#include "core/verifier.h"
#include <QClipboard>
#include <QTimer>
+#include <QKeySequence>
#include <QtTest/QtTest>
MainWindow::MainWindow(bool showMainwindow, bool startWithoutAnimation, bool \
doTesting, QWidget *parent) @@ -65,8 +66,8 @@ MainWindow::MainWindow(bool \
showMainwindow, bool startWithoutAnimation, bool doT m_dock(0),
clipboardTimer(0),
m_startWithoutAnimation(startWithoutAnimation),
- m_doTesting(doTesting),
- m_webinterface(0)
+ m_doTesting(doTesting)/*,
+ m_webinterface(0)*/
{
// do not quit the app when it has been minimized to system tray and a new \
transfer dialog // gets opened and closed again.
@@ -138,77 +139,78 @@ int MainWindow::transfersPercent()
void MainWindow::setupActions()
{
- KAction *newDownloadAction = actionCollection()->addAction("new_download");
+ QAction *newDownloadAction = actionCollection()->addAction("new_download");
newDownloadAction->setText(i18n("&New Download..."));
newDownloadAction->setIcon(KIcon("document-new"));
- newDownloadAction->setShortcuts(KShortcut("Ctrl+N"));
- newDownloadAction->setHelpText(i18n("Opens a dialog to add a transfer to the \
list")); + //newDownloadAction->setShortcut(QKeySequence(i18n("Ctrl+N")));
+ newDownloadAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_N));
+ //newDownloadAction->setHelpText(i18n("Opens a dialog to add a transfer to the \
list"));
connect(newDownloadAction, SIGNAL(triggered()), SLOT(slotNewTransfer()));
- KAction *openAction = actionCollection()->addAction("import_transfers");
+ QAction *openAction = actionCollection()->addAction("import_transfers");
openAction->setText(i18n("&Import Transfers..."));
openAction->setIcon(KIcon("document-open"));
- openAction->setShortcuts(KShortcut("Ctrl+I"));
- openAction->setHelpText(i18n("Imports a list of transfers"));
+ openAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_I));
+ //openAction->setHelpText(i18n("Imports a list of transfers"));
connect(openAction, SIGNAL(triggered()), SLOT(slotImportTransfers()));
- KAction *exportAction = actionCollection()->addAction("export_transfers");
+ QAction *exportAction = actionCollection()->addAction("export_transfers");
exportAction->setText(i18n("&Export Transfers List..."));
exportAction->setIcon(KIcon("document-export"));
- exportAction->setShortcuts(KShortcut("Ctrl+E"));
- exportAction->setHelpText(i18n("Exports the current transfers into a file"));
+ exportAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_E));
+ //exportAction->setHelpText(i18n("Exports the current transfers into a file"));
connect(exportAction, SIGNAL(triggered()), SLOT(slotExportTransfers()));
- KAction *createMetalinkAction = \
actionCollection()->addAction("create_metalink"); + QAction *createMetalinkAction \
= actionCollection()->addAction("create_metalink"); \
createMetalinkAction->setText(i18n("&Create a Metalink...")); \
createMetalinkAction->setIcon(KIcon("journal-new"));
- createMetalinkAction->setHelpText(i18n("Creates or modifies a metalink and saves \
it on disk")); + //createMetalinkAction->setHelpText(i18n("Creates or modifies a \
metalink and saves it on disk"));
connect(createMetalinkAction, SIGNAL(triggered()), SLOT(slotCreateMetalink()));
- KAction *priorityTop = actionCollection()->addAction("priority_top");
+ QAction *priorityTop = actionCollection()->addAction("priority_top");
priorityTop->setText(i18n("Top Priority"));
priorityTop->setIcon(KIcon("arrow-up-double"));
- priorityTop->setShortcuts(KShortcut("Ctrl+PgUp"));
- priorityTop->setHelpText(i18n("Download selected transfer first"));
+ priorityTop->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_PageUp));
+ //priorityTop->setHelpText(i18n("Download selected transfer first"));
connect(priorityTop, SIGNAL(triggered()), this, SLOT(slotPriorityTop()));
- KAction *priorityBottom = actionCollection()->addAction("priority_bottom");
+ QAction *priorityBottom = actionCollection()->addAction("priority_bottom");
priorityBottom->setText(i18n("Least Priority"));
priorityBottom->setIcon(KIcon("arrow-down-double"));
- priorityBottom->setShortcuts(KShortcut("Ctrl+PgDown"));
- priorityBottom->setHelpText(i18n("Download selected transfer last"));
+ priorityBottom->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_PageDown));
+ //priorityBottom->setHelpText(i18n("Download selected transfer last"));
connect(priorityBottom, SIGNAL(triggered()), this, SLOT(slotPriorityBottom()));
- KAction *priorityUp = actionCollection()->addAction("priority_up");
+ QAction *priorityUp = actionCollection()->addAction("priority_up");
priorityUp->setText(i18n("Increase Priority"));
priorityUp->setIcon(KIcon("arrow-up"));
- priorityUp->setShortcuts(KShortcut("Ctrl+Up"));
- priorityUp->setHelpText(i18n("Increase priority for selected transfer"));
+ priorityUp->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Up));
+ //priorityUp->setHelpText(i18n("Increase priority for selected transfer"));
connect(priorityUp, SIGNAL(triggered()), this, SLOT(slotPriorityUp()));
- KAction *priorityDown = actionCollection()->addAction("priority_down");
+ QAction *priorityDown = actionCollection()->addAction("priority_down");
priorityDown->setText(i18n("Decrease Priority"));
priorityDown->setIcon(KIcon("arrow-down"));
- priorityDown->setShortcuts(KShortcut("Ctrl+Down"));
- priorityDown->setHelpText(i18n("Decrease priority for selected transfer"));
+ priorityDown->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Down));
+ //priorityDown->setHelpText(i18n("Decrease priority for selected transfer"));
connect(priorityDown, SIGNAL(triggered()), this, SLOT(slotPriorityDown()));
//FIXME: Not needed maybe because the normal delete already deletes groups?
- KAction *deleteGroupAction = actionCollection()->addAction("delete_groups");
+ QAction *deleteGroupAction = actionCollection()->addAction("delete_groups");
deleteGroupAction->setText(i18n("Delete Group"));
deleteGroupAction->setIcon(KIcon("edit-delete"));
- deleteGroupAction->setHelpText(i18n("Delete selected group"));
+ //deleteGroupAction->setHelpText(i18n("Delete selected group"));
connect(deleteGroupAction, SIGNAL(triggered()), SLOT(slotDeleteGroup()));
- KAction *renameGroupAction = actionCollection()->addAction("rename_groups");
+ QAction *renameGroupAction = actionCollection()->addAction("rename_groups");
renameGroupAction->setText(i18n("Rename Group..."));
renameGroupAction->setIcon(KIcon("edit-rename"));
connect(renameGroupAction, SIGNAL(triggered()), SLOT(slotRenameGroup()));
- KAction *setIconGroupAction = actionCollection()->addAction("seticon_groups");
+ QAction *setIconGroupAction = actionCollection()->addAction("seticon_groups");
setIconGroupAction->setText(i18n("Set Icon..."));
setIconGroupAction->setIcon(KIcon("preferences-desktop-icons"));
- setIconGroupAction->setHelpText(i18n("Select a custom icon for the selected \
group")); + //setIconGroupAction->setHelpText(i18n("Select a custom icon for the \
selected group"));
connect(setIconGroupAction, SIGNAL(triggered()), SLOT(slotSetIconGroup()));
m_autoPasteAction = new KToggleAction(KIcon("edit-paste"),
@@ -238,54 +240,54 @@ void MainWindow::setupActions()
// Transfer related actions
actionCollection()->addAction(KStandardAction::SelectAll, "select_all", \
m_viewsContainer, SLOT(selectAll()));
- KAction *deleteSelectedAction = \
actionCollection()->addAction("delete_selected_download"); + QAction \
*deleteSelectedAction = \
actionCollection()->addAction("delete_selected_download");
deleteSelectedAction->setText(i18nc("delete selected transfer item", "Remove \
Selected")); deleteSelectedAction->setIcon(KIcon("edit-delete"));
- deleteSelectedAction->setShortcuts(KShortcut("Del"));
- deleteSelectedAction->setHelpText(i18n("Removes selected transfer and deletes \
files from disk if it's not finished")); + \
deleteSelectedAction->setShortcut(QKeySequence(Qt::Key_Delete)); +// \
deleteSelectedAction->setHelpText(i18n("Removes selected transfer and deletes files \
from disk if it's not finished"));
connect(deleteSelectedAction, SIGNAL(triggered()), SLOT(slotDeleteSelected()));
- KAction *deleteAllFinishedAction = \
actionCollection()->addAction("delete_all_finished"); + QAction \
*deleteAllFinishedAction = \
actionCollection()->addAction("delete_all_finished");
deleteAllFinishedAction->setText(i18nc("delete all finished transfers", "Remove \
All Finished")); deleteAllFinishedAction->setIcon(KIcon("edit-clear-list"));
- deleteAllFinishedAction->setHelpText(i18n("Removes all finished transfers and \
leaves all files on disk")); +// \
deleteAllFinishedAction->setHelpText(i18n("Removes all finished transfers and leaves \
all files on disk"));
connect(deleteAllFinishedAction, SIGNAL(triggered()), \
SLOT(slotDeleteFinished()));
- KAction *deleteSelectedIncludingFilesAction = \
actionCollection()->addAction("delete_selected_download_including_files"); + \
QAction *deleteSelectedIncludingFilesAction = \
actionCollection()->addAction("delete_selected_download_including_files");
deleteSelectedIncludingFilesAction->setText(i18nc("delete selected transfer item \
and files", "Remove Selected and Delete Files")); \
deleteSelectedIncludingFilesAction->setIcon(KIcon("edit-delete"));
- deleteSelectedIncludingFilesAction->setHelpText(i18n("Removes selected transfer \
and deletes files from disk in any case")); +// \
deleteSelectedIncludingFilesAction->setHelpText(i18n("Removes selected transfer and \
deletes files from disk in any case"));
connect(deleteSelectedIncludingFilesAction, SIGNAL(triggered()), \
SLOT(slotDeleteSelectedIncludingFiles()));
- KAction *redownloadSelectedAction = \
actionCollection()->addAction("redownload_selected_download"); + QAction \
*redownloadSelectedAction = \
actionCollection()->addAction("redownload_selected_download");
redownloadSelectedAction->setText(i18nc("redownload selected transfer item", \
"Redownload Selected")); redownloadSelectedAction->setIcon(KIcon("view-refresh"));
connect(redownloadSelectedAction, SIGNAL(triggered()), \
SLOT(slotRedownloadSelected()));
- KAction *startAllAction = actionCollection()->addAction("start_all_download");
+ QAction *startAllAction = actionCollection()->addAction("start_all_download");
startAllAction->setText(i18n("Start All"));
startAllAction->setIcon(KIcon("media-seek-forward"));
- startAllAction->setShortcuts(KShortcut("Ctrl+R"));
- startAllAction->setHelpText(i18n("Starts / resumes all transfers"));
+ startAllAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_R));
+// startAllAction->setHelpText(i18n("Starts / resumes all transfers"));
connect(startAllAction, SIGNAL(triggered()), SLOT(slotStartAllDownload()));
- KAction *startSelectedAction = \
actionCollection()->addAction("start_selected_download"); + QAction \
*startSelectedAction = actionCollection()->addAction("start_selected_download"); \
startSelectedAction->setText(i18n("Start Selected")); \
startSelectedAction->setIcon(KIcon("media-playback-start"));
- startSelectedAction->setHelpText(i18n("Starts / resumes selected transfer"));
+// startSelectedAction->setHelpText(i18n("Starts / resumes selected transfer"));
connect(startSelectedAction, SIGNAL(triggered()), \
SLOT(slotStartSelectedDownload()));
- KAction *stopAllAction = actionCollection()->addAction("stop_all_download");
+ QAction *stopAllAction = actionCollection()->addAction("stop_all_download");
stopAllAction->setText(i18n("Pause All"));
stopAllAction->setIcon(KIcon("media-playback-pause"));
- stopAllAction->setShortcuts(KShortcut("Ctrl+P"));
- stopAllAction->setHelpText(i18n("Pauses all transfers"));
+ stopAllAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_P));
+// stopAllAction->setHelpText(i18n("Pauses all transfers"));
connect(stopAllAction, SIGNAL(triggered()), SLOT(slotStopAllDownload()));
- KAction *stopSelectedAction = \
actionCollection()->addAction("stop_selected_download"); + QAction \
*stopSelectedAction = actionCollection()->addAction("stop_selected_download"); \
stopSelectedAction->setText(i18n("Stop Selected")); \
stopSelectedAction->setIcon(KIcon("media-playback-pause"));
- stopSelectedAction->setHelpText(i18n("Pauses selected transfer"));
+ //stopSelectedAction->setHelpText(i18n("Pauses selected transfer"));
connect(stopSelectedAction, SIGNAL(triggered()), \
SLOT(slotStopSelectedDownload()));
KActionMenu *startActionMenu = new KActionMenu(KIcon("media-playback-start"), \
i18n("Start"), @@ -304,75 +306,75 @@ void MainWindow::setupActions()
stopActionMenu->addAction(stopAllAction);
connect(stopActionMenu, SIGNAL(triggered()), SLOT(slotStopDownload()));
- KAction *openDestAction = actionCollection()->addAction("transfer_open_dest");
+ QAction *openDestAction = actionCollection()->addAction("transfer_open_dest");
openDestAction->setText(i18n("Open Destination"));
openDestAction->setIcon(KIcon("document-open"));
connect(openDestAction, SIGNAL(triggered()), SLOT(slotTransfersOpenDest()));
- KAction *openFileAction = actionCollection()->addAction("transfer_open_file");
+ QAction *openFileAction = actionCollection()->addAction("transfer_open_file");
openFileAction->setText(i18n("Open File"));
openFileAction->setIcon(KIcon("document-open"));
connect(openFileAction, SIGNAL(triggered()), SLOT(slotTransfersOpenFile()));
- KAction *showDetailsAction = new KToggleAction(KIcon("document-properties"), \
i18n("Show Details"), actionCollection()); + QAction *showDetailsAction = new \
KToggleAction(KIcon("document-properties"), i18n("Show Details"), \
actionCollection());
actionCollection()->addAction("transfer_show_details", showDetailsAction);
connect(showDetailsAction, SIGNAL(triggered()), \
SLOT(slotTransfersShowDetails()));
- KAction *copyUrlAction = \
actionCollection()->addAction("transfer_copy_source_url"); + QAction \
*copyUrlAction = actionCollection()->addAction("transfer_copy_source_url"); \
copyUrlAction->setText(i18n("Copy URL to Clipboard")); \
copyUrlAction->setIcon(KIcon("edit-copy"));
connect(copyUrlAction, SIGNAL(triggered()), SLOT(slotTransfersCopySourceUrl()));
- KAction *transferHistoryAction = \
actionCollection()->addAction("transfer_history"); + QAction \
*transferHistoryAction = actionCollection()->addAction("transfer_history"); \
transferHistoryAction->setText(i18n("&Transfer History")); \
transferHistoryAction->setIcon(KIcon("view-history"));
- transferHistoryAction->setShortcuts(KShortcut("Ctrl+H"));
+ transferHistoryAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_H));
connect(transferHistoryAction, SIGNAL(triggered()), \
SLOT(slotTransferHistory()));
- KAction *transferGroupSettingsAction = \
actionCollection()->addAction("transfer_group_settings"); + QAction \
*transferGroupSettingsAction = \
actionCollection()->addAction("transfer_group_settings"); \
transferGroupSettingsAction->setText(i18n("&Group Settings")); \
transferGroupSettingsAction->setIcon(KIcon("preferences-system"));
- transferGroupSettingsAction->setShortcuts(KShortcut("Ctrl+G"));
+ transferGroupSettingsAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_G));
connect(transferGroupSettingsAction, SIGNAL(triggered()), \
SLOT(slotTransferGroupSettings()));
- KAction *transferSettingsAction = \
actionCollection()->addAction("transfer_settings"); + QAction \
*transferSettingsAction = actionCollection()->addAction("transfer_settings"); \
transferSettingsAction->setText(i18n("&Transfer Settings")); \
transferSettingsAction->setIcon(KIcon("preferences-system"));
- transferSettingsAction->setShortcuts(KShortcut("Ctrl+T"));
+ transferSettingsAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_T));
connect(transferSettingsAction, SIGNAL(triggered()), \
SLOT(slotTransferSettings()));
- KAction *listLinksAction = actionCollection()->addAction("import_links");
+ QAction *listLinksAction = actionCollection()->addAction("import_links");
listLinksAction->setText(i18n("Import &Links..."));
listLinksAction->setIcon(KIcon("view-list-text"));
- listLinksAction->setShortcuts(KShortcut("Ctrl+L"));
+ listLinksAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_L));
connect(listLinksAction, SIGNAL(triggered()), SLOT(slotShowListLinks()));
//create the download finished actions which can be displayed in the toolbar
KSelectAction *downloadFinishedActions = new KSelectAction(i18n("After downloads \
finished action"), this);//TODO maybe with name??
actionCollection()->addAction("download_finished_actions", \
downloadFinishedActions);
- downloadFinishedActions->setHelpText(i18n("Choose an action that is executed \
after all downloads have been finished.")); + \
//downloadFinishedActions->setHelpText(i18n("Choose an action that is executed after \
all downloads have been finished."));
- KAction *noAction = downloadFinishedActions->addAction(i18n("No Action"));
+ QAction *noAction = downloadFinishedActions->addAction(i18n("No Action"));
connect(noAction, SIGNAL(triggered()), SLOT(slotDownloadFinishedActions()));
downloadFinishedActions->addAction(noAction);
- KAction *quitAction = downloadFinishedActions->addAction(i18n("Quit KGet"));
+ QAction *quitAction = downloadFinishedActions->addAction(i18n("Quit KGet"));
quitAction->setData(KGet::Quit);
connect(quitAction, SIGNAL(triggered()), SLOT(slotDownloadFinishedActions()));
downloadFinishedActions->addAction(quitAction);
#ifdef HAVE_KWORKSPACE
- KAction *shutdownAction = downloadFinishedActions->addAction(i18n("Turn Off \
Computer")); + QAction *shutdownAction = \
downloadFinishedActions->addAction(i18n("Turn Off Computer")); \
shutdownAction->setData(KGet::Shutdown);
connect(shutdownAction, SIGNAL(triggered()), \
SLOT(slotDownloadFinishedActions())); \
downloadFinishedActions->addAction(shutdownAction);
- KAction *hibernateAction = downloadFinishedActions->addAction(i18n("Hibernate \
Computer")); + QAction *hibernateAction = \
downloadFinishedActions->addAction(i18n("Hibernate Computer")); \
hibernateAction->setData(KGet::Hibernate);
connect(hibernateAction, SIGNAL(triggered()), \
SLOT(slotDownloadFinishedActions())); \
downloadFinishedActions->addAction(hibernateAction);
- KAction *suspendAction = downloadFinishedActions->addAction(i18n("Suspend \
Computer")); + QAction *suspendAction = \
downloadFinishedActions->addAction(i18n("Suspend Computer")); \
suspendAction->setData(KGet::Suspend);
connect(suspendAction, SIGNAL(triggered()), \
SLOT(slotDownloadFinishedActions())); \
downloadFinishedActions->addAction(suspendAction); @@ -387,7 +389,7 @@ void \
MainWindow::setupActions()
void MainWindow::slotDownloadFinishedActions()
{
- KAction *action = static_cast<KAction*>(QObject::sender());
+ QAction *action = static_cast<QAction*>(QObject::sender());
bool ok;
const int type = action->data().toInt(&ok);
if (ok) {
@@ -453,8 +455,8 @@ void MainWindow::init()
if ( Settings::autoPaste() )
clipboardTimer->start(1000);
- if (Settings::webinterfaceEnabled())
- m_webinterface = new HttpServer(this);
+ /*if (Settings::webinterfaceEnabled())
+ m_webinterface = new HttpServer(this);*///TODO: Port to KF5
if (Settings::speedLimit())
{
@@ -907,10 +909,10 @@ void MainWindow::slotTransfersOpenDest()
QStringList openedDirs;
foreach(TransferHandler * it, KGet::selectedTransfers())
{
- QString directory = it->dest().directory();
+ QString directory = it->dest().adjusted(QUrl::RemoveFilename).toString();
if( !openedDirs.contains( directory ) )
{
- new KRun(directory, this, 0, true, false);
+ new KRun(QUrl(directory), this);
openedDirs.append( directory );
}
}
@@ -920,7 +922,7 @@ void MainWindow::slotTransfersOpenFile()
{
foreach(TransferHandler * it, KGet::selectedTransfers())
{
- new KRun(it->dest(), this, 0, true, false);
+ new KRun(it->dest(), this);
}
}
@@ -998,14 +1000,14 @@ void MainWindow::slotNewConfig()
}
m_autoPasteAction->setChecked(Settings::autoPaste());
- if (Settings::webinterfaceEnabled() && !m_webinterface) {
+ /*if (Settings::webinterfaceEnabled() && !m_webinterface) {
m_webinterface = new HttpServer(this);
} else if (m_webinterface && !Settings::webinterfaceEnabled()) {
delete m_webinterface;
m_webinterface = 0;
} else if (m_webinterface) {
m_webinterface->settingsChanged();
- }
+ }*///TODO: Port to KF5
if (Settings::speedLimit())
{
diff --git a/mainwindow.h b/mainwindow.h
index 31f7294..d17419b 100644
--- a/mainwindow.h
+++ b/mainwindow.h
@@ -155,7 +155,7 @@ private:
bool m_startWithoutAnimation;
bool m_doTesting; // UnitTest flag
- HttpServer *m_webinterface;
+ //HttpServer *m_webinterface;
#ifdef HAVE_QCA2
QCA::Initializer m_qcaInit;
diff --git a/transfer-plugins/CMakeLists.txt b/transfer-plugins/CMakeLists.txt
index 3473716..21f7222 100644
--- a/transfer-plugins/CMakeLists.txt
+++ b/transfer-plugins/CMakeLists.txt
@@ -9,6 +9,6 @@ add_subdirectory(mirrorsearch)
if (LIBMMS_FOUND)
add_subdirectory(mmsthreads)
endif (LIBMMS_FOUND)
-add_subdirectory(checksumsearch)
+#add_subdirectory(checksumsearch) TODO: Port to KF5
SET(SUPPORTED_KGET_MIMETYPES "${SUPPORTED_KGET_MIMETYPES}" PARENT_SCOPE)
diff --git a/transfer-plugins/checksumsearch/CMakeLists.txt \
b/transfer-plugins/checksumsearch/CMakeLists.txt index d633f4e..48e9c95 100644
--- a/transfer-plugins/checksumsearch/CMakeLists.txt
+++ b/transfer-plugins/checksumsearch/CMakeLists.txt
@@ -8,9 +8,9 @@ set(kget_checksumsearchfactory_PART_SRCS
checksumsearchfactory.cpp
)
-kde4_add_kcfg_files(kget_checksumsearchfactory_PART_SRCS \
checksumsearchsettings.kcfgc) \
+kconfig_add_kcfg_files(kget_checksumsearchfactory_PART_SRCS \
checksumsearchsettings.kcfgc)
-kde4_add_plugin(kget_checksumsearchfactory ${kget_checksumsearchfactory_PART_SRCS})
+add_library(kget_checksumsearchfactory MODULE \
${kget_checksumsearchfactory_PART_SRCS})
target_link_libraries(kget_checksumsearchfactory ${KDE4_KIO_LIBS} kgetcore)
@@ -24,13 +24,13 @@ checksumsearch.cpp
dlgchecksumsearch.cpp
)
-kde4_add_ui_files(kcm_kget_checksumsearchfactory_PART_SRCS
+qt5_wrap_ui(kcm_kget_checksumsearchfactory_PART_SRCS
checksumsearch.ui
checksumsearchadddlg.ui
)
-kde4_add_kcfg_files(kcm_kget_checksumsearchfactory_PART_SRCS \
checksumsearchsettings.kcfgc)
-kde4_add_plugin(kcm_kget_checksumsearchfactory \
${kcm_kget_checksumsearchfactory_PART_SRCS}) \
+kconfig_add_kcfg_files(kcm_kget_checksumsearchfactory_PART_SRCS \
checksumsearchsettings.kcfgc) +add_library(kcm_kget_checksumsearchfactory MODULE \
${kcm_kget_checksumsearchfactory_PART_SRCS}) \
target_link_libraries(kcm_kget_checksumsearchfactory ${KDE4_KDEUI_LIBS} \
${KDE4_KIO_LIBS} kgetcore) install(TARGETS kcm_kget_checksumsearchfactory \
DESTINATION ${PLUGIN_INSTALL_DIR})
diff --git a/transfer-plugins/checksumsearch/checksumsearchsettings.kcfgc \
b/transfer-plugins/checksumsearch/checksumsearchsettings.kcfgc index 8037361..0d5f87b \
100644
--- a/transfer-plugins/checksumsearch/checksumsearchsettings.kcfgc
+++ b/transfer-plugins/checksumsearch/checksumsearchsettings.kcfgc
@@ -2,4 +2,4 @@ ClassName=ChecksumSearchSettings
File=kget_checksumsearchfactory.kcfg
Mutators=true
Singleton=true
-Visibility=KDE_EXPORT
+Visibility=Q_DECL_EXPORT
diff --git a/transfer-plugins/checksumsearch/checksumsearchtransferdatasource.h \
b/transfer-plugins/checksumsearch/checksumsearchtransferdatasource.h index \
e8468f3..772afcb 100644
--- a/transfer-plugins/checksumsearch/checksumsearchtransferdatasource.h
+++ b/transfer-plugins/checksumsearch/checksumsearchtransferdatasource.h
@@ -46,30 +46,30 @@ class ChecksumSearchController : public QObject
* @param search ChecksumSearchTransferDataSource to register to baseUrl
* @param baseUrl that is being downloaded
*/
- void registerSearch(ChecksumSearchTransferDataSource *search, const KUrl \
&baseUrl); + void registerSearch(ChecksumSearchTransferDataSource *search, \
const QUrl &baseUrl);
/**
* Unregisters a search, do that e.g. if the search gets destroyed
* @param search ChecksumSearchTransferDataSource to unregister to baseUrl
* @param baseUrl can be empty, in that case search is unregistered for any \
url
*/
- void unregisterSearch(ChecksumSearchTransferDataSource *search, const KUrl \
&baseUrl = KUrl()); + void unregisterSearch(ChecksumSearchTransferDataSource \
*search, const QUrl &baseUrl = QUrl());
private slots:
void slotEntries(KIO::Job *job, const KIO::UDSEntryList &entries);
void slotResult(KJob *job);
private:
- QMultiHash<KUrl, ChecksumSearchTransferDataSource*> m_searches;
- QHash<KUrl, KUrl> m_finished;
- QHash<KJob*, QPair<KUrl, KUrl> > m_jobs;
+ QMultiHash<QUrl, ChecksumSearchTransferDataSource*> m_searches;
+ QHash<QUrl, QUrl> m_finished;
+ QHash<KJob*, QPair<QUrl, QUrl> > m_jobs;
};
class ChecksumSearchTransferDataSource : public TransferDataSource
{
Q_OBJECT
public:
- ChecksumSearchTransferDataSource(const KUrl &srcUrl, QObject *parent);
+ ChecksumSearchTransferDataSource(const QUrl &srcUrl, QObject *parent);
virtual ~ChecksumSearchTransferDataSource();
void start();
@@ -77,10 +77,10 @@ class ChecksumSearchTransferDataSource : public \
TransferDataSource
void addSegments(const QPair<KIO::fileoffset_t, KIO::fileoffset_t> \
&segmentSize, const QPair<int, int> &segmentRange);
private:
- void gotBaseUrl(const KUrl &urlToFile);
+ void gotBaseUrl(const QUrl &urlToFile);
private:
- KUrl m_src;
+ QUrl m_src;
static ChecksumSearchController s_controller;
friend class ChecksumSearchController;
diff --git a/transfer-plugins/checksumsearch/dlgchecksumsearch.cpp \
b/transfer-plugins/checksumsearch/dlgchecksumsearch.cpp index 7f0b5da..b57a8e1 100644
--- a/transfer-plugins/checksumsearch/dlgchecksumsearch.cpp
+++ b/transfer-plugins/checksumsearch/dlgchecksumsearch.cpp
@@ -30,9 +30,11 @@
#include <QtGui/QStandardItemModel>
#include <QtGui/QStringListModel>
+#include <KDebug>
+
KGET_EXPORT_PLUGIN_CONFIG(DlgChecksumSettingsWidget)
-const KUrl ChecksumSearchAddDlg::URL = KUrl("http://www.example.com/file.zip");
+const QUrl ChecksumSearchAddDlg::URL = QUrl("http://www.example.com/file.zip");
ChecksumSearchAddDlg::ChecksumSearchAddDlg(QStringListModel *modesModel, \
QStringListModel *typesModel, QWidget *parent, Qt::WFlags flags) : KDialog(parent, \
flags), @@ -66,7 +68,7 @@ void ChecksumSearchAddDlg::slotUpdate()
enableButtonOk(!ui.change->text().isEmpty());
const ChecksumSearch::UrlChangeMode mode = \
static_cast<ChecksumSearch::UrlChangeMode>(ui.mode->currentIndex());
- const KUrl modifiedUrl = ChecksumSearch::createUrl(URL, ui.change->text(), \
mode); + const QUrl modifiedUrl = ChecksumSearch::createUrl(URL, \
ui.change->text(), mode);
const QString text = i18n("%1 would become %2", URL.prettyUrl(), \
modifiedUrl.prettyUrl()); ui.label->setText(text);
}
diff --git a/transfer-plugins/checksumsearch/dlgchecksumsearch.h \
b/transfer-plugins/checksumsearch/dlgchecksumsearch.h index 0eb1b97..438ee5d 100644
--- a/transfer-plugins/checksumsearch/dlgchecksumsearch.h
+++ b/transfer-plugins/checksumsearch/dlgchecksumsearch.h
@@ -28,6 +28,7 @@
#include <QtGui/QStyledItemDelegate>
#include <KCModule>
+#include <KDialog>
class QSortFilterProxyModel;
class QStandardItemModel;
diff --git a/transfer-plugins/kio/CMakeLists.txt \
b/transfer-plugins/kio/CMakeLists.txt index e8085b3..0de9155 100644
--- a/transfer-plugins/kio/CMakeLists.txt
+++ b/transfer-plugins/kio/CMakeLists.txt
@@ -8,7 +8,7 @@ set(kget_kiofactory_PART_SRCS
transferKioFactory.cpp
)
-kde4_add_plugin(kget_kiofactory ${kget_kiofactory_PART_SRCS})
+add_library(kget_kiofactory MODULE ${kget_kiofactory_PART_SRCS})
target_link_libraries(kget_kiofactory ${KDE4_KIO_LIBS} kgetcore)
diff --git a/transfer-plugins/kio/transferKio.cpp \
b/transfer-plugins/kio/transferKio.cpp index c72b083..fe1983e 100644
--- a/transfer-plugins/kio/transferKio.cpp
+++ b/transfer-plugins/kio/transferKio.cpp
@@ -29,7 +29,7 @@
#include <QDomElement>
TransferKio::TransferKio(TransferGroup * parent, TransferFactory * factory,
- Scheduler * scheduler, const KUrl & source, const KUrl & \
dest, + Scheduler * scheduler, const QUrl & source, const \
QUrl & dest, const QDomElement * e)
: Transfer(parent, factory, scheduler, source, dest, e),
m_copyjob(0),
@@ -40,18 +40,18 @@ TransferKio::TransferKio(TransferGroup * parent, TransferFactory \
* factory,
setCapabilities(Transfer::Cap_Moving | Transfer::Cap_Renaming | \
Transfer::Cap_Resuming);//TODO check if it really can resume }
-bool TransferKio::setDirectory(const KUrl& newDirectory)
+bool TransferKio::setDirectory(const QUrl& newDirectory)
{
- KUrl newDest = newDirectory;
- newDest.addPath(m_dest.fileName());
+ QUrl newDest = newDirectory;
+ newDest.setPath(newDest.adjusted(QUrl::RemoveFilename).toString() + \
m_dest.fileName()); return setNewDestination(newDest);
}
-bool TransferKio::setNewDestination(const KUrl &newDestination)
+bool TransferKio::setNewDestination(const QUrl &newDestination)
{
if (newDestination.isValid() && (newDestination != dest())) {
- KUrl oldPath = KUrl(m_dest.path() + ".part");
- if (oldPath.isValid() && QFile::exists(oldPath.pathOrUrl())) {
+ QUrl oldPath = QUrl(m_dest.path() + ".part");
+ if (oldPath.isValid() && QFile::exists(oldPath.toString())) {
m_movingFile = true;
stop();
setStatus(Job::Moving);
@@ -66,7 +66,7 @@ bool TransferKio::setNewDestination(const KUrl &newDestination)
m_signature->setDestination(newDestination);
}
- KIO::Job *move = KIO::file_move(oldPath, KUrl(newDestination.path() + \
".part"), -1, KIO::HideProgressInfo); + KIO::Job *move = \
KIO::file_move(oldPath, QUrl(newDestination.path() + ".part"), -1, \
KIO::HideProgressInfo);
connect(move, SIGNAL(result(KJob*)), this, SLOT(newDestResult(KJob*)));
connect(move, SIGNAL(infoMessage(KJob*,QString)), this, \
SLOT(slotInfoMessage(KJob*,QString)));
connect(move, SIGNAL(percent(KJob*,ulong)), this, \
SLOT(slotPercent(KJob*,ulong))); @@ -175,7 +175,7 @@ void TransferKio::slotResult( \
KJob * kioJob ) m_copyjob=0;
// If it is an ftp file, there's still work to do
- Transfer::ChangesFlags flags = (m_source.protocol() != "ftp") ? Tc_Status : \
Tc_None; + Transfer::ChangesFlags flags = (m_source.scheme() != "ftp") ? Tc_Status \
: Tc_None; if (status() == Job::Finished) {
if (!m_totalSize) {
//downloaded elsewhere already, e.g. Konqueror
@@ -198,7 +198,7 @@ void TransferKio::slotResult( KJob * kioJob )
}
}
- if (m_source.protocol() == "ftp") {
+ if (m_source.scheme() == "ftp") {
KIO::StatJob * statJob = KIO::stat(m_source);
connect(statJob, SIGNAL(result(KJob*)), this, SLOT(slotStatResult(KJob*)));
statJob->start();
@@ -302,7 +302,7 @@ void TransferKio::slotStatResult(KJob* kioJob)
}
-bool TransferKio::repair(const KUrl &file)
+bool TransferKio::repair(const QUrl &file)
{
Q_UNUSED(file)
@@ -325,7 +325,7 @@ bool TransferKio::repair(const KUrl &file)
return false;
}
-Verifier *TransferKio::verifier(const KUrl &file)
+Verifier *TransferKio::verifier(const QUrl &file)
{
Q_UNUSED(file)
@@ -338,7 +338,7 @@ Verifier *TransferKio::verifier(const KUrl &file)
return m_verifier;
}
-Signature *TransferKio::signature(const KUrl &file)
+Signature *TransferKio::signature(const QUrl &file)
{
Q_UNUSED(file)
diff --git a/transfer-plugins/kio/transferKio.h b/transfer-plugins/kio/transferKio.h
index 19faa4c..3b1ac21 100644
--- a/transfer-plugins/kio/transferKio.h
+++ b/transfer-plugins/kio/transferKio.h
@@ -30,7 +30,7 @@ class TransferKio : public Transfer
public:
TransferKio(TransferGroup * parent, TransferFactory * factory,
- Scheduler * scheduler, const KUrl & src, const KUrl & dest,
+ Scheduler * scheduler, const QUrl & src, const QUrl & dest,
const QDomElement * e = 0);
/**
@@ -38,15 +38,15 @@ class TransferKio : public Transfer
* @param newDirectory is a directory where the download should be stored
* @returns true if newDestination can be used
*/
- virtual bool setDirectory(const KUrl &newDirectory);
+ virtual bool setDirectory(const QUrl &newDirectory);
- bool repair(const KUrl &file = KUrl());
+ bool repair(const QUrl &file = QUrl());
- Verifier *verifier(const KUrl &file = KUrl());
- Signature *signature(const KUrl &file = KUrl());
+ Verifier *verifier(const QUrl &file = QUrl());
+ Signature *signature(const QUrl &file = QUrl());
public slots:
- bool setNewDestination(const KUrl &newDestination);
+ bool setNewDestination(const QUrl &newDestination);
// --- Job virtual functions ---
void start();
diff --git a/transfer-plugins/kio/transferKioFactory.cpp \
b/transfer-plugins/kio/transferKioFactory.cpp index 2d92246..81cec3a 100644
--- a/transfer-plugins/kio/transferKioFactory.cpp
+++ b/transfer-plugins/kio/transferKioFactory.cpp
@@ -53,3 +53,6 @@ QStringList TransferKioFactory::addsProtocols() const
static const QStringList protocols = QStringList() << "http" << "https" << "ftp" \
<< "sftp"; return protocols;
}
+
+#include "transferKioFactory.moc"
+
diff --git a/transfer-plugins/metalink/CMakeLists.txt \
b/transfer-plugins/metalink/CMakeLists.txt index 6f95bba..854cb2d 100644
--- a/transfer-plugins/metalink/CMakeLists.txt
+++ b/transfer-plugins/metalink/CMakeLists.txt
@@ -14,13 +14,13 @@ set(kget_metalinkfactory_PART_SRCS
../../ui/metalinkcreator/metalinker.cpp
)
-kde4_add_ui_files(kget_metalinkfactory_PART_SRCS
+qt5_wrap_ui(kget_metalinkfactory_PART_SRCS
fileselection.ui
)
-kde4_add_kcfg_files(kget_metalinkfactory_PART_SRCS metalinksettings.kcfgc)
+kconfig_add_kcfg_files(kget_metalinkfactory_PART_SRCS metalinksettings.kcfgc)
-kde4_add_plugin(kget_metalinkfactory ${kget_metalinkfactory_PART_SRCS})
+add_library(kget_metalinkfactory MODULE ${kget_metalinkfactory_PART_SRCS})
target_link_libraries(kget_metalinkfactory ${KDE4_KDEUI_LIBS} ${KDE4_KIO_LIBS} \
kgetcore) if (HAVE_NEPOMUK)
@@ -36,12 +36,12 @@ set(kcm_kget_metalinkfactory_PART_SRCS
dlgmetalink.cpp
)
-kde4_add_ui_files(kcm_kget_metalinkfactory_PART_SRCS
+qt5_wrap_ui(kcm_kget_metalinkfactory_PART_SRCS
dlgmetalink.ui
)
-kde4_add_kcfg_files(kcm_kget_metalinkfactory_PART_SRCS metalinksettings.kcfgc)
-kde4_add_plugin(kcm_kget_metalinkfactory ${kcm_kget_metalinkfactory_PART_SRCS})
+kconfig_add_kcfg_files(kcm_kget_metalinkfactory_PART_SRCS metalinksettings.kcfgc)
+add_library(kcm_kget_metalinkfactory MODULE ${kcm_kget_metalinkfactory_PART_SRCS})
target_link_libraries(kcm_kget_metalinkfactory ${KDE4_KDEUI_LIBS} ${KDE4_KIO_LIBS})
install(TARGETS kcm_kget_metalinkfactory DESTINATION ${PLUGIN_INSTALL_DIR})
diff --git a/transfer-plugins/metalink/abstractmetalink.cpp \
b/transfer-plugins/metalink/abstractmetalink.cpp index bcbfe3f..e9aca49 100644
--- a/transfer-plugins/metalink/abstractmetalink.cpp
+++ b/transfer-plugins/metalink/abstractmetalink.cpp
@@ -36,7 +36,7 @@
#include <QtXml/QDomElement>
AbstractMetalink::AbstractMetalink(TransferGroup * parent, TransferFactory * \
factory,
- Scheduler * scheduler, const KUrl & source, const KUrl & \
dest, + Scheduler * scheduler, const QUrl & source, const \
QUrl & dest, const QDomElement * e)
: Transfer(parent, factory, scheduler, source, dest, e),
m_fileModel(0),
@@ -209,7 +209,7 @@ void AbstractMetalink::slotVerified(bool isVerified)
m_fileModel->setData(checksumVerified, \
factory->verifier()->status()); }
if (factory->doDownload() && (factory->verifier()->status() == \
Verifier::NotVerified)) {
- brokenFiles.append(factory->dest().pathOrUrl());
+ brokenFiles.append(factory->dest().toString());
}
}
@@ -238,7 +238,7 @@ void AbstractMetalink::slotSignatureVerified()
m_fileModel->setData(signatureVerified, \
factory->signature()->status()); }
if (factory->doDownload() && (factory->verifier()->status() == \
Verifier::NotVerified)) {
- brokenFiles.append(factory->dest().pathOrUrl());
+ brokenFiles.append(factory->dest().toString());
}
}
/*
@@ -257,7 +257,7 @@ void AbstractMetalink::slotSignatureVerified()
}
}
-bool AbstractMetalink::repair(const KUrl &file)
+bool AbstractMetalink::repair(const QUrl &file)
{
if (file.isValid()) {
if (m_dataSourceFactory.contains(file)) {
@@ -287,7 +287,7 @@ bool AbstractMetalink::repair(const KUrl &file)
}
-Verifier *AbstractMetalink::verifier(const KUrl &file)
+Verifier *AbstractMetalink::verifier(const QUrl &file)
{
if (!m_dataSourceFactory.contains(file)) {
return 0;
@@ -296,7 +296,7 @@ Verifier *AbstractMetalink::verifier(const KUrl &file)
return m_dataSourceFactory[file]->verifier();
}
-Signature *AbstractMetalink::signature(const KUrl &file)
+Signature *AbstractMetalink::signature(const QUrl &file)
{
if (!m_dataSourceFactory.contains(file)) {
return 0;
@@ -305,7 +305,7 @@ Signature *AbstractMetalink::signature(const KUrl &file)
return m_dataSourceFactory[file]->signature();
}
-QList<KUrl> AbstractMetalink::files() const
+QList<QUrl> AbstractMetalink::files() const
{
return m_dataSourceFactory.keys();
}
@@ -314,11 +314,11 @@ FileModel *AbstractMetalink::fileModel()
{
if (!m_fileModel) {
m_fileModel = new FileModel(files(), directory(), this);
- connect(m_fileModel, SIGNAL(rename(KUrl,KUrl)), this, \
SLOT(slotRename(KUrl,KUrl))); + connect(m_fileModel, \
SIGNAL(rename(QUrl,QUrl)), this, SLOT(slotRename(QUrl,QUrl)));
connect(m_fileModel, SIGNAL(checkStateChanged()), this, \
SLOT(filesSelected()));
foreach (DataSourceFactory *factory, m_dataSourceFactory) {
- const KUrl dest = factory->dest();
+ const QUrl dest = factory->dest();
QModelIndex size = m_fileModel->index(dest, FileItem::Size);
m_fileModel->setData(size, static_cast<qlonglong>(factory->size()));
QModelIndex status = m_fileModel->index(dest, FileItem::Status);
@@ -338,7 +338,7 @@ FileModel *AbstractMetalink::fileModel()
return m_fileModel;
}
-void AbstractMetalink::slotRename(const KUrl &oldUrl, const KUrl &newUrl)
+void AbstractMetalink::slotRename(const QUrl &oldUrl, const QUrl &newUrl)
{
if (!m_dataSourceFactory.contains(oldUrl)) {
return;
@@ -351,7 +351,7 @@ void AbstractMetalink::slotRename(const KUrl &oldUrl, const KUrl \
&newUrl) setTransferChange(Tc_FileName);
}
-bool AbstractMetalink::setDirectory(const KUrl &new_directory)
+bool AbstractMetalink::setDirectory(const QUrl &new_directory)
{
if (new_directory == directory()) {
return false;
@@ -361,16 +361,16 @@ bool AbstractMetalink::setDirectory(const KUrl &new_directory)
m_fileModel->setDirectory(new_directory);
}
- const QString oldDirectory = directory().pathOrUrl(KUrl::AddTrailingSlash);
- const QString newDirectory = new_directory.pathOrUrl(KUrl::AddTrailingSlash);
+ const QString oldDirectory = directory().toString();
+ const QString newDirectory = new_directory.toString();
const QString fileName = m_dest.fileName();
m_dest = new_directory;
- m_dest.addPath(fileName);
+ m_dest.setPath(m_dest.adjusted(QUrl::RemoveFilename).toString() + fileName);
- QHash<KUrl, DataSourceFactory*> newStorage;
+ QHash<QUrl, DataSourceFactory*> newStorage;
foreach (DataSourceFactory *factory, m_dataSourceFactory) {
- const KUrl oldUrl = factory->dest();
- const KUrl newUrl = KUrl(oldUrl.pathOrUrl().replace(oldDirectory, \
newDirectory)); + const QUrl oldUrl = factory->dest();
+ const QUrl newUrl = QUrl(oldUrl.toString().replace(oldDirectory, \
newDirectory)); factory->setNewDestination(newUrl);
newStorage[newUrl] = factory;
}
@@ -380,9 +380,9 @@ bool AbstractMetalink::setDirectory(const KUrl &new_directory)
return true;
}
-QHash<KUrl, QPair<bool, int> > AbstractMetalink::availableMirrors(const KUrl &file) \
const +QHash<QUrl, QPair<bool, int> > AbstractMetalink::availableMirrors(const QUrl \
&file) const {
- QHash<KUrl, QPair<bool, int> > urls;
+ QHash<QUrl, QPair<bool, int> > urls;
if (m_dataSourceFactory.contains(file)) {
urls = m_dataSourceFactory[file]->mirrors();
@@ -392,7 +392,7 @@ QHash<KUrl, QPair<bool, int> > \
AbstractMetalink::availableMirrors(const KUrl &fi }
-void AbstractMetalink::setAvailableMirrors(const KUrl &file, const QHash<KUrl, \
QPair<bool, int> > &mirrors) +void AbstractMetalink::setAvailableMirrors(const QUrl \
&file, const QHash<QUrl, QPair<bool, int> > &mirrors) {
if (!m_dataSourceFactory.contains(file)) {
return;
@@ -462,7 +462,7 @@ void AbstractMetalink::filesSelected()
//and asks the user if there are existing files already
foreach (const QModelIndex &index, files)
{
- const KUrl dest = fileModel()->getUrl(index);
+ const QUrl dest = fileModel()->getUrl(index);
bool doDownload = index.data(Qt::CheckStateRole).toBool();
if (m_dataSourceFactory.contains(dest))
{
@@ -486,7 +486,7 @@ void AbstractMetalink::filesSelected()
if (result == KIO::R_RENAME) {
//no reason to use FileModel::rename() since the file does \
not exist yet, so simply skip it //avoids having to deal with signals
- const KUrl newDest = dlg.newDestUrl();
+ const QUrl newDest = dlg.newDestUrl();
factory->setDoDownload(doDownload);
factory->setNewDestination(newDest);
fileModel()->setData(index, newDest.fileName(), \
FileItem::File);
diff --git a/transfer-plugins/metalink/abstractmetalink.h \
b/transfer-plugins/metalink/abstractmetalink.h index d927bd0..ea41fa0 100644
--- a/transfer-plugins/metalink/abstractmetalink.h
+++ b/transfer-plugins/metalink/abstractmetalink.h
@@ -25,37 +25,37 @@ class AbstractMetalink : public Transfer
public:
AbstractMetalink(TransferGroup * parent, TransferFactory * factory,
- Scheduler * scheduler, const KUrl & src, const KUrl & dest,
+ Scheduler * scheduler, const QUrl & src, const QUrl & dest,
const QDomElement * e = 0);
virtual ~AbstractMetalink();
int remainingTime() const;
- bool repair(const KUrl &file = KUrl());
+ bool repair(const QUrl &file = QUrl());
/**
* Move the download to the new destination
* @param newDirectory is a directory where the download should be stored
* @returns true if newDestination can be used
*/
- virtual bool setDirectory(const KUrl &newDirectory);
+ virtual bool setDirectory(const QUrl &newDirectory);
- QHash<KUrl, QPair<bool, int> > availableMirrors(const KUrl &file) const;
- void setAvailableMirrors(const KUrl &file, const QHash<KUrl, QPair<bool, \
int> > &mirrors); + QHash<QUrl, QPair<bool, int> > availableMirrors(const QUrl \
&file) const; + void setAvailableMirrors(const QUrl &file, const QHash<QUrl, \
QPair<bool, int> > &mirrors);
/**
* @param file for which to get the verifier
* @return Verifier that allows you to add checksums manually verify a file \
etc.
*/
- virtual Verifier *verifier(const KUrl &file);
+ virtual Verifier *verifier(const QUrl &file);
/**
* @param file for which to get the signature
* @return Signature that allows you to add signatures and verify them
*/
- virtual Signature *signature(const KUrl &file);
+ virtual Signature *signature(const QUrl &file);
- virtual QList<KUrl> files() const;
+ virtual QList<QUrl> files() const;
FileModel *fileModel();
@@ -82,7 +82,7 @@ class AbstractMetalink : public Transfer
void filesSelected();
void slotUpdateCapabilities();
void slotDataSourceFactoryChange(Transfer::ChangesFlags change);
- void slotRename(const KUrl &oldUrl, const KUrl &newUrl);
+ void slotRename(const QUrl &oldUrl, const QUrl &newUrl);
void slotVerified(bool isVerified);
virtual void slotSignatureVerified();
@@ -100,7 +100,7 @@ class AbstractMetalink : public Transfer
protected:
FileModel *m_fileModel;
int m_currentFiles;
- QHash<KUrl, DataSourceFactory*> m_dataSourceFactory;
+ QHash<QUrl, DataSourceFactory*> m_dataSourceFactory;
bool m_ready;
int m_speedCount;
int m_tempAverageSpeed;
diff --git a/transfer-plugins/metalink/dlgmetalink.cpp \
b/transfer-plugins/metalink/dlgmetalink.cpp index 8f669f9..48317c9 100644
--- a/transfer-plugins/metalink/dlgmetalink.cpp
+++ b/transfer-plugins/metalink/dlgmetalink.cpp
@@ -17,7 +17,7 @@
KGET_EXPORT_PLUGIN_CONFIG(DlgSettingsWidget)
DlgSettingsWidget::DlgSettingsWidget(QWidget *parent, const QVariantList &args)
- : KCModule(KGetFactory::componentData(), parent, args)
+ : KCModule(/*KGetFactory::componentData(), */parent, args)
{
ui.setupUi(this);
diff --git a/transfer-plugins/metalink/metalinksettings.kcfgc \
b/transfer-plugins/metalink/metalinksettings.kcfgc index 3c242a1..d9ff586 100644
--- a/transfer-plugins/metalink/metalinksettings.kcfgc
+++ b/transfer-plugins/metalink/metalinksettings.kcfgc
@@ -2,4 +2,4 @@ ClassName=MetalinkSettings
File=kget_metalinkfactory.kcfg
Mutators=true
Singleton=true
-Visibility=KDE_EXPORT
+Visibility=Q_DECL_EXPORT
diff --git a/transfer-plugins/metalink/metalinkxml.cpp \
b/transfer-plugins/metalink/metalinkxml.cpp index 5b5553c..20db3be 100644
--- a/transfer-plugins/metalink/metalinkxml.cpp
+++ b/transfer-plugins/metalink/metalinkxml.cpp
@@ -43,7 +43,7 @@
#include <QtXml/QDomElement>
MetalinkXml::MetalinkXml(TransferGroup * parent, TransferFactory * factory,
- Scheduler * scheduler, const KUrl & source, const KUrl & \
dest, + Scheduler * scheduler, const QUrl & source, const \
QUrl & dest, const QDomElement * e)
: AbstractMetalink(parent, factory, scheduler, source, dest, e)
@@ -79,10 +79,10 @@ void MetalinkXml::downloadMetalink()
setStatus(Job::Stopped, i18n("Downloading Metalink File...."), \
SmallIcon("document-save")); setTransferChange(Tc_Status, true);
Download *download = new Download(m_source, \
QString(KStandardDirs::locateLocal("appdata", "metalinks/") + \
m_source.fileName()));
- connect(download, SIGNAL(finishedSuccessfully(KUrl,QByteArray)), \
SLOT(metalinkInit(KUrl,QByteArray))); + connect(download, \
SIGNAL(finishedSuccessfully(QUrl,QByteArray)), SLOT(metalinkInit(QUrl,QByteArray))); \
}
-bool MetalinkXml::metalinkInit(const KUrl &src, const QByteArray &data)
+bool MetalinkXml::metalinkInit(const QUrl &src, const QByteArray &data)
{
kDebug(5001);
@@ -123,12 +123,12 @@ bool MetalinkXml::metalinkInit(const KUrl &src, const \
QByteArray &data)
QList<KGetMetalink::File>::const_iterator itEnd = \
m_metalink.files.files.constEnd(); m_totalSize = 0;
KIO::fileoffset_t segSize = 500 * 1024;//TODO use config here!
- const KUrl tempDest = KUrl(m_dest.directory());
- KUrl dest;
+ const QUrl tempDest = QUrl(m_dest.adjusted(QUrl::RemoveFilename));
+ QUrl dest;
for (it = m_metalink.files.files.constBegin(); it != itEnd ; ++it)
{
dest = tempDest;
- dest.addPath((*it).name);
+ dest.setPath(tmpDest.adjusted(QUrl::RemoveFilename).toString() + \
(*it).name);
QList<KGetMetalink::Url> urlList = (*it).resources.urls;
//sort the urls according to their priority (highest first)
@@ -142,7 +142,7 @@ bool MetalinkXml::metalinkInit(const KUrl &src, const QByteArray \
&data)
dataFactory->setMaxMirrorsUsed(MetalinkSettings::mirrorsPerFile());
#ifdef HAVE_NEPOMUK
- nepomukHandler()->setProperties((*it).properties(), QList<KUrl>() << dest);
+ nepomukHandler()->setProperties((*it).properties(), QList<QUrl>() << dest);
#endif //HAVE_NEPOMUK
//TODO compare available file size (<size>) with the sizes of the server while \
downloading? @@ -156,7 +156,7 @@ bool MetalinkXml::metalinkInit(const KUrl &src, \
const QByteArray &data) //add the DataSources
for (int i = 0; i < urlList.size(); ++i)
{
- const KUrl url = urlList[i].url;
+ const QUrl url = urlList[i].url;
if (url.isValid())
{
dataFactory->addMirror(url, MetalinkSettings::connectionsPerUrl());
@@ -278,7 +278,7 @@ void MetalinkXml::load(const QDomElement *element)
}
const QDomElement e = *element;
- m_localMetalinkLocation = KUrl(e.attribute("LocalMetalinkLocation"));
+ m_localMetalinkLocation = QUrl(e.attribute("LocalMetalinkLocation"));
QDomNodeList factories = \
e.firstChildElement("factories").elementsByTagName("factory");
//no stored information found, stop right here
diff --git a/transfer-plugins/metalink/metalinkxml.h \
b/transfer-plugins/metalink/metalinkxml.h index 3f6119e..3ba7707 100644
--- a/transfer-plugins/metalink/metalinkxml.h
+++ b/transfer-plugins/metalink/metalinkxml.h
@@ -28,7 +28,7 @@ class MetalinkXml : public AbstractMetalink
public:
MetalinkXml(TransferGroup * parent, TransferFactory * factory,
- Scheduler * scheduler, const KUrl & src, const KUrl & dest,
+ Scheduler * scheduler, const QUrl & src, const QUrl & dest,
const QDomElement * e = 0);
~MetalinkXml();
@@ -48,7 +48,7 @@ class MetalinkXml : public AbstractMetalink
* @note false does not mean that an error happened, it could mean, that the \
user
* decided to update the metalink
*/
- bool metalinkInit(const KUrl &url = KUrl(), const QByteArray &data = \
QByteArray()); + bool metalinkInit(const QUrl &url = QUrl(), const QByteArray \
&data = QByteArray());
protected :
/**
@@ -60,7 +60,7 @@ class MetalinkXml : public AbstractMetalink
private:
bool m_metalinkJustDownloaded;
- KUrl m_localMetalinkLocation;
+ QUrl m_localMetalinkLocation;
KGetMetalink::Metalink m_metalink;
};
diff --git a/transfer-plugins/mirrorsearch/CMakeLists.txt \
b/transfer-plugins/mirrorsearch/CMakeLists.txt index 689b815..66c810f 100644
--- a/transfer-plugins/mirrorsearch/CMakeLists.txt
+++ b/transfer-plugins/mirrorsearch/CMakeLists.txt
@@ -8,9 +8,9 @@ set(kget_mirrorsearchfactory_PART_SRCS
mirrorsearchfactory.cpp
)
-kde4_add_kcfg_files(kget_mirrorsearchfactory_PART_SRCS mirrorsearchsettings.kcfgc)
+kconfig_add_kcfg_files(kget_mirrorsearchfactory_PART_SRCS \
mirrorsearchsettings.kcfgc)
-kde4_add_plugin(kget_mirrorsearchfactory ${kget_mirrorsearchfactory_PART_SRCS})
+add_library(kget_mirrorsearchfactory MODULE ${kget_mirrorsearchfactory_PART_SRCS})
target_link_libraries(kget_mirrorsearchfactory ${KDE4_KIO_LIBS} kgetcore)
@@ -23,13 +23,13 @@ set(kcm_kget_mirrorsearchfactory_PART_SRCS
dlgmirrorsearch.cpp
)
-kde4_add_ui_files(kcm_kget_mirrorsearchfactory_PART_SRCS
+qt5_wrap_ui(kcm_kget_mirrorsearchfactory_PART_SRCS
dlgmirrorsearch.ui
dlgengineediting.ui
)
-kde4_add_kcfg_files(kcm_kget_mirrorsearchfactory_PART_SRCS \
mirrorsearchsettings.kcfgc)
-kde4_add_plugin(kcm_kget_mirrorsearchfactory \
${kcm_kget_mirrorsearchfactory_PART_SRCS}) \
+kconfig_add_kcfg_files(kcm_kget_mirrorsearchfactory_PART_SRCS \
mirrorsearchsettings.kcfgc) +add_library(kcm_kget_mirrorsearchfactory MODULE \
${kcm_kget_mirrorsearchfactory_PART_SRCS}) \
target_link_libraries(kcm_kget_mirrorsearchfactory ${KDE4_KDEUI_LIBS} \
${KDE4_KIO_LIBS}) install(TARGETS kcm_kget_mirrorsearchfactory DESTINATION \
${PLUGIN_INSTALL_DIR})
diff --git a/transfer-plugins/mirrorsearch/dlgmirrorsearch.cpp \
b/transfer-plugins/mirrorsearch/dlgmirrorsearch.cpp index 987fc1e..e9b6c18 100644
--- a/transfer-plugins/mirrorsearch/dlgmirrorsearch.cpp
+++ b/transfer-plugins/mirrorsearch/dlgmirrorsearch.cpp
@@ -13,6 +13,9 @@
#include "kget_export.h"
#include "mirrorsearchsettings.h"
+#include <KDebug>
+#include <KLocale>
+
DlgEngineEditing::DlgEngineEditing(QWidget *parent)
: KDialog(parent)
{
@@ -54,11 +57,11 @@ QString DlgEngineEditing::engineUrl() const
KGET_EXPORT_PLUGIN_CONFIG(DlgSettingsWidget)
DlgSettingsWidget::DlgSettingsWidget(QWidget *parent, const QVariantList &args)
- : KCModule(KGetFactory::componentData(), parent, args)
+ : KCModule(/*KGetFactory::componentData(),*/ parent, args)
{
ui.setupUi(this);
- ui.newEngineBt->setIcon(KIcon("list-add"));
- ui.removeEngineBt->setIcon(KIcon("list-remove"));
+ ui.newEngineBt->setIcon(QIcon::fromTheme("list-add"));
+ ui.removeEngineBt->setIcon(QIcon::fromTheme("list-remove"));
connect(ui.newEngineBt, SIGNAL(clicked()), SLOT(slotNewEngine()));
connect(ui.removeEngineBt, SIGNAL(clicked()), SLOT(slotRemoveEngine()));
diff --git a/transfer-plugins/mirrorsearch/dlgmirrorsearch.h \
b/transfer-plugins/mirrorsearch/dlgmirrorsearch.h index b6ed546..895def2 100644
--- a/transfer-plugins/mirrorsearch/dlgmirrorsearch.h
+++ b/transfer-plugins/mirrorsearch/dlgmirrorsearch.h
@@ -15,6 +15,7 @@
#include "ui_dlgmirrorsearch.h"
#include <KCModule>
+#include <KDialog>
class DlgEngineEditing : public KDialog
{
diff --git a/transfer-plugins/mirrorsearch/mirrors.cpp \
b/transfer-plugins/mirrorsearch/mirrors.cpp index 527941f..0cd5512 100644
--- a/transfer-plugins/mirrorsearch/mirrors.cpp
+++ b/transfer-plugins/mirrorsearch/mirrors.cpp
@@ -19,7 +19,7 @@ mirror::mirror()
m_search_engine = MirrorSearchSettings::searchEnginesUrlList().takeFirst();
}
-void mirror::search(const KUrl &url, QObject *receiver, const char *member)
+void mirror::search(const QUrl &url, QObject *receiver, const char *member)
{
kDebug(5001);
@@ -36,13 +36,13 @@ void mirror::search(const QString &fileName, QObject *receiver, \
const char *memb {
kDebug(5001);
- KUrl search(m_search_engine.replace("${filename}",fileName));
+ QUrl search(m_search_engine.replace("${filename}",fileName));
m_job = KIO::get(search, KIO::NoReload, KIO::HideProgressInfo);
connect(m_job,SIGNAL(data(KIO::Job*,QByteArray)),
SLOT(slotData(KIO::Job*,QByteArray)));
connect(m_job,SIGNAL(result(KJob*)),
SLOT(slotResult(KJob*)));
- connect(this,SIGNAL(urls(QList<KUrl>&)),receiver,member);
+ connect(this,SIGNAL(urls(QList<QUrl>&)),receiver,member);
}
void mirror::slotData(KIO::Job *, const QByteArray& data)
@@ -77,7 +77,7 @@ void mirror::slotResult( KJob *job )
start = hrefEnd + 1;
if ( u.endsWith( '/' + m_url.fileName() ) )
{
- m_Urls << KUrl(u);
+ m_Urls << QUrl(u);
kDebug(5001) << "url: " << u;
}
}
@@ -87,7 +87,7 @@ void mirror::slotResult( KJob *job )
deleteLater();
}
-void MirrorSearch ( const KUrl &url, QObject *receiver, const char *member )
+void MirrorSearch ( const QUrl &url, QObject *receiver, const char *member )
{
mirror *searcher = new mirror();
searcher->search(url, receiver, member);
diff --git a/transfer-plugins/mirrorsearch/mirrors.h \
b/transfer-plugins/mirrorsearch/mirrors.h index 96aa08c..6ba6b47 100644
--- a/transfer-plugins/mirrorsearch/mirrors.h
+++ b/transfer-plugins/mirrorsearch/mirrors.h
@@ -20,12 +20,12 @@ class mirror : public QObject
public:
mirror();
- void search(const KUrl &url, QObject *receiver, const char *member);
+ void search(const QUrl &url, QObject *receiver, const char *member);
void search(const QString &fileName, QObject *receiver, const char *member);
Q_SIGNALS:
- void urls (QList<KUrl>&);
+ void urls (QList<QUrl>&);
private Q_SLOTS:
@@ -36,11 +36,11 @@ class mirror : public QObject
QString m_search_engine;
KIO::TransferJob *m_job;
- KUrl m_url;
- QList<KUrl> m_Urls;
+ QUrl m_url;
+ QList<QUrl> m_Urls;
QByteArray m_data;
};
-void MirrorSearch ( const KUrl &url, QObject *receiver, const char *member );
+void MirrorSearch ( const QUrl &url, QObject *receiver, const char *member );
#endif // MIRROR_H
diff --git a/transfer-plugins/mirrorsearch/mirrorsearchsettings.kcfgc \
b/transfer-plugins/mirrorsearch/mirrorsearchsettings.kcfgc index eaa3140..8cfee2b \
100644
--- a/transfer-plugins/mirrorsearch/mirrorsearchsettings.kcfgc
+++ b/transfer-plugins/mirrorsearch/mirrorsearchsettings.kcfgc
@@ -2,4 +2,4 @@ ClassName=MirrorSearchSettings
File=kget_mirrorsearchfactory.kcfg
Mutators=true
Singleton=true
-Visibility=KDE_EXPORT
+Visibility=Q_DECL_EXPORT
diff --git a/transfer-plugins/mmsthreads/CMakeLists.txt \
b/transfer-plugins/mmsthreads/CMakeLists.txt index de4fdb7..8c3511f 100755
--- a/transfer-plugins/mmsthreads/CMakeLists.txt
+++ b/transfer-plugins/mmsthreads/CMakeLists.txt
@@ -10,8 +10,8 @@ set(kget_mmsfactory_PART_SRCS
mmsthread.cpp
)
-kde4_add_kcfg_files(kget_mmsfactory_PART_SRCS mmssettings.kcfgc)
-kde4_add_plugin(kget_mmsfactory ${kget_mmsfactory_PART_SRCS})
+kconfig_add_kcfg_files(kget_mmsfactory_PART_SRCS mmssettings.kcfgc)
+add_library(kget_mmsfactory MODULE ${kget_mmsfactory_PART_SRCS})
target_link_libraries(kget_mmsfactory ${KDE4_KIO_LIBS} kgetcore ${LIBMMS_LIBRARIES})
@@ -24,11 +24,11 @@ set(kcm_kget_mmsfactory_PART_SRCS
dlgmms.cpp
)
-kde4_add_ui_files(kcm_kget_mmsfactory_PART_SRCS
+qt5_wrap_ui(kcm_kget_mmsfactory_PART_SRCS
dlgmms.ui
)
-kde4_add_kcfg_files(kcm_kget_mmsfactory_PART_SRCS mmssettings.kcfgc)
-kde4_add_plugin(kcm_kget_mmsfactory ${kcm_kget_mmsfactory_PART_SRCS})
+kconfig_add_kcfg_files(kcm_kget_mmsfactory_PART_SRCS mmssettings.kcfgc)
+add_library(kcm_kget_mmsfactory MODULE ${kcm_kget_mmsfactory_PART_SRCS})
target_link_libraries(kcm_kget_mmsfactory ${KDE4_KDEUI_LIBS} ${KDE4_KIO_LIBS})
install(TARGETS kcm_kget_mmsfactory DESTINATION ${PLUGIN_INSTALL_DIR})
diff --git a/transfer-plugins/mmsthreads/dlgmms.cpp \
b/transfer-plugins/mmsthreads/dlgmms.cpp index e9d2572..fce644b 100644
--- a/transfer-plugins/mmsthreads/dlgmms.cpp
+++ b/transfer-plugins/mmsthreads/dlgmms.cpp
@@ -24,7 +24,7 @@
KGET_EXPORT_PLUGIN_CONFIG(DlgMmsSettings)
DlgMmsSettings::DlgMmsSettings(QWidget *parent, const QVariantList &args)
- : KCModule(KGetFactory::componentData(), parent, args)
+ : KCModule(/*KGetFactory::componentData(), */parent, args)
{
ui.setupUi(this);
connect(ui.numThreadSpinBox, SIGNAL(valueChanged(int)), SLOT(changed()));
diff --git a/transfer-plugins/mmsthreads/mmssettings.kcfgc \
b/transfer-plugins/mmsthreads/mmssettings.kcfgc index da743d9..798092e 100644
--- a/transfer-plugins/mmsthreads/mmssettings.kcfgc
+++ b/transfer-plugins/mmsthreads/mmssettings.kcfgc
@@ -2,4 +2,4 @@ ClassName=MmsSettings
File=kget_mmsfactory.kcfg
Mutators=true
Singleton=true
-Visibility=KDE_EXPORT
+Visibility=Q_DECL_EXPORT
diff --git a/transfer-plugins/mmsthreads/mmstransfer.cpp \
b/transfer-plugins/mmsthreads/mmstransfer.cpp index 8e37f8e..4844205 100755
--- a/transfer-plugins/mmsthreads/mmstransfer.cpp
+++ b/transfer-plugins/mmsthreads/mmstransfer.cpp
@@ -48,8 +48,8 @@ void MmsTransfer::start()
}
setStatus(Job::Running, i18nc("transfer state: running", "Running...."),
- SmallIcon("media-playback-start"));
- m_mmsdownload = new MmsDownload(m_source.prettyUrl(), m_dest.pathOrUrl(),
+ QIcon::fromTheme("media-playback-start").pixmap(16));
+ m_mmsdownload = new MmsDownload(m_source.toString(), m_dest.toString(),
m_fileTemp, m_amountThreads);
connect(m_mmsdownload, SIGNAL(finished()), this, SLOT(slotResult()));
connect(m_mmsdownload, SIGNAL(signBrokenUrl()), this, SLOT(slotBrokenUrl()));
@@ -83,7 +83,7 @@ void MmsTransfer::stop()
}
setStatus(Job::Stopped, i18nc("transfer state: stopped", "Stopped"),
- SmallIcon("process-stop"));
+ QIcon::fromTheme("process-stop").pixmap(16));
m_downloadSpeed = 0;
setTransferChange(Tc_Status | Tc_DownloadSpeed, true);
}
@@ -111,7 +111,7 @@ void MmsTransfer::slotResult()
*/
if (m_downloadedSize == m_totalSize && m_totalSize != 0) {
setStatus(Job::Finished, i18nc("Transfer State:Finished","Finished"),
- SmallIcon("dialog-ok"));
+ QIcon::fromTheme("dialog-ok").pixmap(16));
m_percent = 100;
m_downloadSpeed = 0;
setTransferChange(Tc_Status | Tc_Percent | Tc_DownloadSpeed, true);
@@ -153,7 +153,7 @@ void MmsTransfer::slotProcessedSizeAndPercent(qulonglong size)
void MmsTransfer::slotBrokenUrl()
{
- setError(i18n("Download failed, could not access this URL."), \
SmallIcon("dialog-cancel"), + setError(i18n("Download failed, could not access \
this URL."), QIcon::fromTheme("dialog-cancel").pixmap(16), Job::NotSolveable);
setTransferChange(Tc_Status, true);
}
diff --git a/transfer-plugins/multisegmentkio/CMakeLists.txt \
b/transfer-plugins/multisegmentkio/CMakeLists.txt index b8ec566..0694f82 100644
--- a/transfer-plugins/multisegmentkio/CMakeLists.txt
+++ b/transfer-plugins/multisegmentkio/CMakeLists.txt
@@ -9,9 +9,9 @@ set(kget_multisegkiofactory_PART_SRCS
transfermultisegkiofactory.cpp
)
-kde4_add_kcfg_files(kget_multisegkiofactory_PART_SRCS multisegkiosettings.kcfgc)
+kconfig_add_kcfg_files(kget_multisegkiofactory_PART_SRCS multisegkiosettings.kcfgc)
-kde4_add_plugin(kget_multisegkiofactory ${kget_multisegkiofactory_PART_SRCS})
+add_library(kget_multisegkiofactory MODULE ${kget_multisegkiofactory_PART_SRCS})
target_link_libraries(kget_multisegkiofactory ${KDE4_KIO_LIBS} kgetcore)
@@ -24,12 +24,12 @@ set(kcm_kget_multisegkiofactory_PART_SRCS
dlgmultisegkio.cpp
)
-kde4_add_ui_files(kcm_kget_multisegkiofactory_PART_SRCS
+qt5_wrap_ui(kcm_kget_multisegkiofactory_PART_SRCS
dlgmultisegkio.ui
)
-kde4_add_kcfg_files(kcm_kget_multisegkiofactory_PART_SRCS multisegkiosettings.kcfgc)
-kde4_add_plugin(kcm_kget_multisegkiofactory \
${kcm_kget_multisegkiofactory_PART_SRCS}) \
+kconfig_add_kcfg_files(kcm_kget_multisegkiofactory_PART_SRCS \
multisegkiosettings.kcfgc) +add_library(kcm_kget_multisegkiofactory MODULE \
${kcm_kget_multisegkiofactory_PART_SRCS}) \
target_link_libraries(kcm_kget_multisegkiofactory ${KDE4_KDEUI_LIBS} \
${KDE4_KIO_LIBS}) install(TARGETS kcm_kget_multisegkiofactory DESTINATION \
${PLUGIN_INSTALL_DIR})
diff --git a/transfer-plugins/multisegmentkio/dlgmultisegkio.cpp \
b/transfer-plugins/multisegmentkio/dlgmultisegkio.cpp index 16a4f7c..efbc8f6 100644
--- a/transfer-plugins/multisegmentkio/dlgmultisegkio.cpp
+++ b/transfer-plugins/multisegmentkio/dlgmultisegkio.cpp
@@ -17,7 +17,7 @@
KGET_EXPORT_PLUGIN_CONFIG(DlgSettingsWidget)
DlgSettingsWidget::DlgSettingsWidget(QWidget *parent, const QVariantList &args)
- : KCModule(KGetFactory::componentData(), parent, args)
+ : KCModule(/*KGetFactory::componentData(), */parent, args)
{
ui.setupUi(this);
@@ -40,7 +40,6 @@ void DlgSettingsWidget::load()
void DlgSettingsWidget::save()
{
- kDebug(5001) << "Saving Multithreaded config";
MultiSegKioSettings::setSegments(ui.numSegSpinBox->value());
MultiSegKioSettings::setUseSearchEngines(ui.enginesCheckBox->isChecked());
MultiSegKioSettings::setUseSearchVerification(ui.verificationCheckBox->isChecked());
diff --git a/transfer-plugins/multisegmentkio/multisegkiodatasource.cpp \
b/transfer-plugins/multisegmentkio/multisegkiodatasource.cpp index ba8a56f..4eadf6c \
100644
--- a/transfer-plugins/multisegmentkio/multisegkiodatasource.cpp
+++ b/transfer-plugins/multisegmentkio/multisegkiodatasource.cpp
@@ -15,7 +15,7 @@
#include <KDebug>
-MultiSegKioDataSource::MultiSegKioDataSource(const KUrl &srcUrl, QObject *parent)
+MultiSegKioDataSource::MultiSegKioDataSource(const QUrl &srcUrl, QObject *parent)
: TransferDataSource(srcUrl, parent),
m_size(0),
m_canResume(false),
@@ -80,14 +80,14 @@ void MultiSegKioDataSource::addSegments(const \
QPair<KIO::fileoffset_t, KIO::file
connect(segment, SIGNAL(finishedSegment(Segment*,int,bool)), this, \
SLOT(slotFinishedSegment(Segment*,int,bool)));
connect(segment, SIGNAL(error(Segment*,QString,Transfer::LogLevel)), this, \
SLOT(slotError(Segment*,QString,Transfer::LogLevel)));
connect(segment, SIGNAL(finishedDownload(KIO::filesize_t)), this, \
SLOT(slotFinishedDownload(KIO::filesize_t)));
- connect(segment, SIGNAL(urlChanged(KUrl)), this, SLOT(slotUrlChanged(KUrl)));
+ connect(segment, SIGNAL(urlChanged(QUrl)), this, SLOT(slotUrlChanged(QUrl)));
if (m_started) {
segment->startTransfer();
}
}
-void MultiSegKioDataSource::slotUrlChanged(const KUrl &url)
+void MultiSegKioDataSource::slotUrlChanged(const QUrl &url)
{
if (m_sourceUrl != url) {
emit urlChanged(m_sourceUrl, url);
diff --git a/transfer-plugins/multisegmentkio/multisegkiodatasource.h \
b/transfer-plugins/multisegmentkio/multisegkiodatasource.h index 909e52e..8f5a95d \
100644
--- a/transfer-plugins/multisegmentkio/multisegkiodatasource.h
+++ b/transfer-plugins/multisegmentkio/multisegkiodatasource.h
@@ -21,7 +21,7 @@ class MultiSegKioDataSource : public TransferDataSource
Q_OBJECT
public:
- MultiSegKioDataSource(const KUrl &srcUrl, QObject *parent);
+ MultiSegKioDataSource(const QUrl &srcUrl, QObject *parent);
~MultiSegKioDataSource();
void start();
@@ -57,7 +57,7 @@ class MultiSegKioDataSource : public TransferDataSource
void slotFinishedDownload(KIO::filesize_t size);
- void slotUrlChanged(const KUrl &url);
+ void slotUrlChanged(const QUrl &url);
private:
Segment *mostUnfinishedSegments(int *unfinished = 0) const;
diff --git a/transfer-plugins/multisegmentkio/multisegkiosettings.kcfgc \
b/transfer-plugins/multisegmentkio/multisegkiosettings.kcfgc index fcd8d2f..2f0b33b \
100644
--- a/transfer-plugins/multisegmentkio/multisegkiosettings.kcfgc
+++ b/transfer-plugins/multisegmentkio/multisegkiosettings.kcfgc
@@ -2,4 +2,4 @@ ClassName=MultiSegKioSettings
File=kget_multisegkiofactory.kcfg
Mutators=true
Singleton=true
-Visibility=KDE_EXPORT
+Visibility=Q_DECL_EXPORT
diff --git a/transfer-plugins/multisegmentkio/segment.cpp \
b/transfer-plugins/multisegmentkio/segment.cpp index 9c7fcba..acab2ff 100644
--- a/transfer-plugins/multisegmentkio/segment.cpp
+++ b/transfer-plugins/multisegmentkio/segment.cpp
@@ -19,7 +19,7 @@
#include <QtCore/QTimer>
-Segment::Segment(const KUrl &src, const QPair<KIO::fileoffset_t, KIO::fileoffset_t> \
&segmentSize, const QPair<int, int> &segmentRange, QObject *parent) \
+Segment::Segment(const QUrl &src, const QPair<KIO::fileoffset_t, KIO::fileoffset_t> \
&segmentSize, const QPair<int, int> &segmentRange, QObject *parent) : \
QObject(parent),
m_findFilesize((segmentRange.first == -1) && (segmentRange.second == -1)),
m_canResume(true),
@@ -91,11 +91,11 @@ bool Segment::createTransfer()
connect(m_getJob, SIGNAL(data(KIO::Job*,QByteArray)),
SLOT(slotData(KIO::Job*,QByteArray)));
connect(m_getJob, SIGNAL(result(KJob*)), SLOT(slotResult(KJob*)));
- connect(m_getJob, SIGNAL(redirection(KIO::Job *,const KUrl &)), \
SLOT(slotRedirection(KIO::Job *, const KUrl &))); + connect(m_getJob, \
SIGNAL(redirection(KIO::Job *,const QUrl &)), SLOT(slotRedirection(KIO::Job *, const \
QUrl &))); return true;
}
-void Segment::slotRedirection(KIO::Job* , const KUrl &url)
+void Segment::slotRedirection(KIO::Job* , const QUrl &url)
{
m_url = url;
emit urlChanged(url);
@@ -205,7 +205,7 @@ void Segment::slotData(KIO::Job *, const QByteArray& _data)
kDebug(5001) << m_url << "does not allow resuming.";
stopTransfer();
setStatus(Killed, false );
- const QString errorText = KIO::buildErrorString(KIO::ERR_CANNOT_RESUME, \
m_url.prettyUrl()); + const QString errorText = \
KIO::buildErrorString(KIO::ERR_CANNOT_RESUME, m_url.toString()); emit error(this, \
errorText, Transfer::Log_Warning); return;
}
diff --git a/transfer-plugins/multisegmentkio/segment.h \
b/transfer-plugins/multisegmentkio/segment.h index e4d27e6..fd983e1 100644
--- a/transfer-plugins/multisegmentkio/segment.h
+++ b/transfer-plugins/multisegmentkio/segment.h
@@ -46,7 +46,7 @@ class Segment : public QObject
Finished
};
- Segment(const KUrl &src, const QPair<KIO::fileoffset_t, KIO::fileoffset_t> \
&segmentSize, const QPair<int, int> &segmentRange, QObject *parent); + \
Segment(const QUrl &src, const QPair<KIO::fileoffset_t, KIO::fileoffset_t> \
&segmentSize, const QPair<int, int> &segmentRange, QObject *parent);
~Segment();
@@ -121,7 +121,7 @@ class Segment : public QObject
void totalSize(KIO::filesize_t size, QPair<int, int> segmentRange);
void finishedDownload(KIO::filesize_t size);
void canResume();
- void urlChanged(const KUrl &newUrl);
+ void urlChanged(const QUrl &newUrl);
private Q_SLOTS:
void slotData(KIO::Job *job, const QByteArray &data);
@@ -135,7 +135,7 @@ class Segment : public QObject
*/
void slotWriteRest();
- void slotRedirection(KIO::Job*, const KUrl &);
+ void slotRedirection(KIO::Job*, const QUrl &);
private:
bool writeBuffer();
@@ -153,7 +153,7 @@ class Segment : public QObject
KIO::filesize_t m_bytesWritten;
KIO::filesize_t m_totalBytesLeft;
KIO::TransferJob *m_getJob;
- KUrl m_url;
+ QUrl m_url;
QByteArray m_buffer;
QPair<KIO::fileoffset_t, KIO::fileoffset_t> m_segSize;
};
diff --git a/transfer-plugins/multisegmentkio/transfermultisegkio.cpp \
b/transfer-plugins/multisegmentkio/transfermultisegkio.cpp index c1ffb43..2684f65 \
100644
--- a/transfer-plugins/multisegmentkio/transfermultisegkio.cpp
+++ b/transfer-plugins/multisegmentkio/transfermultisegkio.cpp
@@ -32,7 +32,7 @@
#include <QFile>
TransferMultiSegKio::TransferMultiSegKio(TransferGroup *parent, TransferFactory \
*factory,
- Scheduler *scheduler, const KUrl &source, const KUrl &dest,
+ Scheduler *scheduler, const QUrl &source, const QUrl &dest,
const QDomElement *e)
: Transfer(parent, factory, scheduler, source, dest, e),
m_movingFile(false),
@@ -86,7 +86,7 @@ void TransferMultiSegKio::start()
TransferDataSource *mirrorSearch = KGet::createTransferDataSource(m_source, \
element, this); if (mirrorSearch) {
- connect(mirrorSearch, SIGNAL(data(QList<KUrl>)), this, \
SLOT(slotSearchUrls(QList<KUrl>))); + connect(mirrorSearch, \
SIGNAL(data(QList<QUrl>)), this, SLOT(slotSearchUrls(QList<QUrl>))); \
mirrorSearch->start(); }
}
@@ -106,7 +106,7 @@ void TransferMultiSegKio::stop()
}
}
-bool TransferMultiSegKio::repair(const KUrl &file)
+bool TransferMultiSegKio::repair(const QUrl &file)
{
if (!file.isValid() || (m_dest == file))
{
@@ -120,14 +120,14 @@ bool TransferMultiSegKio::repair(const KUrl &file)
return false;
}
-bool TransferMultiSegKio::setDirectory(const KUrl& newDirectory)
+bool TransferMultiSegKio::setDirectory(const QUrl& newDirectory)
{
- KUrl newDest = newDirectory;
+ QUrl newDest = newDirectory;
newDest.addPath(m_dest.fileName());
return setNewDestination(newDest);
}
-bool TransferMultiSegKio::setNewDestination(const KUrl &newDestination)
+bool TransferMultiSegKio::setNewDestination(const QUrl &newDestination)
{
kDebug(5001) << "New destination: " << newDestination;
if (newDestination.isValid() && (newDestination != dest()) && \
m_dataSourceFactory) @@ -167,22 +167,22 @@ void TransferMultiSegKio::save(const \
QDomElement &element) void \
TransferMultiSegKio::slotDataSourceFactoryChange(Transfer::ChangesFlags change) {
if (change & Tc_FileName) {
- QList<KUrl> urls = m_dataSourceFactory->mirrors().keys();
+ QList<QUrl> urls = m_dataSourceFactory->mirrors().keys();
QString filename = urls.first().fileName();
if (filename.isEmpty())
return;
- foreach (const KUrl url, urls) {
+ foreach (const QUrl url, urls) {
if (filename != url.fileName())
return;
}
- KUrl path = m_dest.directory();
+ QUrl path = m_dest.directory();
path.addPath(filename);
setNewDestination(path);
}
if (change & Tc_Source) {
- m_source = KUrl();
- QHash< KUrl, QPair<bool, int> >::const_iterator it = \
m_dataSourceFactory->mirrors().constBegin();
- QHash< KUrl, QPair<bool, int> >::const_iterator end = \
m_dataSourceFactory->mirrors().constEnd(); + m_source = QUrl();
+ QHash< QUrl, QPair<bool, int> >::const_iterator it = \
m_dataSourceFactory->mirrors().constBegin(); + QHash< QUrl, QPair<bool, int> \
>::const_iterator end = m_dataSourceFactory->mirrors().constEnd(); for (; it != end; \
> it++) {
if (it.value().first) {
m_source = it.key();
@@ -279,11 +279,11 @@ void TransferMultiSegKio::slotStatResult(KJob* kioJob)
setTransferChange(Tc_Status, true);
}
-void TransferMultiSegKio::slotSearchUrls(const QList<KUrl> &urls)
+void TransferMultiSegKio::slotSearchUrls(const QList<QUrl> &urls)
{
kDebug(5001) << "Found " << urls.size() << " urls.";
- foreach (const KUrl &url, urls)
+ foreach (const QUrl &url, urls)
{
m_dataSourceFactory->addMirror(url, MultiSegKioSettings::segments());
}
@@ -294,7 +294,7 @@ void TransferMultiSegKio::slotChecksumFound(QString type, QString \
checksum) m_dataSourceFactory->verifier()->addChecksum(type, checksum);
}
-QHash<KUrl, QPair<bool, int> > TransferMultiSegKio::availableMirrors(const KUrl \
&file) const +QHash<QUrl, QPair<bool, int> > \
TransferMultiSegKio::availableMirrors(const QUrl &file) const {
Q_UNUSED(file)
@@ -302,15 +302,15 @@ QHash<KUrl, QPair<bool, int> > \
TransferMultiSegKio::availableMirrors(const KUrl }
-void TransferMultiSegKio::setAvailableMirrors(const KUrl &file, const QHash<KUrl, \
QPair<bool, int> > &mirrors) +void TransferMultiSegKio::setAvailableMirrors(const \
QUrl &file, const QHash<QUrl, QPair<bool, int> > &mirrors) {
Q_UNUSED(file)
m_dataSourceFactory->setMirrors(mirrors);
- m_source = KUrl();
- QHash< KUrl, QPair<bool, int> >::const_iterator it = mirrors.begin();
- QHash< KUrl, QPair<bool, int> >::const_iterator end = mirrors.end();
+ m_source = QUrl();
+ QHash< QUrl, QPair<bool, int> >::const_iterator it = mirrors.begin();
+ QHash< QUrl, QPair<bool, int> >::const_iterator end = mirrors.end();
for (; it != end; it++) {
if (it.value().first) {
m_source = it.key();
@@ -320,14 +320,14 @@ void TransferMultiSegKio::setAvailableMirrors(const KUrl &file, \
const QHash<KUrl setTransferChange(Tc_Source, true);
}
-Verifier *TransferMultiSegKio::verifier(const KUrl &file)
+Verifier *TransferMultiSegKio::verifier(const QUrl &file)
{
Q_UNUSED(file)
return m_dataSourceFactory->verifier();
}
-Signature *TransferMultiSegKio::signature(const KUrl &file)
+Signature *TransferMultiSegKio::signature(const QUrl &file)
{
Q_UNUSED(file)
@@ -338,8 +338,8 @@ FileModel *TransferMultiSegKio::fileModel()
{
if (!m_fileModel)
{
- m_fileModel = new FileModel(QList<KUrl>() << m_dest, m_dest.upUrl(), this);
- connect(m_fileModel, SIGNAL(rename(KUrl,KUrl)), this, \
SLOT(slotRename(KUrl,KUrl))); + m_fileModel = new FileModel(QList<QUrl>() << \
m_dest, m_dest.upUrl(), this); + connect(m_fileModel, \
SIGNAL(rename(QUrl,QUrl)), this, SLOT(slotRename(QUrl,QUrl)));
QModelIndex statusIndex = m_fileModel->index(m_dest, FileItem::Status);
m_fileModel->setData(statusIndex, m_dataSourceFactory->status());
@@ -354,7 +354,7 @@ FileModel *TransferMultiSegKio::fileModel()
return m_fileModel;
}
-void TransferMultiSegKio::slotRename(const KUrl &oldUrl, const KUrl &newUrl)
+void TransferMultiSegKio::slotRename(const QUrl &oldUrl, const QUrl &newUrl)
{
Q_UNUSED(oldUrl)
diff --git a/transfer-plugins/multisegmentkio/transfermultisegkio.h \
b/transfer-plugins/multisegmentkio/transfermultisegkio.h index 1f84f77..b4ba401 \
100644
--- a/transfer-plugins/multisegmentkio/transfermultisegkio.h
+++ b/transfer-plugins/multisegmentkio/transfermultisegkio.h
@@ -31,40 +31,40 @@ class TransferMultiSegKio : public Transfer
public:
TransferMultiSegKio(TransferGroup * parent, TransferFactory * factory,
- Scheduler * scheduler, const KUrl & src, const KUrl & dest,
+ Scheduler * scheduler, const QUrl & src, const QUrl & dest,
const QDomElement * e = 0);
- bool repair(const KUrl &file = KUrl());
+ bool repair(const QUrl &file = QUrl());
/**
* Move the download to the new destination
* @param newDirectory is a directory where the download should be stored
* @returns true if newDestination can be used
*/
- virtual bool setDirectory(const KUrl &newDirectory);
+ virtual bool setDirectory(const QUrl &newDirectory);
virtual void init();
virtual void deinit(Transfer::DeleteOptions options);
- QHash<KUrl, QPair<bool, int> > availableMirrors(const KUrl &file) const;
- void setAvailableMirrors(const KUrl &file, const QHash<KUrl, QPair<bool, \
int> > &mirrors); + QHash<QUrl, QPair<bool, int> > availableMirrors(const QUrl \
&file) const; + void setAvailableMirrors(const QUrl &file, const QHash<QUrl, \
QPair<bool, int> > &mirrors);
/**
* @param file for which to get the verifier
* @return Verifier that allows you to add checksums manually verify a file \
etc.
*/
- virtual Verifier *verifier(const KUrl &file = KUrl());
+ virtual Verifier *verifier(const QUrl &file = QUrl());
/**
* @param file for which to get the signature
* @return Signature that allows you to add signatures and verify them
*/
- virtual Signature *signature(const KUrl &file = KUrl());
+ virtual Signature *signature(const QUrl &file = QUrl());
FileModel *fileModel();
public slots:
- bool setNewDestination(const KUrl &newDestination);
+ bool setNewDestination(const QUrl &newDestination);
// --- Job virtual functions ---
void start();
void stop();
@@ -79,8 +79,8 @@ class TransferMultiSegKio : public Transfer
private slots:
void slotDataSourceFactoryChange(Transfer::ChangesFlags change);
void slotUpdateCapabilities();
- void slotSearchUrls(const QList<KUrl> &urls);
- void slotRename(const KUrl &oldUrl, const KUrl &newUrl);
+ void slotSearchUrls(const QList<QUrl> &urls);
+ void slotRename(const QUrl &oldUrl, const QUrl &newUrl);
void slotVerified(bool isVerified);
void slotStatResult(KJob * kioJob);
diff --git a/ui/droptarget.cpp b/ui/droptarget.cpp
index e9013f5..eeaf6a2 100644
--- a/ui/droptarget.cpp
+++ b/ui/droptarget.cpp
@@ -57,7 +57,7 @@ DropTarget::DropTarget(MainWindow * mw)
if(Settings::dropSticky())
KWindowSystem::setState(winId(), KWindowSystem::Sticky);
- cachedPixmap = DesktopIcon("kget", TARGET_SIZE);
+ cachedPixmap = QIcon::fromTheme("kget").pixmap(TARGET_SIZE);
if (!cachedPixmap.mask().isNull())
{
QBitmap mask(size());
@@ -89,7 +89,7 @@ DropTarget::DropTarget(MainWindow * mw)
QAction *quitAction = new QAction(this);
quitAction->setText(i18n("Quit KGet"));
- quitAction->setIcon(KIcon("system-shutdown"));
+ quitAction->setIcon(QIcon::fromTheme("system-shutdown"));
connect(quitAction, SIGNAL(triggered()), mw, SLOT(slotQuit()));
popupMenu->addAction(quitAction);
@@ -222,8 +222,8 @@ void DropTarget::dropEvent(QDropEvent * event)
if (list.count() == 1 && list.first().url().endsWith(QLatin1String(".kgt")))
{
int msgBoxResult = KMessageBox::questionYesNoCancel(this, i18n("The \
dropped file is a KGet Transfer List"), "KGet",
- KGuiItem(i18n("&Download"), \
KIcon("document-save")),
- KGuiItem(i18n("&Load transfer list"), \
KIcon("list-add")), KStandardGuiItem::cancel()); + \
KGuiItem(i18n("&Download"), QIcon::fromTheme("document-save")), + \
KGuiItem(i18n("&Load transfer list"), QIcon::fromTheme("list-add")), \
KStandardGuiItem::cancel());
if (msgBoxResult == 3) //Download
NewTransferDialogHandler::showNewTransferDialog(list.first().url());
@@ -290,7 +290,7 @@ void DropTarget::mousePressEvent(QMouseEvent * e)
newtransfer = newtransfer.trimmed();
if(!newtransfer.isEmpty())
- KGet::addTransfer(KUrl(newtransfer), QString(), QString(), true);
+ KGet::addTransfer(QUrl(newtransfer), QString(), QString(), QString(), \
true); }
}
diff --git a/ui/groupsettingsdialog.cpp b/ui/groupsettingsdialog.cpp
index e688340..e1438cf 100644
--- a/ui/groupsettingsdialog.cpp
+++ b/ui/groupsettingsdialog.cpp
@@ -69,7 +69,7 @@ void GroupSettingsDialog::save()
if (ui.defaultFolderRequester->text().isEmpty()) {
m_group->setDefaultFolder(QString());
} else {
- m_group->setDefaultFolder(ui.defaultFolderRequester->url().toLocalFile(KUrl::AddTrailingSlash));
+ m_group->setDefaultFolder(ui.defaultFolderRequester->url().toString());
}
m_group->setDownloadLimit(ui.downloadBox->value(), Transfer::VisibleSpeedLimit);
diff --git a/ui/history/transferhistory.cpp b/ui/history/transferhistory.cpp
index ea5d6c8..66820ab 100644
--- a/ui/history/transferhistory.cpp
+++ b/ui/history/transferhistory.cpp
@@ -38,6 +38,7 @@
#include <kio/global.h>
#include <KPushButton>
#include <KIcon>
+#include <KLocale>
TransferHistory::TransferHistory(QWidget *parent)
: KGetSaveSizeDialog("TransferHistory", parent),
diff --git a/ui/history/transferhistorycategorizedview.cpp \
b/ui/history/transferhistorycategorizedview.cpp index c4f26f3..c4bfd56 100644
--- a/ui/history/transferhistorycategorizedview.cpp
+++ b/ui/history/transferhistorycategorizedview.cpp
@@ -34,8 +34,8 @@ TransferHistoryCategorizedView::TransferHistoryCategorizedView(QWidget \
*parent)
// the kcategoryizedview list
TransferHistoryItemDelegate *item_delegate = new \
TransferHistoryItemDelegate(this);
- m_drawer = new KCategoryDrawer();
m_view = new KCategorizedView(this);
+ m_drawer = new KCategoryDrawer(m_view);
m_view->setCategoryDrawer(m_drawer);
m_view->setSelectionMode(QAbstractItemView::SingleSelection);
m_view->setSpacing(KDialog::spacingHint());
diff --git a/ui/history/transferhistoryitemdelegate.cpp \
b/ui/history/transferhistoryitemdelegate.cpp index daf5e80..211639b 100644
--- a/ui/history/transferhistoryitemdelegate.cpp
+++ b/ui/history/transferhistoryitemdelegate.cpp
@@ -89,9 +89,9 @@ void TransferHistoryItemDelegate::paint(QPainter *painter,
const QAbstractItemModel *model = static_cast <const QAbstractItemModel *> \
(index.model());
QUrl url(model->data(index, \
TransferHistoryCategorizedDelegate::RoleUrl).toString()); QString name = \
url.path().mid(url.path().lastIndexOf("/") + 1);
- KIcon icon(KIO::pixmapForUrl(
- model->data(index, \
TransferHistoryCategorizedDelegate::RoleDest).toString(),
- 0, KIconLoader::Panel));
+ QIcon icon;//(KIO::pixmapForUrl( TODO: PORT THIS!
+ // model->data(index, \
TransferHistoryCategorizedDelegate::RoleDest).toString(), + // 0, \
KIconLoader::Panel));
QString size = KIO::convertSize(model->data(index, \
TransferHistoryCategorizedDelegate::RoleSize).toInt());
QString date = model->data(index, \
TransferHistoryCategorizedDelegate::RoleDate).toDate().toString("dd.MM.yyyy"); \
QString host = url.host();
diff --git a/ui/icons/CMakeLists.txt b/ui/icons/CMakeLists.txt
index 02e3c9e..6505295 100644
--- a/ui/icons/CMakeLists.txt
+++ b/ui/icons/CMakeLists.txt
@@ -1 +1,2 @@
-kde4_install_icons(${ICON_INSTALL_DIR})
+ecm_install_icons(${ICON_INSTALL_DIR})
+#PORT TO KF5
\ No newline at end of file
diff --git a/ui/linkview/kget_linkview.cpp b/ui/linkview/kget_linkview.cpp
index f00a3cb..3858112 100644
--- a/ui/linkview/kget_linkview.cpp
+++ b/ui/linkview/kget_linkview.cpp
@@ -43,11 +43,11 @@ KGetLinkView::KGetLinkView(QWidget *parent)
setCaption(i18n("Import Links"));
setButtons(0);
- if (parent) {
+ /*if (parent) {
KWindowInfo info = KWindowSystem::windowInfo(parent->winId(), \
NET::WMDesktop, NET::WMDesktop); KWindowSystem::setCurrentDesktop(info.desktop());
KWindowSystem::forceActiveWindow(parent->winId());
- }
+ }*///TODO: Port all KWindowSystem stuff
// proxy model to filter links
m_proxyModel = new KGetSortFilterProxyModel(1, this);
@@ -142,8 +142,9 @@ void KGetLinkView::checkClipboard()
m_linkImporter = new LinkImporter(this);
- connect(m_linkImporter, SIGNAL(finished()), SLOT(slotImportFinished()));
m_linkImporter->checkClipboard(clipboardContent);
+
+ slotImportFinished();
}
}
diff --git a/ui/linkview/kget_linkview.h b/ui/linkview/kget_linkview.h
index e8767bd..fd7c025 100644
--- a/ui/linkview/kget_linkview.h
+++ b/ui/linkview/kget_linkview.h
@@ -36,7 +36,7 @@ public:
void importUrl(const QString &url = QString());
signals:
- void leechUrls( const KUrl::List& urls );
+ void leechUrls( const QList<QUrl>& urls );
private slots:
void slotMimeTypeChanged(int index);
diff --git a/ui/metalinkcreator/dragdlg.cpp b/ui/metalinkcreator/dragdlg.cpp
index e010dfa..47c02fd 100644
--- a/ui/metalinkcreator/dragdlg.cpp
+++ b/ui/metalinkcreator/dragdlg.cpp
@@ -26,6 +26,8 @@
#include <QtGui/QCheckBox>
#include <QtGui/QSortFilterProxyModel>
+#include <KLocale>
+
DragDlg::DragDlg(KGetMetalink::Resources *resources, KGetMetalink::CommonData \
*commonData, QSortFilterProxyModel *countrySort, QSortFilterProxyModel *languageSort, \
QWidget *parent) : KGetSaveSizeDialog("DragDlg", parent),
m_resources(resources),
diff --git a/ui/metalinkcreator/filehandler.cpp b/ui/metalinkcreator/filehandler.cpp
index 12e2efe..0526c0d 100644
--- a/ui/metalinkcreator/filehandler.cpp
+++ b/ui/metalinkcreator/filehandler.cpp
@@ -142,7 +142,7 @@ QList<FileData> DirectoryHandler::takeFiles()
return files;
}
-void DirectoryHandler::slotFiles(const QList<KUrl> &files)
+void DirectoryHandler::slotFiles(const QList<QUrl> &files)
{
if (files.isEmpty()) {
return;
@@ -188,8 +188,7 @@ void DirectoryHandler::slotDirEntries(KIO::Job *j, const \
KIO::UDSEntryList &entr if (!entry.isDir()) {
const QString name = entry.stringValue(KIO::UDSEntry::UDS_NAME);
FileData data;
- data.url = baseUrl;
- data.url.addPath(name);
+ data.url.setPath(baseUrl.toString() + "/" + name);//FIXME: Does this \
work? data.file.name = baseDir + name;
data.file.size = entry.numberValue(KIO::UDSEntry::UDS_SIZE, -1);
diff --git a/ui/metalinkcreator/filehandler.h b/ui/metalinkcreator/filehandler.h
index cfb69da..0db9893 100644
--- a/ui/metalinkcreator/filehandler.h
+++ b/ui/metalinkcreator/filehandler.h
@@ -27,7 +27,7 @@
struct FileData
{
- KUrl url;
+ QUrl url;
KGetMetalink::File file;
};
@@ -83,7 +83,7 @@ class DirectoryHandler : public QObject
* The files the FileHandler should handle, the urls can also be urls to \
directories
* then the files of these directories will be got recursively
*/
- void slotFiles(const QList<KUrl> &files);
+ void slotFiles(const QList<QUrl> &files);
signals:
void finished();
@@ -104,7 +104,7 @@ class DirectoryHandler : public QObject
private:
bool m_allJobsStarted;
- QHash<KJob*, KUrl> m_jobs;
+ QHash<KJob*, QUrl> m_jobs;
QList<FileData> m_files;
};
diff --git a/ui/metalinkcreator/localemodels.h b/ui/metalinkcreator/localemodels.h
index f6b0194..d2a66e7 100644
--- a/ui/metalinkcreator/localemodels.h
+++ b/ui/metalinkcreator/localemodels.h
@@ -47,7 +47,7 @@ class CountryModel : public QAbstractListModel
private:
QStringList m_countryCodes;
QStringList m_countryNames;
- QList<KIcon> m_countryIcons;
+ QList<QIcon> m_countryIcons;
};
/**
diff --git a/ui/metalinkcreator/metalinkcreator.cpp \
b/ui/metalinkcreator/metalinkcreator.cpp index 57848bc..838e003 100644
--- a/ui/metalinkcreator/metalinkcreator.cpp
+++ b/ui/metalinkcreator/metalinkcreator.cpp
@@ -28,6 +28,7 @@
#include <QtGui/QLabel>
#include <QtGui/QSortFilterProxyModel>
#include <QtGui/QStandardItemModel>
+#include <QMimeData>
#include <KFileDialog>
#include <KLocale>
@@ -87,8 +88,8 @@ MetalinkCreator::MetalinkCreator(QWidget *parent)
connect(&m_thread, SIGNAL(fileResult(KGetMetalink::File)), this, \
SLOT(slotAddFile(KGetMetalink::File)));
connect(&m_thread, SIGNAL(finished()), this, SLOT(slotThreadFinished()));
- setCaption(i18n("Create a Metalink"));
- showButton(KDialog::Help, false);
+ setWindowTitle(i18n("Create a Metalink"));
+ //showButton(KDialog::Help, false);
}
MetalinkCreator::~MetalinkCreator()
@@ -104,14 +105,14 @@ void \
MetalinkCreator::slotUpdateAssistantButtons(KPageWidgetItem *to, KPageWidge }
//it is impossible to return to the introduction page
- if (to == m_generalPage)
+ /*if (to == m_generalPage)
{
enableButton(KDialog::User3, false);
}
else
{
enableButton(KDialog::User3, true);
- }
+ }*///TODO: Port all of this
if (!m_filesModel->rowCount()) {
uiFiles.infoWidget->setText(i18n("Add at least one file."));
@@ -122,7 +123,7 @@ void MetalinkCreator::slotUpdateAssistantButtons(KPageWidgetItem \
*to, KPageWidge
//only enable finish then the metalink is valid (i.e. no required data missing)
//and the thread is not running
- enableButton(KDialog::User1, metalink.isValid() && !m_thread.isRunning());
+ //enableButton(KDialog::User1, metalink.isValid() && !m_thread.isRunning());
}
void MetalinkCreator::create()
@@ -136,13 +137,13 @@ void MetalinkCreator::create()
void MetalinkCreator::slotDelayedCreation()
{
CountryModel *countryModel = new CountryModel(this);
- countryModel->setupModelData(KGlobal::locale()->allCountriesList());
+ //countryModel->setupModelData(QLocale()->allCountriesList());//TODO:Port these \
2 m_countrySort = new QSortFilterProxyModel(this);
m_countrySort->setSourceModel(countryModel);
m_countrySort->sort(0);
m_languageModel = new LanguageModel(this);
- m_languageModel->setupModelData(KGlobal::locale()->allLanguagesList());
+ //m_languageModel->setupModelData(KGlobal::locale()->allLanguagesList());
m_languageSort = new QSortFilterProxyModel(this);
m_languageSort->setSourceModel(m_languageModel);
m_languageSort->sort(0);
@@ -186,7 +187,7 @@ void MetalinkCreator::createIntroduction()
uiIntroduction.setupUi(widget);
uiIntroduction.save->setFilter("*.meta4|" + i18n("Metalink Version 4.0 file \
(*.meta4)") + "\n*.metalink|" + i18n("Metalink Version 3.0 file \
(*.metalink)"));
- uiIntroduction.save->fileDialog()->setOperationMode(KFileDialog::Saving);
+ uiIntroduction.save->fileDialog()->setAcceptMode(QFileDialog::AcceptSave);
connect(uiIntroduction.save, SIGNAL(textChanged(QString)), this, \
SLOT(slotUpdateIntroductionNextButton()));
connect(uiIntroduction.load, SIGNAL(textChanged(QString)), this, \
SLOT(slotUpdateIntroductionNextButton()));
diff --git a/ui/metalinkcreator/metalinker.cpp b/ui/metalinkcreator/metalinker.cpp
index 1057c4c..958be95 100644
--- a/ui/metalinkcreator/metalinker.cpp
+++ b/ui/metalinkcreator/metalinker.cpp
@@ -355,7 +355,7 @@ bool KGetMetalink::Url::operator<(const KGetMetalink::Url &other) \
const
bool smaller = (this->priority > other.priority) || ((this->priority == 0) && \
(other.priority != 0));
if (!smaller && (this->priority == other.priority)) {
- QString countryCode = KGlobal::locale()->country();
+ QString countryCode;// = KGlobal::locale()->country();//TODO: Port
if (!countryCode.isEmpty()) {
smaller = (other.location.toLower() == countryCode.toLower());
}
diff --git a/ui/mirror/mirrormodel.cpp b/ui/mirror/mirrormodel.cpp
index b1a0753..3140733 100644
--- a/ui/mirror/mirrormodel.cpp
+++ b/ui/mirror/mirrormodel.cpp
@@ -87,7 +87,7 @@ void MirrorDelegate::setEditorData(QWidget *editor, const \
QModelIndex &index) co if (index.isValid() && editor) {
if (index.column() == MirrorItem::Url) {
KLineEdit *line = static_cast<KLineEdit*>(editor);
- const KUrl url = index.data(Qt::EditRole).toUrl();
+ const QUrl url = index.data(Qt::EditRole).toUrl();
line->setUrl(url);
} else if (index.column() == MirrorItem::Connections) {
QSpinBox *numConnections = static_cast<QSpinBox*>(editor);
@@ -194,7 +194,7 @@ QVariant MirrorItem::data(int column, int role) const
{
if (role == Qt::DisplayRole)
{
- return m_url.pathOrUrl();
+ return m_url.toString();
}
else if ((role == Qt::UserRole) || (role == Qt::EditRole))
{
@@ -292,14 +292,14 @@ bool MirrorItem::setData(int column, const QVariant &value, int \
role) }
else if ((column == MirrorItem::Url) && (role == Qt::EditRole))
{
- KUrl url;
+ QUrl url;
if (value.type() == QVariant::Url)
{
- url = KUrl(value.toUrl());
+ url = QUrl(value.toUrl());
}
else if (value.type() == QVariant::String)
{
- url = KUrl(value.toString());
+ url = QUrl(value.toString());
}
if (!url.isEmpty())
@@ -328,16 +328,16 @@ bool MirrorItem::setData(int column, const QVariant &value, int \
role)
QString path = KStandardDirs::locate("locale", \
QString::fromLatin1("l10n/%1/flag.png").arg(m_countryCode)); if (path.isEmpty())
{
- m_countryFlag = KIcon();
+ m_countryFlag = QIcon();
}
else
{
- m_countryFlag = KIcon(path);
+ m_countryFlag = QIcon::fromTheme(path);
}
}
else
{
- m_countryFlag = KIcon();
+ m_countryFlag = QIcon();
}
return true;
}
@@ -390,7 +390,7 @@ QVariant MirrorModel::headerData(int section, Qt::Orientation \
orientation, int r if (role == Qt::DisplayRole) {
return i18nc("The priority of the mirror", "Priority");
} else if (role == Qt::DecorationRole) {
- return KIcon("games-highscores");
+ return QIcon::fromTheme("games-highscores");
}
} else if ((section == MirrorItem::Connections) && (role == Qt::DisplayRole)) {
return i18nc("Number of paralell connections to the mirror", "Connections");
@@ -453,7 +453,7 @@ bool MirrorModel::removeRows(int row, int count, const \
QModelIndex &parent) return true;
}
-void MirrorModel::addMirror(const KUrl &url, int numConnections, int priority, const \
QString &countryCode) +void MirrorModel::addMirror(const QUrl &url, int \
numConnections, int priority, const QString &countryCode) {
if (!url.isValid())
{
@@ -463,7 +463,7 @@ void MirrorModel::addMirror(const KUrl &url, int numConnections, \
int priority, c for (int i = 0; i < rowCount(); ++i)
{
//exists already, so remove the row
- if (KUrl(m_data.at(i)->data(MirrorItem::Url).toString()) == url)
+ if (QUrl(m_data.at(i)->data(MirrorItem::Url).toString()) == url)
{
removeRow(i);
break;
@@ -484,12 +484,12 @@ void MirrorModel::addMirror(const KUrl &url, int \
numConnections, int priority, c emit endInsertRows();
}
-void MirrorModel::setMirrors(const QHash<KUrl, QPair<bool, int> > &mirrors)
+void MirrorModel::setMirrors(const QHash<QUrl, QPair<bool, int> > &mirrors)
{
removeRows(0, rowCount());
- QHash<KUrl, QPair<bool, int> >::const_iterator it;
- QHash<KUrl, QPair<bool, int> >::const_iterator itEnd = mirrors.constEnd();
+ QHash<QUrl, QPair<bool, int> >::const_iterator it;
+ QHash<QUrl, QPair<bool, int> >::const_iterator itEnd = mirrors.constEnd();
for (it = mirrors.constBegin(); it != itEnd; ++it)
{
MirrorItem *item = new MirrorItem;
@@ -503,13 +503,13 @@ void MirrorModel::setMirrors(const QHash<KUrl, QPair<bool, int> \
> &mirrors) emit reset();
}
-QHash<KUrl, QPair<bool, int> > MirrorModel::availableMirrors() const
+QHash<QUrl, QPair<bool, int> > MirrorModel::availableMirrors() const
{
- QHash<KUrl, QPair<bool, int> > mirrors;
+ QHash<QUrl, QPair<bool, int> > mirrors;
foreach (MirrorItem *item, m_data)
{
bool used = (item->data(MirrorItem::Used, Qt::CheckStateRole).toInt() == \
Qt::Checked) ? true : false;
- const KUrl url = KUrl(item->data(MirrorItem::Url).toString());
+ const QUrl url = QUrl(item->data(MirrorItem::Url).toString());
mirrors[url] = QPair<bool, int>(used, item->data(MirrorItem::Connections, \
Qt::UserRole).toInt()); }
return mirrors;
diff --git a/ui/mirror/mirrormodel.h b/ui/mirror/mirrormodel.h
index 5f2e930..435e1a2 100644
--- a/ui/mirror/mirrormodel.h
+++ b/ui/mirror/mirrormodel.h
@@ -23,8 +23,8 @@
#include <QtGui/QSortFilterProxyModel>
#include <QtGui/QStyledItemDelegate>
-#include <KIcon>
-#include <KUrl>
+#include <QIcon>
+#include <QUrl>
class QSortFilterProxyModel;
@@ -76,13 +76,13 @@ class MirrorItem
bool setData(int column, const QVariant &value, int role = Qt::EditRole);
private:
- KUrl m_url;
+ QUrl m_url;
Qt::CheckState m_checked;
int m_numConnections;
int m_priority;
QString m_countryCode;
QString m_countryName;
- KIcon m_countryFlag;
+ QIcon m_countryFlag;
};
class MirrorModel : public QAbstractTableModel
@@ -101,9 +101,9 @@ class MirrorModel : public QAbstractTableModel
bool setData(const QModelIndex &index, const QVariant &value, int role = \
Qt::EditRole);
bool removeRows(int row, int count, const QModelIndex &parent = \
QModelIndex());
- void addMirror(const KUrl &url, int numConnections = 0, int priority = 0, \
const QString &countryCode = QString());
- void setMirrors(const QHash<KUrl, QPair<bool, int> > &mirrors);
- QHash<KUrl, QPair<bool, int> > availableMirrors() const;
+ void addMirror(const QUrl &url, int numConnections = 0, int priority = 0, \
const QString &countryCode = QString()); + void setMirrors(const QHash<QUrl, \
QPair<bool, int> > &mirrors); + QHash<QUrl, QPair<bool, int> > \
availableMirrors() const;
private:
QList<MirrorItem*> m_data;
diff --git a/ui/mirror/mirrorsettings.cpp b/ui/mirror/mirrorsettings.cpp
index bdabd27..e28b841 100644
--- a/ui/mirror/mirrorsettings.cpp
+++ b/ui/mirror/mirrorsettings.cpp
@@ -23,6 +23,8 @@
#include <QtGui/QSortFilterProxyModel>
+#include <KLocale>
+
MirrorAddDlg::MirrorAddDlg(MirrorModel *model, QWidget *parent, Qt::WFlags flags)
: KDialog(parent, flags),
m_model(model),
@@ -97,8 +99,8 @@ void MirrorAddDlg::showItem(MirrorItem::DataType type, bool show)
void MirrorAddDlg::updateButton(const QString &text)
{
bool enabled = false;
- KUrl url(text);
- if (url.isValid() && !url.protocol().isEmpty() && url.hasPath())
+ QUrl url(text);
+ if (url.isValid() && !url.scheme().isEmpty() && !url.path().isEmpty())
{
enabled = true;
}
@@ -111,14 +113,14 @@ void MirrorAddDlg::addMirror()
const int numConnections = ui.numConnections->isVisible() ? \
ui.numConnections->value() : 0;
const int priority = ui.priority->isVisible() ? ui.priority->value() : 0;
const QString countryCode = \
ui.location->itemData(ui.location->currentIndex()).toString();
- m_model->addMirror(KUrl(ui.url->text()), numConnections, priority, countryCode);
+ m_model->addMirror(QUrl(ui.url->text()), numConnections, priority, countryCode);
if (m_countryModel)
{
ui.location->setCurrentIndex(-1);
}
}
-MirrorSettings::MirrorSettings(QWidget *parent, TransferHandler *handler, const KUrl \
&file) +MirrorSettings::MirrorSettings(QWidget *parent, TransferHandler *handler, \
const QUrl &file) : KGetSaveSizeDialog("MirrorSettings", parent),
m_transfer(handler),
m_file(file)
diff --git a/ui/mirror/mirrorsettings.h b/ui/mirror/mirrorsettings.h
index 6f9ff81..60166a6 100644
--- a/ui/mirror/mirrorsettings.h
+++ b/ui/mirror/mirrorsettings.h
@@ -65,7 +65,7 @@ class MirrorSettings : public KGetSaveSizeDialog
Q_OBJECT
public:
- MirrorSettings(QWidget *parent, TransferHandler *handler, const KUrl &file);
+ MirrorSettings(QWidget *parent, TransferHandler *handler, const QUrl &file);
virtual QSize sizeHint() const;
@@ -77,7 +77,7 @@ class MirrorSettings : public KGetSaveSizeDialog
private:
TransferHandler *m_transfer;
- KUrl m_file;
+ QUrl m_file;
MirrorModel *m_model;
MirrorProxyModel *m_proxy;
Ui::MirrorSettings ui;
diff --git a/ui/newtransferdialog.cpp b/ui/newtransferdialog.cpp
index 1ebbb25..2d3c2cf 100644
--- a/ui/newtransferdialog.cpp
+++ b/ui/newtransferdialog.cpp
@@ -36,7 +36,7 @@
#include <KFileDialog>
#include <KWindowSystem>
-K_GLOBAL_STATIC(NewTransferDialogHandler, newTransferDialogHandler)
+Q_GLOBAL_STATIC(NewTransferDialogHandler, newTransferDialogHandler)
NewTransferDialog::NewTransferDialog(QWidget *parent)
@@ -71,7 +71,7 @@ NewTransferDialog::NewTransferDialog(QWidget *parent)
ui.destRequester->comboBox()->setDuplicatesEnabled(false);
ui.destRequester->comboBox()->setUrlDropsEnabled(true);
ui.destRequester->comboBox()->setEditable(true);
- ui.destRequester->fileDialog()->setKeepLocation(true);
+ //ui.destRequester->fileDialog()->setKeepLocation(true);
ui.errorWidget->setCloseButtonVisible(false);
@@ -133,7 +133,7 @@ void NewTransferDialog::clear()
//add all transfer groups
ui.groupComboBox->clear();
foreach (TransferGroupHandler *group, KGet::allTransferGroups()) {
- ui.groupComboBox->addItem(KIcon(group->iconName()), group->name());
+ ui.groupComboBox->addItem(QIcon::fromTheme(group->iconName()), \
group->name()); }
ui.groupComboBox->setCurrentItem(Settings::lastGroup());
if (ui.groupComboBox->currentIndex() == -1) {
@@ -145,27 +145,27 @@ void NewTransferDialog::clear()
ui.groupLabel->setVisible(multipleGroups);
}
-void NewTransferDialog::setSource(const KUrl::List &sources)
+void NewTransferDialog::setSource(const QList<QUrl> &sources)
{
if (sources.isEmpty()) {
return;
}
if (sources.count() == 1) {
- KUrl m_srcUrl = sources.first().url();
+ QUrl m_srcUrl = sources.first().url();
ui.urlRequester->clear();
if (m_srcUrl.isEmpty()) {
- m_srcUrl = \
KUrl(QApplication::clipboard()->text(QClipboard::Clipboard).trimmed()); + \
m_srcUrl = QUrl(QApplication::clipboard()->text(QClipboard::Clipboard).trimmed()); }
if (UrlChecker::checkSource(m_srcUrl) == UrlChecker::NoError) {
- ui.urlRequester->insert(m_srcUrl.prettyUrl());
+ ui.urlRequester->insert(m_srcUrl.toString());
}
} else {
- foreach (const KUrl &sourceUrl, sources) {
- if (sourceUrl.url() != KUrl(sourceUrl.url()).fileName()) {//TODO \
simplify, whatfor is this check anyway, shouldn't the sources be checked already and \
if not add this to UrlChecker + foreach (const QUrl &sourceUrl, sources) {
+ if (sourceUrl.url() != QUrl(sourceUrl.url()).fileName()) {//TODO \
simplify, whatfor is this check anyway, shouldn't the sources be checked already and \
if not add this to UrlChecker kDebug(5001) << "Insert" << sourceUrl;
- QListWidgetItem *newItem = new \
QListWidgetItem(sourceUrl.pathOrUrl(), ui.listWidget); + \
QListWidgetItem *newItem = new QListWidgetItem(sourceUrl.toString(), ui.listWidget); \
newItem->setCheckState(Qt::Checked); }
}
@@ -179,7 +179,7 @@ void NewTransferDialog::setSource(const KUrl::List &sources)
void NewTransferDialog::setDestinationFileName(const QString &filename)
{
- ui.destRequester->setUrl(QString(ui.destRequester->url().path(KUrl::AddTrailingSlash) \
+ filename)); + ui.destRequester->setUrl(QString(ui.destRequester->url().adjusted(QUrl::RemoveFilename).toString() \
+ filename)); }
void NewTransferDialog::setDestination()
@@ -206,7 +206,7 @@ void NewTransferDialog::setDestination()
}
}
-void NewTransferDialog::showDialog(KUrl::List list, const QString \
&suggestedFileName) +void NewTransferDialog::showDialog(QList<QUrl> list, const \
QString &suggestedFileName) {
//TODO handle the case where for some there are suggested file names --> own \
file name column in multiple setting //the dialog is already in use, adapt it
@@ -238,7 +238,7 @@ void NewTransferDialog::setDefaultDestination()
//set a file name
if (!m_multiple) {
- const KUrl url(ui.urlRequester->text().trimmed());
+ const QUrl url(ui.urlRequester->text().trimmed());
if ((UrlChecker::checkSource(url) == UrlChecker::NoError) &&
QFileInfo(ui.destRequester->url().toLocalFile()).isDir()) {
setDestinationFileName(url.fileName());
@@ -248,11 +248,11 @@ void NewTransferDialog::setDefaultDestination()
void NewTransferDialog::prepareDialog()
{
- if (m_window) {
+ /*if (m_window) {
KWindowInfo info = KWindowSystem::windowInfo(m_window->winId(), \
NET::WMDesktop, NET::WMDesktop); KWindowSystem::setCurrentDesktop(info.desktop());
KWindowSystem::forceActiveWindow(m_window->winId());
- }
+ }*/
kDebug(5001) << "Show the dialog!";
show();
@@ -271,8 +271,8 @@ void NewTransferDialog::inputTimer()
void NewTransferDialog::checkInput()
{
- KUrl source = KUrl(ui.urlRequester->text().trimmed());
- const KUrl dest = ui.destRequester->url();
+ QUrl source = QUrl(ui.urlRequester->text().trimmed());
+ const QUrl dest = ui.destRequester->url();
//check the destination folder
UrlChecker::UrlError error = UrlChecker::checkFolder(dest);
@@ -282,7 +282,7 @@ void NewTransferDialog::checkInput()
QString warningText;
if (!folderValid) {
if (m_multiple) {
- infoText = UrlChecker::message(KUrl(), UrlChecker::Folder, error);
+ infoText = UrlChecker::message(QUrl(), UrlChecker::Folder, error);
} else {
//might be a destination instead of a folder
destinationValid = (UrlChecker::checkDestination(dest) == \
UrlChecker::NoError); @@ -298,7 +298,7 @@ void NewTransferDialog::checkInput()
error = UrlChecker::checkSource(source);
const bool sourceValid = (error == UrlChecker::NoError);
if (!m_multiple && !sourceValid) {
- infoText = UrlChecker::message(KUrl(), UrlChecker::Source, error);
+ infoText = UrlChecker::message(QUrl(), UrlChecker::Source, error);
}
//check if any sources are checked and for existing transfers or destinations
@@ -323,8 +323,8 @@ void NewTransferDialog::checkInput()
bool existingFile = false;
for (int i = 0; i < list->count(); ++i) {
QListWidgetItem *item = list->item(i);
- const KUrl source = KUrl(item->text());
- const KUrl destUrl = UrlChecker::destUrl(dest, source);
+ const QUrl source = QUrl(item->text());
+ const QUrl destUrl = UrlChecker::destUrl(dest, source);
if (UrlChecker::wouldOverwrite(source, destUrl)) {
item->setBackground(m_existingFileBackground);
existingFile = true;
@@ -345,20 +345,20 @@ void NewTransferDialog::checkInput()
//show only one message for existing transfers
m_existingTransfer = UrlChecker::existingTransfer(source, \
UrlChecker::Source, &warning); if (m_existingTransfer) {
- warningText = UrlChecker::message(KUrl(), UrlChecker::Source, warning);
+ warningText = UrlChecker::message(QUrl(), UrlChecker::Source, warning);
} else {
m_existingTransfer = UrlChecker::existingTransfer(m_destination, \
UrlChecker::Destination, &warning); if (m_existingTransfer) {
- warningText = UrlChecker::message(KUrl(), UrlChecker::Destination, \
warning); + warningText = UrlChecker::message(QUrl(), \
UrlChecker::Destination, warning); }
}
- if (UrlChecker::wouldOverwrite(KUrl(ui.urlRequester->text().trimmed()), \
m_destination)) { + if \
(UrlChecker::wouldOverwrite(QUrl(ui.urlRequester->text().trimmed()), m_destination)) \
{ m_overWriteSingle = true;
if (!warningText.isEmpty()) {
warningText += '\n';
}
- warningText += UrlChecker::message(KUrl(), UrlChecker::Destination, \
UrlChecker::ExistingFile); + warningText += UrlChecker::message(QUrl(), \
UrlChecker::Destination, UrlChecker::ExistingFile); } else {
m_overWriteSingle = false;
}
@@ -403,7 +403,7 @@ void NewTransferDialog::dialogAccepted()
//set the last directory
QString dir = m_destination.toLocalFile();
if (!QFileInfo(dir).isDir()) {
- dir = m_destination.directory();
+ dir = m_destination.adjusted(QUrl::RemoveFilename).toString();
}
Settings::setLastDirectory(dir);
Settings::self()->writeConfig();
@@ -421,19 +421,19 @@ void NewTransferDialog::dialogAccepted()
}
//sourceUrl is valid, has been checked before
- const KUrl sourceUrl = KUrl(ui.urlRequester->text().trimmed());
+ const QUrl sourceUrl = QUrl(ui.urlRequester->text().trimmed());
kDebug(5001) << "Downloading" << sourceUrl << "to" << m_destination;
data << KGet::TransferData(sourceUrl, m_destination, group);
} else {
- KUrl::List list;
+ QList<QUrl> list;
for (int i = 0; i != ui.listWidget->count(); ++i) {
QListWidgetItem *item = ui.listWidget->item(i);
//find selected sources
if (item->checkState() == Qt::Checked) {
//both sourceUrl and destUrl are valid, they have been tested in \
checkInput
- const KUrl sourceUrl = KUrl(item->text().trimmed());
- const KUrl destUrl = UrlChecker::destUrl(m_destination, sourceUrl);
+ const QUrl sourceUrl = QUrl(item->text().trimmed());
+ const QUrl destUrl = UrlChecker::destUrl(m_destination, sourceUrl);
kDebug(5001) << "Downloading" << sourceUrl << "to" << destUrl;
//file exists already, remove it
@@ -490,12 +490,12 @@ NewTransferDialogHandler::~NewTransferDialogHandler()
}
-void NewTransferDialogHandler::showNewTransferDialog(const KUrl &url)
+void NewTransferDialogHandler::showNewTransferDialog(const QUrl &url)
{
- showNewTransferDialog(url.isEmpty() ? KUrl::List() : KUrl::List() << url);
+ showNewTransferDialog(url.isEmpty() ? QList<QUrl>() : QList<QUrl>() << url);
}
-void NewTransferDialogHandler::showNewTransferDialog(KUrl::List urls)
+void NewTransferDialogHandler::showNewTransferDialog(QList<QUrl> urls)
{
if (urls.isEmpty()) {
newTransferDialogHandler->createDialog(urls, QString());
@@ -508,7 +508,7 @@ void NewTransferDialogHandler::showNewTransferDialog(KUrl::List \
urls)
///Only two urls defined, check if second one is a path or a file name
if (urls.count() == 2) {
- const KUrl lastUrl = urls.last();
+ const QUrl lastUrl = urls.last();
QDir dir(lastUrl.toLocalFile());
//check if last url is a file path, either absolute or relative
@@ -516,19 +516,19 @@ void NewTransferDialogHandler::showNewTransferDialog(KUrl::List \
urls) if (QDir::isAbsolutePath(lastUrl.toLocalFile())) {
if (dir.exists()) {
//second url is a folder path
- folder = lastUrl.path(KUrl::AddTrailingSlash);
+ folder = lastUrl.adjusted(QUrl::RemoveFilename).toString();
} else {
//second url is a file path, use this one
- folder = lastUrl.directory(KUrl::AppendTrailingSlash);
+ folder = lastUrl.adjusted(QUrl::RemoveFilename).toString();
suggestedFileName = lastUrl.fileName();
}
urls.removeLast();
} else {
//second url is just a file name
- suggestedFileName = lastUrl.fileName(KUrl::ObeyTrailingSlash);
+ suggestedFileName = lastUrl.fileName();
urls.removeLast();
}
- } else if (!lastUrl.isValid() || (lastUrl.scheme().isEmpty() && \
lastUrl.directory().isEmpty())) { + } else if (!lastUrl.isValid() || \
(lastUrl.scheme().isEmpty() && \
lastUrl.adjusted(QUrl::RemoveFilename).isEmpty())) {
// Sometimes valid filenames are not recognised by KURL::isLocalFile(), \
they are marked as invalid then suggestedFileName = lastUrl.url();
urls.removeLast();
@@ -544,9 +544,9 @@ void NewTransferDialogHandler::showNewTransferDialog(KUrl::List \
urls)
* and giving them the possibility to improve their mistake
*/
// if (!QFileInfo(urls.last().toLocalFile()).isDir()) {
-// folder = urls.last().directory(KUrl::AppendTrailingSlash);
+// folder = urls.last().directory(QUrl::AppendTrailingSlash);
// } else {
- folder = urls.last().path(KUrl::AddTrailingSlash);//checks if that \
folder is correct happen later + folder = \
urls.last().adjusted(QUrl::RemoveFilename).toString();//checks if that folder is \
correct happen later // }
urls.removeLast();
}
@@ -556,11 +556,11 @@ void NewTransferDialogHandler::showNewTransferDialog(KUrl::List \
urls) (*itUrls).folder = folder;
}
if (!suggestedFileName.isEmpty()) {
- (*itUrls).suggestedFileName = \
KUrl(suggestedFileName).pathOrUrl();//pathOrUrl to get a non percent encoded url + \
(*itUrls).suggestedFileName = QUrl(suggestedFileName).toString();//pathOrUrl to get a \
non percent encoded url }
newTransferDialogHandler->m_numJobs[newTransferDialogHandler->m_nextJobId] = \
urls.count();
- foreach (const KUrl &url, urls) {
+ foreach (const QUrl &url, urls) {
//needed to avoid when protocols like the desktop protocol is used, see \
bko:185283 KIO::Job *job = mostLocalUrlJob(url);
job->setProperty("jobId", (newTransferDialogHandler->m_nextJobId));
@@ -596,17 +596,17 @@ void NewTransferDialogHandler::handleUrls(const int jobId)
return;
}
- KUrl::List urls = (*itUrls).urls;
+ QList<QUrl> urls = (*itUrls).urls;
UrlChecker::removeDuplicates(urls);
QString folder = (*itUrls).folder;
- if (!folder.isEmpty() && (UrlChecker::checkFolder(KUrl(folder), true) != \
UrlChecker::NoError)) { + if (!folder.isEmpty() && \
(UrlChecker::checkFolder(QUrl(folder), true) != UrlChecker::NoError)) { \
folder.clear(); }
const QString suggestedFileName = (*itUrls).suggestedFileName;
- KUrl newDest;
- const KUrl folderUrl = KUrl(folder);
+ QUrl newDest;
+ const QUrl folderUrl = QUrl(folder);
//check if the sources are correct
UrlChecker check(UrlChecker::Source);
@@ -619,7 +619,7 @@ void NewTransferDialogHandler::handleUrls(const int jobId)
///Just one file to download, with a specified suggestedFileName, handle if \
possible if (!suggestedFileName.isEmpty() && (urls.count() == 1)) {
- const KUrl sourceUrl = urls.first();
+ const QUrl sourceUrl = urls.first();
const QList<TransferGroupHandler*> groups = \
KGet::groupsFromExceptions(sourceUrl);
const QString groupName = (groups.isEmpty() ? QString() : \
groups.first()->name()); QString defaultFolder;
@@ -630,15 +630,15 @@ void NewTransferDialogHandler::handleUrls(const int jobId)
}
if (!folder.isEmpty()) {
- const KUrl destUrl = UrlChecker::destUrl(KUrl(folder), sourceUrl, \
suggestedFileName); + const QUrl destUrl = \
UrlChecker::destUrl(QUrl(folder), sourceUrl, suggestedFileName); newDest = \
check.checkExistingFile(sourceUrl, destUrl); if (!newDest.isEmpty()) {
data << KGet::TransferData(sourceUrl, newDest, groupName);
}
urls.removeFirst();
} else if (((!groups.isEmpty() && !Settings::directoriesAsSuggestion()) || \
!Settings::askForDestination()) &&
- (UrlChecker::checkFolder(KUrl(defaultFolder)) == \
UrlChecker::NoError)) {
- const KUrl destUrl = UrlChecker::destUrl(KUrl(defaultFolder), sourceUrl, \
suggestedFileName); + (UrlChecker::checkFolder(QUrl(defaultFolder)) \
== UrlChecker::NoError)) { + const QUrl destUrl = \
UrlChecker::destUrl(QUrl(defaultFolder), sourceUrl, suggestedFileName); newDest = \
check.checkExistingFile(sourceUrl, destUrl); if (!newDest.isEmpty()) {
data << KGet::TransferData(sourceUrl, newDest, groupName);
@@ -660,11 +660,11 @@ void NewTransferDialogHandler::handleUrls(const int jobId)
const QStringList patterns = group->regExp().pattern().split(',');
//find all urls where a group can be identified
- KUrl::List::iterator it = urls.begin();
+ QList<QUrl>::iterator it = urls.begin();
while (it != urls.end()) {
- const KUrl sourceUrl = *it;
+ const QUrl sourceUrl = *it;
if (KGet::matchesExceptions(sourceUrl, patterns)) {
- const KUrl destUrl = UrlChecker::destUrl(folderUrl, sourceUrl);
+ const QUrl destUrl = UrlChecker::destUrl(folderUrl, sourceUrl);
newDest = check.checkExistingFile(sourceUrl, destUrl);
if (!newDest.isEmpty()) {
data << KGet::TransferData(sourceUrl, newDest, groupName);
@@ -677,8 +677,8 @@ void NewTransferDialogHandler::handleUrls(const int jobId)
}
//there are still some unhandled urls, i.e. for those no group could be \
found, add them with an empty group
- foreach (const KUrl &sourceUrl, urls) {
- const KUrl destUrl = UrlChecker::destUrl(folderUrl, sourceUrl);
+ foreach (const QUrl &sourceUrl, urls) {
+ const QUrl destUrl = UrlChecker::destUrl(folderUrl, sourceUrl);
newDest = check.checkExistingFile(sourceUrl, destUrl);
if (!newDest.isEmpty()) {
data << KGet::TransferData(sourceUrl, newDest);
@@ -701,7 +701,7 @@ void NewTransferDialogHandler::handleUrls(const int jobId)
break;
}
- const KUrl folderUrl = KUrl(group->defaultFolder());
+ const QUrl folderUrl = QUrl(group->defaultFolder());
if (UrlChecker::checkFolder(folderUrl) != UrlChecker::NoError) {
continue;
}
@@ -709,11 +709,11 @@ void NewTransferDialogHandler::handleUrls(const int jobId)
const QString groupName = group->name();
const QStringList patterns = group->regExp().pattern().split(',');
- KUrl::List::iterator it = urls.begin();
+ QList<QUrl>::iterator it = urls.begin();
while (it != urls.end()) {
- const KUrl sourceUrl = *it;
+ const QUrl sourceUrl = *it;
if (KGet::matchesExceptions(sourceUrl, patterns)) {
- const KUrl destUrl = UrlChecker::destUrl(folderUrl, sourceUrl);
+ const QUrl destUrl = UrlChecker::destUrl(folderUrl, sourceUrl);
newDest = check.checkExistingFile(sourceUrl, destUrl);
if (!newDest.isEmpty()) {
data << KGet::TransferData(sourceUrl, newDest, groupName);
@@ -732,10 +732,10 @@ void NewTransferDialogHandler::handleUrls(const int jobId)
//the download path will be always used
const QString dir = KGlobalSettings::downloadPath();
if (!dir.isEmpty()) {
- KUrl::List::iterator it = urls.begin();
+ QList<QUrl>::iterator it = urls.begin();
while (it != urls.end()) {
- const KUrl sourceUrl = *it;
- const KUrl destUrl = UrlChecker::destUrl(dir, sourceUrl);
+ const QUrl sourceUrl = *it;
+ const QUrl destUrl = UrlChecker::destUrl(dir, sourceUrl);
newDest = check.checkExistingFile(sourceUrl, destUrl);
if (!newDest.isEmpty()) {
data << KGet::TransferData(sourceUrl, newDest);
@@ -753,15 +753,15 @@ void NewTransferDialogHandler::handleUrls(const int jobId)
///Handle custom newtransferdialogs...
if ((!m_dialog || m_dialog->isEmpty()) && urls.count() == 1) {//FIXME why the \
m_dialog check? whenever a dialog has been created this would not be \
shown?
- KUrl url = urls.first();
+ QUrl url = urls.first();
QPointer<KDialog> dialog;
foreach (TransferFactory * factory, KGet::factories()) {
const QList<TransferGroupHandler*> groups = \
KGet::groupsFromExceptions(url);
dialog = factory->createNewTransferDialog(url, suggestedFileName, \
!groups.isEmpty() ? groups.first() : 0); if (dialog) {
- KWindowInfo info = \
KWindowSystem::windowInfo(KGet::m_mainWindow->winId(), NET::WMDesktop, \
NET::WMDesktop); + /**KWindowInfo info = \
KWindowSystem::windowInfo(KGet::m_mainWindow->winId(), NET::WMDesktop, \
NET::WMDesktop); KWindowSystem::setCurrentDesktop(info.desktop());
- KWindowSystem::forceActiveWindow(KGet::m_mainWindow->winId());
+ KWindowSystem::forceActiveWindow(KGet::m_mainWindow->winId());**/
dialog->exec();
delete dialog;
@@ -778,7 +778,7 @@ void NewTransferDialogHandler::handleUrls(const int jobId)
}
}
-void NewTransferDialogHandler::createDialog(const KUrl::List &urls, const QString \
&suggestedFileName) +void NewTransferDialogHandler::createDialog(const QList<QUrl> \
&urls, const QString &suggestedFileName) {
if (!m_dialog) {
m_dialog = new NewTransferDialog(KGet::m_mainWindow);
diff --git a/ui/newtransferdialog.h b/ui/newtransferdialog.h
index 300166c..d21bedb 100644
--- a/ui/newtransferdialog.h
+++ b/ui/newtransferdialog.h
@@ -15,7 +15,7 @@
#define NEW_TRANSFER_DIALOG_H
#include <KDialog>
-#include <KUrl>
+#include <QUrl>
#include "ui_newtransferwidget.h"
@@ -24,10 +24,10 @@ class TransferHandler;
/**
* Dialog to allow add one or more transfers to kget.
-* If only one transfer is added then the dialog shows a KUrlRequester.
+* If only one transfer is added then the dialog shows a QUrlRequester.
* If a list of transfers are added then the dialog shows a KListWidget (multiple = \
true)
* with the transfers as checkable items.
-* Also display a KUrlComboRequester for the destination file (or folder if multiple \
= true) +* Also display a QUrlComboRequester for the destination file (or folder if \
multiple = true)
* And a QComboBox with the groups of transfer in case there are more than one
*
* @note this class is private and should be used via NewTransferDialogHandler
@@ -59,7 +59,7 @@ class NewTransferDialog : public KDialog
/**
* Shows the dialog adding one url list transfers
*/
- void showDialog(KUrl::List list, const QString &suggestedFileName = \
QString()); + void showDialog(QList<QUrl> list, const QString \
&suggestedFileName = QString()); void prepareDialog();
bool isEmpty();
@@ -71,7 +71,7 @@ class NewTransferDialog : public KDialog
/**
* Set sources to the dialog
*/
- void setSource(const KUrl::List &sources);
+ void setSource(const QList<QUrl> &sources);
void setDestinationFileName(const QString &filename);
void setDestination();
@@ -87,10 +87,10 @@ class NewTransferDialog : public KDialog
Ui::NewTransferWidget ui;
QWidget *m_window;
QTimer *m_timer;
- KUrl::List m_sources;
+ QList<QUrl> m_sources;
//points to a folder if m_multiple otherwise to the destination
- KUrl m_destination;
+ QUrl m_destination;
TransferHandler *m_existingTransfer;
@@ -110,9 +110,9 @@ class NewTransferDialogHandler : public QObject
~NewTransferDialogHandler();
/**
- * @see showNewTransferDialog(KUrl::List)
+ * @see showNewTransferDialog(QList<QUrl>)
*/
- static void showNewTransferDialog(const KUrl &url = KUrl());
+ static void showNewTransferDialog(const QUrl &url = QUrl());
/**
* This will show a dialog to the user to input needed information.
@@ -123,18 +123,18 @@ class NewTransferDialogHandler : public QObject
*
* @note MainWindow will always be the parent widget
*/
- static void showNewTransferDialog(KUrl::List list);
+ static void showNewTransferDialog(QList<QUrl> list);
private slots:
void slotMostLocalUrlResult(KJob *job);
private:
void handleUrls(const int jobId);
- void createDialog(const KUrl::List &urls, const QString &suggestedFileName);
+ void createDialog(const QList<QUrl> &urls, const QString \
&suggestedFileName);
private:
struct UrlData {
- KUrl::List urls;
+ QList<QUrl> urls;
QString folder;
QString suggestedFileName;
QWidget *parent;
diff --git a/ui/renamefile.cpp b/ui/renamefile.cpp
index 9842d7b..b738e9f 100644
--- a/ui/renamefile.cpp
+++ b/ui/renamefile.cpp
@@ -36,7 +36,7 @@ RenameFile::RenameFile(FileModel *model, const QModelIndex &index, \
QWidget *pare setMainWidget(widget);
const QString originalName = m_model->data(m_index, Qt::DisplayRole).toString();
- m_dest = m_model->getUrl(m_index).upUrl();
+ m_dest = m_model->getUrl(m_index).adjusted(QUrl::RemoveFilename);
ui.label->setText(i18n("Rename %1 to:", originalName));
ui.name->setText(originalName);
@@ -51,10 +51,10 @@ RenameFile::RenameFile(FileModel *model, const QModelIndex \
&index, QWidget *pare void RenameFile::updateButton()
{
const QString newName = ui.name->text();
- KUrl dest = m_dest;
- dest.addPath(newName);
+ QUrl dest = m_dest;
+ dest.setPath(m_dest.toString() + newName);
- const bool enabled = !newName.isEmpty() && !QFile::exists(dest.pathOrUrl());
+ const bool enabled = !newName.isEmpty() && !QFile::exists(dest.toString());
enableButtonOk(enabled);
}
diff --git a/ui/renamefile.h b/ui/renamefile.h
index f84d21b..5c076a8 100644
--- a/ui/renamefile.h
+++ b/ui/renamefile.h
@@ -21,6 +21,7 @@
#define RENAMEFILE_H
#include <KDialog>
+#include <QUrl>
#include "ui_renamefile.h"
@@ -43,7 +44,7 @@ class RenameFile : public KDialog
FileModel *m_model;
QModelIndex m_index;
Ui::RenameFile ui;
- KUrl m_dest;
+ QUrl m_dest;
};
#endif
diff --git a/ui/signaturedlg.cpp b/ui/signaturedlg.cpp
index ff72241..955a971 100644
--- a/ui/signaturedlg.cpp
+++ b/ui/signaturedlg.cpp
@@ -33,10 +33,11 @@
#include <KFileDialog>
#include <KLocale>
+#include <KIconLoader>
const QStringList SignatureDlg::OWNERTRUST = QStringList() << i18nc("trust level", \
"Unknown") << i18nc("trust level", "Undefined") << i18nc("trust level", "Never") << \
i18nc("trust level", "Marginal") << i18nc("trust level", "Full") << i18nc("trust \
level", "Ultimate");
-SignatureDlg::SignatureDlg(TransferHandler *transfer, const KUrl &dest, QWidget \
*parent, Qt::WFlags flags) +SignatureDlg::SignatureDlg(TransferHandler *transfer, \
const QUrl &dest, QWidget *parent, Qt::WFlags flags) : \
KGetSaveSizeDialog("SignatureDlg", parent, flags), \
m_signature(transfer->signature(dest)), m_fileModel(transfer->fileModel())
@@ -44,8 +45,8 @@ SignatureDlg::SignatureDlg(TransferHandler *transfer, const KUrl \
&dest, QWidget
setCaption(i18nc("Signature here is meant in cryptographic terms, so the \
signature of a file.", "Signature of %1.", dest.fileName())); QWidget *widget = new \
QWidget(this); ui.setupUi(widget);
- ui.loadSignature->setIcon(KIcon("document-open"));
- ui.verify->setIcon(KIcon("document-encrypt"));
+ ui.loadSignature->setIcon(QIcon::fromTheme("document-open"));
+ ui.verify->setIcon(QIcon::fromTheme("document-encrypt"));
setMainWidget(widget);
ui.information->setCloseButtonVisible(false);
@@ -71,7 +72,7 @@ SignatureDlg::SignatureDlg(TransferHandler *transfer, const KUrl \
&dest, QWidget }
}
-void SignatureDlg::fileFinished(const KUrl &file)
+void SignatureDlg::fileFinished(const QUrl &file)
{
if (m_fileModel && (m_fileModel->getUrl(m_file) == file)) {
updateButtons();
@@ -273,13 +274,13 @@ void SignatureDlg::updateData()
case Signature::Verified:
case Signature::VerifiedInformation:
case Signature::VerifiedWarning:
- ui.verificationIcon->setPixmap(KIcon("dialog-ok").pixmap(iconSize));
+ ui.verificationIcon->setPixmap(QIcon::fromTheme("dialog-ok").pixmap(iconSize));
ui.verificationIcon->show();
ui.verified->setText(i18nc("pgp signature is verified", "Verified"));
break;
case Signature::NotVerified:
ui.verified->setText(i18nc("pgp signature is not verified", "Failed"));
- ui.verificationIcon->setPixmap(KIcon("dialog-error").pixmap(iconSize));
+ ui.verificationIcon->setPixmap(QIcon::fromTheme("dialog-error").pixmap(iconSize));
ui.verificationIcon->show();
information.prepend(i18n("Caution: Verification failed. Either you \
entered the wrong signature, or the data has been modified.")); error = true;
diff --git a/ui/signaturedlg.h b/ui/signaturedlg.h
index f3432e8..40e301e 100644
--- a/ui/signaturedlg.h
+++ b/ui/signaturedlg.h
@@ -32,10 +32,10 @@ class SignatureDlg : public KGetSaveSizeDialog
Q_OBJECT
public:
- SignatureDlg(TransferHandler *transfer, const KUrl &dest, QWidget *parent = \
0, Qt::WFlags flags = 0); + SignatureDlg(TransferHandler *transfer, const QUrl \
&dest, QWidget *parent = 0, Qt::WFlags flags = 0);
private slots:
- void fileFinished(const KUrl &file);
+ void fileFinished(const QUrl &file);
void verifyClicked();
void updateData();
void updateButtons();
diff --git a/ui/transferdetails.cpp b/ui/transferdetails.cpp
index fb0c493..e317087 100644
--- a/ui/transferdetails.cpp
+++ b/ui/transferdetails.cpp
@@ -30,8 +30,8 @@ TransferDetails::TransferDetails(TransferHandler * transfer)
m_layout->addWidget(m_genericWidget);
setLayout(m_layout);
- frm.sourceContentEdit->setText(m_transfer->source().pathOrUrl());
- frm.destContentEdit->setText(m_transfer->dest().pathOrUrl());
+ frm.sourceContentEdit->setText(m_transfer->source().toString());
+ frm.destContentEdit->setText(m_transfer->dest().toString());
//This updates the widget with the right values
slotTransferChanged(transfer, 0xFFFFFFFF);
@@ -92,11 +92,11 @@ void TransferDetails::slotTransferChanged(TransferHandler * \
transfer, TransferHa }
if(flags & Transfer::Tc_FileName) {
- frm.destContentEdit->setText(m_transfer->dest().pathOrUrl());
+ frm.destContentEdit->setText(m_transfer->dest().toString());
}
if (flags & Transfer::Tc_Source) {
- frm.sourceContentEdit->setText(m_transfer->source().pathOrUrl());
+ frm.sourceContentEdit->setText(m_transfer->source().toString());
}
frm.remainingTimeLabel->setText(KIO::convertSeconds(m_transfer->remainingTime()));
diff --git a/ui/transfersettingsdialog.cpp b/ui/transfersettingsdialog.cpp
index 503f15a..fdeb5b8 100644
--- a/ui/transfersettingsdialog.cpp
+++ b/ui/transfersettingsdialog.cpp
@@ -21,6 +21,7 @@
#include <KMessageBox>
#include <KLineEdit>
+#include <KLocale>
#include <QSortFilterProxyModel>
TransferSettingsDialog::TransferSettingsDialog(QWidget *parent, TransferHandler \
*transfer) @@ -34,16 +35,16 @@ TransferSettingsDialog::TransferSettingsDialog(QWidget \
*parent, TransferHandler QWidget *widget = new QWidget(this);
ui.setupUi(widget);
setMainWidget(widget);
- ui.ktitlewidget->setPixmap(SmallIcon("preferences-other"));
+ ui.ktitlewidget->setPixmap(QIcon::fromTheme("preferences-other").pixmap(16));
ui.downloadSpin->setValue(m_transfer->downloadLimit(Transfer::VisibleSpeedLimit));
ui.uploadSpin->setValue(m_transfer->uploadLimit(Transfer::VisibleSpeedLimit));
ui.ratioSpin->setValue(m_transfer->maximumShareRatio());
- ui.destination->setUrl(m_transfer->directory().pathOrUrl());
+ ui.destination->setUrl(m_transfer->directory().toString());
ui.destination->lineEdit()->setReadOnly(true);
- ui.rename->setIcon(KIcon("edit-rename"));
- ui.mirrors->setIcon(KIcon("download"));
- ui.signature->setIcon(KIcon("application-pgp-signature"));
- ui.verification->setIcon(KIcon("document-decrypt"));
+ ui.rename->setIcon(QIcon::fromTheme("edit-rename"));
+ ui.mirrors->setIcon(QIcon::fromTheme("download"));
+ ui.signature->setIcon(QIcon::fromTheme("application-pgp-signature"));
+ ui.verification->setIcon(QIcon::fromTheme("document-decrypt"));
if (m_model)
{
@@ -157,8 +158,8 @@ void TransferSettingsDialog::slotSelectionChanged()
void TransferSettingsDialog::save()
{//TODO: Set to -1 when no limit
- KUrl oldDirectory = m_transfer->directory();
- KUrl newDirectory = ui.destination->url();
+ QUrl oldDirectory = m_transfer->directory();
+ QUrl newDirectory = ui.destination->url();
if ((oldDirectory != newDirectory) && !m_transfer->setDirectory(newDirectory))
{
KMessageBox::error(this, i18n("Changing the destination did not work, the \
destination stays unmodified."), i18n("Destination unmodified"));
diff --git a/ui/transfersview.cpp b/ui/transfersview.cpp
index 7eee6c7..66756b0 100644
--- a/ui/transfersview.cpp
+++ b/ui/transfersview.cpp
@@ -240,7 +240,7 @@ void TransfersView::slotItemCollapsed(const QModelIndex & index)
QList<TransferHandler *> transfers = groupHandler->transfers();
foreach(TransferHandler * transfer, transfers) {
- kDebug(5001) << "Transfer = " << transfer->source().prettyUrl();
+ kDebug(5001) << "Transfer = " << transfer->source().toString();
view_delegate->contractItem(KGet::model()->itemFromTransferHandler(transfer)->index());
}
}
diff --git a/ui/transfersviewdelegate.cpp b/ui/transfersviewdelegate.cpp
index 933709f..0ded2db 100644
--- a/ui/transfersviewdelegate.cpp
+++ b/ui/transfersviewdelegate.cpp
@@ -317,8 +317,8 @@ TransfersViewDelegate::TransfersViewDelegate(QAbstractItemView \
*parent) : BasicTransfersViewDelegate(parent)
{
Q_ASSERT(qobject_cast<QAbstractItemView *>(parent));
- setExtendPixmap(SmallIcon("arrow-right"));
- setContractPixmap(SmallIcon("arrow-down"));
+ setExtendPixmap(QIcon::fromTheme("arrow-right").pixmap(16));
+ setContractPixmap(QIcon::fromTheme("arrow-down").pixmap(16));
}
void TransfersViewDelegate::paint(QPainter * painter, const QStyleOptionViewItem & \
option, const QModelIndex & index) const
diff --git a/ui/tray.cpp b/ui/tray.cpp
index a54fe9a..735f848 100644
--- a/ui/tray.cpp
+++ b/ui/tray.cpp
@@ -15,6 +15,7 @@
#include <kapplication.h>
#include <kmenu.h>
#include <kdebug.h>
+#include <klocale.h>
#include <QClipboard>
@@ -25,7 +26,7 @@ Tray::Tray(MainWindow * parent)
: KStatusNotifierItem(parent)
{
// set up the context menu
- KMenu * cm = contextMenu();
+ QMenu * cm = contextMenu();
cm->addAction( parent->actionCollection()->action("new_download") );
cm->addAction( parent->actionCollection()->action("import_links") );
cm->addSeparator();
diff --git a/ui/verificationdialog.cpp b/ui/verificationdialog.cpp
index d7fdae3..407c0da 100644
--- a/ui/verificationdialog.cpp
+++ b/ui/verificationdialog.cpp
@@ -80,7 +80,7 @@ void VerificationAddDlg::addChecksum()
}
}
-VerificationDialog::VerificationDialog(QWidget *parent, TransferHandler *transfer, \
const KUrl &file) +VerificationDialog::VerificationDialog(QWidget *parent, \
TransferHandler *transfer, const QUrl &file) : \
KGetSaveSizeDialog("VerificationDialog", parent), m_transfer(transfer),
m_verifier(transfer->verifier(file)),
@@ -116,7 +116,7 @@ VerificationDialog::VerificationDialog(QWidget *parent, \
TransferHandler *transfe m_fileModel = m_transfer->fileModel();
if (m_fileModel) {
m_file = m_fileModel->index(file, FileItem::File);
- connect(m_fileModel, SIGNAL(fileFinished(KUrl)), this, \
SLOT(fileFinished(KUrl))); + connect(m_fileModel, \
SIGNAL(fileFinished(QUrl)), this, SLOT(fileFinished(QUrl))); }
updateButtons();
@@ -148,7 +148,7 @@ void VerificationDialog::slotFinished()
}
}
-void VerificationDialog::fileFinished(const KUrl &file)
+void VerificationDialog::fileFinished(const QUrl &file)
{
if (m_fileModel && (m_fileModel->getUrl(m_file) == file)) {
updateButtons();
diff --git a/ui/verificationdialog.h b/ui/verificationdialog.h
index 984d3fd..d1e1a9f 100644
--- a/ui/verificationdialog.h
+++ b/ui/verificationdialog.h
@@ -55,12 +55,12 @@ class VerificationDialog : public KGetSaveSizeDialog
Q_OBJECT
public:
- VerificationDialog(QWidget *parent, TransferHandler *transfer, const KUrl \
&file); + VerificationDialog(QWidget *parent, TransferHandler *transfer, const \
QUrl &file);
virtual QSize sizeHint() const;
private slots:
- void fileFinished(const KUrl &file);
+ void fileFinished(const QUrl &file);
void updateButtons();
void addClicked();
void removeClicked();
diff --git a/ui/viewscontainer.h b/ui/viewscontainer.h
index 9b5dc46..966aadc 100644
--- a/ui/viewscontainer.h
+++ b/ui/viewscontainer.h
@@ -14,7 +14,7 @@
#ifndef VIEWSCONTAINER_H
#define VIEWSCONTAINER_H
-#include <QWidget>
+#include <QtWidgets/QWidget>
class TransfersView;
class TransferHandler;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic