Page MenuHomePhorge

No OneTemporary

This file is larger than 256 KB, so syntax highlighting was skipped.
diff --git a/CMakeLists.txt b/CMakeLists.txt
index fd7643ad50..2c2e922a48 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,406 +1,407 @@
cmake_minimum_required(VERSION 2.8.7)
project(kdelibs)
# where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/ is checked
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules")
# Make CPack available to easy generate binary packages
include(CPack)
find_file(FOUND_KDE4_HEADERS kglobal.h)
if (${FOUND_KDE4_HEADERS})
string(REGEX MATCH ${CMAKE_INSTALL_PREFIX} COMPATIBLE_HEADERS_TEST ${FOUND_KDE4_HEADERS})
if (NOT ${COMPATIBLE_HEADERS_TEST})
message("Found KDE4 headers. This will cause compiling failures while developing KDE Frameworks 5. Uninstall distro installed headers if applicable")
message("FOUND: ${FOUND_KDE4_HEADERS}")
return()
endif()
endif()
################# set KDE specific information #################
set (KDE_VERSION_MAJOR 4)
set (KDE_VERSION_MINOR 90)
set (KDE_VERSION_RELEASE 00)
set (KDE_VERSION "${KDE_VERSION_MAJOR}.${KDE_VERSION_MINOR}.${KDE_VERSION_RELEASE}" )
set (KDE_VERSION_STRING "${KDE_VERSION} (4.90.0 (KDE Frameworks >= 20120113)")
set (KDE_DISTRIBUTION_TEXT "compiled sources" CACHE STRING "Indicate the distribution in bug reports" )
# win32: give kde home in debug mode a different name as the release home dir because the settings and caches are different
if (WIN32 AND CMAKE_BUILD_TYPE STREQUAL "Debug")
set (_KDE_DEFAULT_HOME_POSTFIX "-debug" CACHE STRING "default KDE home directory postfix" )
endif (WIN32 AND CMAKE_BUILD_TYPE STREQUAL "Debug")
set (KDE_DEFAULT_HOME ".kde${_KDE_DEFAULT_HOME_POSTFIX}" CACHE STRING "The default KDE home directory" )
# this must be before FindKDE4Internal in order to preset the result of the visibility test, so that it will be skipped
option(KHTML_BUILD_TESTREGRESSION "Build KHTML's testregression. Note: this disables hidden visibility")
# Disable visibility if testregression is built, because the symbols are needed then
if (KHTML_BUILD_TESTREGRESSION)
set (__KDE_HAVE_GCC_VISIBILITY 0)
endif (KHTML_BUILD_TESTREGRESSION)
option(STATIC_LIBRARY "Build kdelibs as static libraries." FALSE)
option(QT5_BUILD "Build kdelibs against Qt5." FALSE)
find_package(extra-cmake-modules 0.0.2 REQUIRED)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${EXTRA_CMAKE_MODULES_MODULE_PATH})
if (NOT QT5_BUILD)
add_subdirectory( libinqt5 )
set(INQT5_LIBRARY inqt5)
include_directories(
${CMAKE_SOURCE_DIR}/libinqt5/src/
${CMAKE_BINARY_DIR}/libinqt5/src/
)
endif()
add_subdirectory( libqtmimetypes )
add_subdirectory( tier1 )
set(CMAKE_AUTOMOC ON)
# By default don't add any linked libraries to the "exported"
# link interfaces of shared libraries, so that executables linking
# against these libraries will not automatically add implicit
# dependencies to their link list.
#
# This reduces inter-package dependencies and makes it easier to remove
# dependencies of shared libraries without breaking binary compatibility.
set(CMAKE_LINK_INTERFACE_LIBRARIES "")
################# write platform profile file which will be installed #################
include(CreateKDEPlatformProfile.cmake)
if(KDE_PLATFORM_FEATURE_DISABLE_DEPRECATED)
set(KDE_NO_DEPRECATED TRUE)
endif(KDE_PLATFORM_FEATURE_DISABLE_DEPRECATED)
############### Load the CTest options ###############
# CTestCustom.cmake has to be in the CTEST_BINARY_DIR.
# in the KDE build system, this is the same as CMAKE_BINARY_DIR.
configure_file(${CMAKE_SOURCE_DIR}/CTestCustom.cmake ${CMAKE_BINARY_DIR}/CTestCustom.cmake COPYONLY)
################# now find all used packages #################
set (QT_MIN_VERSION "4.7.0")
find_package(KDE4Internal REQUIRED)
include(KDE4Defaults)
include (MacroLibrary)
if (APPLE)
find_package(Carbon REQUIRED)
endif (APPLE)
if(UNIX AND Q_WS_X11)
#X11 Session Management (SM) is required
#X11_SM_FOUND is set in FindX11, which is required by KDE4Internal
if(NOT X11_SM_FOUND)
message(FATAL_ERROR "\nThe X11 Session Management (SM) development package could not be found.\nPlease install libSM.\n")
endif(NOT X11_SM_FOUND)
endif(UNIX AND Q_WS_X11)
#required features:
# Perl is used e.g. in khtml, kjs, kjsembed and others
find_package(Perl)
macro_log_feature(PERL_FOUND "Perl" "Needed for building kdelibs" "http://www.perl.org" TRUE "" "")
find_package(ZLIB)
macro_log_feature(ZLIB_FOUND "ZLib" "Support for gzip compressed files and data streams" "http://www.zlib.net" TRUE "" "Required by the core KDE libraries and some critical kioslaves")
set(STRIGI_MIN_VERSION 0.6.3)
find_package(Strigi)
if (WIN32)
set (STRIGI_REQUIRED FALSE)
set (STRIGI_EXTRA_TEXT "")
else (WIN32)
set (STRIGI_REQUIRED TRUE)
set (STRIGI_EXTRA_TEXT "Required by some critical kioslaves")
endif (WIN32)
macro_log_feature(STRIGI_FOUND "Strigi" "Desktop indexing and search support" "http://strigi.sourceforge.net" ${STRIGI_REQUIRED} "${STRIGI_MIN_VERSION}" ${STRIGI_EXTRA_TEXT})
set(LIBATTICA_MIN_VERSION "0.1.90")
find_package(LibAttica)
macro_log_feature(LIBATTICA_FOUND "libattica" "Support for Get Hot New Stuff" "git clone git://anongit.kde.org/attica" TRUE "${LIBATTICA_MIN_VERSION}" "")
#optional features
if(X11_FOUND)
#X11_Xrender discovery is done by FindX11
macro_log_feature(X11_Xrender_FOUND "X Rendering Extension (libXrender)" "Support for compositing, rendering operations, and alpha-blending" "http://www.x.org" FALSE "" "STRONGLY RECOMMENDED")
macro_bool_to_01(X11_Xscreensaver_FOUND HAVE_XSCREENSAVER)
macro_bool_to_01(X11_XSync_FOUND HAVE_XSYNC)
macro_log_feature(HAVE_XSCREENSAVER "X Screensaver Extension (libXss)" "Support for KIdleTime (fallback mode)" "http://www.x.org/" FALSE "" "")
macro_log_feature(HAVE_XSYNC "X Sync Extension (libXext)" "Efficient operation of KIdleTime" "http://www.x.org/" FALSE "" "STRONGLY RECOMMENDED")
if(NOT HAVE_XSYNC AND NOT HAVE_XSCREENSAVER)
message(FATAL_ERROR "\nNeither the XSync (libXext) nor XScreensaver (libXss) development package was found.\nPlease install one of them (XSync is recommended)\n")
endif(NOT HAVE_XSYNC AND NOT HAVE_XSCREENSAVER)
endif(X11_FOUND)
find_package(OpenSSL)
macro_log_feature(OPENSSL_FOUND "OpenSSL" "Support for secure network communications (SSL and TLS)" "http://openssl.org" FALSE "" "STRONGLY RECOMMENDED: KDE uses OpenSSL for the bulk of secure communications, including secure web browsing via HTTPS")
find_package(Libintl)
macro_log_feature(LIBINTL_FOUND "Libintl" "Support for multiple languages" "http://www.gnu.org/software/gettext" FALSE "" "STRONGLY RECOMMENDED: Enables KDE to be available in many different languages")
find_package(QCA2)
macro_log_feature(QCA2_FOUND "QCA2" "Support for remote plasma widgets" "http://delta.affinix.com/qca" FALSE "2.0.0" "")
find_package(DBusMenuQt)
macro_log_feature(DBUSMENUQT_FOUND "DBusMenuQt" "Support for notification area menus via the DBusMenu protocol" "https://launchpad.net/libdbusmenu-qt" TRUE "" "")
################# Disallow in-source build #################
macro_ensure_out_of_source_build("kdelibs requires an out of source build. Please create a separate build directory and run 'cmake path_to_kdelibs [options]' there.")
# ... and warn in case of an earlier in-source build
set(generatedFileInSourceDir EXISTS ${kdelibs_SOURCE_DIR}/kdemacros.h OR EXISTS ${kdelibs_SOURCE_DIR}/config.h)
if(${generatedFileInSourceDir})
message(STATUS "kdemacros.h or config.h exists in your source directory.")
message(FATAL_ERROR "Please run svn-clean, it would seem that your source directory has generated files in it.")
endif(${generatedFileInSourceDir})
#########################################################################
add_definitions(${QT_DEFINITIONS} ${KDE4_DEFINITIONS})
remove_definitions(-DQT3_SUPPORT_WARNINGS -DQT3_SUPPORT)
add_definitions(-DQT_USE_FAST_CONCATENATION -DQT_USE_FAST_OPERATOR_PLUS)
################# setup the include directories #################
# for including config.h and for includes like <kparts/foo.h>
include_directories( ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR}/interfaces)
if(QCA2_FOUND)
include_directories(
${QCA2_INCLUDE_DIR}
)
endif(QCA2_FOUND)
# Those variables for are only valid inside of kdelibs, of course.
# Use the one variable for the lib you depend upon.
# E.g. kdeui uses ${KDE4_KDECORE_INCLUDES}. Something that depends on kparts uses ${KDE4_KPARTS_INCLUDES}.
set(KDE4_KJS_INCLUDES ${CMAKE_SOURCE_DIR}/kjs
${CMAKE_BINARY_DIR}/kjs)
if(NOT WINCE)
set(KDE4_KDECORE_INCLUDES ${KDE4_KJS_INCLUDES} )
endif(NOT WINCE)
set(KDE4_KCONFIG_INCLUDES ${CMAKE_SOURCE_DIR}/kdecore/config
${CMAKE_SOURCE_DIR}/staging/kcoreaddons/src/io # for kurl.h
${CMAKE_BINARY_DIR}/staging/kcoreaddons/src
)
# kdecore depends on Qt and kcoreaddons (need only headers from kjs)
set(KDE4_KDECORE_INCLUDES ${KDE4_KDECORE_INCLUDES}
${CMAKE_SOURCE_DIR}/kdecore
${CMAKE_BINARY_DIR}/kdecore
${CMAKE_SOURCE_DIR}/kdecore/compression
${CMAKE_SOURCE_DIR}/kdecore/config
${CMAKE_SOURCE_DIR}/kdecore/date
${CMAKE_SOURCE_DIR}/kdecore/io
${CMAKE_SOURCE_DIR}/kdecore/kernel
${CMAKE_SOURCE_DIR}/kdecore/network
${CMAKE_SOURCE_DIR}/kdecore/services
${CMAKE_SOURCE_DIR}/kdecore/localization
${CMAKE_SOURCE_DIR}/kdecore/sycoca
${CMAKE_SOURCE_DIR}/kdecore/text
${CMAKE_SOURCE_DIR}/kdecore/util
${CMAKE_SOURCE_DIR}/kdecore/sonnet
${CMAKE_SOURCE_DIR}/staging/kcoreaddons/src/io
${CMAKE_SOURCE_DIR}/staging/kcoreaddons/src/kernel
${CMAKE_SOURCE_DIR}/staging/kcoreaddons/src/jobs
${CMAKE_SOURCE_DIR}/staging/kcoreaddons/src/text
${CMAKE_BINARY_DIR}/staging/kcoreaddons/src
${CMAKE_BINARY_DIR}/staging/kde4support/src
${CMAKE_SOURCE_DIR}/staging/kde4support/src
${CMAKE_SOURCE_DIR}/libqtmimetypes/include/QtMimeTypes
${QT_INCLUDES}
${_KDE4_PLATFORM_INCLUDE_DIRS})
# kdeui depends on kdecore
set(KDE4_KDEUI_INCLUDES ${CMAKE_SOURCE_DIR}/kdeui
${CMAKE_BINARY_DIR}/kdeui
${CMAKE_SOURCE_DIR}/kdeui/actions
${CMAKE_SOURCE_DIR}/kdeui/colors
${CMAKE_SOURCE_DIR}/kdeui/config
${CMAKE_SOURCE_DIR}/kdeui/dialogs
${CMAKE_SOURCE_DIR}/kdeui/findreplace
${CMAKE_SOURCE_DIR}/kdeui/fonts
${CMAKE_SOURCE_DIR}/kdeui/icons
${CMAKE_SOURCE_DIR}/kdeui/itemviews
${CMAKE_SOURCE_DIR}/kdeui/jobs
${CMAKE_SOURCE_DIR}/kdeui/kernel
${CMAKE_SOURCE_DIR}/kdeui/notifications
${CMAKE_SOURCE_DIR}/kdeui/paged
${CMAKE_SOURCE_DIR}/kdeui/plotting
${CMAKE_SOURCE_DIR}/kdeui/shortcuts
${CMAKE_SOURCE_DIR}/kdeui/sonnet
${CMAKE_SOURCE_DIR}/kdeui/util
${CMAKE_SOURCE_DIR}/kdeui/widgets
${CMAKE_SOURCE_DIR}/kdeui/windowmanagement
${CMAKE_SOURCE_DIR}/kdeui/xmlgui
${KDE4_KDECORE_INCLUDES})
# kio depends on kdeui
set(KDE4_KIO_INCLUDES ${CMAKE_SOURCE_DIR}/kio
+ ${CMAKE_BINARY_DIR}/kio
${CMAKE_SOURCE_DIR}/kio/bookmarks
${CMAKE_SOURCE_DIR}/kio/kio
${CMAKE_SOURCE_DIR}/kio/kfile
${KDE4_KDEUI_INCLUDES})
# kpty
set(KDE4_KPTY_INCLUDES ${CMAKE_SOURCE_DIR}/kpty ${KDE4_KIO_INCLUDES} )
# kparts depends on kio
set(KDE4_KPARTS_INCLUDES ${CMAKE_SOURCE_DIR}/kparts
${KDE4_KIO_INCLUDES})
# kde3support depends on kparts
set(KDE4_KDE3SUPPORT_INCLUDES ${CMAKE_SOURCE_DIR}/kde3support
${CMAKE_SOURCE_DIR}/kde3support/kdecore
${CMAKE_SOURCE_DIR}/kde3support/kdeui
${CMAKE_SOURCE_DIR}/kde3support/kio
${KDE4_KPARTS_INCLUDES})
if(NOT WINCE)
set(KDE4_KHTML_INCLUDES ${CMAKE_SOURCE_DIR}/khtml)
endif(NOT WINCE)
################# configure checks and create the configured files #################
if(WINCE)
set(STATIC_LIBRARY ON)
add_definitions(-DSTATIC_INSTALL_PATH=L\\\"/programme/kde\\\")
endif(WINCE)
if(STATIC_LIBRARY)
set(LIBRARY_TYPE STATIC)
add_definitions(-DKDELIBS_STATIC_LIBS)
message(STATUS "Building kdelibs as static libraries")
else(STATIC_LIBRARY)
set(LIBRARY_TYPE SHARED)
endif(STATIC_LIBRARY)
# ACL stuff (used in kio/ and kioslaves/)
find_package(ACL)
macro_bool_to_01(ACL_FOUND HAVE_LIBACL HAVE_POSIX_ACL)
macro_log_feature(ACL_FOUND "LibACL" "Support for manipulating access control lists" "ftp://oss.sgi.com/projects/xfs/cmd_tars" FALSE "" "STRONGLY RECOMMENDED")
configure_file(config-acl.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-acl.h )
include(ConfigureChecks.cmake)
# now create config headers
configure_file(config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h )
configure_file(config-prefix.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-prefix.h )
configure_file(config-compiler.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-compiler.h )
configure_file(config-pty.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-pty.h )
configure_file(kdemacros.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/kdemacros.h )
# these two calls here should go somewhere else, Alex
check_library_exists(nsl gethostbyname "" HAVE_NSL_LIBRARY)
check_library_exists(socket connect "" HAVE_SOCKET_LIBRARY)
# TODO: Port away from this:
add_definitions(-DKDE_NO_WINDOWSYSTEM)
add_definitions(-DKDE_NO_PHONON)
################# list the subdirectories #################
add_subdirectory( cmake )
add_subdirectory( kdecore )
add_subdirectory( staging )
add_subdirectory( tier2 )
if (UNIX)
add_subdirectory( kpty )
add_subdirectory( kdesu )
endif (UNIX)
if(NOT WINCE)
add_subdirectory( kjs )
add_subdirectory( kjsembed )
endif(NOT WINCE)
add_subdirectory( kconf_update )
add_subdirectory( licenses )
add_subdirectory( mimetypes )
add_subdirectory( kdeui )
add_subdirectory( dnssd )
add_subdirectory( security )
add_subdirectory( kio )
add_subdirectory( kded )
if (QT_QT3SUPPORT_FOUND)
add_subdirectory( kde3support )
endif (QT_QT3SUPPORT_FOUND)
add_subdirectory( kfile )
if(NOT WINCE)
add_subdirectory( kdoctools )
endif(NOT WINCE)
add_subdirectory( kioslave )
add_subdirectory( kparts )
add_subdirectory( kunitconversion )
if(NOT WINCE)
# TO BE SPLITTED OUT add_subdirectory( khtml )
endif(NOT WINCE)
add_subdirectory( interfaces )
add_subdirectory( kdewidgets )
add_subdirectory( kross )
add_subdirectory( kutils )
add_subdirectory( kinit )
if(NOT WINCE)
add_subdirectory( kimgio )
endif(NOT WINCE)
add_subdirectory( knewstuff )
if(Qt5WebKit_FOUND OR NOT QT5_BUILD)
add_subdirectory( kdewebkit )
endif()
add_subdirectory( includes )
macro_optional_add_subdirectory( doc )
add_subdirectory( experimental )
add_subdirectory( knotify )
find_package(KdepimLibs 4.5.60)
macro_log_feature(KDEPIMLIBS_FOUND "kdepimlibs" "KDE PIM libraries" "http://www.kde.org" FALSE "" "Needed for building several Plasma DataEngines")
# Plasma needs gpgme++
if(KDEPIMLIBS_FOUND AND NOT WINCE)
add_subdirectory( plasma )
endif()
################# write dependency file which will be installed #################
# Used in configure_file() and install(EXPORT)
set(KDE4_TARGET_PREFIX KDE4__)
include(CreateKDELibsDependenciesFile.cmake)
################# install files #################
install( FILES ${CMAKE_CURRENT_BINARY_DIR}/kdemacros.h DESTINATION ${INCLUDE_INSTALL_DIR} )
install( FILES ${CMAKE_CURRENT_BINARY_DIR}/KDELibsDependencies.cmake DESTINATION ${DATA_INSTALL_DIR}/cmake/modules)
install( FILES ${CMAKE_CURRENT_BINARY_DIR}/KDEPlatformProfile.cmake DESTINATION ${DATA_INSTALL_DIR}/cmake/modules)
# run a script before installing the exports files which deletes previously installed
# configuration specific export files KDELibs4(Library|Tools)Targets-<config>.cmake
# if the main exports file KDELibs4(Library|Tools)Targets.cmake has changed. This makes sure
# that this main file doesn't include older and different configuration specific exports files,
# which might have a different set of targets or targets with different names.
# The code for installing the exports files will soon go into a macro. Alex
install(CODE "set(EXPORT_FILES KDELibs4LibraryTargets.cmake KDELibs4ToolsTargets.cmake)"
CODE "set(EXPORT_INSTALL_DIR \"${DATA_INSTALL_DIR}/cmake/modules\")"
SCRIPT "${CMAKE_SOURCE_DIR}/cmake/modules/check_installed_exports_file.cmake" )
# No longer applicable, replaced with individual frameworks
# install( EXPORT kdelibsToolsTargets DESTINATION ${DATA_INSTALL_DIR}/cmake/modules NAMESPACE ${KDE4_TARGET_PREFIX} FILE KDELibs4ToolsTargets.cmake )
# the following will be the correct locations once cmake has the improved FIND_PACKAGE()
# install( FILES ${CMAKE_CURRENT_BINARY_DIR}/KDELibsDependencies.cmake DESTINATION ${PLUGIN_INSTALL_DIR}/cmake RENAME KDE4Config.cmake)
feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)
macro_display_feature_log()
diff --git a/kio/CMakeLists.txt b/kio/CMakeLists.txt
index 26d3b18015..2642f4a727 100644
--- a/kio/CMakeLists.txt
+++ b/kio/CMakeLists.txt
@@ -1,512 +1,513 @@
project(kio)
if(KDE_PLATFORM_FEATURE_BINARY_INCOMPATIBLE_FEATURE_REDUCTION)
set(KIO_NO_SOLID TRUE)
set(KIO_NO_NEPOMUK TRUE)
endif(KDE_PLATFORM_FEATURE_BINARY_INCOMPATIBLE_FEATURE_REDUCTION)
if(NOT HAVE_NEPOMUK)
set(KIO_NO_NEPOMUK TRUE)
endif(NOT HAVE_NEPOMUK)
if(NOT STRIGI_FOUND)
set(KIO_NO_STRIGI TRUE)
endif(NOT STRIGI_FOUND)
if(NOT SOPRANO_FOUND)
set(KIO_NO_SOPRANO TRUE)
endif(NOT SOPRANO_FOUND)
if(OPENSSL_FOUND)
set(KSSL_HAVE_SSL 1)
include_directories(${OPENSSL_INCLUDE_DIR})
endif(OPENSSL_FOUND)
if(NOT KIO_NO_NEPOMUK)
include_directories(
${SOPRANO_INCLUDE_DIR}
${CMAKE_SOURCE_DIR}/nepomuk/
${CMAKE_SOURCE_DIR}/nepomuk/core/
${CMAKE_SOURCE_DIR}/nepomuk/types/
${CMAKE_SOURCE_DIR}/nepomuk/ui/
${CMAKE_SOURCE_DIR}/nepomuk/query/
)
endif(NOT KIO_NO_NEPOMUK)
# This applies to all subdirs; let's put kio's dependencies (and own dirs) here, once and for all
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/bookmarks
${CMAKE_CURRENT_SOURCE_DIR}/kio
${CMAKE_CURRENT_SOURCE_DIR}/kfile
${CMAKE_CURRENT_SOURCE_DIR}/kssl
${CMAKE_CURRENT_SOURCE_DIR} # for including kio/kio_export.h
${CMAKE_CURRENT_BINARY_DIR}/kio
${CMAKE_CURRENT_BINARY_DIR}/kssl
${CMAKE_CURRENT_BINARY_DIR} # e.g. for observer_stub.h
${KDE4_KDEUI_INCLUDES}
${KDE4_KDECORE_INCLUDES}
${ZLIB_INCLUDE_DIR}
)
if (NOT KIO_NO_STRIGI)
include_directories(${STRIGI_INCLUDE_DIR})
set(KIO_EXTRA_LIBS ${KIO_EXTRA_LIBS} ${STRIGI_STREAMANALYZER_LIBRARY} ${STRIGI_STREAMS_LIBRARY})
endif()
if (NOT KIO_NO_SOPRANO)
include_directories(${SOPRANO_INCLUDE_DIR})
endif (NOT KIO_NO_SOPRANO)
if(NOT KIO_NO_SOLID)
include_directories(${CMAKE_BINARY_DIR}/tier1/solid/)
include_directories(${CMAKE_SOURCE_DIR}/tier1/solid/)
set(KIO_EXTRA_LIBS ${KIO_EXTRA_LIBS} ${KDE4_SOLID_LIBS})
endif(NOT KIO_NO_SOLID)
configure_file(kio/config-kio.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/kio/config-kio.h )
if (NOT KIO_NO_STRIGI)
configure_file(kio/config-strigi.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/kio/config-strigi.h )
endif (NOT KIO_NO_STRIGI)
configure_file(kssl/ksslconfig.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/kssl/ksslconfig.h )
#macro_additional_clean_files( ${CMAKE_CURRENT_BINARY_DIR}/kssl/ksslconfig.h )
add_subdirectory( kssl/kssl )
add_subdirectory( kssl/kcm )
add_subdirectory( misc )
add_subdirectory( tests )
if(STRIGI_FOUND)
add_subdirectory( kio/dummyanalyzers )
endif(STRIGI_FOUND)
set(kiocore_STAT_SRCS
kio/accessmanager.cpp
kio/accessmanagerreply_p.cpp
kio/authinfo.cpp
kio/chmodjob.cpp
kio/connection.cpp
kio/copyjob.cpp
kio/dataprotocol.cpp
kio/dataslave.cpp
kio/davjob.cpp
kio/defaultviewadapter.cpp
kio/delegateanimationhandler.cpp
kio/deletejob.cpp
kio/directorysizejob.cpp
kio/filejob.cpp
kio/fileundomanager.cpp
kio/forwardingslavebase.cpp
kio/global.cpp
kio/imagefilter.cpp
kio/job.cpp
kio/jobuidelegate.cpp
kio/joburlcache.cpp
kio/kabstractfileitemactionplugin.cpp
kio/kacl.cpp
kio/kbuildsycocaprogressdialog.cpp
kio/kdatatool.cpp
kio/kdbusservicestarter.cpp
kio/kdesktopfileactions.cpp
kio/kdirlister.cpp
kio/kdirmodel.cpp
kio/kdirnotify.cpp
kio/kdynamicjobtracker.cpp
kio/kemailsettings.cpp
kio/kfileitem.cpp
kio/kfileitemactionplugin.cpp
kio/kfileitemlistproperties.cpp
kio/kfileitemactions.cpp
kio/kfileitemdelegate.cpp
kio/kfilemetainfo.cpp
kio/kfilemetainfoitem.cpp
kio/kfileshare.cpp
kio/kfilewriteplugin.cpp
kio/kimageio.cpp
kio/kmimetypechooser.cpp
kio/kprotocolmanager.cpp
kio/kremoteencoding.cpp
kio/krun.cpp
kio/kscan.cpp
kio/kshellcompletion.cpp
kio/kurifilter.cpp
kio/kurlcompletion.cpp
kio/kurlpixmapprovider.cpp
kio/metainfojob.cpp
kio/netaccess.cpp
kio/paste.cpp
kio/pastedialog.cpp
kio/predicateproperties.cpp
kio/previewjob.cpp
kio/renamedialog.cpp
kio/renamedialogplugin.cpp
kio/scheduler.cpp
kio/sessiondata.cpp
kio/skipdialog.cpp
kio/slave.cpp
kio/slavebase.cpp
kio/slaveconfig.cpp
kio/slaveinterface.cpp
kio/tcpslavebase.cpp
kio/thumbcreator.cpp
kio/thumbsequencecreator.cpp
kio/udsentry.cpp
kio/hostinfo.cpp
kio/kpasswdserver.cpp
kio/kpasswdserverloop.cpp
)
if(NOT KDE_NO_DEPRECATED)
set(kiocore_STAT_SRCS
${kiocore_STAT_SRCS}
kio/kmimetyperesolver.cpp
kio/passworddialog.cpp
)
endif(NOT KDE_NO_DEPRECATED)
if(NOT KIO_NO_SOLID)
set(kiocore_STAT_SRCS
${kiocore_STAT_SRCS}
kio/kstatusbarofflineindicator.cpp
)
endif(NOT KIO_NO_SOLID)
qt4_add_dbus_adaptor(kiocore_STAT_SRCS kio/org.kde.kio.FileUndoManager.xml fileundomanager_p.h KIO::FileUndoManagerPrivate fileundomanager_adaptor KIOFileUndoManagerAdaptor)
qt4_add_dbus_interface(kiocore_STAT_SRCS kio/org.kde.kuiserver.xml kuiserver_interface)
set_source_files_properties(kio/org.kde.KPasswdServer.xml
PROPERTIES INCLUDE kio/authinfo.h
)
qt4_add_dbus_interface(kiocore_STAT_SRCS kio/org.kde.KPasswdServer.xml kpasswdserver_interface)
install(FILES kio/org.kde.KPasswdServer.xml DESTINATION ${DBUS_INTERFACES_INSTALL_DIR})
if(UNIX)
set(kiocore_STAT_SRCS ${kiocore_STAT_SRCS}
kio/kautomount.cpp
kio/knfsshare.cpp
kio/ksambashare.cpp
kio/ksambasharedata.cpp
)
endif(UNIX)
if(WIN32)
set(kiocore_STAT_SRCS ${kiocore_STAT_SRCS}
kio/krun_win.cpp
)
endif(WIN32)
set(kbookmarks_STAT_SRCS
bookmarks/kbookmark.cc
bookmarks/kbookmarkimporter.cc
bookmarks/kbookmarkmanager.cc
bookmarks/kbookmarkmanageradaptor.cc
bookmarks/kbookmarkmenu.cc
bookmarks/konqbookmarkmenu.cc
bookmarks/kbookmarkimporter_opera.cc
bookmarks/kbookmarkimporter_ie.cc
bookmarks/kbookmarkimporter_ns.cc
bookmarks/kbookmarkdombuilder.cc
bookmarks/kbookmarkdialog.cc
)
if(NOT KDE_NO_DEPRECATED)
set(kbookmarks_STAT_SRCS
${kbookmarks_STAT_SRCS}
bookmarks/kbookmarkimporter_crash.cc
)
endif(NOT KDE_NO_DEPRECATED)
set(kfile_STAT_SRCS
kfile/kabstractfilemodule.cpp
kfile/kacleditwidget.cpp
kfile/kdiskfreespaceinfo.cpp
kfile/kencodingfiledialog.cpp
kfile/kfile.cpp
kfile/kfiledialog.cpp
kfile/kfilemetadataconfigurationwidget.cpp
kfile/kfilemetadatawidget.cpp
kfile/kfilemetainfowidget.cpp
kfile/kfilemetapreview.cpp
kfile/kimagefilepreview.cpp
kfile/kmetaprops.cpp
kfile/knfotranslator.cpp
kfile/kopenwithdialog.cpp
kfile/kpreviewprops.cpp
kfile/kpreviewwidgetbase.cpp
kfile/kpropertiesdialog.cpp
kfile/krecentdirs.cpp
kfile/krecentdocument.cpp
kfile/kurlcombobox.cpp
kfile/kurlrequester.cpp
kfile/kurlrequesterdialog.cpp
)
if(NOT KIO_NO_SOLID)
set(kfile_STAT_SRCS
${kfile_STAT_SRCS}
kfile/kdiskfreespace.cpp
kfile/kdevicelistitem.cpp
kfile/kdevicelistmodel.cpp
)
endif(NOT KIO_NO_SOLID)
if(NOT KIO_NO_NEPOMUK)
set(kfile_STAT_SRCS
${kfile_STAT_SRCS}
kfile/kcommentwidget.cpp
kfile/kfilemetadatareader.cpp
kfile/kfilemetadataprovider.cpp
)
endif(NOT KIO_NO_NEPOMUK)
if(NOT WIN32)
set(kfile_STAT_SRCS
${kfile_STAT_SRCS}
kfile/kfilesharedialog.cpp
kfile/kfsprocess.cpp
)
endif(NOT WIN32)
qt4_add_resources(kfile_STAT_SRCS kfile/kacleditwidget.qrc)
# kio/kssl/Makefile.am: kssl
set(kssl_STAT_SRCS
kssl/sslui.cpp
kssl/ksslcertificatebox.cpp
kssl/ksslinfodialog.cpp
# below is what's left of KDE2/3 SSL code, still required for certificate chain validation
# by hand and for key generation. Network code has been removed.
kssl/kopenssl.cpp
kssl/kssl.cpp
kssl/ksslcertchain.cpp
kssl/ksslcertificate.cpp
kssl/ksslkeygen.cpp
kssl/ksslsettings.cpp
kssl/ksslutils.cpp
kssl/ksslx509v3.cpp
)
########### next target ###############
set(kio_LIB_SRCS
${kiocore_STAT_SRCS}
${kbookmarks_STAT_SRCS}
${kfile_STAT_SRCS}
${kssl_STAT_SRCS}
)
set(kio_LIB_PRIVATE_SRCS
kio/kfileshare_p.h
kio/krun_p.h
kio/connection_p.h
kio/slaveinterface_p.h
)
if(NOT KIO_NO_NEPOMUK)
set(kfilemetadatareaderprocess_SRCS
kfile/kfilemetadatareaderprocess.cpp
)
endif(NOT KIO_NO_NEPOMUK)
kde4_add_ui_files(kio_LIB_SRCS
kfile/kpropertiesdesktopadvbase.ui
kfile/kpropertiesdesktopbase.ui
kssl/keygenwizard.ui
kssl/keygenwizard2.ui
kssl/sslinfo.ui
kssl/certificateparty.ui
)
install(FILES kssl/ksslcertificatemanager.upd
kssl/ksslcertificatemanager.upd.sh
DESTINATION ${DATA_INSTALL_DIR}/kconf_update)
kde4_add_library(kio ${LIBRARY_TYPE} ${kio_LIB_SRCS})
+generate_export_header(kio)
if(NOT KIO_NO_NEPOMUK)
kde4_add_executable(kfilemetadatareader ${kfilemetadatareaderprocess_SRCS})
target_link_libraries(kfilemetadatareader ${KDE4_KIO_LIBS} ${KDE4_NEPOMUK_LIBRARY} nepomukutils kcoreaddons kde4support)
target_link_libraries(kio ${KDE4_NEPOMUK_LIBRARY} nepomukquery nepomukutils)
endif(NOT KIO_NO_NEPOMUK)
target_link_libraries(kio QtMimeTypes kcoreaddons kde4support ${KDE4_KDEUI_LIBS} ${ZLIB_LIBRARY} ${QT_QTNETWORK_LIBRARY} ${QT_QTXML_LIBRARY} ${QT_QTSVG_LIBRARY} ${X11_LIBRARIES} ${KIO_EXTRA_LIBS})
target_link_libraries(kio LINK_INTERFACE_LIBRARIES kdeui kdecore ${QT_QTNETWORK_LIBRARY} ${QT_QTXML_LIBRARY} ${QT_QTGUI_LIBRARY} )
if(ACL_FOUND)
target_link_libraries(kio ${ACL_LIBS})
endif(ACL_FOUND)
if(X11_Xrender_FOUND)
target_link_libraries(kio ${X11_Xrender_LIB})
endif(X11_Xrender_FOUND)
set_target_properties(kio PROPERTIES VERSION ${KDE_NON_GENERIC_LIB_VERSION}
SOVERSION ${KDE_NON_GENERIC_LIB_SOVERSION}
)
########### install files ###############
install(TARGETS kio ${INSTALL_TARGETS_DEFAULT_ARGS})
if(NOT KIO_NO_NEPOMUK)
install(TARGETS kfilemetadatareader ${INSTALL_TARGETS_DEFAULT_ARGS})
endif(NOT KIO_NO_NEPOMUK)
install( PROGRAMS useragent.pl proxytype.pl DESTINATION ${KCONF_UPDATE_INSTALL_DIR} )
install( FILES data.protocol DESTINATION ${SERVICES_INSTALL_DIR} )
install( FILES
application.desktop
kcmodule.desktop
kcmoduleinit.desktop
kdatatool.desktop
kfileplugin.desktop
kscan.desktop
kurifilterplugin.desktop
renamedialogplugin.desktop
kfile/kpropertiesdialogplugin.desktop
kio/kfilewrite.desktop
kio/kfileitemactionplugin.desktop
kfile/kiofilemodule.desktop
DESTINATION ${SERVICETYPES_INSTALL_DIR} )
install( FILES kioslave.upd DESTINATION ${DATA_INSTALL_DIR}/kconf_update )
install( FILES
- kio/kio_export.h
+ ${CMAKE_CURRENT_BINARY_DIR}/kio_export.h
kio/accessmanager.h
kio/connection.h
kio/slaveinterface.h
kio/slave.h
kio/slaveconfig.h
kio/sessiondata.h
kio/global.h
kio/netaccess.h
kio/job.h
kio/scheduler.h
kio/jobclasses.h
kio/copyjob.h
kio/deletejob.h
kio/jobuidelegate.h
kio/paste.h
kio/slavebase.h
kio/filejob.h
kio/fileundomanager.h
kio/tcpslavebase.h
kio/forwardingslavebase.h
kio/chmodjob.h
kio/authinfo.h
kio/ioslave_defaults.h
kio/http_slave_defaults.h
kio/previewjob.h
kio/thumbcreator.h
kio/thumbsequencecreator.h
kio/metainfojob.h
kio/davjob.h
kio/directorysizejob.h
kio/renamedialog.h
kio/renamedialogplugin.h
kio/skipdialog.h
kio/udsentry.h
kssl/sslui.h
DESTINATION ${INCLUDE_INSTALL_DIR}/kio COMPONENT Devel)
if( NOT WIN32 )
install( FILES
kfile/kfilesharedialog.h
DESTINATION ${INCLUDE_INSTALL_DIR} COMPONENT Devel)
endif( NOT WIN32 )
install( FILES
kio/kabstractfileitemactionplugin.h
kio/kacl.h
kio/kautomount.h
kio/kbuildsycocaprogressdialog.h
kio/kdatatool.h
kio/kdbusservicestarter.h
kio/kdesktopfileactions.h
kio/kdirlister.h
kio/kdirmodel.h
kio/kdirnotify.h
kio/kemailsettings.h
kio/kfileitem.h
kio/kfileitemlistproperties.h
kio/kfileitemactionplugin.h
kio/kfileitemactions.h
kio/kfileitemdelegate.h
kio/kfilemetainfo.h
kio/kfilemetainfoitem.h
kio/kfileshare.h
kio/kfilewriteplugin.h
kio/kimageio.h
kio/kmimetypechooser.h
kio/knfsshare.h
kio/kprotocolmanager.h
kio/kremoteencoding.h
kio/krun.h
kio/ksambashare.h
kio/ksambasharedata.h
kio/kscan.h
kio/kshellcompletion.h
kio/kurifilter.h
kio/kurlcompletion.h
kio/kurlpixmapprovider.h
kio/predicateproperties.h
kfile/kabstractfilemodule.h
kfile/kabstractfilewidget.h
kfile/kdiskfreespaceinfo.h
kfile/kencodingfiledialog.h
kfile/kfile.h
kfile/kfiledialog.h
kfile/kimagefilepreview.h
kfile/kfilemetadataconfigurationwidget.h
kfile/kfilemetadatawidget.h
kfile/kopenwithdialog.h
kfile/kpreviewwidgetbase.h
kfile/kpropertiesdialog.h
kfile/kpropsdialog.h
kfile/krecentdirs.h
kfile/krecentdocument.h
kfile/kurlcombobox.h
kfile/kurlrequester.h
kfile/kurlrequesterdialog.h
bookmarks/kbookmark.h
bookmarks/kbookmarkexporter.h
bookmarks/kbookmarkimporter.h
bookmarks/kbookmarkmanager.h
bookmarks/kbookmarkmenu.h
bookmarks/kbookmarkimporter_opera.h
bookmarks/kbookmarkimporter_ie.h
bookmarks/kbookmarkimporter_ns.h
bookmarks/kbookmarkdombuilder.h
bookmarks/konqbookmarkmenu.h
bookmarks/kbookmarkdialog.h
DESTINATION ${INCLUDE_INSTALL_DIR} COMPONENT Devel)
if(NOT KDE_NO_DEPRECATED)
install( FILES
bookmarks/kbookmarkimporter_crash.h
kfile/kdiskfreespace.h
kio/kmimetyperesolver.h
DESTINATION ${INCLUDE_INSTALL_DIR} COMPONENT Devel)
install( FILES
kio/passworddialog.h
DESTINATION ${INCLUDE_INSTALL_DIR}/kio COMPONENT Devel)
endif(NOT KDE_NO_DEPRECATED)
if(NOT KIO_NO_SOLID)
install( FILES
kfile/kdevicelistmodel.h
kio/kstatusbarofflineindicator.h
DESTINATION ${INCLUDE_INSTALL_DIR} COMPONENT Devel)
endif(NOT KIO_NO_SOLID)
install(FILES
kio/org.kde.KDirNotify.xml
kio/org.kde.kio.FileUndoManager.xml
DESTINATION ${DBUS_INTERFACES_INSTALL_DIR})
install(FILES kio/accept-languages.codes DESTINATION ${CONFIG_INSTALL_DIR})
diff --git a/kio/bookmarks/kbookmark.h b/kio/bookmarks/kbookmark.h
index 7bd07cfc9e..88ef30f0d3 100644
--- a/kio/bookmarks/kbookmark.h
+++ b/kio/bookmarks/kbookmark.h
@@ -1,471 +1,472 @@
// -*- c-basic-offset: 4; indent-tabs-mode:nil -*-
// vim: set ts=4 sts=4 sw=4 et:
/* This file is part of the KDE libraries
Copyright (C) 2000-2005 David Faure <faure@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef __kbookmark_h
#define __kbookmark_h
-#include <kio/kio_export.h>
+#include "kio_export.h"
+#include "kdemacros.h"
#include <QtCore/QString>
#include <QtCore/QList>
#include <QtCore/QMetaType>
#include <QtXml/QDomElement>
#include <kurl.h>
class KBookmarkManager;
class KBookmarkGroup;
class KIO_EXPORT KBookmark
{
friend class KBookmarkGroup;
public:
enum MetaDataOverwriteMode {
OverwriteMetaData, DontOverwriteMetaData
};
/**
* KUrl::Bookmark is a QList that contains bookmarks with a few
* convenience methods.
* @see KBookmark
* @see QList
*/
class KIO_EXPORT List : public QList<KBookmark>
{
public:
List();
/**
* Adds this list of bookmark into the given QMimeData.
*
* @param mimeData the QMimeData instance used to drag or copy this bookmark
*/
void populateMimeData( QMimeData* mimeData ) const;
/**
* Return true if @p mimeData contains bookmarks
*/
static bool canDecode( const QMimeData *mimeData );
/**
* Return the list of mimeTypes that can be decoded by fromMimeData
*/
static QStringList mimeDataTypes();
/**
* Extract a list of bookmarks from the contents of @p mimeData.
* Decoding will fail if @p mimeData does not contain any bookmarks.
* @param mimeData the mime data to extract from; cannot be 0
* @return the list of bookmarks
* @note those bookmarks are valid QDomElements, but their parent QDomDocument
* is already deleted, do not use ownerDocument()
* @deprecated use fromMimeData(mimeData, doc), to avoid crashes
*/
#ifndef KDE_NO_DEPRECATED
- static KDE_DEPRECATED KBookmark::List fromMimeData( const QMimeData *mimeData );
+ static KIO_DEPRECATED KBookmark::List fromMimeData( const QMimeData *mimeData );
#endif
/**
* Extract a list of bookmarks from the contents of @p mimeData.
* Decoding will fail if @p mimeData does not contain any bookmarks.
* @param mimeData the mime data to extract from; cannot be 0
* @param parentDocument pass an empty QDomDocument here, it will be used as
* container for the bookmarks. You just need to make sure it stays alive longer
* (or just as long) as the returned bookmarks.
* @return the list of bookmarks
* @since 4.3.2
*/
static KBookmark::List fromMimeData( const QMimeData *mimeData, QDomDocument& parentDocument );
};
/**
* Constructs a null bookmark, i.e. a bookmark for which isNull() returns true
* If you want to create a new bookmark use eitehr KBookmarkGroup.addBookmark
* or if you want an interactive dialog use KBookmarkDialog.
*/
KBookmark( );
/**
* Creates the KBookmark wrapper for @param elem
* Mostly for internal usage.
*/
explicit KBookmark( const QDomElement &elem );
/**
* Creates a stand alone bookmark. This is fairly expensive since a new QDom Tree is build.
*/
static KBookmark standaloneBookmark( const QString & text, const KUrl & url, const QString & icon = QString() );
/**
* Whether the bookmark is a group or a normal bookmark
*/
bool isGroup() const;
/**
* Whether the bookmark is a separator
*/
bool isSeparator() const;
/**
* @return true if this is a null bookmark. This will never
* be the case for a real bookmark (in a menu), but it's used
* for instance as the end condition for KBookmarkGroup::next()
*/
bool isNull() const;
/**
* @return true if bookmark is contained by a QDomDocument,
* if not it is most likely that it has become separated and
* is thus invalid and/or has been deleted from the bookmarks.
*/
bool hasParent() const;
/**
* Text shown for the bookmark
* If bigger than 40, the text is shortened by
* replacing middle characters with "..." (see KStringHandler::csqueeze)
*/
QString text() const;
/**
* Text shown for the bookmark, not truncated.
* You should not use this - this is mainly for keditbookmarks.
*/
QString fullText() const;
/**
* Set the text shown for the bookmark.
*
* @param fullText the new bookmark title
*/
void setFullText(const QString &fullText);
/**
* URL contained by the bookmark
*/
KUrl url() const;
/**
* Set the URL of the bookmark
*
* @param url the new bookmark URL
*/
void setUrl(const KUrl &url);
/**
* @return the pixmap file for this bookmark
* (i.e. the name of the icon)
*/
QString icon() const;
/**
* Set the icon name of the bookmark
*
* @param icon the new icon name for this bookmark
*/
void setIcon(const QString &icon);
/**
* @return Description of the bookmark
* @since 4.4
*/
QString description() const;
/**
* Set the description of the bookmark
*
* @param description
* @since 4.4
*/
void setDescription(const QString &description);
/**
* @return Mime-Type of this item
* @since 4.1
*/
QString mimeType() const;
/**
* Set the Mime-Type of this item
*
* @param Mime-Type
* @since 4.1
*/
void setMimeType(const QString &mimeType);
/**
* @return if the bookmark should be shown in the toolbar
* (used by the filtered toolbar)
*
*/
bool showInToolbar() const;
/**
* Set whether this bookmark is show in a filterd toolbar
*/
void setShowInToolbar(bool show);
/**
* @return the group containing this bookmark
*/
KBookmarkGroup parentGroup() const;
/**
* Convert this to a group - do this only if
* isGroup() returns true.
*/
KBookmarkGroup toGroup() const;
/**
* Return the "address" of this bookmark in the whole tree.
* This is used when telling other processes about a change
* in a given bookmark. The encoding of the address is "/4/2", for
* instance, to designate the 2nd child inside the 4th child of the
* root bookmark.
*/
QString address() const;
/**
* Return the position in the parent, i.e. the last number in the address
*/
int positionInParent() const;
// Hard to decide. Good design would imply that each bookmark
// knows about its manager, so that there can be several managers.
// But if we say there is only one manager (i.e. set of bookmarks)
// per application, then KBookmarkManager::self() is much easier.
//KBookmarkManager * manager() const { return m_manager; }
/**
* @internal for KEditBookmarks
*/
QDomElement internalElement() const;
/**
* Updates the bookmarks access metadata
* Call when a user accesses the bookmark
*/
void updateAccessMetadata();
// Utility functions (internal)
/**
* @return address of parent
*/
static QString parentAddress( const QString & address );
/**
* @return position in parent (e.g. /4/5/2 -> 2)
*/
static uint positionInParent( const QString & address );
/**
* @return address of previous sibling (e.g. /4/5/2 -> /4/5/1)
* Returns QString() for a first child
*/
static QString previousAddress( const QString & address );
/**
* @return address of next sibling (e.g. /4/5/2 -> /4/5/3)
* This doesn't check whether it actually exists
*/
static QString nextAddress( const QString & address );
/**
* @return the common parent of both addresses which
* has the greatest depth
*/
static QString commonParent( const QString &A, const QString &B );
/**
* @return the metadata container node for a certain matadata owner
* @since 4.1
*/
QDomNode metaData(const QString &owner, bool create) const;
/**
* Get the value of a specific metadata item (owner = "http://www.kde.org").
* @param key Name of the metadata item
* @return Value of the metadata item. QString() is returned in case
* the specified key does not exist.
*/
QString metaDataItem( const QString &key ) const;
/**
* Change the value of a specific metadata item, or create the given item
* if it doesn't exist already (owner = "http://www.kde.org").
* @param key Name of the metadata item to change
* @param value Value to use for the specified metadata item
* @param mode Whether to overwrite the item's value if it exists already or not.
*/
void setMetaDataItem( const QString &key, const QString &value, MetaDataOverwriteMode mode = OverwriteMetaData );
/**
* Adds this bookmark into the given QMimeData.
*
* WARNING: do not call this method multiple times, use KBookmark::List::populateMimeData instead.
*
* @param mimeData the QMimeData instance used to drag or copy this bookmark
*/
void populateMimeData( QMimeData* mimeData ) const;
/**
* Comparison operator
*/
bool operator==(const KBookmark& rhs) const;
protected:
QDomElement element;
// Note: you can't add new member variables here.
// The KBookmarks are created on the fly, as wrappers
// around internal QDomElements. Any additional information
// has to be implemented as an attribute of the QDomElement.
};
#ifdef MAKE_KIO_LIB
KDE_DUMMY_QHASH_FUNCTION(KBookmark)
#endif
/**
* A group of bookmarks
*/
class KIO_EXPORT KBookmarkGroup : public KBookmark
{
public:
/**
* Create an invalid group. This is mostly for use in QValueList,
* and other places where we need a null group.
* Also used as a parent for a bookmark that doesn't have one
* (e.g. Netscape bookmarks)
*/
KBookmarkGroup();
/**
* Create a bookmark group as specified by the given element
*/
KBookmarkGroup( const QDomElement &elem );
/**
* @return true if the bookmark folder is opened in the bookmark editor
*/
bool isOpen() const;
/**
* Return the first child bookmark of this group
*/
KBookmark first() const;
/**
* Return the prevous sibling of a child bookmark of this group
* @param current has to be one of our child bookmarks.
*/
KBookmark previous( const KBookmark & current ) const;
/**
* Return the next sibling of a child bookmark of this group
* @param current has to be one of our child bookmarks.
*/
KBookmark next( const KBookmark & current ) const;
/**
* Return the index of a child bookmark, -1 if not found
*/
int indexOf(const KBookmark& child) const;
/**
* Create a new bookmark folder, as the last child of this group
* @param text for the folder.
* If you want an dialog use KBookmarkDialog
*/
KBookmarkGroup createNewFolder( const QString & text );
/**
* Create a new bookmark separator
* Don't forget to use KBookmarkManager::self()->emitChanged( parentBookmark );
*/
KBookmark createNewSeparator();
/**
* Create a new bookmark, as the last child of this group
* Don't forget to use KBookmarkManager::self()->emitChanged( parentBookmark );
* @param bm the bookmark to add
*/
KBookmark addBookmark( const KBookmark &bm );
/**
* Create a new bookmark, as the last child of this group
* Don't forget to use KBookmarkManager::self()->emitChanged( parentBookmark );
* @param text for the bookmark
* @param url the URL that the bookmark points to
* @param icon the name of the icon to associate with the bookmark. A suitable default
* will be determined from the URL if not specified.
*/
KBookmark addBookmark( const QString & text, const KUrl & url, const QString & icon = QString() );
/**
* Moves @p bookmark after @p after (which should be a child of ours).
* If after is null, @p bookmark is moved as the first child.
* Don't forget to use KBookmarkManager::self()->emitChanged( parentBookmark );
*/
bool moveBookmark( const KBookmark & bookmark, const KBookmark & after);
#ifndef KDE_NO_DEPRECATED
- KDE_DEPRECATED bool moveItem( const KBookmark & item, const KBookmark & after );
+ KIO_DEPRECATED bool moveItem( const KBookmark & item, const KBookmark & after );
#endif
/**
* Delete a bookmark - it has to be one of our children !
* Don't forget to use KBookmarkManager::self()->emitChanged( parentBookmark );
*/
void deleteBookmark( const KBookmark &bk );
/**
* @return true if this is the toolbar group
*/
bool isToolbarGroup() const;
/**
* @internal
*/
QDomElement findToolbar() const;
/**
* @return the list of urls of bookmarks at top level of the group
*/
QList<KUrl> groupUrlList() const;
protected:
QDomElement nextKnownTag( const QDomElement &start, bool goNext ) const;
private:
// Note: you can't add other member variables here, except for caching info.
// The KBookmarks are created on the fly, as wrappers
// around internal QDomElements. Any additional information
// has to be implemented as an attribute of the QDomElement.
};
class KIO_EXPORT KBookmarkGroupTraverser {
protected:
virtual ~KBookmarkGroupTraverser();
void traverse(const KBookmarkGroup &);
virtual void visit(const KBookmark &);
virtual void visitEnter(const KBookmarkGroup &);
virtual void visitLeave(const KBookmarkGroup &);
};
#define KIO_KBOOKMARK_METATYPE_DEFINED 1
Q_DECLARE_METATYPE( KBookmark )
#endif
diff --git a/kio/bookmarks/kbookmarkimporter_crash.h b/kio/bookmarks/kbookmarkimporter_crash.h
index d06f372f45..2487f9726b 100644
--- a/kio/bookmarks/kbookmarkimporter_crash.h
+++ b/kio/bookmarks/kbookmarkimporter_crash.h
@@ -1,69 +1,69 @@
// -*- c-basic-offset:4; indent-tabs-mode:nil -*-
// vim: set ts=4 sts=4 sw=4 et:
/* This file is part of the KDE libraries
Copyright (C) 2002 Alexander Kellett <lypanov@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef __kbookmarkimporter_crash_h
#define __kbookmarkimporter_crash_h
#include <QtCore/QStringList>
#include <QtCore/QMap>
#include <kconfig.h>
#include <kdemacros.h>
#include "kbookmarkimporter.h"
/**
* A class for importing all crash sessions as bookmarks
* @deprecated
*/
-class KIO_EXPORT_DEPRECATED KCrashBookmarkImporter : public QObject
+class KIO_DEPRECATED_EXPORT KCrashBookmarkImporter : public QObject
{
Q_OBJECT
public:
KCrashBookmarkImporter( const QString & fileName ) : m_fileName(fileName) {}
~KCrashBookmarkImporter() {}
void parseCrashBookmarks( bool del = true );
static QString crashBookmarksDir( );
Q_SIGNALS:
void newBookmark( const QString & text, const QString & url, const QString & additionalInfo );
void newFolder( const QString & text, bool open, const QString & additionalInfo );
void newSeparator();
void endFolder();
protected:
QString m_fileName;
};
/**
* A class for importing all crash sessions as bookmarks
*/
class KIO_EXPORT KCrashBookmarkImporterImpl : public KBookmarkImporterBase
{
public:
KCrashBookmarkImporterImpl() : m_shouldDelete(false) { }
void setShouldDelete(bool);
virtual void parse();
virtual QString findDefaultLocation(bool forSaving = false) const;
static QStringList getCrashLogs();
private:
bool m_shouldDelete;
QMap<QString, QString> parseCrashLog_noemit( const QString & filename, bool del );
class KCrashBookmarkImporterImplPrivate *d;
};
#endif
diff --git a/kio/kfile/kdiskfreespace.h b/kio/kfile/kdiskfreespace.h
index f9f687d316..fcaee8dd1f 100644
--- a/kio/kfile/kdiskfreespace.h
+++ b/kio/kfile/kdiskfreespace.h
@@ -1,96 +1,96 @@
/*
* kdiskfreespace.h
*
* Copyright 2007 David Faure <faure@kde.org>
* Copyright 2008 Dirk Mueller <mueller@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License version 2 as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KDISKFREESP_H
#define KDISKFREESP_H
#include <QtCore/QObject>
#include <QtCore/QString>
#include <kio/kio_export.h>
/**
* \deprecated Use KDiskFreeSpaceInfo
*/
-class KIO_EXPORT_DEPRECATED KDiskFreeSpace : public QObject
+class KIO_DEPRECATED_EXPORT KDiskFreeSpace : public QObject
{
Q_OBJECT
public:
/**
* Constructor
*/
explicit KDiskFreeSpace( QObject *parent = 0 );
/**
* Destructor - this object autodeletes itself when it's done
*/
~KDiskFreeSpace();
/**
* Call this to fire a search on the disk usage information
* for @p mountPoint.
* The foundMountPoint() signal will be emitted
* if this mount point is found, with the info requested.
* The done() signal is emitted in any case.
*
* @return true if the request could be handled, false if another
* request is happening already. readDF() can only be called once
* on a given instance of KDiskFreeSpace, given that it handles only
* the request for one mount point and then auto-deletes itself.
* Suicidal objects are not reusable...
*/
bool readDF( const QString & mountPoint );
/**
* Call this to fire a search on the disk usage information
* for the mount point containing @p path.
* The foundMountPoint() signal will be emitted
* if this mount point is found, with the info requested.
* The done() signal is emitted in any case.
*/
static KDiskFreeSpace * findUsageInfo( const QString & path );
Q_SIGNALS:
/**
* Emitted when the information about the requested mount point was found.
* @param mountPoint the requested mount point
* @param kibSize the total size of the partition in KiB
* @param kibUsed the amount of KiB being used on the partition
* @param kibAvail the available space on the partition in KiB
*/
void foundMountPoint( const QString & mountPoint, quint64 kibSize, quint64 kibUsed, quint64 kibAvail );
/**
* Emitted when the request made via readDF is over, whether foundMountPoint was emitted or not.
*/
void done();
private:
class Private;
Private * const d;
Q_PRIVATE_SLOT( d, bool _k_calculateFreeSpace() )
};
#endif
diff --git a/kio/kfile/kpropertiesdialog.h b/kio/kfile/kpropertiesdialog.h
index 7656c7955c..b69f6faf07 100644
--- a/kio/kfile/kpropertiesdialog.h
+++ b/kio/kfile/kpropertiesdialog.h
@@ -1,407 +1,407 @@
/* This file is part of the KDE project
Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
Copyright (c) 1999, 2000 Preston Brown <pbrown@kde.org>
Copyright (c) 2000 Simon Hausmann <hausmann@kde.org>
Copyright (c) 2000 David Faure <faure@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KPROPERTIESDIALOG_H
#define KPROPERTIESDIALOG_H
#include <QtCore/QString>
#include <kdemacros.h>
#include <kurl.h>
#include <kfileitem.h>
#include <kpagedialog.h>
class KPropertiesDialogPlugin;
class KJob;
namespace KIO { class Job; }
/**
* The main properties dialog class.
* A Properties Dialog is a dialog which displays various information
* about a particular file or URL, or several files or URLs.
* This main class holds various related classes, which are instantiated in
* the form of tab entries in the tabbed dialog that this class provides.
* The various tabs themselves will let the user view, and sometimes change,
* information about the file or URL.
*
* \image html kpropertiesdialog.png "Typical KProperties Dialog"
*
* The best way to display the properties dialog is to use showDialog().
* Otherwise, you should use (void)new KPropertiesDialog(...)
* It will take care of deleting itself when closed.
*
* If you are looking for more flexibility, see KFileMetaInfo and
* KFileMetaInfoWidget.
*/
class KIO_EXPORT KPropertiesDialog : public KPageDialog
{
Q_OBJECT
public:
/**
* Determine whether there are any property pages available for the
* given file items.
* @param _items the list of items to check.
* @return true if there are any property pages, otherwise false.
*/
static bool canDisplay( const KFileItemList& _items );
/**
* Brings up a Properties dialog, as shown above.
* This is the normal constructor for
* file-manager type applications, where you have a KFileItem instance
* to work with. Normally you will use this
* method rather than the one below.
*
* @param item file item whose properties should be displayed.
* @param parent is the parent of the dialog widget.
* @param name is the internal name.
*/
explicit KPropertiesDialog( const KFileItem& item,
QWidget* parent = 0 );
/**
* \overload
*
* You use this constructor for cases where you have a number of items,
* rather than a single item. Be careful which methods you use
* when passing a list of files or URLs, since some of them will only
* work on the first item in a list.
*
* @param _items list of file items whose properties should be displayed.
* @param parent is the parent of the dialog widget.
* @param name is the internal name.
*/
explicit KPropertiesDialog( const KFileItemList& _items,
QWidget *parent = 0 );
/**
* Brings up a Properties dialog. Convenience constructor for
* non-file-manager applications, where you have a KUrl rather than a
* KFileItem or KFileItemList.
*
* @param _url the URL whose properties should be displayed
* @param parent is the parent of the dialog widget.
* @param name is the internal name.
*
* IMPORTANT: This constructor, together with exec(), leads to a grave
* display bug (due to KIO::stat() being run before the dialog has all the
* necessary information). Do not use this combination for now.
* TODO: Check if the above is still true with Qt4.
* For local files with a known mimetype, simply create a KFileItem and pass
* it to the other constructor.
*/
explicit KPropertiesDialog( const KUrl& _url,
QWidget* parent = 0 );
/**
* Creates a properties dialog for a new .desktop file (whose name
* is not known yet), based on a template. Special constructor for
* "File / New" in file-manager type applications.
*
* @param _tempUrl template used for reading only
* @param _currentDir directory where the file will be written to
* @param _defaultName something to put in the name field,
* like mimetype.desktop
* @param parent is the parent of the dialog widget.
* @param name is the internal name.
*/
KPropertiesDialog( const KUrl& _tempUrl, const KUrl& _currentDir,
const QString& _defaultName,
QWidget* parent = 0 );
/**
* Creates an empty properties dialog (for applications that want use
* a standard dialog, but for things not doable via the plugin-mechanism).
*
* @param title is the string display as the "filename" in the caption of the dialog.
* @param parent is the parent of the dialog widget.
* @param name is the internal name.
* @param modal tells the dialog whether it should be modal.
*/
explicit KPropertiesDialog(const QString& title,
QWidget* parent = 0);
/**
* Cleans up the properties dialog and frees any associated resources,
* including the dialog itself. Note that when a properties dialog is
* closed it cleans up and deletes itself.
*/
virtual ~KPropertiesDialog();
/**
* Immediately displays a Properties dialog using constructor with
* the same parameters.
* On MS Windows, if @p item points to a local file, native (non modal) property
* dialog is displayed (@p parent and @p modal are ignored in this case).
*
* @return true on successful dialog displaying (can be false on win32).
*/
static bool showDialog(const KFileItem& item, QWidget* parent = 0,
bool modal = true);
/**
* Immediately displays a Properties dialog using constructor with
* the same parameters.
* On MS Windows, if @p _url points to a local file, native (non modal) property
* dialog is displayed (@p parent and @p modal are ignored in this case).
*
* @return true on successful dialog displaying (can be false on win32).
*/
static bool showDialog(const KUrl& _url, QWidget* parent = 0,
bool modal = true);
/**
* Immediately displays a Properties dialog using constructor with
* the same parameters.
* On MS Windows, if @p _items has one element and this element points
* to a local file, native (non modal) property dialog is displayed
* (@p parent and @p modal are ignored in this case).
*
* @return true on successful dialog displaying (can be false on win32).
*/
static bool showDialog(const KFileItemList& _items, QWidget* parent = 0,
bool modal = true);
/**
* Adds a "3rd party" properties plugin to the dialog. Useful
* for extending the properties mechanism.
*
* To create a new plugin type, inherit from the base class KPropertiesDialogPlugin
* and implement all the methods. If you define a service .desktop file
* for your plugin, you do not need to call insertPlugin().
*
* @param plugin is a pointer to the KPropertiesDialogPlugin. The Properties
* dialog will do destruction for you. The KPropertiesDialogPlugin \b must
* have been created with the KPropertiesDialog as its parent.
* @see KPropertiesDialogPlugin
*/
void insertPlugin (KPropertiesDialogPlugin *plugin);
/**
* The URL of the file that has its properties being displayed.
* This is only valid if the KPropertiesDialog was created/shown
* for one file or URL.
*
* @return a parsed URL.
*/
KUrl kurl() const;
/**
* @return the file item for which the dialog is shown
*
* Warning: this method returns the first item of the list.
* This means that you should use this only if you are sure the dialog is used
* for a single item. Otherwise, you probably want items() instead.
*/
KFileItem& item();
/**
* @return the items for which the dialog is shown
*/
KFileItemList items() const;
/**
* If the dialog is being built from a template, this method
* returns the current directory. If no template, it returns QString().
* See the template form of the constructor.
*
* @return the current directory or QString()
*/
KUrl currentDir() const;
/**
* If the dialog is being built from a template, this method
* returns the default name. If no template, it returns QString().
* See the template form of the constructor.
* @return the default name or QString()
*/
QString defaultName() const;
/**
* Updates the item URL (either called by rename or because
* a global apps/mimelnk desktop file is being saved)
* Can only be called if the dialog applies to a single file or URL.
* @param _newUrl the new URL
*/
void updateUrl( const KUrl& _newUrl );
/**
* Renames the item to the specified name. This can only be called if
* the dialog applies to a single file or URL.
* @param _name new filename, encoded.
* \see FilePropsDialogPlugin::applyChanges
*/
void rename( const QString& _name );
/**
* To abort applying changes.
*/
void abortApplying();
/**
* Shows the page that was previously set by
* setFileSharingPage(), or does nothing if no page
* was set yet.
* \see setFileSharingPage
*/
void showFileSharingPage();
/**
* Sets the file sharing page.
* This page is shown when calling showFileSharingPage().
*
* @param page the page to set
* \see showFileSharingPage
*/
void setFileSharingPage(QWidget* page);
/**
* Call this to make the filename lineedit readonly, to prevent the user
* from renaming the file.
* \param ro true if the lineedit should be read only
*/
void setFileNameReadOnly( bool ro );
public Q_SLOTS:
/**
* Called when the user presses 'Ok'.
*/
virtual void slotOk(); // Deletes the PropertiesDialog instance
/**
* Called when the user presses 'Cancel'.
*/
virtual void slotCancel(); // Deletes the PropertiesDialog instance
Q_SIGNALS:
/**
* This signal is emitted when the Properties Dialog is closed (for
* example, with OK or Cancel buttons)
*/
void propertiesClosed();
/**
* This signal is emitted when the properties changes are applied (for
* example, with the OK button)
*/
void applied();
/**
* This signal is emitted when the properties changes are aborted (for
* example, with the Cancel button)
*/
void canceled();
/**
* Emitted before changes to @p oldUrl are saved as @p newUrl.
* The receiver may change @p newUrl to point to an alternative
* save location.
*/
void saveAs(const KUrl &oldUrl, KUrl &newUrl);
Q_SIGNALS:
void leaveModality();
private:
class KPropertiesDialogPrivate;
KPropertiesDialogPrivate* const d;
Q_DISABLE_COPY(KPropertiesDialog)
};
/**
* A Plugin in the Properties dialog
* This is an abstract class. You must inherit from this class
* to build a new kind of tabbed page for the KPropertiesDialog.
* A plugin in itself is just a library containing code, not a dialog's page.
* It's up to the plugin to insert pages into the parent dialog.
*
* To make a plugin available, define a service that implements the KPropertiesDialog/Plugin
* servicetype, as well as the mimetypes for which the plugin should be created.
* For instance, ServiceTypes=KPropertiesDialog/Plugin,text/html,application/x-mymimetype.
*
* You can also include X-KDE-Protocol=file if you want that plugin
* to be loaded only for local files, for instance.
*/
class KIO_EXPORT KPropertiesDialogPlugin : public QObject
{
Q_OBJECT
public:
/**
* Constructor
* To insert tabs into the properties dialog, use the add methods provided by
* KPageDialog (the properties dialog is a KPageDialog).
*/
KPropertiesDialogPlugin( KPropertiesDialog *_props );
virtual ~KPropertiesDialogPlugin();
/**
* Applies all changes to the file.
* This function is called when the user presses 'Ok'. The last plugin inserted
* is called first.
*/
virtual void applyChanges();
/**
* Convenience method for most ::supports methods
* @return true if the file is a local, regular, readable, desktop file
* @deprecated use KFileItem::isDesktopFile
*/
#ifndef KDE_NO_DEPRECATED
- static KDE_DEPRECATED bool isDesktopFile( const KFileItem& _item );
+ static KIO_DEPRECATED bool isDesktopFile( const KFileItem& _item );
#endif
void setDirty( bool b );
bool isDirty() const;
public Q_SLOTS:
void setDirty(); // same as setDirty( true ). TODO KDE5: void setDirty(bool dirty=true);
Q_SIGNALS:
/**
* Emit this signal when the user changed anything in the plugin's tabs.
* The hosting PropertiesDialog will call applyChanges only if the
* PropsPlugin has emitted this signal or if you have called setDirty() before.
*/
void changed();
protected:
/**
* Pointer to the dialog
*/
KPropertiesDialog *properties;
/**
* Returns the font height.
*/
int fontHeight() const;
private:
class KPropertiesDialogPluginPrivate;
KPropertiesDialogPluginPrivate* const d;
};
#endif
diff --git a/kio/kfile/kurlrequester.h b/kio/kfile/kurlrequester.h
index 2083d4c986..06b6700bcf 100644
--- a/kio/kfile/kurlrequester.h
+++ b/kio/kfile/kurlrequester.h
@@ -1,330 +1,330 @@
/* This file is part of the KDE libraries
Copyright (C) 1999,2000,2001 Carsten Pfeiffer <pfeiffer@kde.org>
library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2, as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KURLREQUESTER_H
#define KURLREQUESTER_H
#include <kfile.h>
#include <kpushbutton.h>
#include <kurl.h>
#include <khbox.h>
#ifndef KDE_NO_DEPRECATED
#include <keditlistbox.h>
#else
#include <keditlistwidget.h>
#endif
class KComboBox;
class KFileDialog;
class KLineEdit;
class KUrlCompletion;
class QString;
class QEvent;
/**
* This class is a widget showing a lineedit and a button, which invokes a
* filedialog. File name completion is available in the lineedit.
*
* The defaults for the filedialog are to ask for one existing local file, i.e.
* KFileDialog::setMode( KFile::File | KFile::ExistingOnly | KFile::LocalOnly )
* The default filter is "*", i.e. show all files, and the start directory is
* the current working directory, or the last directory where a file has been
* selected.
*
* You can change this behavior by using setMode() or setFilter().
*
* The default window modality for the file dialog is Qt::ApplicationModal
*
* \image html kurlrequester.png "KDE URL Requester"
*
* @short A widget to request a filename/url from the user
* @author Carsten Pfeiffer <pfeiffer@kde.org>
*/
class KIO_EXPORT KUrlRequester : public KHBox
{
Q_OBJECT
Q_PROPERTY( KUrl url READ url WRITE setUrl NOTIFY textChanged USER true )
Q_PROPERTY( QString filter READ filter WRITE setFilter )
Q_PROPERTY( KFile::Modes mode READ mode WRITE setMode )
Q_PROPERTY( QString clickMessage READ clickMessage WRITE setClickMessage )
Q_PROPERTY(QString text READ text WRITE setText)
Q_PROPERTY( Qt::WindowModality fileDialogModality READ fileDialogModality WRITE setFileDialogModality )
public:
/**
* Constructs a KUrlRequester widget.
*/
explicit KUrlRequester( QWidget *parent=0);
/**
* Constructs a KUrlRequester widget with the initial URL @p url.
*/
explicit KUrlRequester( const KUrl& url, QWidget *parent=0);
/**
* Special constructor, which creates a KUrlRequester widget with a custom
* edit-widget. The edit-widget can be either a KComboBox or a KLineEdit
* (or inherited thereof). Note: for geometry management reasons, the
* edit-widget is reparented to have the KUrlRequester as parent.
*/
KUrlRequester( QWidget *editWidget, QWidget *parent);
/**
* Destructs the KUrlRequester.
*/
~KUrlRequester();
/**
* @returns the current url in the lineedit. May be malformed, if the user
* entered something weird. ~user or environment variables are substituted
* for local files.
*/
KUrl url() const;
/**
* @returns the current start dir
* @since 4.3
*/
KUrl startDir() const;
/**
* @returns the current text in the lineedit or combobox.
* This does not do the URL expansion that url() does, it's only provided
* for cases where KUrlRequester is used to enter URL-or-something-else,
* like KOpenWithDialog where you can type a full command with arguments.
*
* @since 4.2
*/
QString text() const;
/**
* Sets the mode of the file dialog.
* Note: you can only select one file with the filedialog,
* so KFile::Files doesn't make much sense.
* @see KFileDialog::setMode()
*/
void setMode( KFile::Modes m );
/**
* Returns the current mode
* @see KFileDialog::mode()
*/
KFile::Modes mode() const;
/**
* Sets the filter for the file dialog.
* @see KFileDialog::setFilter()
*/
void setFilter( const QString& filter );
/**
* Returns the current filter for the file dialog.
* @see KFileDialog::filter()
*/
QString filter() const;
/**
* @returns a pointer to the filedialog.
* You can use this to customize the dialog, e.g. to call setLocationLabel
* or other things which are not accessible in the KUrlRequester API.
*
* Never returns 0. This method creates the file dialog on demand.
*
* Important: in "Directory only" mode, a KDirSelectDialog is used
* instead, so calling this method is useless.
*/
virtual KFileDialog * fileDialog() const;
/**
* @returns a pointer to the lineedit, either the default one, or the
* special one, if you used the special constructor.
*
* It is provided so that you can e.g. set an own completion object
* (e.g. KShellCompletion) into it.
*/
KLineEdit * lineEdit() const;
/**
* @returns a pointer to the combobox, in case you have set one using the
* special constructor. Returns 0L otherwise.
*/
KComboBox * comboBox() const;
/**
* @returns a pointer to the pushbutton. It is provided so that you can
* specify an own pixmap or a text, if you really need to.
*/
KPushButton * button() const;
/**
* @returns the KUrlCompletion object used in the lineedit/combobox.
*/
KUrlCompletion *completionObject() const;
/**
* @returns an object, suitable for use with KEditListWidget. It allows you
* to put this KUrlRequester into a KEditListWidget.
* Basically, do it like this:
* \code
* KUrlRequester *req = new KUrlRequester( someWidget );
* [...]
* KEditListWidget *editListWidget = new KEditListWidget( req->customEditor(), someWidget );
* \endcode
*/
#ifndef KDE_NO_DEPRECATED
const KEditListBox::CustomEditor &customEditor();
#else
const KEditListWidget::CustomEditor &customEditor();
#endif
/**
* @returns the message set with setClickMessage
* @since 4.2
*/
QString clickMessage() const;
/**
* Set a click message @p msg
* @since 4.2
*/
void setClickMessage(const QString& msg);
/**
* @returns the window modality of the file dialog set with setFileDialogModality
* @since 4.4
*/
Qt::WindowModality fileDialogModality() const;
/**
* Set the window modality for the file dialog to @p modality
* Directory selection dialogs are always modal
* @since 4.4
*/
void setFileDialogModality(Qt::WindowModality modality);
public Q_SLOTS:
/**
* Sets the url in the lineedit to @p url.
*/
void setUrl( const KUrl& url );
/**
* Sets the start dir @p startDir.
* The start dir is only used when the URL isn't set.
* @since 4.3
*/
void setStartDir( const KUrl& startDir );
/**
* Sets the url in the lineedit to @p KUrl::fromPath(path).
* This is only for local paths; do not pass a url here.
* This method is mostly for "local paths only" url requesters,
* for instance those set up with setMode(KFile::File|KFile::ExistingOnly|KFile::LocalOnly)
*
* @deprecated Use setUrl(KUrl(path)) instead.
*/
#ifndef KDE_NO_DEPRECATED
- KDE_DEPRECATED void setPath(const QString& path);
+ KIO_DEPRECATED void setPath(const QString& path);
#endif
/**
* Sets the current text in the lineedit or combobox.
* This is used for cases where KUrlRequester is used to
* enter URL-or-something-else, like KOpenWithDialog where you
* can type a full command with arguments.
*
* @see text
* @since 4.3
*/
void setText(const QString& text);
/**
* Clears the lineedit/combobox.
*/
void clear();
Q_SIGNALS:
// forwards from LineEdit
/**
* Emitted when the text in the lineedit changes.
* The parameter contains the contents of the lineedit.
*/
void textChanged( const QString& );
/**
* Emitted when return or enter was pressed in the lineedit.
*/
void returnPressed();
/**
* Emitted when return or enter was pressed in the lineedit.
* The parameter contains the contents of the lineedit.
*/
void returnPressed( const QString& );
/**
* Emitted before the filedialog is going to open. Connect
* to this signal to "configure" the filedialog, e.g. set the
* filefilter, the mode, a preview-widget, etc. It's usually
* not necessary to set a URL for the filedialog, as it will
* get set properly from the editfield contents.
*
* If you use multiple KUrlRequesters, you can connect all of them
* to the same slot and use the given KUrlRequester pointer to know
* which one is going to open.
*/
void openFileDialog( KUrlRequester * );
/**
* Emitted when the user changed the URL via the file dialog.
* The parameter contains the contents of the lineedit.
*/
void urlSelected( const KUrl& );
protected:
virtual void changeEvent (QEvent *e);
bool eventFilter( QObject *obj, QEvent *ev );
private:
class KUrlRequesterPrivate;
KUrlRequesterPrivate* const d;
Q_DISABLE_COPY(KUrlRequester)
Q_PRIVATE_SLOT(d, void _k_slotUpdateUrl())
Q_PRIVATE_SLOT(d, void _k_slotOpenDialog())
Q_PRIVATE_SLOT(d, void _k_slotFileDialogFinished())
};
class KIO_EXPORT KUrlComboRequester : public KUrlRequester // krazy:exclude=dpointer (For use in Qt Designer)
{
Q_OBJECT
public:
/**
* Constructs a KUrlRequester widget with a combobox.
*/
explicit KUrlComboRequester(QWidget *parent = 0);
private:
class Private;
Private* const d;
};
#endif // KURLREQUESTER_H
diff --git a/kio/kio/accessmanager.h b/kio/kio/accessmanager.h
index f3ea616b6a..02653a2b43 100644
--- a/kio/kio/accessmanager.h
+++ b/kio/kio/accessmanager.h
@@ -1,356 +1,356 @@
/*
* This file is part of the KDE project.
*
* Copyright (C) 2008 - 2009 Urs Wolfer <uwolfer @ kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*
*/
#ifndef KIO_ACCESSMANAGER_H
#define KIO_ACCESSMANAGER_H
#include <kio/global.h>
#include <QtNetwork/QNetworkAccessManager>
#include <QtNetwork/QNetworkRequest>
#include <QtNetwork/QNetworkCookieJar>
class QWidget;
namespace KIO {
/**
* @short A KDE implementation of QNetworkAccessManager.
*
* Use this class instead of QNetworkAccessManager if you want to integrate
* with KDE's KIO and KCookieJar modules for network operations and cookie
* handling respectively.
*
* Here is a simple example that shows how to set the QtWebKit module to use KDE's
* KIO for its network operations:
* @code
* QWebView *view = new QWebView(this);
* KIO::Integration::AccessManager *manager = new KIO::Integration::AccessManager(view);
* view->page()->setNetworkAccessManager(manager);
* @endcode
*
* To access member functions in the cookiejar class at a later point in your
* code simply downcast the pointer returned by QWebPage::networkAccessManager
* as follows:
* @code
* KIO::Integration::AccessManager *manager = qobject_cast<KIO::Integration::AccessManager*>(view->page()->accessManager());
* @endcode
*
* Please note that this class is in the KIO namespace for backward compatablity.
* You should use KIO::Integration::AccessManager to access this class in your
* code.
*
* <b>IMPORTANT</b>This class is not a replacement for the standard KDE API.
* It should ONLY be used to provide KDE integration in applications that
* cannot use the standard KDE API directly.
*
* @author Urs Wolfer \<uwolfer @ kde.org\>
* @author Dawit Alemayehu \<adawit @ kde.org\>
*
* @deprecated Use the KIO::Integration::AccessManager typedef to access this class instead.
* @since 4.3
*/
class KIO_EXPORT AccessManager : public QNetworkAccessManager
{
Q_OBJECT
public:
/*!
* Extensions to QNetworkRequest::Attribute enums.
* @since 4.3.2
*/
enum Attribute {
MetaData = QNetworkRequest::User, /** < Used to send KIO MetaData back and forth. type: QVariant::Map. */
KioError /**< Used to send KIO error codes that cannot be mapped into QNetworkReply::NetworkError. type: QVariant::Int */
};
/**
* Constructor
*/
AccessManager(QObject *parent);
/**
* Destructor
*/
virtual ~AccessManager();
/**
* Set @p allowed to false if you don't want any external content to be fetched.
* By default external content is fetched.
*/
void setExternalContentAllowed(bool allowed);
/**
* Returns true if external content is going to be fetched.
*
* @see setExternalContentAllowed
*/
bool isExternalContentAllowed() const;
/**
* Sets the cookiejar's window id to @p id.
*
* This is a convenience function that allows you to set the cookiejar's
* window id. Note that this function does nothing unless the cookiejar in
* use is of type KIO::Integration::CookieJar.
*
* By default the cookiejar's window id is set to false. Make sure you call
* this function and set the window id to its proper value when create an
* instance of this object. Otherwise, the KDE cookiejar will not be able
* to properly manage session based cookies.
*
* @see KIO::Integration::CookieJar::setWindowId.
* @since 4.4
* @deprecated Use setWindow
*/
#ifndef KDE_NO_DEPRECATED
- KDE_DEPRECATED void setCookieJarWindowId(WId id);
+ KIO_DEPRECATED void setCookieJarWindowId(WId id);
#endif
/**
* Sets the window associated with this network access manager.
*
* Note that @p widget will be used as a parent for dialogs in KIO as well
* as the cookie jar. If @p widget is not a window, this function will
* invoke @ref QWidget::window() to obtain the window for the given widget.
*
* @see KIO::Integration::CookieJar::setWindow.
* @since 4.7
*/
void setWindow(QWidget* widget);
/**
* Returns the cookiejar's window id.
*
* This is a convenience function that returns the window id associated
* with the cookiejar. Note that this function will return a 0 if the
* cookiejar is not of type KIO::Integration::CookieJar or a window id
* has not yet been set.
*
* @see KIO::Integration::CookieJar::windowId.
* @since 4.4
* @deprecated Use KIO::Integration::CookieJar::windowId
*/
#ifndef KDE_NO_DEPRECATED
- KDE_DEPRECATED WId cookieJarWindowid() const;
+ KIO_DEPRECATED WId cookieJarWindowid() const;
#endif
/**
* Returns the window associated with this network access manager.
*
* @see setWindow
* @since 4.7
*/
QWidget* window() const;
/**
* Returns a reference to the temporary meta data container.
*
* See kdelibs/kio/DESIGN.metadata for list of supported KIO meta data.
*
* Use this function when you want to set per request KIO meta data that
* will be removed after it has been sent once.
*
* @since 4.4
*/
KIO::MetaData& requestMetaData();
/**
* Returns a reference to the persistent meta data container.
*
* See kdelibs/kio/DESIGN.metadata for list of supported KIO meta data.
*
* Use this function when you want to set per session KIO meta data that
* will be sent with every request.
*
* Unlike @p requestMetaData, the meta data values set using the reference
* returned by this function will not be deleted and will be sent with every
* request.
*
* @since 4.4
*/
KIO::MetaData& sessionMetaData();
/**
* Puts the ioslave associated with the given @p reply on hold.
*
* This function is intended to make possible the implementation of
* the special case mentioned in KIO::get's documentation within the
* KIO-QNAM integration.
*
* @see KIO::get.
* @since 4.6
*/
static void putReplyOnHold(QNetworkReply* reply);
/**
* Sets the network reply object to emit readyRead when it receives meta data.
*
* Meta data is any information that is not the actual content itself, e.g.
* HTTP response headers of the HTTP protocol. You should only call this
* function, when an application does not connect to a reply object's
* metaDataChanged signal.
*
* @see QNetworkReply::metaDataChanged
* @since 4.7
*/
void setEmitReadyReadOnMetaDataChange(bool);
protected:
/**
* Reimplemented for internal reasons, the API is not affected.
*
* @see QNetworkAccessManager::createRequest
* @internal
*/
virtual QNetworkReply *createRequest(Operation op, const QNetworkRequest &req, QIODevice *outgoingData = 0);
private:
class AccessManagerPrivate;
AccessManagerPrivate* const d;
};
namespace Integration {
// KDE5: Move AccessManager into the KIO::Integration namespace.
typedef KIO::AccessManager AccessManager;
/**
* Maps KIO SSL meta data into the given QSslConfiguration object.
*
* @since 4.5
* @return true if @p metadata contains ssl information and the mapping succeeded.
*/
KIO_EXPORT bool sslConfigFromMetaData(const KIO::MetaData& metadata, QSslConfiguration& sslconfig);
/**
* @short A KDE implementation of QNetworkCookieJar.
*
* Use this class in place of QNetworkCookieJar if you want to integrate with
* KDE's cookiejar instead of the one that comes with Qt.
*
* Here is a simple example that shows how to set the QtWebKit module to use KDE's
* cookiejar:
* @code
* QWebView *view = new QWebView(this);
* KIO::Integration::CookieJar *cookieJar = new KIO::Integration::CookieJar;
* cookieJar->setWindowId(view->window()->winId());
* view->page()->networkAccessManager()->setCookieJar(cookieJar);
* @endcode
*
* To access member functions in the cookiejar class at a later point in your
* code simply downcast the pointer returned by QNetworkAccessManager::cookieJar
* as follows:
* @code
* KIO::Integration::CookieJar *cookieJar = qobject_cast<KIO::Integration::CookieJar*>(view->page()->accessManager()->cookieJar());
* @endcode
*
* <b>IMPORTANT</b>This class is not a replacement for the standard KDE API.
* It should ONLY be used to to provide KDE integration in applications that
* cannot use the standard KDE API directly.
*
* @see QNetworkAccessManager::setCookieJar for details.
*
* @author Dawit Alemayehu \<adawit @ kde.org\>
* @since 4.4
*/
class KIO_EXPORT CookieJar : public QNetworkCookieJar
{
Q_OBJECT
public:
/**
* Constructs a KNetworkCookieJar with parent @p parent.
*/
explicit CookieJar(QObject *parent = 0);
/**
* Destroys the KNetworkCookieJar.
*/
~CookieJar();
/**
* Returns the currently set window id. The default value is -1.
*/
WId windowId() const;
/**
* Sets the window id of the application.
*
* This value is used by KDE's cookiejar to manage session cookies, namely
* to delete them when the last application referring to such cookies is
* closed by the end user.
*
* @see QWidget::window()
* @see QWidget::winId()
*
* @param id the value of @ref QWidget::winId() from the window that contains your widget.
*/
void setWindowId(WId id);
/**
* Reparse the KDE cookiejar configuration file.
*/
void reparseConfiguration();
/**
* Reimplemented for internal reasons, the API is not affected.
*
* @see QNetworkCookieJar::cookiesForUrl
* @internal
*/
QList<QNetworkCookie> cookiesForUrl(const QUrl &url) const;
/**
* Reimplemented for internal reasons, the API is not affected.
*
* @see QNetworkCookieJar::setCookiesFromUrl
* @internal
*/
bool setCookiesFromUrl(const QList<QNetworkCookie> &cookieList, const QUrl &url);
/**
* Returns true if persistent caching of cookies is disabled.
*
* @see setDisableCookieStorage
* @since 4.6
*/
bool isCookieStorageDisabled() const;
/**
* Prevent persistent storage of cookies.
*
* Call this function if you do not want cookies to be stored locally for
* later access without disabling the cookiejar. All cookies will be discarded
* once the sessions that are using the cookie are done.
*
* @since 4.6
*/
void setDisableCookieStorage (bool disable);
private:
class CookieJarPrivate;
CookieJarPrivate* const d;
};
}
}
#endif // KIO_ACCESSMANAGER_H
diff --git a/kio/kio/connection.h b/kio/kio/connection.h
index 88d58c21a7..5729615174 100644
--- a/kio/kio/connection.h
+++ b/kio/kio/connection.h
@@ -1,190 +1,190 @@
// -*- c++ -*-
/* This file is part of the KDE libraries
Copyright (C) 2000 Stephan Kulow <coolo@kde.org>
David Faure <faure@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KIO_CONNECTION_H
#define KIO_CONNECTION_H
#if defined(MAKE_KIO_LIB) || defined(MAKE_KLAUNCHER)
# define KIO_CONNECTION_EXPORT KIO_EXPORT
#else
-# define KIO_CONNECTION_EXPORT KIO_EXPORT_DEPRECATED
+# define KIO_CONNECTION_EXPORT KIO_DEPRECATED_EXPORT
#endif
#include "kio_export.h"
#include <QtCore/QObject>
#include <QtCore/QString>
namespace KIO {
class ConnectionPrivate;
class ConnectionServer;
/**
* @private
*
* This class provides a simple means for IPC between two applications
* via a pipe.
* It handles a queue of commands to be sent which makes it possible to
* queue data before an actual connection has been established.
*/
class KIO_CONNECTION_EXPORT Connection : public QObject
{
Q_OBJECT
public:
/**
* Creates a new connection.
* @see connectToRemote, listenForRemote
*/
explicit Connection(QObject *parent = 0);
virtual ~Connection();
/**
* Connects to the remote address.
*/
void connectToRemote(const QString &address);
/// Closes the connection.
void close();
QString errorString() const;
bool isConnected() const;
/**
* Checks whether the connection has been initialized.
* @return true if the initialized
* @see init()
*/
bool inited() const;
/**
* Sends/queues the given command to be sent.
* @param cmd the command to set
* @param arr the bytes to send
* @return true if successful, false otherwise
*/
bool send(int cmd, const QByteArray &arr = QByteArray());
/**
* Sends the given command immediately.
* @param _cmd the command to set
* @param data the bytes to send
* @return true if successful, false otherwise
*/
bool sendnow( int _cmd, const QByteArray &data );
/**
* Returns true if there are packets to be read immediately,
* false if waitForIncomingTask must be called before more data
* is available.
*/
bool hasTaskAvailable() const;
/**
* Waits for one more command to be handled and ready.
*
* @param ms the time to wait in milliseconds
* @returns true if one command can be read, false if we timed out
*/
bool waitForIncomingTask(int ms = 30000);
/**
* Receive data.
*
* @param _cmd the received command will be written here
* @param data the received data will be written here
* @return >=0 indicates the received data size upon success
* -1 indicates error
*/
int read( int* _cmd, QByteArray &data );
/**
* Don't handle incoming data until resumed.
*/
void suspend();
/**
* Resume handling of incoming data.
*/
void resume();
/**
* Returns status of connection.
* @return true if suspended, false otherwise
*/
bool suspended() const;
Q_SIGNALS:
void readyRead();
private:
Q_PRIVATE_SLOT(d, void dequeue())
Q_PRIVATE_SLOT(d, void commandReceived(Task))
Q_PRIVATE_SLOT(d, void disconnected())
friend class ConnectionPrivate;
friend class ConnectionServer;
class ConnectionPrivate* const d;
};
class ConnectionServerPrivate;
/**
* @private
*
* This class provides a way to obtaining KIO::Connection connections.
*/
class KIO_EXPORT ConnectionServer : public QObject
{
Q_OBJECT
public:
ConnectionServer(QObject *parent = 0);
~ConnectionServer();
/**
* Sets this connection to listen mode. Use address() to obtain the
* address this is listening on.
*/
void listenForRemote();
bool isListening() const;
/// Closes the connection.
void close();
/**
* Returns the address for this connection if it is listening, an empty
* string if not.
*/
QString address() const;
Connection *nextPendingConnection();
void setNextPendingConnection(Connection *conn);
Q_SIGNALS:
void newConnection();
private:
friend class ConnectionServerPrivate;
ConnectionServerPrivate * const d;
};
}
#undef KIO_CONNECTION_EXPORT
#endif
diff --git a/kio/kio/global.h b/kio/kio/global.h
index bd4d9a20b5..b9a79fc277 100644
--- a/kio/kio/global.h
+++ b/kio/kio/global.h
@@ -1,447 +1,447 @@
// -*- c-basic-offset: 2 -*-
/* This file is part of the KDE libraries
Copyright (C) 2000-2005 David Faure <faure@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KIO_GLOBAL_H
#define KIO_GLOBAL_H
#include <kio/kio_export.h>
#include <QtCore/QString>
#include <QtCore/QHash>
#include <QtCore/QMap>
#include <QtCore/QList>
#include <QtCore/QVariant>
#include <kiconloader.h>
#include <QPixmap> // for pixmapForUrl
#include <sys/stat.h> // S_ISDIR
#include <sys/types.h> // mode_t
#include <kjob.h>
#ifdef Q_CC_MSVC
template class KDE_EXPORT QMap<QString, QString>;
#endif
class KUrl;
class KJobTrackerInterface;
class QTime;
/**
* @short A namespace for KIO globals
*
*/
namespace KIO
{
/// 64-bit file offset
typedef qlonglong fileoffset_t;
/// 64-bit file size
typedef qulonglong filesize_t;
/**
* Converts @p size from bytes to the string representation.
*
* @param size size in bytes
* @return converted size as a string - e.g. 123.4 KiB , 12.0 MiB
*/
KIO_EXPORT QString convertSize( KIO::filesize_t size );
/**
* Converts a size to a string representation
* Not unlike QString::number(...)
*
* @param size size in bytes
* @return converted size as a string - e.g. 123456789
*/
KIO_EXPORT QString number( KIO::filesize_t size );
/**
* Converts size from kibi-bytes (2^10) to the string representation.
*
* @param kibSize size in kibi-bytes (2^10)
* @return converted size as a string - e.g. 123.4 KiB , 12.0 MiB
*/
KIO_EXPORT QString convertSizeFromKiB( KIO::filesize_t kibSize );
/**
* Calculates remaining time in seconds from total size, processed size and speed.
*
* @param totalSize total size in bytes
* @param processedSize processed size in bytes
* @param speed speed in bytes per second
* @return calculated remaining time in seconds
*/
KIO_EXPORT unsigned int calculateRemainingSeconds( KIO::filesize_t totalSize,
KIO::filesize_t processedSize, KIO::filesize_t speed );
/**
* Convert @p seconds to a string representing number of days, hours, minutes and seconds
*
* @param seconds number of seconds to convert
* @return string representation in a locale depending format
*/
KIO_EXPORT QString convertSeconds( unsigned int seconds );
/**
* Calculates remaining time from total size, processed size and speed.
* Warning: As QTime is limited to 23:59:59, use calculateRemainingSeconds() instead
*
* @param totalSize total size in bytes
* @param processedSize processed size in bytes
* @param speed speed in bytes per second
* @return calculated remaining time
*/
#ifndef KDE_NO_DEPRECATED
- KIO_EXPORT_DEPRECATED QTime calculateRemaining( KIO::filesize_t totalSize, KIO::filesize_t processedSize, KIO::filesize_t speed );
+ KIO_DEPRECATED_EXPORT QTime calculateRemaining( KIO::filesize_t totalSize, KIO::filesize_t processedSize, KIO::filesize_t speed );
#endif
/**
* Helper for showing information about a set of files and directories
* @param items the number of items (= @p files + @p dirs + number of symlinks :)
* @param files the number of files
* @param dirs the number of dirs
* @param size the sum of the size of the @p files
* @param showSize whether to show the size in the result
* @return the summary string
*/
KIO_EXPORT QString itemsSummaryString(uint items, uint files, uint dirs, KIO::filesize_t size, bool showSize);
/**
* Encodes (from the text displayed to the real filename)
* This translates '/' into a "unicode fraction slash", QChar(0x2044).
* Used by KIO::link, for instance.
* @param str the file name to encode
* @return the encoded file name
*/
KIO_EXPORT QString encodeFileName( const QString & str );
/**
* Decodes (from the filename to the text displayed)
* This doesn't do anything anymore, it used to do the opposite of encodeFileName
* when encodeFileName was using %2F for '/'.
* @param str the file name to decode
* @return the decoded file name
*/
KIO_EXPORT QString decodeFileName( const QString & str );
/**
* @internal
* Commands that can be invoked by a job.
*
* (Move this to a non-public header)
*/
enum Command {
CMD_HOST = '0', // 48
CMD_CONNECT = '1', // 49
CMD_DISCONNECT = '2', // 50
CMD_SLAVE_STATUS = '3', // 51
CMD_SLAVE_CONNECT = '4', // 52
CMD_SLAVE_HOLD = '5', // 53
CMD_NONE = 'A', // 65
CMD_TESTDIR = 'B', // 66
CMD_GET = 'C', // 67
CMD_PUT = 'D', // 68
CMD_STAT = 'E', // 69
CMD_MIMETYPE = 'F', // 70
CMD_LISTDIR = 'G', // 71
CMD_MKDIR = 'H', // 72
CMD_RENAME = 'I', // 73
CMD_COPY = 'J', // 74
CMD_DEL = 'K', // 75
CMD_CHMOD = 'L', // 76
CMD_SPECIAL = 'M', // 77
CMD_SETMODIFICATIONTIME = 'N', // 78
CMD_REPARSECONFIGURATION = 'O', // 79
CMD_META_DATA = 'P', // 80
CMD_SYMLINK = 'Q', // 81
CMD_SUBURL = 'R', // 82 Inform the slave about the url it is streaming on.
CMD_MESSAGEBOXANSWER = 'S', // 83
CMD_RESUMEANSWER = 'T', // 84
CMD_CONFIG = 'U', // 85
CMD_MULTI_GET = 'V', // 86
CMD_SETLINKDEST = 'W', // 87
CMD_OPEN = 'X', // 88
CMD_CHOWN = 'Y', // 89
CMD_READ = 'Z', // 90
CMD_WRITE = 91,
CMD_SEEK = 92,
CMD_CLOSE = 93,
CMD_HOST_INFO = 94
// Add new ones here once a release is done, to avoid breaking binary compatibility.
// Note that protocol-specific commands shouldn't be added here, but should use special.
};
/**
* Error codes that can be emitted by KIO.
*/
enum Error {
ERR_CANNOT_OPEN_FOR_READING = KJob::UserDefinedError + 1,
ERR_CANNOT_OPEN_FOR_WRITING = KJob::UserDefinedError + 2,
ERR_CANNOT_LAUNCH_PROCESS = KJob::UserDefinedError + 3,
ERR_INTERNAL = KJob::UserDefinedError + 4,
ERR_MALFORMED_URL = KJob::UserDefinedError + 5,
ERR_UNSUPPORTED_PROTOCOL = KJob::UserDefinedError + 6,
ERR_NO_SOURCE_PROTOCOL = KJob::UserDefinedError + 7,
ERR_UNSUPPORTED_ACTION = KJob::UserDefinedError + 8,
ERR_IS_DIRECTORY = KJob::UserDefinedError + 9, // ... where a file was expected
ERR_IS_FILE = KJob::UserDefinedError + 10, // ... where a directory was expected (e.g. listing)
ERR_DOES_NOT_EXIST = KJob::UserDefinedError + 11,
ERR_FILE_ALREADY_EXIST = KJob::UserDefinedError + 12,
ERR_DIR_ALREADY_EXIST = KJob::UserDefinedError + 13,
ERR_UNKNOWN_HOST = KJob::UserDefinedError + 14,
ERR_ACCESS_DENIED = KJob::UserDefinedError + 15,
ERR_WRITE_ACCESS_DENIED = KJob::UserDefinedError + 16,
ERR_CANNOT_ENTER_DIRECTORY = KJob::UserDefinedError + 17,
ERR_PROTOCOL_IS_NOT_A_FILESYSTEM = KJob::UserDefinedError + 18,
ERR_CYCLIC_LINK = KJob::UserDefinedError + 19,
ERR_USER_CANCELED = KJob::KilledJobError,
ERR_CYCLIC_COPY = KJob::UserDefinedError + 21,
ERR_COULD_NOT_CREATE_SOCKET = KJob::UserDefinedError + 22, // KDE4: s/COULD_NOT/CANNOT/ or the other way round
ERR_COULD_NOT_CONNECT = KJob::UserDefinedError + 23,
ERR_CONNECTION_BROKEN = KJob::UserDefinedError + 24,
ERR_NOT_FILTER_PROTOCOL = KJob::UserDefinedError + 25,
ERR_COULD_NOT_MOUNT = KJob::UserDefinedError + 26,
ERR_COULD_NOT_UNMOUNT = KJob::UserDefinedError + 27,
ERR_COULD_NOT_READ = KJob::UserDefinedError + 28,
ERR_COULD_NOT_WRITE = KJob::UserDefinedError + 29,
ERR_COULD_NOT_BIND = KJob::UserDefinedError + 30,
ERR_COULD_NOT_LISTEN = KJob::UserDefinedError + 31,
ERR_COULD_NOT_ACCEPT = KJob::UserDefinedError + 32,
ERR_COULD_NOT_LOGIN = KJob::UserDefinedError + 33,
ERR_COULD_NOT_STAT = KJob::UserDefinedError + 34,
ERR_COULD_NOT_CLOSEDIR = KJob::UserDefinedError + 35,
ERR_COULD_NOT_MKDIR = KJob::UserDefinedError + 37,
ERR_COULD_NOT_RMDIR = KJob::UserDefinedError + 38,
ERR_CANNOT_RESUME = KJob::UserDefinedError + 39,
ERR_CANNOT_RENAME = KJob::UserDefinedError + 40,
ERR_CANNOT_CHMOD = KJob::UserDefinedError + 41,
ERR_CANNOT_DELETE = KJob::UserDefinedError + 42,
// The text argument is the protocol that the dead slave supported.
// This means for example: file, ftp, http, ...
ERR_SLAVE_DIED = KJob::UserDefinedError + 43,
ERR_OUT_OF_MEMORY = KJob::UserDefinedError + 44,
ERR_UNKNOWN_PROXY_HOST = KJob::UserDefinedError + 45,
ERR_COULD_NOT_AUTHENTICATE = KJob::UserDefinedError + 46,
ERR_ABORTED = KJob::UserDefinedError + 47, // Action got aborted from application side
ERR_INTERNAL_SERVER = KJob::UserDefinedError + 48,
ERR_SERVER_TIMEOUT = KJob::UserDefinedError + 49,
ERR_SERVICE_NOT_AVAILABLE = KJob::UserDefinedError + 50,
ERR_UNKNOWN = KJob::UserDefinedError + 51,
// (was a warning) ERR_CHECKSUM_MISMATCH = 52,
ERR_UNKNOWN_INTERRUPT = KJob::UserDefinedError + 53,
ERR_CANNOT_DELETE_ORIGINAL = KJob::UserDefinedError + 54,
ERR_CANNOT_DELETE_PARTIAL = KJob::UserDefinedError + 55,
ERR_CANNOT_RENAME_ORIGINAL = KJob::UserDefinedError + 56,
ERR_CANNOT_RENAME_PARTIAL = KJob::UserDefinedError + 57,
ERR_NEED_PASSWD = KJob::UserDefinedError + 58,
ERR_CANNOT_SYMLINK = KJob::UserDefinedError + 59,
ERR_NO_CONTENT = KJob::UserDefinedError + 60, // Action succeeded but no content will follow.
ERR_DISK_FULL = KJob::UserDefinedError + 61,
ERR_IDENTICAL_FILES = KJob::UserDefinedError + 62, // src==dest when moving/copying
ERR_SLAVE_DEFINED = KJob::UserDefinedError + 63, // for slave specified errors that can be
// rich text. Email links will be handled
// by the standard email app and all hrefs
// will be handled by the standard browser.
// <a href="exec:/khelpcenter ?" will be
// forked.
ERR_UPGRADE_REQUIRED = KJob::UserDefinedError + 64, // A transport upgrade is required to access this
// object. For instance, TLS is demanded by
// the server in order to continue.
ERR_POST_DENIED = KJob::UserDefinedError + 65, // Issued when trying to POST data to a certain Ports
// see job.cpp
ERR_COULD_NOT_SEEK = KJob::UserDefinedError + 66,
ERR_CANNOT_SETTIME = KJob::UserDefinedError + 67, // Emitted by setModificationTime
ERR_CANNOT_CHOWN = KJob::UserDefinedError + 68,
ERR_POST_NO_SIZE = KJob::UserDefinedError + 69
};
/**
* Returns a translated error message for @p errorCode using the
* additional error information provided by @p errorText.
* @param errorCode the error code
* @param errorText the additional error text
* @return the created error string
*/
KIO_EXPORT QString buildErrorString(int errorCode, const QString &errorText);
/**
* Returns a translated html error message for @p errorCode using the
* additional error information provided by @p errorText , @p reqUrl
* (the request URL), and the ioslave @p method .
* @param errorCode the error code
* @param errorText the additional error text
* @param reqUrl the request URL
* @param method the ioslave method
* @return the created error string
*/
KIO_EXPORT QString buildHTMLErrorString(int errorCode, const QString &errorText,
const KUrl *reqUrl = 0L, int method = -1 );
/**
* Returns translated error details for @p errorCode using the
* additional error information provided by @p errorText , @p reqUrl
* (the request URL), and the ioslave @p method .
*
* @param errorCode the error code
* @param errorText the additional error text
* @param reqUrl the request URL
* @param method the ioslave method
* @return the following data:
* @li QString errorName - the name of the error
* @li QString techName - if not null, the more technical name of the error
* @li QString description - a description of the error
* @li QStringList causes - a list of possible causes of the error
* @li QStringList solutions - a liso of solutions for the error
*/
KIO_EXPORT QByteArray rawErrorDetail(int errorCode, const QString &errorText,
const KUrl *reqUrl = 0L, int method = -1 );
/**
* Returns an appropriate error message if the given command @p cmd
* is an unsupported action (ERR_UNSUPPORTED_ACTION).
* @param protocol name of the protocol
* @param cmd given command
* @see enum Command
*/
KIO_EXPORT QString unsupportedActionErrorString(const QString &protocol, int cmd);
/**
* Specifies how to use the cache.
* @see parseCacheControl()
* @see getCacheControlString()
*/
enum CacheControl
{
CC_CacheOnly, ///< Fail request if not in cache
CC_Cache, ///< Use cached entry if available
CC_Verify, ///< Validate cached entry with remote site if expired
CC_Refresh, ///< Always validate cached entry with remote site
CC_Reload ///< Always fetch from remote site.
};
/**
* Parses the string representation of the cache control option.
*
* @param cacheControl the string representation
* @return the cache control value
* @see getCacheControlString()
*/
KIO_EXPORT KIO::CacheControl parseCacheControl(const QString &cacheControl);
/**
* Returns a string representation of the given cache control method.
*
* @param cacheControl the cache control method
* @return the string representation
* @see parseCacheControl()
*/
KIO_EXPORT QString getCacheControlString(KIO::CacheControl cacheControl);
/**
* Convenience method to find the pixmap for a URL.
*
* Call this one when you don't know the mimetype.
*
* @param _url URL for the file.
* @param _mode the mode of the file. The mode may modify the icon
* with overlays that show special properties of the
* icon. Use 0 for default
* @param _group The icon group where the icon is going to be used.
* @param _force_size Override globally configured icon size.
* Use 0 for the default size
* @param _state The icon state, one of: KIconLoader::DefaultState,
* KIconLoader::ActiveState or KIconLoader::DisabledState.
* @param _path Output parameter to get the full path. Seldom needed.
* Ignored if 0
* @return the pixmap of the URL, can be a default icon if not found
*/
KIO_EXPORT QPixmap pixmapForUrl( const KUrl & _url, mode_t _mode = 0, KIconLoader::Group _group = KIconLoader::Desktop,
int _force_size = 0, int _state = 0, QString * _path = 0 );
KIO_EXPORT KJobTrackerInterface *getJobTracker();
/**
* MetaData is a simple map of key/value strings.
*/
class KIO_EXPORT MetaData : public QMap<QString, QString>
{
public:
/**
* Creates an empty meta data map.
*/
MetaData() : QMap<QString, QString>() { }
/**
* Copy constructor.
*/
MetaData(const QMap<QString, QString>&metaData) :
QMap<QString, QString>(metaData) { }
/**
* Creates a meta data map from a QVaraint map.
* @since 4.3.1
*/
MetaData(const QMap<QString,QVariant> &);
/**
* Adds the given meta data map to this map.
* @param metaData the map to add
* @return this map
*/
MetaData & operator += ( const QMap<QString,QString> &metaData )
{
QMap<QString,QString>::ConstIterator it;
for(it = metaData.constBegin(); it != metaData.constEnd(); ++it)
{
insert(it.key(), it.value());
}
return *this;
}
/**
* Same as above except the value in the map is a QVariant.
*
* This convenience function allows you to easily assign the values
* of a QVariant to this meta data class.
*
* @param metaData the map to add
* @return this map
* @since 4.3.1
*/
MetaData & operator += ( const QMap<QString,QVariant> &metaData );
/**
* Sets the given meta data map to this map.
* @param metaData the map to add
* @return this map
* @since 4.3.1
*/
MetaData & operator = ( const QMap<QString,QVariant> &metaData );
/**
* Returns the contents of the map as a QVariant.
*
* @return a QVariant representation of the meta data map.
* @since 4.3.1
*/
QVariant toVariant() const;
};
}
#endif
diff --git a/kio/kio/job.h b/kio/kio/job.h
index aeaffa2a15..456a01834f 100644
--- a/kio/kio/job.h
+++ b/kio/kio/job.h
@@ -1,522 +1,522 @@
// -*- c++ -*-
/* This file is part of the KDE libraries
Copyright (C) 2000 Stephan Kulow <coolo@kde.org>
2000-2009 David Faure <faure@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KIO_JOB_H
#define KIO_JOB_H
#include <kio/jobclasses.h>
namespace KIO {
enum LoadType { Reload, NoReload };
class FileJob;
/**
* Creates a single directory.
*
*
*
*
* @param url The URL of the directory to create.
* @param permissions The permissions to set after creating the
* directory (unix-style), -1 for default permissions.
* @return A pointer to the job handling the operation.
*/
KIO_EXPORT SimpleJob * mkdir( const KUrl& url, int permissions = -1 ); // TODO KDE5: return a MkdirJob and make that class public again
/**
* Removes a single directory.
*
* The directory is assumed to be empty.
* The job will fail if the directory is not empty.
* Use KIO::del() (DeleteJob) to delete non-empty directories.
*
* @param url The URL of the directory to remove.
* @return A pointer to the job handling the operation.
*/
KIO_EXPORT SimpleJob * rmdir( const KUrl& url );
/**
* Changes permissions on a file or directory.
* See the other chmod in chmodjob.h for changing many files
* or directories.
*
* @param url The URL of file or directory.
* @param permissions The permissions to set.
* @return the job handling the operation.
*/
KIO_EXPORT SimpleJob * chmod( const KUrl& url, int permissions );
/**
* Changes ownership and group of a file or directory.
*
* @param url The URL of file or directory.
* @param owner the new owner
* @param group the new group
* @return the job handling the operation.
*/
KIO_EXPORT SimpleJob * chown( const KUrl& url, const QString& owner, const QString& group );
/**
* Changes the modification time on a file or directory.
*
* @param url The URL of file or directory.
* @param permissions The permissions to set.
* @return the job handling the operation.
*/
KIO_EXPORT SimpleJob *setModificationTime( const KUrl& url, const QDateTime& mtime );
/**
* Rename a file or directory.
* Warning: this operation fails if a direct renaming is not
* possible (like with files or dirs on separate partitions)
* Use move or file_move in this case.
*
* @param src The original URL
* @param dest The final URL
* @param flags Can be Overwrite here
* @return the job handling the operation.
*/
KIO_EXPORT SimpleJob * rename( const KUrl& src, const KUrl & dest, JobFlags flags = DefaultFlags );
/**
* Create or move a symlink.
* This is the lowlevel operation, similar to file_copy and file_move.
* It doesn't do any check (other than those the slave does)
* and it doesn't show rename and skip dialogs - use KIO::link for that.
* @param target The string that will become the "target" of the link (can be relative)
* @param dest The symlink to create.
* @param flags Can be Overwrite and HideProgressInfo
* @return the job handling the operation.
*/
KIO_EXPORT SimpleJob * symlink( const QString & target, const KUrl& dest, JobFlags flags = DefaultFlags );
/**
* Execute any command that is specific to one slave (protocol).
*
* Examples are : HTTP POST, mount and unmount (kio_file)
*
* @param url The URL isn't passed to the slave, but is used to know
* which slave to send it to :-)
* @param data Packed data. The meaning is completely dependent on the
* slave, but usually starts with an int for the command number.
* @param flags Can be HideProgressInfo here
* @return the job handling the operation.
*/
KIO_EXPORT SimpleJob * special( const KUrl& url, const QByteArray & data, JobFlags flags = DefaultFlags );
/**
* Mount filesystem.
*
* Special job for @p kio_file.
*
* @param ro Mount read-only if @p true.
* @param fstype File system type (e.g. "ext2", can be empty).
* @param dev Device (e.g. /dev/sda0).
* @param point Mount point, can be @p null.
* @param flags Can be HideProgressInfo here
* @return the job handling the operation.
*/
KIO_EXPORT SimpleJob *mount( bool ro, const QByteArray& fstype, const QString& dev, const QString& point, JobFlags flags = DefaultFlags );
/**
* Unmount filesystem.
*
* Special job for @p kio_file.
*
* @param point Point to unmount.
* @param flags Can be HideProgressInfo here
* @return the job handling the operation.
*/
KIO_EXPORT SimpleJob *unmount( const QString & point, JobFlags flags = DefaultFlags );
/**
* HTTP cache update
*
* @param url Url to update, protocol must be "http".
* @param no_cache If true, cache entry for @p url is deleted.
* @param expireDate Local machine time indicating when the entry is
* supposed to expire.
* @return the job handling the operation.
*/
KIO_EXPORT SimpleJob *http_update_cache( const KUrl& url, bool no_cache, time_t expireDate);
/**
* Find all details for one file or directory.
*
* @param url the URL of the file
* @param flags Can be HideProgressInfo here
* @return the job handling the operation.
*/
KIO_EXPORT StatJob * stat( const KUrl& url, JobFlags flags = DefaultFlags );
/**
* Find all details for one file or directory.
* This version of the call includes two additional booleans, @p sideIsSource and @p details.
*
* @param url the URL of the file
* @param side is SourceSide when stating a source file (we will do a get on it if
* the stat works) and DestinationSide when stating a destination file (target of a copy).
* The reason for this parameter is that in some cases the kioslave might not
* be able to determine a file's existence (e.g. HTTP doesn't allow it, FTP
* has issues with case-sensitivity on some systems).
* When the slave can't reliably determine the existence of a file, it will:
* @li be optimistic if SourceSide, i.e. it will assume the file exists,
* and if it doesn't this will appear when actually trying to download it
* @li be pessimistic if DestinationSide, i.e. it will assume the file
* doesn't exist, to prevent showing "about to overwrite" errors to the user.
* If you simply want to check for existence without downloading/uploading afterwards,
* then you should use DestinationSide.
*
* @param details selects the level of details we want.
* By default this is 2 (all details wanted, including modification time, size, etc.),
* setDetails(1) is used when deleting: we don't need all the information if it takes
* too much time, no need to follow symlinks etc.
* setDetails(0) is used for very simple probing: we'll only get the answer
* "it's a file or a directory or a symlink, or it doesn't exist". This is used by KRun and DeleteJob.
* @param flags Can be HideProgressInfo here
* @return the job handling the operation.
*/
KIO_EXPORT StatJob * stat( const KUrl& url, KIO::StatJob::StatSide side,
short int details, JobFlags flags = DefaultFlags );
/**
* Find all details for one file or directory.
* This version of the call includes two additional booleans, @p sideIsSource and @p details.
*
* @param url the URL of the file
* @param sideIsSource is true when stating a source file (we will do a get on it if
* the stat works) and false when stating a destination file (target of a copy).
* The reason for this parameter is that in some cases the kioslave might not
* be able to determine a file's existence (e.g. HTTP doesn't allow it, FTP
* has issues with case-sensitivity on some systems).
* When the slave can't reliably determine the existence of a file, it will:
* @li be optimistic if sideIsSource=true, i.e. it will assume the file exists,
* and if it doesn't this will appear when actually trying to download it
* @li be pessimistic if sideIsSource=false, i.e. it will assume the file
* doesn't exist, to prevent showing "about to overwrite" errors to the user.
* If you simply want to check for existence without downloading/uploading afterwards,
* then you should use sideIsSource=false.
*
* @param details selects the level of details we want.
* By default this is 2 (all details wanted, including modification time, size, etc.),
* setDetails(1) is used when deleting: we don't need all the information if it takes
* too much time, no need to follow symlinks etc.
* setDetails(0) is used for very simple probing: we'll only get the answer
* "it's a file or a directory, or it doesn't exist". This is used by KRun.
* @param flags Can be HideProgressInfo here
* @return the job handling the operation.
*/
#ifndef KDE_NO_DEPRECATED
- KIO_EXPORT_DEPRECATED StatJob * stat( const KUrl& url, bool sideIsSource,
+ KIO_DEPRECATED_EXPORT StatJob * stat( const KUrl& url, bool sideIsSource,
short int details, JobFlags flags = DefaultFlags );
#endif
/**
* Get (a.k.a. read).
* This is the job to use in order to "download" a file into memory.
* The slave emits the data through the data() signal.
*
* Special case: if you want to determine the mimetype of the file first,
* and then read it with the appropriate component, you can still use
* a KIO::get() directly. When that job emits the mimeType signal, (which is
* guaranteed to happen before it emits any data), put the job on hold:
* <code>
* job->putOnHold();
* KIO::Scheduler::publishSlaveOnHold();
* </code>
* and forget about the job. The next time someone does a KIO::get() on the
* same URL (even in another process) this job will be resumed. This saves KIO
* from doing two requests to the server.
*
* @param url the URL of the file
* @param reload: Reload to reload the file, NoReload if it can be taken from the cache
* @param flags Can be HideProgressInfo here
* @return the job handling the operation.
*/
KIO_EXPORT TransferJob *get( const KUrl& url, LoadType reload = NoReload, JobFlags flags = DefaultFlags );
/**
* Open ( random access I/O )
*
* The file-job emits open() when opened
* @param url the URL of the file
* @param mode the access privileges: see \ref OpenMode
*
* @return The file-handling job. It will never return 0. Errors are handled asynchronously
* (emitted as signals).
*/
KIO_EXPORT FileJob *open(const KUrl &url, QIODevice::OpenMode mode);
/**
* Put (a.k.a. write)
*
* @param url Where to write data.
* @param permissions May be -1. In this case no special permission mode is set.
* @param flags Can be HideProgressInfo, Overwrite and Resume here. WARNING:
* Setting Resume means that the data will be appended to @p dest if @p dest exists.
* @return the job handling the operation.
* @see multi_get()
*/
KIO_EXPORT TransferJob *put( const KUrl& url, int permissions,
JobFlags flags = DefaultFlags );
/**
* HTTP POST (for form data).
*
* Example:
* \code
* job = KIO::http_post( url, postData, KIO::HideProgressInfo );
* job->addMetaData("content-type", contentType );
* job->addMetaData("referrer", referrerURL);
* \endcode
*
* @p postData is the data that you want to send and
* @p contentType is the complete HTTP header line that
* specifies the content's MIME type, for example
* "Content-Type: text/xml".
*
* You MUST specify content-type!
*
* Often @p contentType is
* "Content-Type: application/x-www-form-urlencoded" and
* the @p postData is then an ASCII string (without null-termination!)
* with characters like space, linefeed and percent escaped like %20,
* %0A and %25.
*
* @param url Where to write the data.
* @param postData Encoded data to post.
* @param flags Can be HideProgressInfo here
* @return the job handling the operation.
*/
KIO_EXPORT TransferJob *http_post( const KUrl& url, const QByteArray &postData,
JobFlags flags = DefaultFlags );
/**
* HTTP POST.
*
* This function, unlike the one that accepts a QByteArray, accepts an IO device
* from which to read the encoded data to be posted to the server in order to
* to avoid holding the content of very large post requests, e.g. multimedia file
* uploads, in memory.
*
* @param url Where to write the data.
* @param postData Encoded data to post.
* @param size Size of the encoded post data.
* @param flags Can be HideProgressInfo here
* @return the job handling the operation.
*
* @since 4.7
*/
KIO_EXPORT TransferJob *http_post( const KUrl& url, QIODevice* device,
qint64 size = -1, JobFlags flags = DefaultFlags );
/**
* HTTP DELETE.
*
* Though this function servers the same purpose as KIO::file_delete, unlike
* file_delete it accomodates HTTP sepecific actions such as redirections.
*
* @param src url resource to delete.
* @param flags Can be HideProgressInfo here
* @return the job handling the operation.
*
* @since 4.7.3
*/
KIO_EXPORT TransferJob *http_delete( const KUrl& url, JobFlags flags = DefaultFlags );
/**
* Get (a.k.a. read), into a single QByteArray.
* @see StoredTransferJob
*
* @param url the URL of the file
* @param reload: Reload to reload the file, NoReload if it can be taken from the cache
* @param flags Can be HideProgressInfo here
* @return the job handling the operation.
*/
KIO_EXPORT StoredTransferJob *storedGet( const KUrl& url, LoadType reload = NoReload, JobFlags flags = DefaultFlags );
/**
* Put (a.k.a. write) data from a single QByteArray.
* @see StoredTransferJob
*
* @param arr The data to write
* @param url Where to write data.
* @param permissions May be -1. In this case no special permission mode is set.
* @param flags Can be HideProgressInfo, Overwrite and Resume here. WARNING:
* Setting Resume means that the data will be appended to @p dest if @p dest exists.
* @return the job handling the operation.
*/
KIO_EXPORT StoredTransferJob *storedPut( const QByteArray& arr, const KUrl& url, int permissions,
JobFlags flags = DefaultFlags );
/**
* HTTP POST (a.k.a. write) data from a single QByteArray.
* @see StoredTransferJob
*
* @param arr The data to write
* @param url Where to write data.
* @param flags Can be HideProgressInfo here.
* @return the job handling the operation.
* @since 4.2
*/
KIO_EXPORT StoredTransferJob *storedHttpPost( const QByteArray& arr, const KUrl& url,
JobFlags flags = DefaultFlags );
/**
* HTTP POST (a.k.a. write) data from the given IO device.
* @see StoredTransferJob
*
* @param device Device from which the encoded data to be posted is read.
* @param url Where to write data.
* @param size Size of the encoded data to be posted.
* @param flags Can be HideProgressInfo here.
* @return the job handling the operation.
*
* @since 4.7
*/
KIO_EXPORT StoredTransferJob *storedHttpPost( QIODevice* device, const KUrl& url,
qint64 size = -1, JobFlags flags = DefaultFlags );
/**
* Creates a new multiple get job.
*
* @param id the id of the get operation
* @param url the URL of the file
* @param metaData the MetaData associated with the file
*
* @return the job handling the operation.
* @see get()
*/
KIO_EXPORT MultiGetJob *multi_get( long id, const KUrl &url, const MetaData &metaData);
/**
* Find mimetype for one file or directory.
*
* If you are going to download the file right after determining its mimetype,
* then don't use this, prefer using a KIO::get() job instead. See the note
* about putting the job on hold once the mimetype is determined.
*
* @param url the URL of the file
* @param flags Can be HideProgressInfo here
* @return the job handling the operation.
*/
KIO_EXPORT MimetypeJob * mimetype( const KUrl& url,
JobFlags flags = DefaultFlags );
/**
* Copy a single file.
*
* Uses either SlaveBase::copy() if the slave supports that
* or get() and put() otherwise.
* @param src Where to get the file.
* @param dest Where to put the file.
* @param permissions May be -1. In this case no special permission mode is set.
* @param flags Can be HideProgressInfo, Overwrite and Resume here. WARNING:
* Setting Resume means that the data will be appended to @p dest if @p dest exists.
* @return the job handling the operation.
*/
KIO_EXPORT FileCopyJob *file_copy( const KUrl& src, const KUrl& dest, int permissions=-1,
JobFlags flags = DefaultFlags );
/**
* Overload for catching code mistakes. Do NOT call this method (it is not implemented),
* insert a value for permissions (-1 by default) before the JobFlags.
* @since 4.5
*/
FileCopyJob *file_copy( const KUrl& src, const KUrl& dest, JobFlags flags ); // not implemented - on purpose.
/**
* Move a single file.
*
* Use either SlaveBase::rename() if the slave supports that,
* or copy() and del() otherwise, or eventually get() & put() & del()
* @param src Where to get the file.
* @param dest Where to put the file.
* @param permissions May be -1. In this case no special permission mode is set.
* @param flags Can be HideProgressInfo, Overwrite and Resume here. WARNING:
* Setting Resume means that the data will be appended to @p dest if @p dest exists.
* @return the job handling the operation.
*/
KIO_EXPORT FileCopyJob *file_move( const KUrl& src, const KUrl& dest, int permissions=-1,
JobFlags flags = DefaultFlags );
/**
* Overload for catching code mistakes. Do NOT call this method (it is not implemented),
* insert a value for permissions (-1 by default) before the JobFlags.
* @since 4.3
*/
FileCopyJob *file_move( const KUrl& src, const KUrl& dest, JobFlags flags ); // not implemented - on purpose.
/**
* Delete a single file.
*
* @param src File to delete.
* @param flags Can be HideProgressInfo here
* @return the job handling the operation.
*/
KIO_EXPORT SimpleJob *file_delete( const KUrl& src, JobFlags flags = DefaultFlags );
/**
* List the contents of @p url, which is assumed to be a directory.
*
* "." and ".." are returned, filter them out if you don't want them.
*
*
* @param url the url of the directory
* @param flags Can be HideProgressInfo here
* @param includeHidden true for all files, false to cull out UNIX hidden
* files/dirs (whose names start with dot)
* @return the job handling the operation.
*/
KIO_EXPORT ListJob *listDir( const KUrl& url, JobFlags flags = DefaultFlags,
bool includeHidden = true );
/**
* The same as the previous method, but recurses subdirectories.
* Directory links are not followed.
*
* "." and ".." are returned but only for the toplevel directory.
* Filter them out if you don't want them.
*
* @param url the url of the directory
* @param flags Can be HideProgressInfo here
* @param includeHidden true for all files, false to cull out UNIX hidden
* files/dirs (whose names start with dot)
* @return the job handling the operation.
*/
KIO_EXPORT ListJob *listRecursive( const KUrl& url, JobFlags flags = DefaultFlags,
bool includeHidden = true );
/**
* Tries to map a local URL for the given URL, using a KIO job.
*
* Starts a (stat) job for determining the "most local URL" for a given URL.
* Retrieve the result with StatJob::mostLocalUrl in the result slot.
* @param url The URL we are testing.
* \since 4.4
*/
KIO_EXPORT StatJob* mostLocalUrl(const KUrl& url, JobFlags flags = DefaultFlags);
}
#endif
diff --git a/kio/kio/jobclasses.h b/kio/kio/jobclasses.h
index de27f4043a..a56d921d74 100644
--- a/kio/kio/jobclasses.h
+++ b/kio/kio/jobclasses.h
@@ -1,1043 +1,1043 @@
// -*- c++ -*-
/* This file is part of the KDE libraries
Copyright (C) 2000 Stephan Kulow <coolo@kde.org>
2000-2009 David Faure <faure@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KIO_JOBCLASSES_H
#define KIO_JOBCLASSES_H
#include <QtCore/QObject>
#include <QtCore/QLinkedList> // KDE5: remove
#include <QtCore/QStringList>
#include <kurl.h>
#include <kio/global.h>
#include <kio/udsentry.h>
#include <kcompositejob.h>
namespace KIO {
/**
* Flags for the job properties.
* Not all flags are supported in all cases. Please see documentation of
* the calling function!
*/
enum JobFlag {
/**
* Show the progress info GUI, no Resume and no Overwrite
*/
DefaultFlags = 0,
/**
* Hide progress information dialog, i.e. don't show a GUI.
*/
HideProgressInfo = 1,
/**
* When set, automatically append to the destination file if it exists already.
* WARNING: this is NOT the builtin support for offering the user to resume a previous
* partial download. The Resume option is much less used, it allows to append
* to an existing file.
* This is used by KIO::put(), KIO::file_copy(), KIO::file_move().
*/
Resume = 2,
/**
* When set, automatically overwrite the destination if it exists already.
* This is used by KIO::rename(), KIO::put(), KIO::file_copy(), KIO::file_move(), KIO::symlink().
* Otherwise the operation will fail with ERR_FILE_ALREADY_EXIST or ERR_DIR_ALREADY_EXIST.
*/
Overwrite = 4
};
Q_DECLARE_FLAGS(JobFlags, JobFlag)
Q_DECLARE_OPERATORS_FOR_FLAGS(JobFlags)
class JobUiDelegate;
class JobPrivate;
/**
* The base class for all jobs.
* For all jobs created in an application, the code looks like
*
* \code
* KIO::Job * job = KIO::someoperation( some parameters );
* connect( job, SIGNAL( result( KJob * ) ),
* this, SLOT( slotResult( KJob * ) ) );
* \endcode
* (other connects, specific to the job)
*
* And slotResult is usually at least:
*
* \code
* if ( job->error() )
* job->ui()->showErrorMessage();
* \endcode
* @see KIO::Scheduler
*/
class KIO_EXPORT Job : public KCompositeJob {
Q_OBJECT
protected:
Job();
Job(JobPrivate &dd);
public:
virtual ~Job();
void start() {} // Since KIO autostarts its jobs
/**
* Retrieves the UI delegate of this job.
*
* This method is basically a convenience for static_cast<KIO::JobUiDelegate*>(uiDelegate()).
*
* @return the delegate used by the job to communicate with the UI
*/
JobUiDelegate *ui() const;
protected:
/**
* Abort this job.
* This kills all subjobs and deletes the job.
*
*/
virtual bool doKill();
/**
* Suspend this job
* @see resume
*/
virtual bool doSuspend();
/**
* Resume this job
* @see suspend
*/
virtual bool doResume();
public:
/**
* Converts an error code and a non-i18n error message into an
* error message in the current language. The low level (non-i18n)
* error message (usually a url) is put into the translated error
* message using %1.
*
* Example for errid == ERR_CANNOT_OPEN_FOR_READING:
* \code
* i18n( "Could not read\n%1" ).arg( errortext );
* \endcode
* Use this to display the error yourself, but for a dialog box
* use ui()->showErrorMessage(). Do not call it if error()
* is not 0.
* @return the error message and if there is no error, a message
* telling the user that the app is broken, so check with
* error() whether there is an error
*/
QString errorString() const;
/**
* Converts an error code and a non-i18n error message into i18n
* strings suitable for presentation in a detailed error message box.
*
* @param reqUrl the request URL that generated this error message
* @param method the method that generated this error message
* (unimplemented)
* @return the following strings: caption, error + description,
* causes+solutions
*/
QStringList detailedErrorStrings(const KUrl *reqUrl = 0L,
int method = -1) const;
/**
* Display a dialog box to inform the user of the error given by
* this job.
* Only call if error is not 0, and only in the slot connected
* to result.
* @param parent the parent widget for the dialog box, can be 0 for
* top-level
* @deprecated you should use job->ui()->setWindow(parent)
* and job->ui()->showErrorMessage() instead
*/
#ifndef KDE_NO_DEPRECATED
- KDE_DEPRECATED void showErrorDialog( QWidget *parent = 0 );
+ KIO_DEPRECATED void showErrorDialog( QWidget *parent = 0 );
#endif
/**
* Returns whether the user should be asked about things when the job
* is unsure, like whether to overwrite existing files etc.
* @return true if user interactions are enabled (true by default),
* false if setUiDelegate(0) was called.
* @see setUiDelegate()
*/
bool isInteractive() const;
/**
* Set the parent Job.
* One example use of this is when FileCopyJob calls RenameDialog::open,
* it must pass the correct progress ID of the parent CopyJob
* (to hide the progress dialog).
* You can set the parent job only once. By default a job does not
* have a parent job.
* @param parentJob the new parent job
*/
void setParentJob( Job* parentJob );
/**
* Returns the parent job, if there is one.
* @return the parent job, or 0 if there is none
* @see setParentJob
*/
Job* parentJob() const;
/**
* Set meta data to be sent to the slave, replacing existing
* meta data.
* @param metaData the meta data to set
* @see addMetaData()
* @see mergeMetaData()
*/
void setMetaData( const KIO::MetaData &metaData);
/**
* Add key/value pair to the meta data that is sent to the slave.
* @param key the key of the meta data
* @param value the value of the meta data
* @see setMetaData()
* @see mergeMetaData()
*/
void addMetaData(const QString &key, const QString &value);
/**
* Add key/value pairs to the meta data that is sent to the slave.
* If a certain key already existed, it will be overridden.
* @param values the meta data to add
* @see setMetaData()
* @see mergeMetaData()
*/
void addMetaData(const QMap<QString,QString> &values);
/**
* Add key/value pairs to the meta data that is sent to the slave.
* If a certain key already existed, it will remain unchanged.
* @param values the meta data to merge
* @see setMetaData()
* @see addMetaData()
*/
void mergeMetaData(const QMap<QString,QString> &values);
/**
* @internal. For the scheduler. Do not use.
*/
MetaData outgoingMetaData() const;
/**
* Get meta data received from the slave.
* (Valid when first data is received and/or slave is finished)
* @return the job's meta data
*/
MetaData metaData() const;
/**
* Query meta data received from the slave.
* (Valid when first data is received and/or slave is finished)
* @param key the key of the meta data to retrieve
* @return the value of the meta data, or QString() if the
* @p key does not exist
*/
QString queryMetaData(const QString &key);
protected:
Q_SIGNALS:
/**
* @deprecated. Don't use !
* Emitted when the job is canceled.
* Signal result() is emitted as well, and error() is,
* in this case, ERR_USER_CANCELED.
* @param job the job that emitted this signal
*/
void canceled( KJob *job );
/**
* Emitted when the slave successfully connected to the host.
* There is no guarantee the slave will send this, and this is
* currently unused (in the applications).
* @param job the job that emitted this signal
*/
void connected( KIO::Job *job );
protected:
/**
* Add a job that has to be finished before a result
* is emitted. This has obviously to be called before
* the finish signal is emitted by the slave.
*
* @param job the subjob to add
*/
virtual bool addSubjob( KJob *job );
/**
* Mark a sub job as being done.
*
* KDE4 change: this doesn't terminate the parent job anymore, call emitResult to do that.
*
* @param job the subjob to remove
*/
virtual bool removeSubjob( KJob *job );
private:
/**
* Forward signal from subjob.
* @param job the subjob
* @param speed the speed in bytes/s
* @see speed()
*/
Q_PRIVATE_SLOT(d_func(), void slotSpeed( KJob *job, unsigned long speed ))
Q_DECLARE_PRIVATE(Job)
};
class SimpleJobPrivate;
/**
* A simple job (one url and one command).
* This is the base class for all jobs that are scheduled.
* Other jobs are high-level jobs (CopyJob, DeleteJob, FileCopyJob...)
* that manage subjobs but aren't scheduled directly.
*/
class KIO_EXPORT SimpleJob : public KIO::Job {
Q_OBJECT
public:
~SimpleJob();
protected:
/**
* Suspend this job
* @see resume
*/
virtual bool doSuspend();
/**
* Resume this job
* @see suspend
*/
virtual bool doResume();
/**
* Abort job.
* This kills all subjobs and deletes the job.
*/
virtual bool doKill();
public:
/**
* Returns the SimpleJob's URL
* @return the url
*/
const KUrl& url() const;
/**
* Abort job.
* Suspends slave to be reused by another job for the same request.
*/
virtual void putOnHold();
/**
* Discard suspended slave.
*/
static void removeOnHold();
/**
* Returns true when redirections are handled internally, the default.
*
* @since 4.4
*/
bool isRedirectionHandlingEnabled() const;
/**
* Set @p handle to false to prevent the internal handling of redirections.
*
* When this flag is set, redirection requests are simply forwarded to the
* caller instead of being handled internally.
*
* @since 4.4
*/
void setRedirectionHandlingEnabled(bool handle);
public Q_SLOTS:
/**
* @internal
* Called on a slave's error.
* Made public for the scheduler.
*/
void slotError( int , const QString & );
protected Q_SLOTS:
/**
* Called when the slave marks the job
* as finished.
*/
virtual void slotFinished( );
/**
* @internal
* Called on a slave's warning.
*/
virtual void slotWarning( const QString & );
/**
* MetaData from the slave is received.
* @param _metaData the meta data
* @see metaData()
*/
virtual void slotMetaData( const KIO::MetaData &_metaData);
protected:
/*
* Allow jobs that inherit SimpleJob and are aware
* of redirections to store the SSL session used.
* Retrieval is handled by SimpleJob::start
* @param m_redirectionURL Reference to redirection URL,
* used instead of m_url if not empty
*/
void storeSSLSessionFromJob(const KUrl &m_redirectionURL);
/**
* Creates a new simple job. You don't need to use this constructor,
* unless you create a new job that inherits from SimpleJob.
*/
SimpleJob(SimpleJobPrivate &dd);
private:
Q_PRIVATE_SLOT(d_func(), void slotConnected())
Q_PRIVATE_SLOT(d_func(), void slotProcessedSize( KIO::filesize_t data_size ))
Q_PRIVATE_SLOT(d_func(), void slotSpeed( unsigned long speed ))
Q_PRIVATE_SLOT(d_func(), void slotTotalSize( KIO::filesize_t data_size ))
Q_PRIVATE_SLOT(d_func(), void _k_slotSlaveInfoMessage(const QString&))
Q_DECLARE_PRIVATE(SimpleJob)
};
class StatJobPrivate;
/**
* A KIO job that retrieves information about a file or directory.
* @see KIO::stat()
*/
class KIO_EXPORT StatJob : public SimpleJob {
Q_OBJECT
public:
enum StatSide {
SourceSide,
DestinationSide
};
~StatJob();
/**
* A stat() can have two meanings. Either we want to read from this URL,
* or to check if we can write to it. First case is "source", second is "dest".
* It is necessary to know what the StatJob is for, to tune the kioslave's behavior
* (e.g. with FTP).
* @param side SourceSide or DestinationSide
*/
void setSide(StatSide side);
/**
* A stat() can have two meanings. Either we want to read from this URL,
* or to check if we can write to it. First case is "source", second is "dest".
* It is necessary to know what the StatJob is for, to tune the kioslave's behavior
* (e.g. with FTP).
* @param source true for "source" mode, false for "dest" mode
*/
#ifndef KDE_NO_DEPRECATED
- KDE_DEPRECATED void setSide( bool source );
+ KIO_DEPRECATED void setSide( bool source );
#endif
/**
* Selects the level of @p details we want.
* By default this is 2 (all details wanted, including modification time, size, etc.),
* setDetails(1) is used when deleting: we don't need all the information if it takes
* too much time, no need to follow symlinks etc.
* setDetails(0) is used for very simple probing: we'll only get the answer
* "it's a file or a directory, or it doesn't exist". This is used by KRun.
* @param details 2 for all details, 1 for simple, 0 for very simple
*/
void setDetails( short int details );
/**
* @brief Result of the stat operation.
* Call this in the slot connected to result,
* and only after making sure no error happened.
* @return the result of the stat
*/
const UDSEntry & statResult() const;
/**
* @brief most local URL
* Call this in the slot connected to result,
* and only after making sure no error happened.
* @return the most local URL for the URL we were stat'ing.
*
* Sample usage:
* <code>
* KIO::StatJob* job = KIO::mostLocalUrl("desktop:/foo");
* job->ui()->setWindow(this);
* connect(job, SIGNAL(result(KJob*)), this, SLOT(slotMostLocalUrlResult(KJob*)));
* [...]
* // and in the slot
* if (job->error()) {
* [...] // doesn't exist
* } else {
* const KUrl localUrl = job->mostLocalUrl();
* // localUrl = file:///$HOME/Desktop/foo
* [...]
* }
*
* \since 4.4
*/
KUrl mostLocalUrl() const;
Q_SIGNALS:
/**
* Signals a redirection.
* Use to update the URL shown to the user.
* The redirection itself is handled internally.
* @param job the job that is redirected
* @param url the new url
*/
void redirection( KIO::Job *job, const KUrl &url );
/**
* Signals a permanent redirection.
* The redirection itself is handled internally.
* @param job the job that is redirected
* @param fromUrl the original URL
* @param toUrl the new URL
*/
void permanentRedirection( KIO::Job *job, const KUrl &fromUrl, const KUrl &toUrl );
protected Q_SLOTS:
virtual void slotFinished();
virtual void slotMetaData( const KIO::MetaData &_metaData);
protected:
StatJob(StatJobPrivate &dd);
private:
Q_PRIVATE_SLOT(d_func(), void slotStatEntry( const KIO::UDSEntry & entry ))
Q_PRIVATE_SLOT(d_func(), void slotRedirection( const KUrl &url))
Q_DECLARE_PRIVATE(StatJob)
};
class FileCopyJobPrivate;
class TransferJobPrivate;
/**
* The transfer job pumps data into and/or out of a Slave.
* Data is sent to the slave on request of the slave ( dataReq).
* If data coming from the slave can not be handled, the
* reading of data from the slave should be suspended.
*/
class KIO_EXPORT TransferJob : public SimpleJob {
Q_OBJECT
public:
~TransferJob();
/**
* Sets the modification time of the file to be created (by KIO::put)
* Note that some kioslaves might ignore this.
*/
void setModificationTime( const QDateTime& mtime );
/**
* Checks whether we got an error page. This currently only happens
* with HTTP urls. Call this from your slot connected to result().
*
* @return true if we got an (HTML) error page from the server
* instead of what we asked for.
*/
bool isErrorPage() const;
/**
* Enable the async data mode.
* When async data is enabled, data should be provided to the job by
* calling sendAsyncData() instead of returning data in the
* dataReq() signal.
*/
void setAsyncDataEnabled(bool enabled);
/**
* Provide data to the job when async data is enabled.
* Should be called exactly once after receiving a dataReq signal
* Sending an empty block indicates end of data.
*/
void sendAsyncData(const QByteArray &data);
/**
* When enabled, the job reports the amount of data that has been sent,
* instead of the amount of data that that has been received.
* @see slotProcessedSize
* @see slotSpeed
* @deprecated not needed, this is false for KIO::get and true for KIO::put,
* automatically since KDE-4.2.1
*/
#ifndef KDE_NO_DEPRECATED
- KDE_DEPRECATED void setReportDataSent(bool enabled);
+ KIO_DEPRECATED void setReportDataSent(bool enabled);
#endif
/**
* Returns whether the job reports the amount of data that has been
* sent (true), or whether the job reports the amount of data that
* has been received (false)
* @deprecated not needed, this is false for KIO::get and true for KIO::put,
* automatically since KDE-4.2.1 (and not useful as public API)
*/
#ifndef KDE_NO_DEPRECATED
- KDE_DEPRECATED bool reportDataSent() const;
+ KIO_DEPRECATED bool reportDataSent() const;
#endif
/**
* Call this in the slot connected to result,
* and only after making sure no error happened.
* @return the mimetype of the URL
*/
QString mimetype() const;
/**
* Set the total size of data that we are going to send
* in a put job. Helps getting proper progress information.
* @since 4.2.1
*/
void setTotalSize(KIO::filesize_t bytes);
protected:
/**
* Called when m_subJob finishes.
* @param job the job that finished
*/
virtual void slotResult( KJob *job );
/**
* Reimplemented for internal reasons
*/
virtual bool doResume();
Q_SIGNALS:
/**
* Data from the slave has arrived.
* @param job the job that emitted this signal
* @param data data received from the slave.
*
* End of data (EOD) has been reached if data.size() == 0, however, you
* should not be certain of data.size() == 0 ever happening (e.g. in case
* of an error), so you should rely on result() instead.
*/
void data( KIO::Job *job, const QByteArray &data );
/**
* Request for data.
* Please note, that you shouldn't put too large chunks
* of data in it as this requires copies within the frame
* work, so you should rather split the data you want
* to pass here in reasonable chunks (about 1MB maximum)
*
* @param job the job that emitted this signal
* @param data buffer to fill with data to send to the
* slave. An empty buffer indicates end of data. (EOD)
*/
void dataReq( KIO::Job *job, QByteArray &data );
/**
* Signals a redirection.
* Use to update the URL shown to the user.
* The redirection itself is handled internally.
* @param job the job that emitted this signal
* @param url the new URL
*/
void redirection( KIO::Job *job, const KUrl &url );
/**
* Signals a permanent redirection.
* The redirection itself is handled internally.
* @param job the job that emitted this signal
* @param fromUrl the original URL
* @param toUrl the new URL
*/
void permanentRedirection( KIO::Job *job, const KUrl &fromUrl, const KUrl &toUrl );
/**
* Mimetype determined.
* @param job the job that emitted this signal
* @param type the mime type
*/
void mimetype( KIO::Job *job, const QString &type );
/**
* @internal
* Emitted if the "put" job found an existing partial file
* (in which case offset is the size of that file)
* and emitted by the "get" job if it supports resuming to
* the given offset - in this case @p offset is unused)
*/
void canResume( KIO::Job *job, KIO::filesize_t offset );
protected Q_SLOTS:
virtual void slotRedirection( const KUrl &url);
virtual void slotFinished();
virtual void slotData( const QByteArray &data);
virtual void slotDataReq();
virtual void slotMimetype( const QString &mimetype );
virtual void slotMetaData( const KIO::MetaData &_metaData);
protected:
TransferJob(TransferJobPrivate &dd);
private:
Q_PRIVATE_SLOT(d_func(), void slotErrorPage())
Q_PRIVATE_SLOT(d_func(), void slotCanResume( KIO::filesize_t offset ))
Q_PRIVATE_SLOT(d_func(), void slotPostRedirection())
Q_PRIVATE_SLOT(d_func(), void slotNeedSubUrlData())
Q_PRIVATE_SLOT(d_func(), void slotSubUrlData(KIO::Job*, const QByteArray &))
Q_PRIVATE_SLOT(d_func(), void slotDataReqFromDevice())
Q_DECLARE_PRIVATE(TransferJob)
// A FileCopyJob may control one or more TransferJobs
friend class FileCopyJob;
friend class FileCopyJobPrivate;
};
class StoredTransferJobPrivate;
/**
* StoredTransferJob is a TransferJob (for downloading or uploading data) that
* also stores a QByteArray with the data, making it simpler to use than the
* standard TransferJob.
*
* For KIO::storedGet it puts the data into the member QByteArray, so the user
* of this class can get hold of the whole data at once by calling data()
* when the result signal is emitted.
* You should only use StoredTransferJob to download data if you cannot
* process the data by chunks while it's being downloaded, since storing
* everything in a QByteArray can potentially require a lot of memory.
*
* For KIO::storedPut the user of this class simply provides the bytearray from
* the start, and the job takes care of uploading it.
* You should only use StoredTransferJob to upload data if you cannot
* provide the in chunks while it's being uploaded, since storing
* everything in a QByteArray can potentially require a lot of memory.
*/
class KIO_EXPORT StoredTransferJob : public KIO::TransferJob {
Q_OBJECT
public:
~StoredTransferJob();
/**
* Set data to be uploaded. This is for put jobs.
* Automatically called by KIO::storedPut(const QByteArray &, ...),
* do not call this yourself.
*/
void setData( const QByteArray& arr );
/**
* Get hold of the downloaded data. This is for get jobs.
* You're supposed to call this only from the slot connected to the result() signal.
*/
QByteArray data() const;
protected:
StoredTransferJob(StoredTransferJobPrivate &dd);
private:
Q_PRIVATE_SLOT(d_func(), void slotStoredData( KIO::Job *job, const QByteArray &data ))
Q_PRIVATE_SLOT(d_func(), void slotStoredDataReq( KIO::Job *job, QByteArray &data ))
Q_DECLARE_PRIVATE(StoredTransferJob)
};
class MultiGetJobPrivate;
/**
* The MultiGetJob is a TransferJob that allows you to get
* several files from a single server. Don't create directly,
* but use KIO::multi_get() instead.
* @see KIO::multi_get()
*/
class KIO_EXPORT MultiGetJob : public TransferJob {
Q_OBJECT
public:
virtual ~MultiGetJob();
/**
* Get an additional file.
*
* @param id the id of the file
* @param url the url of the file to get
* @param metaData the meta data for this request
*/
void get(long id, const KUrl &url, const MetaData &metaData);
Q_SIGNALS:
/**
* Data from the slave has arrived.
* @param id the id of the request
* @param data data received from the slave.
* End of data (EOD) has been reached if data.size() == 0
*/
void data( long id, const QByteArray &data);
/**
* Mimetype determined
* @param id the id of the request
* @param type the mime type
*/
void mimetype( long id, const QString &type );
/**
* File transfer completed.
*
* When all files have been processed, result(KJob *) gets
* emitted.
* @param id the id of the request
*/
void result( long id);
protected Q_SLOTS:
virtual void slotRedirection( const KUrl &url);
virtual void slotFinished();
virtual void slotData( const QByteArray &data);
virtual void slotMimetype( const QString &mimetype );
protected:
MultiGetJob(MultiGetJobPrivate &dd);
private:
Q_DECLARE_PRIVATE(MultiGetJob)
};
class MimetypeJobPrivate;
/**
* A MimetypeJob is a TransferJob that allows you to get
* the mime type of an URL. Don't create directly,
* but use KIO::mimetype() instead.
* @see KIO::mimetype()
*/
class KIO_EXPORT MimetypeJob : public TransferJob {
Q_OBJECT
public:
~MimetypeJob();
protected Q_SLOTS:
virtual void slotFinished( );
protected:
MimetypeJob(MimetypeJobPrivate &dd);
private:
Q_DECLARE_PRIVATE(MimetypeJob)
};
/**
* The FileCopyJob copies data from one place to another.
* @see KIO::file_copy()
* @see KIO::file_move()
*/
class KIO_EXPORT FileCopyJob : public Job {
Q_OBJECT
public:
~FileCopyJob();
/**
* If you know the size of the source file, call this method
* to inform this job. It will be displayed in the "resume" dialog.
* @param size the size of the source file
*/
void setSourceSize(KIO::filesize_t size);
/**
* Sets the modification time of the file
*
* Note that this is ignored if a direct copy (SlaveBase::copy) can be done,
* in which case the mtime of the source is applied to the destination (if the protocol
* supports the concept).
*/
void setModificationTime( const QDateTime& mtime );
/**
* Returns the source URL.
* @return the source URL
*/
KUrl srcUrl() const;
/**
* Returns the destination URL.
* @return the destination URL
*/
KUrl destUrl() const;
bool doSuspend();
bool doResume();
Q_SIGNALS:
/**
* Mimetype determined during a file copy.
* This is never emitted during a move, and might not be emitted during
* a file copy, depending on the slave. But when a get and a put are
* being used (which is the common case), this signal forwards the
* mimetype information from the get job.
*
* @param job the job that emitted this signal
* @param type the mime type
*/
void mimetype( KIO::Job *job, const QString &type );
protected Q_SLOTS:
/**
* Called whenever a subjob finishes.
* @param job the job that emitted this signal
*/
virtual void slotResult( KJob *job );
protected:
FileCopyJob(FileCopyJobPrivate &dd);
private:
Q_PRIVATE_SLOT(d_func(), void slotStart())
Q_PRIVATE_SLOT(d_func(), void slotData( KIO::Job *, const QByteArray &data))
Q_PRIVATE_SLOT(d_func(), void slotDataReq( KIO::Job *, QByteArray &data))
Q_PRIVATE_SLOT(d_func(), void slotMimetype( KIO::Job*, const QString& type ))
Q_PRIVATE_SLOT(d_func(), void slotProcessedSize( KJob *job, qulonglong size ))
Q_PRIVATE_SLOT(d_func(), void slotTotalSize( KJob *job, qulonglong size ))
Q_PRIVATE_SLOT(d_func(), void slotPercent( KJob *job, unsigned long pct ))
Q_PRIVATE_SLOT(d_func(), void slotCanResume( KIO::Job *job, KIO::filesize_t offset ))
Q_DECLARE_PRIVATE(FileCopyJob)
};
class ListJobPrivate;
/**
* A ListJob is allows you to get the get the content of a directory.
* Don't create the job directly, but use KIO::listRecursive() or
* KIO::listDir() instead.
* @see KIO::listRecursive()
* @see KIO::listDir()
*/
class KIO_EXPORT ListJob : public SimpleJob {
Q_OBJECT
public:
~ListJob();
/**
* Returns the ListJob's redirection URL. This will be invalid if there
* was no redirection.
* @return the redirection url
*/
const KUrl& redirectionUrl() const;
/**
* Do not apply any KIOSK restrictions to this job.
*/
void setUnrestricted(bool unrestricted);
Q_SIGNALS:
/**
* This signal emits the entry found by the job while listing.
* The progress signals aren't specific to ListJob. It simply
* uses SimpleJob's processedSize (number of entries listed) and
* totalSize (total number of entries, if known),
* as well as percent.
* @param job the job that emitted this signal
* @param list the list of UDSEntries
*/
void entries( KIO::Job *job, const KIO::UDSEntryList& list); // TODO KDE5: use KIO::ListJob* argument to avoid casting
/**
* Signals a redirection.
* Use to update the URL shown to the user.
* The redirection itself is handled internally.
* @param job the job that is redirected
* @param url the new url
*/
void redirection( KIO::Job *job, const KUrl &url );
/**
* Signals a permanent redirection.
* The redirection itself is handled internally.
* @param job the job that emitted this signal
* @param fromUrl the original URL
* @param toUrl the new URL
*/
void permanentRedirection( KIO::Job *job, const KUrl &fromUrl, const KUrl &toUrl );
protected Q_SLOTS:
virtual void slotFinished( );
virtual void slotMetaData( const KIO::MetaData &_metaData);
virtual void slotResult( KJob *job );
protected:
ListJob(ListJobPrivate &dd);
private:
Q_PRIVATE_SLOT(d_func(), void slotListEntries( const KIO::UDSEntryList& list ))
Q_PRIVATE_SLOT(d_func(), void slotRedirection( const KUrl &url ))
Q_PRIVATE_SLOT(d_func(), void gotEntries( KIO::Job * subjob, const KIO::UDSEntryList& list ))
Q_DECLARE_PRIVATE(ListJob)
};
class SpecialJobPrivate;
/**
* A class that sends a special command to an ioslave.
* This allows you to send a binary blob to an ioslave and handle
* its responses. The ioslave will receive the binary data as an
* argument to the "special" function (inherited from SlaveBase::special()).
*
* Use this only on ioslaves that belong to your application. Sending
* special commands to other ioslaves may cause unexpected behaviour.
*
* @see KIO::special
*/
class KIO_EXPORT SpecialJob : public TransferJob
{
Q_OBJECT
public:
/**
* Creates a KIO::SpecialJob.
*
* @param url the URL to be passed to the ioslave
* @param data the data to be sent to the SlaveBase::special() function.
*/
explicit SpecialJob(const KUrl &url, const QByteArray &data = QByteArray());
/**
* Sets the QByteArray that is passed to SlaveBase::special() on
* the ioslave.
*/
void setArguments(const QByteArray &data);
/**
* Returns the QByteArray data that will be sent (or has been sent) to the
* ioslave.
*/
QByteArray arguments() const;
public:
~SpecialJob();
private:
Q_DECLARE_PRIVATE(SpecialJob)
};
}
#endif
diff --git a/kio/kio/kdatatool.h b/kio/kio/kdatatool.h
index f4518acf6a..25743f5aaf 100644
--- a/kio/kio/kdatatool.h
+++ b/kio/kio/kdatatool.h
@@ -1,310 +1,310 @@
/* This file is part of the KDE project
Copyright (C) 1998, 1999, 2000 Torben Weis <weis@kde.org>
Copyright (C) 2001 David Faure <faure@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KDATATOOL_H
#define KDATATOOL_H
#include <kio/kio_export.h>
#include <QtCore/QObject>
#include <QtCore/QString>
#include <kaction.h>
#include <kservice.h>
#include <kcomponentdata.h>
class KDataTool;
class QPixmap;
class QStringList;
class KActionCollection;
// If you're only looking at implementing a data-tool, skip directly to the last
// class definition, KDataTool.
/**
* This is a convenience class for KService. You can use it if you have
* a KService describing a KDataTool. In this case the KDataToolInfo class
* is more convenient to work with.
*
* Especially useful is the method createTool which creates the datatool
* described by the service.
* @see KDataTool
*/
class KIO_EXPORT KDataToolInfo
{
public:
/**
* Create an invalid KDataToolInfo.
*/
KDataToolInfo();
/**
* Create a valid KDataToolInfo.
* @param service the corresponding service
* @param instance the instance to use
*/
KDataToolInfo(const KService::Ptr& service, const KComponentData &instance);
/**
* Destructor
*/
~KDataToolInfo();
/**
* Copy constructor.
*/
KDataToolInfo( const KDataToolInfo& info );
/**
* Assignment operator.
*/
KDataToolInfo& operator= ( const KDataToolInfo& info );
/**
* Returns the data type that the DataTool can accept.
* @return the C++ data type that this DataTool accepts.
* For example "QString" or "QImage" or something more
* complicated.
*/
QString dataType() const;
/**
* Returns a list of mime type that will be accepted by the DataTool.
* The mimetypes are only used if the dataType can be used to store
* different mimetypes. For example in a "QString" you could save "text/plain"
* or "text/html" or "text/xml".
*
* @return the mime types accepted by this DataTool. For example
* "image/gif" or "text/plain". In some cases the dataType
* determines the accepted type of data perfectly. In this cases
* this list may be empty.
*/
QStringList mimeTypes() const;
/**
* Checks whether the DataTool is read-only.
* @return true if the DataTool does not modify the data passed to it by KDataTool::run.
*/
bool isReadOnly() const;
/**
* Returns the icon of this data tool.
* @return a large pixmap for the DataTool.
* @deprecated, use iconName()
*/
#ifndef KDE_NO_DEPRECATED
- KDE_DEPRECATED QPixmap icon() const;
+ KIO_DEPRECATED QPixmap icon() const;
#endif
/**
* Returns the mini icon of this data tool.
* @return a mini pixmap for the DataTool.
* @deprecated, use iconName()
*/
#ifndef KDE_NO_DEPRECATED
- KDE_DEPRECATED QPixmap miniIcon() const;
+ KIO_DEPRECATED QPixmap miniIcon() const;
#endif
/**
* Returns the icon name for this DataTool.
* @return the name of the icon for the DataTool
*/
QString iconName() const;
/**
* Returns a list of strings that you can put in a QPopupMenu item, for example to
* offer the DataTools services to the user. The returned value
* is usually something like "Spell checking", "Shrink Image", "Rotate Image"
* or something like that.
* This list comes from the Comment field of the tool's desktop file
* (so that it can be translated).
*
* Each of the strings returned corresponds to a string in the list returned by
* commands.
*
* @return a list of strings that you can put in a QPopupMenu item
*/
QStringList userCommands() const;
/**
* Returns the list of commands the DataTool can execute. The application
* passes the command to the KDataTool::run method.
*
* This list comes from the Commands field of the tool's desktop file.
*
* Each of the strings returned corresponds to a string in the list returned by
* userCommands.
* @return the list of commands the DataTool can execute, suitable for
* the KDataTool::run method.
*/
QStringList commands() const;
/**
* Creates the data tool described by this KDataToolInfo.
* @param parent the parent of the QObject (or 0 for parent-less KDataTools)
* @return a pointer to the created data tool or 0 on error.
*/
KDataTool* createTool( QObject* parent = 0 ) const;
/**
* The KDataToolInfo's service that is represented by this class.
* @return the service
*/
KService::Ptr service() const;
/**
* The instance of the service.
* @return the instance
*/
KComponentData componentData() const;
/**
* A DataToolInfo may be invalid if the KService passed to its constructor does
* not feature the service type "KDataTool".
* @return true if valid, false otherwise
*/
bool isValid() const;
/**
* Queries the KServiceTypeTrader about installed KDataTool implementations.
* @param datatype a type that the application can 'export' to the tools (e.g. QString)
* @param mimetype the mimetype of the data (e.g. text/plain)
* @param instance the application (or the part)'s instance (to check if a tool is excluded from this part,
* and also used if the tool wants to read its configuration in the app's config file).
* @return the list of results
*/
static QList<KDataToolInfo> query(const QString& datatype, const QString& mimetype, const KComponentData &instance);
private:
class KDataToolInfoPrivate;
KDataToolInfoPrivate * const d;
};
/**
* This class helps applications implement support for KDataTool.
* The steps to follow are simple:
* @li query for the available tools using KDataToolInfo::query
* @li pass the result to KDataToolAction::dataToolActionList (with a slot)
* @li plug the resulting actions, either using KXMLGUIClient::plugActionList, or by hand.
*
* The slot defined for step 2 is called when the action is activated, and
* that's where the tool should be created and run.
*/
class KIO_EXPORT KDataToolAction : public KAction
{
Q_OBJECT
public:
/**
* Constructs a new KDataToolAction.
*
* @param text The text that will be displayed
* @param info The corresponding KDataToolInfo
* @param command The command of the action
* @param parent This action's parent
* @param name The name of the action
*/
KDataToolAction( const QString & text, const KDataToolInfo & info, const QString & command, QObject *parent );
/**
* Destructor
*/
~KDataToolAction();
/**
* Creates a list of actions from a list of information about data-tools.
* The slot must have a signature corresponding to the toolActivated signal.
*
* Note that it's the caller's responsibility to delete the actions when they're not needed anymore.
* @param tools the list of data tool descriptions
* @param receiver the receiver for toolActivated() signals
* @param slot the slot that will receive the toolActivated() signals
* @param parent the parent action collection for the actions to be created
* @return the KActions
*/
static QList<QAction*> dataToolActionList( const QList<KDataToolInfo> & tools, const QObject *receiver, const char* slot, KActionCollection* parent );
Q_SIGNALS:
/**
* Emitted when a tool has been activated.
* @param info a description of the activated tools
* @param command the command for the tool
*/
void toolActivated( const KDataToolInfo & info, const QString & command );
protected:
virtual void slotActivated();
private:
class KDataToolActionPrivate;
KDataToolActionPrivate * const d;
};
/**
* A generic tool that processes data.
*
* A data-tool is a "plugin" for an application, that acts (reads/modifies)
* on a portion of the data present in the document (e.g. a text document,
* a single word or paragraph, a KSpread cell, an image, etc.)
*
* The application has some generic code for presenting the tools in a popupmenu
* @see KDataToolAction, and for activating a tool, passing it the data
* (and possibly getting modified data from it).
*/
class KIO_EXPORT KDataTool : public QObject
{
Q_OBJECT
public:
/**
* Constructor
* The data-tool is only created when a menu-item, that relates to it, is activated.
* @param parent the parent of the QObject (or 0 for parent-less KDataTools)
*/
KDataTool( QObject* parent = 0 );
/**
* Destructor
*/
~KDataTool();
/**
* @internal. Do not use under any circumstance (including bad weather).
*/
void setComponentData(const KComponentData &componentData);
/**
* Returns the instance of the part that created this tool.
* Usually used if the tool wants to read its configuration in the app's config file.
* @return the instance of the part that created this tool.
*/
const KComponentData &componentData() const;
/**
* Interface for 'running' this tool.
* This is the method that the data-tool must implement.
*
* @param command is the command that was selected (see KDataToolInfo::commands())
* @param data the data provided by the application, on which to run the tool.
* The application is responsible for setting that data before running the tool,
* and for getting it back and updating itself with it, after the tool ran.
* @param datatype defines the type of @p data.
* @param mimetype defines the mimetype of the data (for instance datatype may be
* QString, but the mimetype can be text/plain, text/html etc.)
* @return true if successful, false otherwise
*/
virtual bool run( const QString& command, void* data, const QString& datatype, const QString& mimetype) = 0;
private:
class KDataToolPrivate;
KDataToolPrivate * const d;
};
#endif
diff --git a/kio/kio/kdirmodel.h b/kio/kio/kdirmodel.h
index 6691e03e06..e35757fcaf 100644
--- a/kio/kio/kdirmodel.h
+++ b/kio/kio/kdirmodel.h
@@ -1,276 +1,276 @@
/* This file is part of the KDE project
Copyright (C) 2006 David Faure <faure@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KDIRMODEL_H
#define KDIRMODEL_H
#include <QtCore/QAbstractItemModel>
#include <kio/kio_export.h>
#include <kfileitem.h>
class KDirLister;
class KDirModelPrivate;
class JobUrlCache;
/**
* @short A model for a KIO-based directory tree.
*
* KDirModel implements the QAbstractItemModel interface (for use with Qt's model/view widgets)
* around the directory listing for one directory or a tree of directories.
*
* Note that there are some cases when using QPersistentModelIndexes from this model will not give
* expected results. QPersistentIndexes will remain valid and updated if its siblings are added or
* removed. However, if the QPersistentIndex or one of its ancestors is moved, the QPersistentIndex will become
* invalid. For example, if a file or directory is renamed after storing a QPersistentModelIndex for it,
* the index (along with any stored children) will become invalid even though it is still in the model. The reason
* for this is that moves of files and directories are treated as separate insert and remove actions.
*
* @see KDirSortFilterProxyModel
*
* @author David Faure
* Based on work by Hamish Rodda and Pascal Letourneau
*/
class KIO_EXPORT KDirModel : public QAbstractItemModel
{
Q_OBJECT
public:
/**
* @param parent parent qobject
*/
explicit KDirModel( QObject* parent = 0 );
~KDirModel();
/**
* Set the directory lister to use by this model, instead of the default KDirLister created internally.
* The model takes ownership.
*/
void setDirLister( KDirLister* dirLister );
/**
* Return the directory lister used by this model.
*/
KDirLister* dirLister() const;
/**
* Return the fileitem for a given index. This is O(1), i.e. fast.
*/
KFileItem itemForIndex( const QModelIndex& index ) const;
/**
* Return the index for a given kfileitem. This can be slow.
* @deprecated use the method that takes a KFileItem by value
*/
#ifndef KDE_NO_DEPRECATED
- KDE_DEPRECATED QModelIndex indexForItem( const KFileItem* ) const;
+ KIO_DEPRECATED QModelIndex indexForItem( const KFileItem* ) const;
#endif
/**
* Return the index for a given kfileitem. This can be slow.
*/
QModelIndex indexForItem( const KFileItem& ) const;
/**
* Return the index for a given url. This can be slow.
*/
QModelIndex indexForUrl(const KUrl& url) const;
/**
* @short Lists subdirectories using fetchMore() as needed until the given @p url exists in the model.
*
* When the model is used by a treeview, call KDirLister::openUrl with the base url of the tree,
* then the treeview will take care of calling fetchMore() when the user opens directories.
* However if you want the tree to show a given URL (i.e. open the tree recursively until that URL),
* call expandToUrl().
* Note that this is asynchronous; the necessary listing of subdirectories will take time so
* the model will not immediately have this url available.
* The model emits the signal expand() when an index has become available; this can be connected
* to the treeview in order to let it open that index.
* @param url the url of a subdirectory of the directory model (or a file in a subdirectory)
*/
void expandToUrl(const KUrl& url);
/**
* Notify the model that the item at this index has changed.
* For instance because KMimeTypeResolver called determineMimeType on it.
* This makes the model emit its dataChanged signal at this index, so that views repaint.
* Note that for most things (renaming, changing size etc.), KDirLister's signals tell the model already.
*/
void itemChanged( const QModelIndex& index );
/***
* Useful "default" columns. Views can use a proxy to have more control over this.
*/
enum ModelColumns {
Name = 0,
Size,
ModifiedTime,
Permissions,
Owner,
Group,
Type,
ColumnCount
};
/// Possible return value for data(ChildCountRole), meaning the item isn't a directory,
/// or we haven't calculated its child count yet
enum { ChildCountUnknown = -1 };
enum AdditionalRoles {
// Note: use printf "0x%08X\n" $(($RANDOM*$RANDOM))
// to define additional roles.
FileItemRole = 0x07A263FF, ///< returns the KFileItem for a given index
ChildCountRole = 0x2C4D0A40, ///< returns the number of items in a directory, or ChildCountUnknown
HasJobRole = 0x01E555A5 ///< returns whether or not there is a job on an item (file/directory)
};
enum DropsAllowedFlag {
NoDrops = 0,
DropOnDirectory = 1, ///< allow drops on any directory
DropOnAnyFile = 2, ///< allow drops on any file
DropOnLocalExecutable = 4 ///< allow drops on local executables, shell scripts and desktop files. Can be used with DropOnDirectory.
};
Q_DECLARE_FLAGS(DropsAllowed, DropsAllowedFlag)
/// Set whether dropping onto items should be allowed, and for which kind of item
/// Drops are disabled by default.
void setDropsAllowed(DropsAllowed dropsAllowed);
/// Reimplemented from QAbstractItemModel. Returns true for empty directories.
virtual bool canFetchMore ( const QModelIndex & parent ) const;
/// Reimplemented from QAbstractItemModel. Returns ColumnCount.
virtual int columnCount ( const QModelIndex & parent = QModelIndex() ) const;
/// Reimplemented from QAbstractItemModel.
virtual QVariant data ( const QModelIndex & index, int role = Qt::DisplayRole ) const;
/// Reimplemented from QAbstractItemModel. Not implemented yet.
virtual bool dropMimeData ( const QMimeData * data, Qt::DropAction action, int row, int column, const QModelIndex & parent );
/// Reimplemented from QAbstractItemModel. Lists the subdirectory.
virtual void fetchMore ( const QModelIndex & parent );
/// Reimplemented from QAbstractItemModel.
virtual Qt::ItemFlags flags ( const QModelIndex & index ) const;
/// Reimplemented from QAbstractItemModel. Returns true for directories.
virtual bool hasChildren ( const QModelIndex & parent = QModelIndex() ) const;
/// Reimplemented from QAbstractItemModel. Returns the column titles.
virtual QVariant headerData ( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const;
/// Reimplemented from QAbstractItemModel. O(1)
virtual QModelIndex index ( int row, int column, const QModelIndex & parent = QModelIndex() ) const;
/// Reimplemented from QAbstractItemModel.
virtual QMimeData * mimeData ( const QModelIndexList & indexes ) const;
/// Reimplemented from QAbstractItemModel.
virtual QStringList mimeTypes () const;
/// Reimplemented from QAbstractItemModel.
virtual QModelIndex parent ( const QModelIndex & index ) const;
/// Reimplemented from QAbstractItemModel.
virtual int rowCount ( const QModelIndex & parent = QModelIndex() ) const;
/// Reimplemented from QAbstractItemModel.
/// Call this to set a new icon, e.g. a preview
virtual bool setData ( const QModelIndex & index, const QVariant & value, int role = Qt::EditRole );
/// Reimplemented from QAbstractItemModel. Not implemented. @see KDirSortFilterProxyModel
virtual void sort ( int column, Qt::SortOrder order = Qt::AscendingOrder );
/**
* Remove urls from the list if an ancestor is present on the list. This can
* be used to delete only the ancestor url and skip a potential error of a non-existent url.
*
* For example, for a list of "/home/foo/a", "/home/foo/a/a.txt", "/home/foo/a/a/a.txt", "/home/foo/a/b/b.txt",
* "home/foo/b/b.txt", this method will return the list "/home/foo/a", "/home/foo/b/b.txt".
*
* @return the list @p urls without parented urls inside.
* @since 4.2
*/
static KUrl::List simplifiedUrlList( const KUrl::List & urls );
/**
* This emits the needSequenceIcon signal, requesting another sequence icon
*
* If there is a KFilePreviewGenerator attached to this model, that generator will care
* about creating another preview.
*
* @param index Index of the item that should get another icon
* @param sequenceIndex Index in the sequence. If it is zero, the standard icon will be assigned.
* For higher indices, arbitrary different meaningful icons will be generated.
* @since 4.3
*/
void requestSequenceIcon(const QModelIndex& index, int sequenceIndex);
/**
* Enable/Disable the displaying of an animated overlay that is shown for any destination
* urls (in the view). When enabled, the animations (if any) will be drawn automatically.
*
* Only the files/folders that are visible and have jobs associated with them
* will display the animation.
* You would likely not want this enabled if you perform some kind of custom painting
* that takes up a whole item, and will just make this(and what you paint) look funky.
*
* Default is disabled.
*
* Note: KFileItemDelegate needs to have it's method called with the same
* value, when you make the call to this method.
*
* @since 4.5
*/
void setJobTransfersVisible(bool value);
/**
* Returns whether or not displaying job transfers has been enabled.
* @since 4.5
*/
bool jobTransfersVisible() const;
Q_SIGNALS:
/**
* Emitted for each subdirectory that is a parent of a url passed to expandToUrl
* This allows to asynchronously open a tree view down to a given directory.
* Also emitted for the final file, if expandToUrl is called with a file
* (for instance so that it can be selected).
*/
void expand(const QModelIndex& index);
/**
* Emitted when another icon sequence index is requested
* @param index Index of the item that should get another icon
* @param sequenceIndex Index in the sequence. If it is zero, the standard icon should be assigned.
* For higher indices, arbitrary different meaningful icons should be generated.
* This is usually slowly counted up while the user hovers the icon.
* If no meaningful alternative icons can be generated, this should be ignored.
* @since 4.3
*/
void needSequenceIcon(const QModelIndex& index, int sequenceIndex);
private:
// Make those private, they shouldn't be called by applications
virtual bool insertRows(int , int, const QModelIndex & = QModelIndex());
virtual bool insertColumns(int, int, const QModelIndex & = QModelIndex());
virtual bool removeRows(int, int, const QModelIndex & = QModelIndex());
virtual bool removeColumns(int, int, const QModelIndex & = QModelIndex());
private:
friend class KDirModelPrivate;
KDirModelPrivate *const d;
Q_PRIVATE_SLOT( d, void _k_slotNewItems(const KUrl&, const KFileItemList&) )
Q_PRIVATE_SLOT( d, void _k_slotDeleteItems(const KFileItemList&) )
Q_PRIVATE_SLOT( d, void _k_slotRefreshItems(const QList<QPair<KFileItem, KFileItem> >&) )
Q_PRIVATE_SLOT( d, void _k_slotClear() )
Q_PRIVATE_SLOT( d, void _k_slotRedirection(const KUrl&, const KUrl&) )
Q_PRIVATE_SLOT( d, void _k_slotJobUrlsChanged(const QStringList&))
};
Q_DECLARE_OPERATORS_FOR_FLAGS(KDirModel::DropsAllowed)
#endif /* KDIRMODEL_H */
diff --git a/kio/kio/kfileitem.h b/kio/kio/kfileitem.h
index fe7ea29ab6..e16a495aef 100644
--- a/kio/kio/kfileitem.h
+++ b/kio/kio/kfileitem.h
@@ -1,702 +1,702 @@
/* This file is part of the KDE project
Copyright (C) 1999-2006 David Faure <faure@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KFILEITEM_H
#define KFILEITEM_H
#include <sys/stat.h>
#include <kio/global.h>
#include <kio/udsentry.h>
#include <kurl.h>
#include <kacl.h>
#include <kmimetype.h>
#include <kfilemetainfo.h>
#include <kdatetime.h>
#include <QtCore/QList>
class KFileItemPrivate;
/**
* A KFileItem is a generic class to handle a file, local or remote.
* In particular, it makes it easier to handle the result of KIO::listDir
* (UDSEntry isn't very friendly to use).
* It includes many file attributes such as mimetype, icon, text, mode, link...
*
* KFileItem is implicitly shared, i.e. it can be used as a value and copied around at almost no cost.
*/
class KIO_EXPORT KFileItem
{
public:
enum { Unknown = static_cast<mode_t>(-1) };
/**
* The timestamps associated with a file.
* - ModificationTime: the time the file's contents were last modified
* - AccessTime: the time the file was last accessed (last read or written to)
* - CreationTime: the time the file was created
*/
enum FileTimes {
// warning: don't change without looking at the Private class
ModificationTime = 0,
AccessTime = 1,
CreationTime = 2
//ChangeTime
};
/**
* Null KFileItem. Doesn't represent any file, only exists for convenience.
*
* NOTE KDE 4.0 when porting from KFileItem* to KFileItem&:
* '(KFileItem*)a==0' becomes '(KFileItem)a.isNull()'
*/
KFileItem();
/**
* Creates an item representing a file, from a UDSEntry.
* This is the preferred constructor when using KIO::listDir().
*
* @param entry the KIO entry used to get the file, contains info about it
* @param itemOrDirUrl the URL of the item or of the directory containing this item (see urlIsDirectory).
* @param delayedMimeTypes specifies if the mimetype of the given
* URL should be determined immediately or on demand.
* See the bool delayedMimeTypes in the KDirLister constructor.
* @param urlIsDirectory specifies if the url is just the directory of the
* fileitem and the filename from the UDSEntry should be used.
*
* When creating KFileItems out of the UDSEntry emitted by a KIO list job,
* use KFileItem(entry, listjob->url(), delayedMimeTypes, true);
*/
KFileItem( const KIO::UDSEntry& entry, const KUrl& itemOrDirUrl,
bool delayedMimeTypes = false,
bool urlIsDirectory = false );
/**
* Creates an item representing a file, from all the necessary info for it.
* @param mode the file mode (according to stat() (e.g. S_IFDIR...)
* Set to KFileItem::Unknown if unknown. For local files, KFileItem will use stat().
* @param permissions the access permissions
* If you set both the mode and the permissions, you save a ::stat() for
* local files.
* Set to KFileItem::Unknown if you don't know the mode or the permission.
* @param url the file url
*
* @param delayedMimeTypes specify if the mimetype of the given URL
* should be determined immediately or on demand
*/
KFileItem( mode_t mode, mode_t permissions, const KUrl& url,
bool delayedMimeTypes = false );
/**
* Creates an item representing a file, for which the mimetype is already known.
* @param url the file url
* @param mimeType the name of the file's mimetype
* @param mode the mode (S_IFDIR...)
*/
KFileItem( const KUrl &url, const QString &mimeType, mode_t mode );
/**
* Copy constructor
*/
KFileItem(const KFileItem& other);
/**
* Assignment operator
*/
KFileItem& operator=(const KFileItem& other);
/**
* Destructs the KFileItem. Extra data set via setExtraData()
* is not deleted.
*/
~KFileItem();
/**
* Throw away and re-read (for local files) all information about the file.
* This is called when the _file_ changes.
*/
void refresh();
/**
* Re-reads mimetype information.
* This is called when the mimetype database changes.
*/
void refreshMimeType();
/**
* Returns the url of the file.
* @return the url of the file
*/
KUrl url() const;
/**
* Sets the item's URL. Do not call unless you know what you are doing!
* (used for example when an item got renamed).
* @param url the item's URL
*/
void setUrl( const KUrl &url );
/**
* Sets the item's name (i.e. the filename).
* This is automatically done by setUrl, to set the name from the URL's fileName().
* This method is provided for some special cases like relative paths as names (KFindPart)
* @param name the item's name
*/
void setName( const QString &name );
/**
* Returns the permissions of the file (stat.st_mode containing only permissions).
* @return the permissions of the file
*/
mode_t permissions() const;
/**
* Returns the access permissions for the file as a string.
* @return the access persmission as string
*/
QString permissionsString() const;
/**
* Tells if the file has extended access level information ( Posix ACL )
* @return true if the file has extend ACL information or false if it hasn't
*/
bool hasExtendedACL() const;
/**
* Returns the access control list for the file.
* @return the access control list as a KACL
*/
KACL ACL() const;
/**
* Returns the default access control list for the directory.
* @return the default access control list as a KACL
*/
KACL defaultACL() const;
/**
* Returns the file type (stat.st_mode containing only S_IFDIR, S_IFLNK, ...).
* @return the file type
*/
mode_t mode() const;
/**
* Returns the owner of the file.
* @return the file's owner
*/
QString user() const;
/**
* Returns the group of the file.
* @return the file's group
*/
QString group() const;
/**
* Returns true if this item represents a link in the UNIX sense of
* a link.
* @return true if the file is a link
*/
bool isLink() const;
/**
* Returns true if this item represents a directory.
* @return true if the item is a directory
*/
bool isDir() const;
/**
* Returns true if this item represents a file (and not a a directory)
* @return true if the item is a file
*/
bool isFile() const;
/**
* Checks whether the file or directory is readable. In some cases
* (remote files), we may return true even though it can't be read.
* @return true if the file can be read - more precisely,
* false if we know for sure it can't
*/
bool isReadable() const;
/**
* Checks whether the file or directory is writable. In some cases
* (remote files), we may return true even though it can't be written to.
* @return true if the file or directory can be written to - more precisely,
* false if we know for sure it can't
*/
bool isWritable() const;
/**
* Checks whether the file is hidden.
* @return true if the file is hidden.
*/
bool isHidden() const;
/**
* @return true if the file is a remote URL, or a local file on a network mount.
* It will return false only for really-local file systems.
* @since 4.7.4
*/
bool isSlow() const;
/**
* Checks whether the file is a readable local .desktop file,
* i.e. a file whose path can be given to KDesktopFile
* @return true if the file is a desktop file.
* @since 4.1
*/
bool isDesktopFile() const;
/**
* Returns the link destination if isLink() == true.
* @return the link destination. QString() if the item is not a link
*/
QString linkDest() const;
/**
* Returns the target url of the file, which is the same as url()
* in cases where the slave doesn't specify UDS_TARGET_URL
* @return the target url.
* @since 4.1
*/
KUrl targetUrl() const;
/**
* Returns the resource URI to be used for Nepomuk annotations. In case
* the slave does not specify UDS_NEPOMUK_URI an invalid url is
* returned.
* For local files this is the same as url().
* @return The Nepomuk resource URI.
* @since 4.4
*/
KUrl nepomukUri() const;
/**
* Returns the local path if isLocalFile() == true or the KIO item has
* a UDS_LOCAL_PATH atom.
* @return the item local path, or QString() if not known
*/
QString localPath() const;
/**
* Returns the size of the file, if known.
* @return the file size, or 0 if not known
*/
KIO::filesize_t size() const;
/**
* Requests the modification, access or creation time, depending on @p which.
* @param which the timestamp
* @return the time asked for, (time_t)0 if not available
* @see timeString()
*/
KDateTime time( FileTimes which ) const;
#ifndef KDE_NO_DEPRECATED
- KDE_DEPRECATED time_t time( unsigned int which ) const;
+ KIO_DEPRECATED time_t time( unsigned int which ) const;
#endif
/**
* Requests the modification, access or creation time as a string, depending
* on @p which.
* @param which the timestamp
* @returns a formatted string of the requested time.
* @see time
*/
QString timeString( FileTimes which = ModificationTime ) const;
#ifndef KDE_NO_DEPRECATED
- KDE_DEPRECATED QString timeString( unsigned int which) const;
+ KIO_DEPRECATED QString timeString( unsigned int which) const;
#endif
/**
* Returns true if the file is a local file.
* @return true if the file is local, false otherwise
*/
bool isLocalFile() const;
/**
* Returns the text of the file item.
* It's not exactly the filename since some decoding happens ('%2F'->'/').
* @return the text of the file item
*/
QString text() const;
/**
* Return the name of the file item (without a path).
* Similar to text(), but unencoded, i.e. the original name.
* @param lowerCase if true, the name will be returned in lower case,
* which is useful to speed up sorting by name, case insensitively.
* @return the file's name
*/
QString name( bool lowerCase = false ) const;
/**
* Returns the mimetype of the file item.
* If @p delayedMimeTypes was used in the constructor, this will determine
* the mimetype first. Equivalent to determineMimeType()->name()
* @return the mime type of the file
*/
QString mimetype() const;
/**
* Returns the mimetype of the file item.
* If delayedMimeTypes was used in the constructor, this will determine
* the mimetype first.
* @return the mime type
*/
KMimeType::Ptr determineMimeType() const;
/**
* Returns the currently known mimetype of the file item.
* This will not try to determine the mimetype if unknown.
* @return the known mime type
*/
KMimeType::Ptr mimeTypePtr() const;
/**
* @return true if we have determined the mimetype of this file already,
* i.e. if determineMimeType() will be fast. Otherwise it will have to
* find what the mimetype is, which is a possibly slow operation; usually
* this is delayed until necessary.
*/
bool isMimeTypeKnown() const;
/**
* Returns the user-readable string representing the type of this file,
* like "OpenDocument Text File".
* @return the type of this KFileItem
*/
QString mimeComment() const;
/**
* Returns the full path name to the icon that represents
* this mime type.
* @return iconName the name of the file's icon
*/
QString iconName() const;
/**
* Returns a pixmap representing the file.
* @param _size Size for the pixmap in pixels. Zero will return the
* globally configured default size.
* @param _state The state of the icon: KIconLoader::DefaultState,
* KIconLoader::ActiveState or KIconLoader::DisabledState.
* @return the pixmap
*/
QPixmap pixmap( int _size, int _state=0 ) const;
/**
* Returns the overlays (bitfield of KIconLoader::*Overlay flags) that are used
* for this item's pixmap. Overlays are used to show for example, whether
* a file can be modified.
* @return the overlays of the pixmap
*/
QStringList overlays() const;
/**
* A comment which can contain anything - even rich text. It will
* simply be displayed to the user as is.
*
* @since 4.6
*/
QString comment() const;
/**
* Returns the string to be displayed in the statusbar,
* e.g. when the mouse is over this item
* @return the status bar information
*/
QString getStatusBarInfo() const;
/**
* Returns the string to be displayed in the tool tip when the mouse
* is over this item. This may load a plugin to determine additional
* information specific to the mimetype of the file.
*
* @param maxcount the maximum number of entries shown
* @return the tool tip string
*
* @deprecated File Managers implement more complete tooltips.
*/
#ifndef KDE_NO_DEPRECATED
- KDE_DEPRECATED QString getToolTipText(int maxcount = 6) const;
+ KIO_DEPRECATED QString getToolTipText(int maxcount = 6) const;
#endif
/**
* Returns true if files can be dropped over this item.
* Contrary to popular belief, not only dirs will return true :)
* Executables, .desktop files, will do so as well.
* @return true if you can drop files over the item
*
* @deprecated This logic is application-dependent, the behavior described above
* mostly makes sense for file managers only.
* KDirModel has setDropsAllowed for similar (but configurable) logic.
*/
#ifndef KDE_NO_DEPRECATED
- KDE_DEPRECATED bool acceptsDrops() const;
+ KIO_DEPRECATED bool acceptsDrops() const;
#endif
/**
* Let's "KRun" this file !
* (e.g. when file is clicked or double-clicked or return is pressed)
*/
void run( QWidget* parentWidget = 0 ) const;
/**
* Returns the UDS entry. Used by the tree view to access all details
* by position.
* @return the UDS entry
*/
KIO::UDSEntry entry() const;
/**
* Used when updating a directory. marked == seen when refreshing.
* @return true if the file item is marked
*/
bool isMarked() const;
/**
* Marks the item.
* @see isMarked()
*/
void mark();
/**
* Unmarks the item.
* @see isMarked()
*/
void unmark();
/**
* Return true if this item is a regular file,
* false otherwise (directory, link, character/block device, fifo, socket)
* @since 4.3
*/
bool isRegularFile() const;
/**
* Somewhat like a comparison operator, but more explicit,
* and it can detect that two kfileitems are equal even when they do
* not share the same internal pointer - e.g. when KDirLister compares
* fileitems after listing a directory again, to detect changes.
* @param item the item to compare
* @return true if all values are equal
*/
bool cmp( const KFileItem & item ) const;
bool operator==(const KFileItem& other) const;
bool operator!=(const KFileItem& other) const;
/**
* Converts this KFileItem to a QVariant, this allows to use KFileItem
* in QVariant() constructor
*/
operator QVariant() const;
/**
* This allows to associate some "extra" data to a KFileItem. As one
* KFileItem can be used by several objects (often views) which all need
* to add some data, you have to use a key to reference your extra data
* within the KFileItem.
*
* That way a KFileItem can hold and provide access to all those views
* separately.
*
* I.e. a KFileIconView that associates a KFileIconViewItem (an item suitable
* for use with QIconView) does
*
* \code
* kfileItem->setExtraData( this, iconViewItem );
* \endcode
*
* and can later access the iconViewItem by doing
*
* \code
* KFileIconViewItem *iconViewItem = static_cast<KFileIconViewItem*>( kfileItem->extraData( this ));
* \endcode
*
* This is usually more efficient then having every view associate data to
* items by using a separate QDict or QMap.
*
* Note: you have to remove and destroy the data you associated yourself
* when you don't need it anymore!
*
* @param key the key of the extra data
* @param value the value of the extra data
* @see extraData
* @see removeExtraData
*
* @deprecated use model/view (KDirModel) and you won't need this anymore
*/
#ifndef KDE_NO_DEPRECATED
- KDE_DEPRECATED void setExtraData( const void *key, void *value );
+ KIO_DEPRECATED void setExtraData( const void *key, void *value );
#endif
/**
* Retrieves the extra data with the given @p key.
* @param key the key of the extra data
* @return the extra data associated to an item with @p key via
* setExtraData. 0L if nothing was associated with @p key.
* @see extraData
*
* @deprecated use model/view (KDirModel) and you won't need this anymore
*/
#ifndef KDE_NO_DEPRECATED
- KDE_DEPRECATED const void * extraData( const void *key ) const;
+ KIO_DEPRECATED const void * extraData( const void *key ) const;
#endif
/**
* Removes the extra data associated with an item via @p key.
* @param key the key of the extra data to remove
*
* @deprecated use model/view (KDirModel) and you won't need this anymore
*/
#ifndef KDE_NO_DEPRECATED
- KDE_DEPRECATED void removeExtraData( const void *key );
+ KIO_DEPRECATED void removeExtraData( const void *key );
#endif
/**
* Sets the metainfo of this item to @p info.
*
* Made const to avoid deep copy.
* @param info the new meta info
*/
void setMetaInfo( const KFileMetaInfo & info ) const;
/**
* Returns the metainfo of this item.
*
* (since 4.4.3) By default it uses the KFileMetaInfo::ContentInfo | KFileMetaInfo::TechnicalInfo.
* If you need more information, create your own KFileMetaInfo object and set it using setMetaInfo()
* @param autoget if true, the metainfo will automatically be created
* @param what how much metainfo you need to retrieve from the file (KFileMetaInfo::WhatFlag)
*/
KFileMetaInfo metaInfo(bool autoget = true,
int what = KFileMetaInfo::ContentInfo | KFileMetaInfo::TechnicalInfo) const;
/**
* @deprecated simply use '='
*/
#ifndef KDE_NO_DEPRECATED
- KDE_DEPRECATED void assign( const KFileItem & item );
+ KIO_DEPRECATED void assign( const KFileItem & item );
#endif
/**
* Reinitialize KFileItem with a new UDSEntry.
*
* Note: extra-data set with setExtraData() is not changed or deleted, so
* be careful what you do!
*
* KDirListerCache uses it to save new/delete calls by updating existing
* items that are otherwise not needed anymore.
*
* @param entry the UDSEntry to assign to this KFileItem
* @param url the file url
* @param delayedMimeTypes specifies if the mimetype of the given
* URL should be determined immediately or on demand
* @param urlIsDirectory specifies if the url is just the directory of the
* fileitem and the filename from the UDSEntry should be used.
*
* @deprecated why not just create another KFileItem and use operator=,
* now that it's a value class?
*/
#ifndef KDE_NO_DEPRECATED
- KDE_DEPRECATED void setUDSEntry( const KIO::UDSEntry& entry, const KUrl& url,
+ KIO_DEPRECATED void setUDSEntry( const KIO::UDSEntry& entry, const KUrl& url,
bool delayedMimeTypes = false,
bool urlIsDirectory = false );
#endif
/**
* Tries to give a local URL for this file item if possible.
* The given boolean indicates if the returned url is local or not.
*/
KUrl mostLocalUrl(bool &local) const; // KDE4 TODO: bool* local = 0
/**
* Tries to give a local URL for this file item if possible.
*
* \since 4.6
*/
KUrl mostLocalUrl() const; // KDE5: merge with above version
/**
* Return true if default-constructed
*/
bool isNull() const;
private:
QSharedDataPointer<KFileItemPrivate> d;
private:
KIO_EXPORT friend QDataStream & operator<< ( QDataStream & s, const KFileItem & a );
KIO_EXPORT friend QDataStream & operator>> ( QDataStream & s, KFileItem & a );
};
Q_DECLARE_METATYPE(KFileItem)
Q_CORE_EXPORT uint qHash(const QString &key);
inline uint qHash(const KFileItem& item){ return qHash(item.url().url()); }
/**
* List of KFileItems, which adds a few helper
* methods to QList<KFileItem>.
*/
class KIO_EXPORT KFileItemList : public QList<KFileItem>
{
public:
/// Creates an empty list of file items.
KFileItemList();
/// Creates a new KFileItemList from a QList of file @p items.
KFileItemList( const QList<KFileItem> &items );
/**
* Find a KFileItem by name and return it.
* @return the item with the given name, or a null-item if none was found
* (see KFileItem::isNull())
*/
KFileItem findByName( const QString& fileName ) const;
/**
* Find a KFileItem by URL and return it.
* @return the item with the given URL, or a null-item if none was found
* (see KFileItem::isNull())
*/
KFileItem findByUrl( const KUrl& url ) const;
/// @return the list of URLs that those items represent
KUrl::List urlList() const;
/// @return the list of target URLs that those items represent
/// @since 4.2
KUrl::List targetUrlList() const;
// TODO KDE-5 add d pointer here so that we can merge KFileItemListProperties into KFileItemList
};
KIO_EXPORT QDataStream & operator<< ( QDataStream & s, const KFileItem & a );
KIO_EXPORT QDataStream & operator>> ( QDataStream & s, KFileItem & a );
/**
* Support for qDebug() << aFileItem
* \since 4.4
*/
KIO_EXPORT QDebug operator<<(QDebug stream, const KFileItem& item);
#endif
diff --git a/kio/kio/kfileitemactionplugin.h b/kio/kio/kfileitemactionplugin.h
index 5f70f473e1..acce35655c 100644
--- a/kio/kio/kfileitemactionplugin.h
+++ b/kio/kio/kfileitemactionplugin.h
@@ -1,51 +1,51 @@
/* This file is part of the KDE project
Copyright (C) 2010 Sebastian Trueg <trueg@kde.org>
Based on konq_popupmenuplugin.h Copyright 2008 David Faure <faure@kde.org>
This library is free software; you can redistribute it and/or modify
it under the terms of the GNU Library General Public License as published
by the Free Software Foundation; either version 2 of the License or
( at your option ) version 3 or, at the discretion of KDE e.V.
( which shall act as a proxy as in section 14 of the GPLv3 ), any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KFILEITEMACTION_PLUGIN_H
#define KFILEITEMACTION_PLUGIN_H
#include <kio/kio_export.h>
#include <QtCore/QObject>
class QAction;
class QMenu;
class QWidget;
class KFileItemListProperties;
/**
* @deprecated use KAbstractFileItemActionPlugin instead
* (introduced in kdelibs-4.6.1 in order to remove the erroneous
* "const" in the actions method)
*/
-class KIO_EXPORT_DEPRECATED KFileItemActionPlugin : public QObject
+class KIO_DEPRECATED_EXPORT KFileItemActionPlugin : public QObject
{
Q_OBJECT
public:
KFileItemActionPlugin(QObject *parent);
virtual ~KFileItemActionPlugin();
virtual QList<QAction*> actions(const KFileItemListProperties &fileItemInfos,
QWidget *parentWidget) const = 0;
};
#endif
diff --git a/kio/kio/kfilemetainfo.h b/kio/kio/kfilemetainfo.h
index 4fc6eae22b..d2a5fbb584 100644
--- a/kio/kio/kfilemetainfo.h
+++ b/kio/kio/kfilemetainfo.h
@@ -1,166 +1,166 @@
/* This file is part of the KDE libraries
Copyright (c) 2001,2002 Carsten Pfeiffer <pfeiffer@kde.org>
2007 Jos van den Oever <jos@vandenoever.info>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License (LGPL) as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KFILEMETAINFO_H
#define KFILEMETAINFO_H
#include "predicateproperties.h"
#include "kfilemetainfoitem.h"
#include <QtCore/QList>
#include <QtCore/QStringList>
class KUrl;
typedef QList<KFileMetaInfoItem> KFileMetaInfoItemList;
class KFileMetaInfoGroupPrivate;
class KIO_EXPORT KFileMetaInfoGroup {
public:
KFileMetaInfoGroup();
KFileMetaInfoGroup(const KFileMetaInfoGroup&);
~KFileMetaInfoGroup();
const KFileMetaInfoGroup& operator=(const KFileMetaInfoGroup&);
KFileMetaInfoItemList items() const;
const QString& name() const;
const QStringList& keys() const;
private:
QSharedDataPointer<KFileMetaInfoGroupPrivate> d;
};
typedef QList<KFileMetaInfoGroup> KFileMetaInfoGroupList;
class KFileMetaInfoPrivate;
/**
* KFileMetaInfo provides metadata extracted from a file or other resource.
*
* When instantiating an instance of this class, the metadata related to it
* will be retrieved and stored in the instance. The data can be inspected
* through KFileMetaInfoItem objects.
**/
class KIO_EXPORT KFileMetaInfo {
public:
/**
* This is used to specify what a KFileMetaInfo object should read, so
* you can specify if you want to read "expensive" items or not.
* This is like a preset which can be customized by passing additional
* parameters to constructors.
*/
enum What
{
Fastest = 0x1, /**< do the fastest possible read and omit all items
that might need a significantly longer time
than the others */
// Deprecated
// DontCare = 0x2, ///< let the plugin decide what to read.
TechnicalInfo = 0x4, /**< extract technical details about the file, like
e.g. play time, resolution or a compressioni
type */
ContentInfo = 0x8, /**< read information about the content of the file
like comments or id3 tags */
ExternalSources = 0x10, /**<read external metadata sources such as
filesystem based extended attributes if
they are supported for the filesystem;
RDF storages etc */
Thumbnail = 0x20, /**< only read the file's thumbnail, if it contains
one */
// Deprecated
// Preferred = 0x40, ///< get at least the preferred items
LinkedData = 0x80, //< extract linked/related files like html links, source #include etc
Everything = 0xffff ///< read everything, even if it might take a while
};
Q_DECLARE_FLAGS(WhatFlags, What)
/**
* @brief Construct a KFileMetaInfo that contains metainformation about
* the resource pointed to by @p path.
*
* When w is not Everything, a limit of 64kbytes is imposed on the file size.
**/
explicit KFileMetaInfo(const QString& path, const QString& mimetype = QString(),
WhatFlags w = Everything);
/**
* @brief Construct a KFileMetaInfo that contains metainformation about
* the resource pointed to by @p url.
* @note that c'tor is not thread-safe
**/
KFileMetaInfo(const KUrl& url);
/**
* @brief Construct an empty, invalid KFileMetaInfo instance.
**/
KFileMetaInfo();
/**
* @brief Construct a KFileMetaInfo instance from another one.
**/
KFileMetaInfo(const KFileMetaInfo&);
/**
* @brief Destructor.
**/
~KFileMetaInfo();
/**
* @brief Copy a KFileMetaInfo instance from another one.
**/
const KFileMetaInfo& operator=(KFileMetaInfo const& kfmi);
/**
* @brief Save the changes made to this KFileMetaInfo instance.
*/
bool applyChanges();
/**
* @brief Retrieve all the items.
**/
const QHash<QString, KFileMetaInfoItem>& items() const;
KFileMetaInfoItem& item(const QString& key);
const KFileMetaInfoItem& item(const QString& key) const;
bool isValid() const;
/**
* Deprecated
**/
QStringList preferredKeys() const;
/**
* Deprecated
**/
QStringList supportedKeys() const;
KIO_EXPORT friend QDataStream& operator >>(QDataStream& s, KFileMetaInfo& )
;
KIO_EXPORT friend QDataStream& operator <<(QDataStream& s, const KFileMetaInfo&);
/**
* Deprecated
**/
#ifndef KDE_NO_DEPRECATED
- KDE_DEPRECATED KFileMetaInfoGroupList preferredGroups() const;
+ KIO_DEPRECATED KFileMetaInfoGroupList preferredGroups() const;
#endif
/**
* Deprecated
**/
#ifndef KDE_NO_DEPRECATED
- KDE_DEPRECATED KFileMetaInfoGroupList supportedGroups() const;
+ KIO_DEPRECATED KFileMetaInfoGroupList supportedGroups() const;
#endif
KFileMetaInfoGroupList groups() const;
QStringList keys() const;
const KUrl& url() const;
private:
QSharedDataPointer<KFileMetaInfoPrivate> d;
};
Q_DECLARE_OPERATORS_FOR_FLAGS(KFileMetaInfo::WhatFlags)
#endif
diff --git a/kio/kio/kfilemetainfoitem.h b/kio/kio/kfilemetainfoitem.h
index a82b672a9a..57a8555822 100644
--- a/kio/kio/kfilemetainfoitem.h
+++ b/kio/kio/kfilemetainfoitem.h
@@ -1,120 +1,120 @@
/* This file is part of the KDE libraries
Copyright (c) 2001,2002 Carsten Pfeiffer <pfeiffer@kde.org>
2007 Jos van den Oever <jos@vandenoever.info>
2010 Sebastian Trueg <trueg@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License (LGPL) as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KFILEMETAINFOITEM_H
#define KFILEMETAINFOITEM_H
#include <kio/kio_export.h>
#include <QtCore/QSharedData>
class KFileWritePlugin;
class QVariant;
class PredicateProperties;
class KUrl;
class KFileMetaInfoItemPrivate;
class KIO_EXPORT KFileMetaInfoItem {
friend class KFileMetaInfo;
friend class KFileMetaInfoPrivate;
friend class KMetaInfoWriter;
public:
/**
* @brief Default constructor
**/
KFileMetaInfoItem();
/**
* @brief Copy constructor
**/
KFileMetaInfoItem(const KFileMetaInfoItem& item);
/**
* @brief Destructor
**/
~KFileMetaInfoItem();
/**
* @brief Copy operator
**/
const KFileMetaInfoItem& operator=(const KFileMetaInfoItem& item);
/**
* @brief Can this item be edited.
**/
bool isEditable() const;
/**
* @brief Has this value been removed, e.g with setValue(QVariant())
**/
bool isRemoved() const;
/**
* @brief Can this item be removed.
**/
bool isModified() const;
/**
* @brief Has this value been skipped by analyzer due to performance or other considerations.
**/
bool isSkipped() const;
/**
* @brief Retrieve the current value of this item
**/
const QVariant& value() const;
/**
* @brief Set the value of this field.
**/
bool setValue(const QVariant& value);
/**
* @brief Append a value to the properties in this file.
**/
bool addValue(const QVariant&);
/**
* @brief Is this a valid item.
**/
bool isValid() const;
/**
* @brief Retrieve the properties of this field type.
*
* @deprecated
**/
#ifndef KDE_NO_DEPRECATED
- KDE_DEPRECATED const PredicateProperties& properties() const;
+ KIO_DEPRECATED const PredicateProperties& properties() const;
#endif
/**
* Localized name of the predicate.
**/
const QString& name() const;
/**
* This method returns a translated suffix to be displayed after the
* value. Think of the kbps in 128kbps
*
* @return the suffix
*/
QString suffix() const;
/**
* This method returns a translated prefix to be displayed before the
* value.
*
* @return the prefix
*/
QString prefix() const;
private:
QSharedDataPointer<KFileMetaInfoItemPrivate> d;
KFileMetaInfoItem(const QString& p,
const QVariant& v, KFileWritePlugin* w, bool e);
};
#endif
diff --git a/kio/kio/kio_export.h b/kio/kio/kio_export.h
deleted file mode 100644
index d36ecb5eb8..0000000000
--- a/kio/kio/kio_export.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/* This file is part of the KDE project
- Copyright (C) 2007 David Faure <faure@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#ifndef KIO_EXPORT_H
-#define KIO_EXPORT_H
-
-/* needed for KDE_EXPORT and KDE_IMPORT macros */
-#include <kdemacros.h>
-
-#ifndef KIO_EXPORT
-# if defined(KDELIBS_STATIC_LIBS)
- /* No export/import for static libraries */
-# define KIO_EXPORT
-# elif defined(MAKE_KIO_LIB)
- /* We are building this library */
-# define KIO_EXPORT KDE_EXPORT
-# else
- /* We are using this library */
-# define KIO_EXPORT KDE_IMPORT
-# endif
-#endif
-
-# ifndef KIO_EXPORT_DEPRECATED
-# define KIO_EXPORT_DEPRECATED KDE_DEPRECATED KIO_EXPORT
-# endif
-
-#endif
diff --git a/kio/kio/kmimetyperesolver.h b/kio/kio/kmimetyperesolver.h
index d6fef8098b..81486baba3 100644
--- a/kio/kio/kmimetyperesolver.h
+++ b/kio/kio/kmimetyperesolver.h
@@ -1,82 +1,82 @@
/* This file is part of the KDE libraries
Copyright (C) 2000, 2006 David Faure <faure@kde.org>
Copyright (C) 2000 Rik Hemsley <rik@kde.org>
Copyright (C) 2002 Carsten Pfeiffer <pfeiffer@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KMIMETYPERESOLVER_H
#define KMIMETYPERESOLVER_H
#include <QtCore/QObject>
#include <kio/kio_export.h>
class QModelIndex;
class QAbstractItemView;
class QAbstractProxyModel;
class KDirModel;
class KMimeTypeResolverPrivate;
class KAbstractViewAdapter;
/**
* This class implements the "delayed-mimetype-determination" feature,
* for directory views.
*
* It determines the mimetypes of the icons in the background, but giving
* preferrence to the visible icons.
*
* @deprecated since 4.3, use KFilePreviewGenerator instead (from libkfile),
* which can do both delayed-mimetype-determination and delayed-preview-determination
* (actually, it rather does one or the other), and with better performance
* (it batches the updates rather than doing them one by one)
*/
class KIO_EXPORT KMimeTypeResolver : public QObject
{
Q_OBJECT
public:
/**
* The mimetype resolver is made a child of the view.
* It is OK to have one resolver per view, and have those views share a common model;
* this way the mimetypes will only be determined once per item in the model, which saves time.
*
* WARNING: if you call KDirModel::setDirLister, do it before creating the KMimeTypeResolver
* If this is a problem, tell me and I'll add a signal...
*/
- KDE_DEPRECATED KMimeTypeResolver(QAbstractItemView* view, KDirModel* model);
+ KIO_DEPRECATED KMimeTypeResolver(QAbstractItemView* view, KDirModel* model);
/**
* This constructor should be used when the view uses a proxy model instead of a KDirModel.
* The source model must be a KDirModel however, and the above warning applies
* to this constructor as well.
*/
- KDE_DEPRECATED KMimeTypeResolver(QAbstractItemView* view, QAbstractProxyModel* model);
+ KIO_DEPRECATED KMimeTypeResolver(QAbstractItemView* view, QAbstractProxyModel* model);
/**
* @internal
*/
- explicit KDE_DEPRECATED KMimeTypeResolver(KAbstractViewAdapter* adapter);
+ explicit KIO_DEPRECATED KMimeTypeResolver(KAbstractViewAdapter* adapter);
~KMimeTypeResolver();
private:
KMimeTypeResolverPrivate *const d;
Q_PRIVATE_SLOT( d, void _k_slotRowsInserted(const QModelIndex&,int,int) )
Q_PRIVATE_SLOT( d, void _k_slotViewportAdjusted() )
Q_PRIVATE_SLOT( d, void _k_slotProcessMimeIcons() )
};
#endif /* KMIMETYPERESOLVER_H */
diff --git a/kio/kio/krun.h b/kio/kio/krun.h
index be4f8ab287..e902dcdf7e 100644
--- a/kio/kio/krun.h
+++ b/kio/kio/krun.h
@@ -1,567 +1,567 @@
// -*- mode: c++; c-basic-offset: 2 -*-
/* This file is part of the KDE project
Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
Copyright (C) 2006 David Faure <faure@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KRUN_H
#define KRUN_H
#include <kio/kio_export.h>
#include <QtCore/QObject>
#include <QtCore/QTimer>
#include <QtCore/QString>
#include <sys/types.h>
#include <kurl.h>
class KService;
class KStartupInfo;
class KJob;
namespace KIO
{
class Job;
}
/**
* To open files with their associated applications in KDE, use KRun.
*
* It can execute any desktop entry, as well as any file, using
* the default application or another application "bound" to the file type
* (or URL protocol).
*
* In that example, the mimetype of the file is not known by the application,
* so a KRun instance must be created. It will determine the mimetype by itself.
* If the mimetype is known, or if you even know the service (application) to
* use for this file, use one of the static methods.
*
* By default KRun uses auto deletion. It causes the KRun instance to delete
* itself when the it finished its task. If you allocate the KRun
* object on the stack you must disable auto deletion, otherwise it will crash.
*
* @short Opens files with their associated applications in KDE
*/
class KIO_EXPORT KRun : public QObject
{
Q_OBJECT
public:
/**
* @param url the URL of the file or directory to 'run'
*
* @param window
* The top-level widget of the app that invoked this object.
* It is used to make sure private information like passwords
* are properly handled per application.
*
* @param mode The @p st_mode field of <tt>struct stat</tt>. If
* you don't know this set it to 0.
*
* @param isLocalFile
* If this parameter is set to @p false then @p url is
* examined to find out whether it is a local URL or
* not. This flag is just used to improve speed, since the
* function KUrl::isLocalFile is a bit slow.
*
* @param showProgressInfo
* Whether to show progress information when determining the
* type of the file (i.e. when using KIO::stat and KIO::mimetype)
* Before you set this to false to avoid a dialog box, think about
* a very slow FTP server...
* It is always better to provide progress info in such cases.
* @param asn
* Application startup notification id, if available (otherwise "").
*/
KRun(const KUrl& url, QWidget* window, mode_t mode = 0,
bool isLocalFile = false, bool showProgressInfo = true,
const QByteArray& asn = QByteArray());
/**
* Destructor. Don't call it yourself, since a KRun object auto-deletes
* itself.
*/
virtual ~KRun();
/**
* Abort this KRun. This kills any jobs launched by it,
* and leads to deletion if auto-deletion is on.
* This is much safer than deleting the KRun (in case it's
* currently showing an error dialog box, for instance)
*/
void abort();
/**
* Returns true if the KRun instance has an error.
* @return true when an error occurred
* @see error()
*/
bool hasError() const;
/**
* Returns true if the KRun instance has finished.
* @return true if the KRun instance has finished
* @see finished()
*/
bool hasFinished() const;
/**
* Checks whether auto delete is activated.
* Auto-deletion causes the KRun instance to delete itself
* when it finished its task.
* By default auto deletion is on.
* @return true if auto deletion is on, false otherwise
*/
bool autoDelete() const;
/**
* Enables or disabled auto deletion.
* Auto deletion causes the KRun instance to delete itself
* when it finished its task. If you allocate the KRun
* object on the stack you must disable auto deletion.
* By default auto deletion is on.
* @param b true to enable auto deletion, false to disable
*/
void setAutoDelete(bool b);
/**
* Set the preferred service for opening this URL, after
* its mimetype will have been found by KRun. IMPORTANT: the service is
* only used if its configuration says it can handle this mimetype.
* This is used for instance for the X-KDE-LastOpenedWith key in
* the recent documents list, or for the app selection in
* KParts::BrowserOpenOrSaveQuestion.
* @param desktopEntryName the desktopEntryName of the service, e.g. "kate".
*/
void setPreferredService(const QString& desktopEntryName);
/**
* Sets whether executables, .desktop files or shell scripts should
* be run by KRun. This is enabled by default.
* @param b whether to run executable files or not.
* @see isExecutable()
*/
void setRunExecutables(bool b);
/**
* Sets whether the external webbrowser setting should be honoured.
* This is enabled by default.
* This should only be disabled in webbrowser applications.
* @param b whether to enable the external browser or not.
*/
void setEnableExternalBrowser(bool b);
/**
* Sets the file name to use in the case of downloading the file to a tempfile
* in order to give to a non-url-aware application. Some apps rely on the extension
* to determine the mimetype of the file. Usually the file name comes from the URL,
* but in the case of the HTTP Content-Disposition header, we need to override the
* file name.
*/
void setSuggestedFileName(const QString& fileName);
/**
* Suggested file name given by the server (e.g. HTTP content-disposition)
*/
QString suggestedFileName() const;
/**
* Open a list of URLs with a certain service (application).
*
* @param service the service to run
* @param urls the list of URLs, can be empty (app launched
* without argument)
* @param window The top-level widget of the app that invoked this object.
* @param tempFiles if true and urls are local files, they will be deleted
* when the application exits.
* @param suggestedFileName see setSuggestedFileName
* @param asn Application startup notification id, if any (otherwise "").
* @return @c true on success, @c false on error
*/
static bool run(const KService& service, const KUrl::List& urls, QWidget* window,
bool tempFiles = false, const QString& suggestedFileName = QString(),
const QByteArray& asn = QByteArray());
/**
* Open a list of URLs with an executable.
*
* @param exec the name of the executable, for example
* "/usr/bin/netscape %u".
* Don't forget to include the %u if you know that the applications
* supports URLs. Otherwise, non-local urls will first be downloaded
* to a temp file (using kioexec).
* @param urls the list of URLs to open, can be empty (app launched without argument)
* @param window The top-level widget of the app that invoked this object.
* @param name the logical name of the application, for example
* "Netscape 4.06".
* @param icon the icon which should be used by the application.
* @param asn Application startup notification id, if any (otherwise "").
* @return @c true on success, @c false on error
*/
static bool run(const QString& exec, const KUrl::List& urls, QWidget* window,
const QString& name = QString(),
const QString& icon = QString(),
const QByteArray& asn = QByteArray());
/**
* Open the given URL.
*
* This function is used after the mime type
* is found out. It will search for all services which can handle
* the mime type and call run() afterwards.
* @param url the URL to open
* @param mimetype the mime type of the resource
* @param window The top-level widget of the app that invoked this object.
* @param tempFile if true and url is a local file, it will be deleted
* when the launched application exits.
* @param runExecutables if false then local .desktop files,
* executables and shell scripts will not be run.
* See also isExecutable().
* @param suggestedFileName see setSuggestedFileName
* @param asn Application startup notification id, if any (otherwise "").
* @return @c true on success, @c false on error
*/
static bool runUrl(const KUrl& url, const QString& mimetype, QWidget* window,
bool tempFile = false , bool runExecutables = true,
const QString& suggestedFileName = QString(), const QByteArray& asn = QByteArray());
/**
* Run the given shell command and notifies KDE of the starting
* of the application. If the program to be called doesn't exist,
* an error box will be displayed.
*
* Use only when you know the full command line. Otherwise use the other
* static methods, or KRun's constructor.
*
* @p cmd must be a shell command. You must not append "&"
* to it, since the function will do that for you.
* @param window The top-level widget of the app that invoked this object.
*
* @return @c true on success, @c false on error
*/
static bool runCommand(const QString &cmd, QWidget* window);
/**
* Overload that also takes a working directory, so that a command like
* "kwrite file.txt" finds file.txt from the right place.
* @since 4.4
*/
static bool runCommand(const QString &cmd, QWidget* window, const QString& workingDirectory);
// TODO KDE5: merge the above with 2-args runCommand, using QString()
/**
* Same as the other runCommand(), but it also takes the name of the
* binary, to display an error message in case it couldn't find it.
*
* @param cmd must be a shell command. You must not append "&"
* to it, since the function will do that for you.
* @param execName the name of the executable
* @param icon icon for app starting notification
* @param window The top-level widget of the app that invoked this object.
* @param asn Application startup notification id, if any (otherwise "").
* @return @c true on success, @c false on error
*/
static bool runCommand(const QString& cmd, const QString & execName,
const QString & icon, QWidget* window, const QByteArray& asn = QByteArray());
/**
* Overload that also takes a working directory, so that a command like
* "kwrite file.txt" finds file.txt from the right place.
* @param workingDirectory the working directory for the started process. The default
* (if passing an empty string) is the user's document path.
* @since 4.4
*/
static bool runCommand(const QString& cmd, const QString & execName,
const QString & icon, QWidget* window,
const QByteArray& asn, const QString& workingDirectory);
// TODO KDE5: merge the above with 5-args runCommand, using QString()
/**
* Display the Open-With dialog for those URLs, and run the chosen application.
* @param lst the list of applications to run
* @param window The top-level widget of the app that invoked this object.
* @param tempFiles if true and lst are local files, they will be deleted
* when the application exits.
* @param suggestedFileName see setSuggestedFileName
* @param asn Application startup notification id, if any (otherwise "").
* @return false if the dialog was canceled
*/
static bool displayOpenWithDialog(const KUrl::List& lst, QWidget* window,
bool tempFiles = false, const QString& suggestedFileName = QString(),
const QByteArray& asn = QByteArray());
/**
* Quotes a string for the shell.
* An empty string will @em not be quoted.
*
* @deprecated Use KShell::quoteArg() instead. @em Note that this function
* behaves differently for empty arguments and returns the result
* differently.
*
* @param str the string to quote. The quoted string will be written here
*/
#ifndef KDE_NO_DEPRECATED
- static KDE_DEPRECATED void shellQuote(QString &str);
+ static KIO_DEPRECATED void shellQuote(QString &str);
#endif
/**
* Processes a Exec= line as found in .desktop files.
* @param _service the service to extract information from.
* @param _urls The urls the service should open.
* @param tempFiles if true and urls are local files, they will be deleted
* when the application exits.
* @param suggestedFileName see setSuggestedFileName
*
* @return a list of arguments suitable for KProcess::setProgram().
*/
static QStringList processDesktopExec(const KService &_service, const KUrl::List &_urls,
bool tempFiles = false,
const QString& suggestedFileName = QString());
/**
* Given a full command line (e.g. the Exec= line from a .desktop file),
* extract the name of the binary being run.
* @param execLine the full command line
* @param removePath if true, remove a (relative or absolute) path. E.g. /usr/bin/ls becomes ls.
* @return the name of the binary to run
*/
static QString binaryName(const QString & execLine, bool removePath);
/**
* Returns whether @p serviceType refers to an executable program instead
* of a data file.
*/
static bool isExecutable(const QString& serviceType);
/**
* Returns whether the @p url of @p mimetype is executable.
* To be executable the file must pass the following rules:
* -# Must reside on the local filesystem.
* -# Must be marked as executable for the user by the filesystem.
* -# The mime type must inherit application/x-executable or application/x-executable-script.
* To allow a script to run when the above rules are satisfied add the entry
* @code
* X-KDE-IsAlso=application/x-executable-script
* @endcode
* to the mimetype's desktop file.
*/
static bool isExecutableFile(const KUrl& url, const QString &mimetype);
/**
* @internal
*/
static bool checkStartupNotify(const QString& binName, const KService* service, bool* silent_arg,
QByteArray* wmclass_arg);
Q_SIGNALS:
/**
* Emitted when the operation finished.
* This signal is emitted in all cases of completion, whether successful or with error.
* @see hasFinished()
*/
void finished();
/**
* Emitted when the operation had an error.
* @see hasError()
*/
void error();
protected Q_SLOTS:
/**
* All following protected slots are used by subclasses of KRun!
*/
/**
* This slot is called whenever the internal timer fired,
* in order to move on to the next step.
*/
void slotTimeout(); // KDE5: rename to slotNextStep() or something like that
/**
* This slot is called when the scan job is finished.
*/
void slotScanFinished(KJob *);
/**
* This slot is called when the scan job has found out
* the mime type.
*/
void slotScanMimeType(KIO::Job *, const QString &type);
/**
* Call this from subclasses when you have determined the mimetype.
* It will call foundMimeType, but also sets up protection against deletion during message boxes.
* @since 4.0.2
*/
void mimeTypeDetermined(const QString& mimeType);
/**
* This slot is called when the 'stat' job has finished.
*/
virtual void slotStatResult(KJob *);
protected:
/**
* All following protected methods are used by subclasses of KRun!
*/
/**
* Initializes the krun object.
*/
virtual void init();
/**
* Start scanning a file.
*/
virtual void scanFile();
/**
* Called if the mimetype has been detected. The function runs
* the application associated with this mimetype.
* Reimplement this method to implement a different behavior,
* like opening the component for displaying the URL embedded.
*
* Important: call setFinished(true) once you are done!
* Usually at the end of the foundMimeType reimplementation, but if the
* reimplementation is asynchronous (e.g. uses KIO jobs) then
* it can be called later instead.
*/
virtual void foundMimeType(const QString& type);
/**
* Kills the file scanning job.
*/
virtual void killJob();
/**
* Sets the url.
*/
void setUrl(const KUrl &url);
/**
* Returns the url.
*/
KUrl url() const;
/**
* Sets whether an error has occurred.
*/
void setError(bool error);
/**
* Sets whether progress information shall be shown.
*/
void setProgressInfo(bool progressInfo);
/**
* Returns whether progress information are shown.
*/
bool progressInfo() const;
/**
* Marks this 'KRun' instance as finished.
*/
void setFinished(bool finished);
/**
* Sets the job.
*/
void setJob(KIO::Job *job);
/**
* Returns the job.
*/
KIO::Job* job();
/**
* Returns the timer object.
* @deprecated setFinished(true) now takes care of the timer().start(0),
* so this can be removed.
*/
#ifndef KDE_NO_DEPRECATED
- KDE_DEPRECATED QTimer& timer();
+ KIO_DEPRECATED QTimer& timer();
#endif
/**
* Indicate that the next action is to scan the file.
* @deprecated not useful in public API
*/
#ifndef KDE_NO_DEPRECATED
- KDE_DEPRECATED void setDoScanFile(bool scanFile);
+ KIO_DEPRECATED void setDoScanFile(bool scanFile);
#endif
/**
* Returns whether the file shall be scanned.
* @deprecated not useful in public API
*/
#ifndef KDE_NO_DEPRECATED
- KDE_DEPRECATED bool doScanFile() const;
+ KIO_DEPRECATED bool doScanFile() const;
#endif
/**
* Sets whether it is a directory.
* @deprecated typo in the name, and not useful as a public method
*/
#ifndef KDE_NO_DEPRECATED
- KDE_DEPRECATED void setIsDirecory(bool isDirectory);
+ KIO_DEPRECATED void setIsDirecory(bool isDirectory);
#endif
/**
* Returns whether it is a directory.
*/
bool isDirectory() const;
/**
* @deprecated not useful in public API
*/
#ifndef KDE_NO_DEPRECATED
- KDE_DEPRECATED void setInitializeNextAction(bool initialize);
+ KIO_DEPRECATED void setInitializeNextAction(bool initialize);
#endif
/**
* @deprecated not useful in public API
*/
#ifndef KDE_NO_DEPRECATED
- KDE_DEPRECATED bool initializeNextAction() const;
+ KIO_DEPRECATED bool initializeNextAction() const;
#endif
/**
* Sets whether it is a local file.
*/
void setIsLocalFile(bool isLocalFile);
/**
* Returns whether it is a local file.
*/
bool isLocalFile() const;
/**
* Sets the file mode.
*/
void setMode(mode_t mode);
/**
* Returns the file mode.
*/
mode_t mode() const;
private:
class KRunPrivate;
KRunPrivate* const d;
};
#endif
diff --git a/kio/kio/ksambashare.h b/kio/kio/ksambashare.h
index bab0aab46b..7169597240 100644
--- a/kio/kio/ksambashare.h
+++ b/kio/kio/ksambashare.h
@@ -1,133 +1,133 @@
/* This file is part of the KDE project
Copyright (c) 2004 Jan Schaefer <j_schaef@informatik.uni-kl.de>
Copyright 2010 Rodrigo Belem <rclbelem@gmail.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef ksambashare_h
#define ksambashare_h
#include <QtCore/QObject>
#include <kio/kio_export.h>
class KSambaShareData;
class KSambaSharePrivate;
/**
* This class lists Samba user shares and monitors them for addition, update and removal.
* Singleton class, call instance() to get an instance.
*/
class KIO_EXPORT KSambaShare : public QObject
{
Q_OBJECT
public:
/**
* @return the one and only instance of KSambaShare.
*/
static KSambaShare *instance();
/**
* Whether or not the given path is shared by Samba.
*
* @param path the path to check if it is shared by Samba.
*
* @return whether the given path is shared by Samba.
*/
bool isDirectoryShared(const QString &path) const;
/**
* Returns a list of all directories shared by local users in Samba.
* The resulting list is not sorted.
*
* @return a list of all directories shared by Samba.
*/
QStringList sharedDirectories() const;
/**
* Tests that a share name is valid and does not conflict with system users names or shares.
*
* @param name the share name.
*
* @return whether the given name is already being used or not.
*
* @since 4.7
*/
bool isShareNameAvailable(const QString &name) const;
/**
* Returns the list of available shares.
*
* @return @c a QStringList containing the user shares names.
* @return @c an empty list if there aren't user shared directories.
*
* @since 4.7
*/
QStringList shareNames() const;
/**
* Returns the KSambaShareData object of the share name.
*
* @param name the share name.
*
* @return @c the KSambaShareData object that matches the name.
* @return @c an empty KSambaShareData object if there isn't match for the name.
*
* @since 4.7
*/
KSambaShareData getShareByName(const QString &name) const;
/**
* Returns a list of KSambaShareData matching the path.
*
* @param path the path that wants to get KSambaShareData object.
*
* @return @c the QList of KSambaShareData objects that matches the path.
* @return @c an empty QList if there aren't matches for the given path.
*
* @since 4.7
*/
QList<KSambaShareData> getSharesByPath(const QString &path) const;
virtual ~KSambaShare();
/**
* Returns the path to the used smb.conf file
* or empty string if no file was found
*
* @return @c the path to the smb.conf file
*
* @deprecated
*/
- KDE_DEPRECATED QString smbConfPath() const;
+ KIO_DEPRECATED QString smbConfPath() const;
Q_SIGNALS:
/**
* Emitted when a share is updated, added or removed
*/
void changed();
private:
KSambaShare();
KSambaSharePrivate * const d_ptr;
Q_DECLARE_PRIVATE(KSambaShare)
friend class KSambaShareData;
Q_PRIVATE_SLOT(d_func(), void _k_slotFileChange(const QString &))
};
#endif
diff --git a/kio/kio/kurifilter.h b/kio/kio/kurifilter.h
index 289b910154..315be14ee8 100644
--- a/kio/kio/kurifilter.h
+++ b/kio/kio/kurifilter.h
@@ -1,1020 +1,1020 @@
/*
* This file is part of the KDE libraries
* Copyright (C) 2000-2001,2003,2010 Dawit Alemayehu <adawit at kde.org>
*
* Original author
* Copyright (C) 2000 Yves Arrouye <yves@realnames.com>
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
**/
#ifndef KURIFILTER_H
#define KURIFILTER_H
#include <kio/kio_export.h>
#include <kurl.h>
#include <QtCore/QObject>
#include <QtCore/QHash>
#include <QtCore/QPair>
#include <QtCore/QStringList>
#ifdef Q_OS_WIN
#undef ERROR
#endif
class KUriFilterPrivate;
class KUriFilterDataPrivate;
class KCModule;
class QHostInfo;
/**
* Class that holds information about a search provider.
*
* @since 4.6
*/
class KIO_EXPORT KUriFilterSearchProvider
{
public:
/**
* Default constructor.
*/
KUriFilterSearchProvider();
/**
* Copy constructor.
*/
KUriFilterSearchProvider(const KUriFilterSearchProvider&);
/**
* Destructor.
*/
virtual ~KUriFilterSearchProvider();
/**
* Returns the desktop filename of the search provider without any extension.
*
* For example, if the desktop filename of the search provider was
* "foobar.desktop", this function will return "foobar".
*/
QString desktopEntryName() const;
/**
* Returns the descriptive name of the search provider, e.g. "Google News".
*
* This name comes from the "Name=" property entry in the desktop file that
* contains the search provider's information.
*/
QString name() const;
/**
* Returns the icon name associated with the search provider when available.
*/
QString iconName() const;
/**
* Returns all the web shortcut keys associated with this search provider.
*
* @see defaultKey
*/
QStringList keys() const;
/**
* Returns the default web shortcut key for this search provider.
*
* Right now this is the same as doing keys().first(), it might however
* change based on what the backend plugins do.
*
* @see keys
*/
QString defaultKey() const;
/**
* Assignment operator.
*/
KUriFilterSearchProvider& operator=(const KUriFilterSearchProvider&);
protected:
void setDesktopEntryName(const QString&);
void setIconName(const QString&);
void setKeys(const QStringList&);
void setName(const QString&);
private:
friend class KUriFilterPlugin;
class KUriFilterSearchProviderPrivate;
KUriFilterSearchProviderPrivate * const d;
};
/**
* This class is a basic messaging class used to exchange filtering information
* between the filter plugins and the application requesting the filtering
* service.
*
* Use this object if you require a more detailed information about the URI you
* want to filter. Any application can create an instance of this class and send
* it to KUriFilter to have the plugins fill out all possible information about
* the URI.
*
* On successful filtering you can use @ref uriType() to determine what type
* of resource the request was filtered into. See @ref KUriFilter::UriTypes for
* details. If an error is encountered, then @ref KUriFilter::Error is returned.
* You can use @ref errorMsg to obtain the error information.
*
* The functions in this class are not reentrant.
*
* \b Example
*
* Here is a basic example of how this class is used with @ref KUriFilter:
* \code
* KUriFilterData filterData (QLatin1String("kde.org"));
* bool filtered = KUriFilter::self()->filterUri(filterData);
* \endcode
*
* If you are only interested in getting the list of preferred search providers,
* then you can do the following (requires KDE >= 4.5):
*
* \code
* KDE 4.5:
* KUriFilterData data;
* data.setData("<text-to-search-for>");
* data.setAlternateDefaultSearchProvider("google");
* bool filtered = KUriFilter::self()->filterUri(data, "kuriikwsfilter");
*
* KDE >= 4.6:
* KUriFilterData data;
* data.setData("<text-to-search-for>");
* data.setSearchFilteringOption(KUriFilterData::RetrievePreferredSearchProvidersOnly);
* bool filtered = KUriFilter::self()->filterSearchUri(data, KUriFilter::NormalTextFilter);
* \endcode
*
* @short A class for exchanging filtering information.
* @author Dawit Alemayehu <adawit at kde.org>
*/
class KIO_EXPORT KUriFilterData
{
public:
/**
* Describes the type of the URI that was filtered.
* Here is a brief description of the types:
*
* @li NetProtocol - Any network protocol: http, ftp, nttp, pop3, etc...
* @li LocalFile - A local file whose executable flag is not set
* @li LocalDir - A local directory
* @li Executable - A local file whose executable flag is set
* @li Help - A man or info page
* @li Shell - A shell executable (ex: echo "Test..." >> ~/testfile)
* @li Blocked - A URI that should be blocked/filtered (ex: ad filtering)
* @li Error - An incorrect URI (ex: "~johndoe" when user johndoe
* does not exist in that system )
* @li Unknown - A URI that is not identified. Default value when
* a KUriFilterData is first created.
*/
enum UriTypes { NetProtocol=0, LocalFile, LocalDir, Executable, Help, Shell, Blocked, Error, Unknown };
/**
* This enum describes the search filtering options to be used.
*
* @li SearchFilterOptionNone
* No search filter options are set and normal filtering is performed
* on the input data.
* @li RetrieveSearchProvidersOnly
* If set, the list of all available search providers are returned without
* any input filtering. This flag only applies when used in conjunction
* with the @ref KUriFilter::NormalTextFilter flag.
* @li RetrievePreferredSearchProvidersOnly
* If set, the list of preferred search providers are returned without
* any input filtering. This flag only applies when used in conjunction
* with the @ref KUriFilter::NormalTextFilter flag.
* @li RetrieveAvailableSearchProvidersOnly
* Same as doing RetrievePreferredSearchProvidersOnly | RetrieveSearchProvidersOnly,
* where all available search providers are returned if no preferred ones
* ones are available. No input filtering will be performed.
*
* @see setSearchFilteringOptions
* @see KUriFilter::filterSearchUri
* @since 4.6
*/
enum SearchFilterOption
{
SearchFilterOptionNone = 0x0,
RetrieveSearchProvidersOnly = 0x01,
RetrievePreferredSearchProvidersOnly = 0x02,
RetrieveAvailableSearchProvidersOnly = (RetrievePreferredSearchProvidersOnly | RetrieveSearchProvidersOnly)
};
Q_DECLARE_FLAGS(SearchFilterOptions, SearchFilterOption)
/**
* Default constructor.
*
* Creates a UriFilterData object.
*/
KUriFilterData();
/**
* Creates a KUriFilterData object from the given URL.
*
* @param url is the URL to be filtered.
*/
explicit KUriFilterData( const KUrl& url );
/**
* Creates a KUriFilterData object from the given string.
*
* @param url is the string to be filtered.
*/
explicit KUriFilterData( const QString& url );
/**
* Copy constructor.
*
* Creates a KUriFilterData object from another KURIFilterData object.
*
* @param other the uri filter data to be copied.
*/
KUriFilterData( const KUriFilterData& other );
/**
* Destructor.
*/
~KUriFilterData();
/**
* Returns the filtered or the original URL.
*
* If one of the plugins successfully filtered the original input, this
* function returns it. Otherwise, it will return the input itself.
*
* @return the filtered or original url.
*/
KUrl uri() const;
/**
* Returns an error message.
*
* This functions returns the error message set by the plugin whenever the
* uri type is set to KUriFilterData::ERROR. Otherwise, it returns a NULL
* string.
*
* @return the error message or a NULL when there is none.
*/
QString errorMsg() const;
/**
* Returns the URI type.
*
* This method always returns KUriFilterData::UNKNOWN if the given URL was
* not filtered.
*
* @return the type of the URI
*/
UriTypes uriType() const;
/**
* Returns the absolute path if one has already been set.
*
* @return the absolute path, or QString()
*
* @see hasAbsolutePath()
*/
QString absolutePath() const;
/**
* Checks whether the supplied data had an absolute path.
*
* @return true if the supplied data has an absolute path
*
* @see absolutePath()
*/
bool hasAbsolutePath() const;
/**
* Returns the command line options and arguments for a local resource
* when present.
*
* @return options and arguments when present, otherwise QString()
*/
QString argsAndOptions() const;
/**
* Checks whether the current data is a local resource with command line
* options and arguments.
*
* @return true if the current data has command line options and arguments
*/
bool hasArgsAndOptions() const;
/**
* @return true if the filters should attempt to check whether the
* supplied uri is an executable. False otherwise.
*/
bool checkForExecutables() const;
/**
* The string as typed by the user, before any URL processing is done.
*/
QString typedString() const;
/**
* Returns the search term portion of the typed string.
*
* If the @ref typedString was not filtered by a search filter plugin, this
* function returns an empty string.
*
* @see typedString
* @since 4.5
*/
QString searchTerm() const;
/**
* Returns the character that is used to separate the search term from the
* keyword.
*
* If @ref typedString was not filtered by a search filter plugin, this
* function returns a null charater.
*
* @see typedString
* @since 4.5
*/
QChar searchTermSeparator() const;
/**
* Returns the name of the search service provider, e.g. Google.
*
* If @ref typedString was not filtered by a search filter plugin, this
* function returns an empty string.
*
* @see typedString
* @since 4.5
*/
QString searchProvider() const;
/**
* Returns a list of the names of preferred or available search providers.
*
* This function returns the list of providers marked as preferred whenever
* the input data, i.e. @ref typedString, is successfully filtered.
*
* If no default search provider has been selected prior to a filter request,
* this function will return an empty list. To avoid this problem you must
* either set an alternate default search provider using @ref setAlternateDefaultSearchProvider
* or set one of the @ref SearchFilterOption flags if you are only interested
* in getting the list of providers and not filtering the input.
*
* Additionally, you can also provide alternate search providers in case
* there are no preferred ones already selected.
*
* You can use @ref queryForPreferredServiceProvider to obtain the query
* associated with the list of search providers returned by this function.
*
* @see setAlternateSearchProviders
* @see setAlternateDefaultSearchProvider
* @see setSearchFilteringOption
* @see queryForPreferredServiceProvider
* @since 4.5
*/
QStringList preferredSearchProviders() const;
/**
* Returns information about @p provider.
*
* You can use this function to obtain the more information about the search
* providers returned by @ref preferredSearchProviders.
*
* @see preferredSearchProviders
* @see KUriFilterSearchProvider
* @since 4.6
*/
KUriFilterSearchProvider queryForSearchProvider(const QString& provider) const;
/**
* Returns the web shortcut url for the given preferred search provider.
*
* You can use this function to obtain the query for the preferred search
* providers returned by @ref preferredSearchProviders.
*
* The query returned by this function is in web shortcut format, i.e.
* "gg:foo bar", and must be re-filtered through KUriFilter to obtain a
* valid url.
*
* @see preferredSearchProviders
* @since 4.5
*/
QString queryForPreferredSearchProvider(const QString &provider) const;
/**
* Returns all the query urls for the given search provider.
*
* Use this function to obtain all the different queries that can be used
* for the given provider. For example, if a search engine provider named
* "foobar" has web shortcuts named "foobar", "foo" and "bar", then this
* function, unlike @ref queryForPreferredSearchProvider, will return a
* a query for each and every web shortcut.
*
* @see queryForPreferredSearchProvider
* @since 4.6
*/
QStringList allQueriesForSearchProvider(const QString& provider) const;
/**
* Returns the icon associated with the given preferred search provider.
*
* You can use this function to obtain the icon names associated with the
* preferred search providers returned by @ref preferredSearchProviders.
*
* @see preferredSearchProviders
* @since 4.5
*/
QString iconNameForPreferredSearchProvider(const QString &provider) const;
/**
* Returns the list of alternate search providers.
*
* This function returns an empty list if @ref setAlternateSearchProviders
* was not called to set the alternate search providers to be when no
* preferred providers have been chosen by the user through the search
* configuration module.
*
* @see setAlternatteSearchProviders
* @see preferredSearchProviders
* @since 4.5
*/
QStringList alternateSearchProviders() const;
/**
* Returns the search provider to use when a default provider is not available.
*
* This function returns an empty string if @ref setAlternateDefaultSearchProvider
* was not called to set the default search provider to be used when none has been
* chosen by the user through the search configuration module.
*
* @see setAlternateDefaultSearchProvider
* @since 4.5
*/
QString alternateDefaultSearchProvider() const;
/**
* Returns the default protocol to use when filtering potentially valid url inputs.
*
* By default this function will return an empty string.
*
* @see setDefaultUrlScheme
* @since 4.6
*/
QString defaultUrlScheme() const;
/**
* Returns the specified search filter options.
*
* By default this function returns @ref SearchFilterOptionNone.
*
* @see setSearchFilteringOptions
* @since 4.6
*/
SearchFilterOptions searchFilteringOptions() const;
/**
* The name of the icon that matches the current filtered URL.
*
* This function returns a null string by default and when no icon is found
* for the filtered URL.
*/
QString iconName();
/**
* Check whether the provided uri is executable or not.
*
* Setting this to false ensures that typing the name of an executable does
* not start that application. This is useful in the location bar of a
* browser. The default value is true.
*/
void setCheckForExecutables (bool check);
/**
* Same as above except the argument is a URL.
*
* Use this function to set the string to be filtered when you construct an
* empty filter object.
*
* @param url the URL to be filtered.
*/
void setData( const KUrl& url );
/**
* Sets the URL to be filtered.
*
* Use this function to set the string to be
* filtered when you construct an empty filter
* object.
*
* @param url the string to be filtered.
*/
void setData( const QString& url );
/**
* Sets the absolute path to be used whenever the supplied data is a
* relative local URL.
*
* NOTE: This function should only be used for local resources, i.e. the
* "file:/" protocol. It is useful for specifying the absolute path in
* cases where the actual URL might be relative. If deriving the path from
* a KUrl, make sure you set the argument for this function to the result
* of calling path () instead of url ().
*
* @param abs_path the abolute path to the local resource.
*
* @return true if absolute path is successfully set. Otherwise, false.
*/
bool setAbsolutePath( const QString& abs_path );
/**
* Sets a list of search providers to use in case no preferred search
* providers are available.
*
* The list of preferred search providers set using this function will only
* be used if the default and favorite search providers have not yet been
* selected by the user. Otherwise, the providers specified through this
* function will be ignored.
*
* @see alternateSearchProviders
* @see preferredSearchProviders
* @since 4.5
*/
void setAlternateSearchProviders(const QStringList &providers);
/**
* Sets the search provider to use in case no default provider is available.
*
* The default search provider set using this function will only be used if
* the default and favorite search providers have not yet been selected by
* the user. Otherwise, the default provider specified by through function
* will be ignored.
*
* @see alternateDefaultSearchProvider
* @see preferredSearchProviders
* @since 4.5
*/
void setAlternateDefaultSearchProvider(const QString &provider);
/**
* Sets the default scheme used when filtering potentially valid url inputs.
*
* Use this function to change the default protocol used when filtering
* potentially valid url inputs. The default protocol is http.
*
* If the scheme is specified without a separator, then "://" will be used
* as the separator by default. For example, if the default url scheme was
* simply set to "ftp", then a potentially valid url input such as "kde.org"
* will be filtered to "ftp://kde.org".
*
* @see defaultUrlScheme
* @since 4.6
*/
void setDefaultUrlScheme(const QString&);
/**
* Sets the options used by search filter plugins to filter requests.
*
* The default search filter option is @ref SearchFilterOptionNone. See
* @ref SearchFilterOption for the description of the other flags.
*
* It is important to note that the options set through this function can
* prevent any filtering from being performed by search filter plugins.
* As such, @ref uriTypes can return KUriFilterData::Unknown and @ref uri
* can return an invalid url eventhough the filtering request returned
* a successful response.
*
* @see searchFilteringOptions
* @since 4.6
*/
void setSearchFilteringOptions(SearchFilterOptions options);
/**
* Overloaded assigenment operator.
*
* This function allows you to easily assign a KUrl
* to a KUriFilterData object.
*
* @return an instance of a KUriFilterData object.
*/
KUriFilterData& operator=( const KUrl& url );
/**
* Overloaded assigenment operator.
*
* This function allows you to easily assign a QString to a KUriFilterData
* object.
*
* @return an instance of a KUriFilterData object.
*/
KUriFilterData& operator=( const QString& url );
private:
friend class KUriFilterPlugin;
KUriFilterDataPrivate * const d;
};
/**
* Base class for URI filter plugins.
*
* This class applies a single filter to a URI. All plugins designed to provide
* URI filtering service should inherit from this abstract class and provide a
* concrete implementation.
*
* All inheriting classes need to implement the pure virtual function
* @ref filterUri.
*
* @short Abstract class for URI filter plugins.
*/
class KIO_EXPORT KUriFilterPlugin : public QObject
{
Q_OBJECT
public:
/**
* List for holding the following search provider information:
* ([search provider name], [search query, search query icon name])
*
* @since 4.5
* @deprecated Use @ref KUriFilterSearchProvider instead. See @ref setSearchProviders;
*/
#ifndef KDE_NO_DEPRECATED
- KDE_DEPRECATED typedef QHash<QString, QPair<QString, QString> > ProviderInfoList;
+ KIO_DEPRECATED typedef QHash<QString, QPair<QString, QString> > ProviderInfoList;
#endif
/**
* Constructs a filter plugin with a given name
*
* @param parent the parent object, or 0 for no parent
* @param name the name of the plugin, mandatory
*/
explicit KUriFilterPlugin( const QString &name, QObject *parent = 0 );
/**
* Filters a URI.
*
* @param data the URI data to be filtered.
* @return A boolean indicating whether the URI has been changed.
*/
virtual bool filterUri( KUriFilterData& data ) const = 0;
/**
* Creates a configuration module for the filter.
*
* It is the responsibility of the caller to delete the module once it is
* not needed anymore.
*
* @return A configuration module, 0 if the filter isn't configurable.
*/
virtual KCModule *configModule( QWidget*, const char* ) const;
/**
* Returns the name of the configuration module for the filter.
*
* @return the name of a configuration module or QString() if none.
*/
virtual QString configName() const;
protected:
/**
* Sets the URL in @p data to @p uri.
*/
void setFilteredUri ( KUriFilterData& data, const KUrl& uri ) const;
/**
* Sets the error message in @p data to @p errormsg.
*/
void setErrorMsg ( KUriFilterData& data, const QString& errmsg ) const;
/**
* Sets the URI type in @p data to @p type.
*/
void setUriType ( KUriFilterData& data, KUriFilterData::UriTypes type) const;
/**
* Sets the arguments and options string in @p data to @p args if any were
* found during filterting.
*/
void setArguments( KUriFilterData& data, const QString& args ) const;
/**
* Sets the name of the search provider, the search term and keyword/term
* separator in @p data.
*
* @since 4.5
*/
void setSearchProvider( KUriFilterData& data, const QString& provider,
const QString& term, const QChar& separator) const;
/**
* Sets the name of the preferred search providers in @p data.
*
* @since 4.5
* @deprecated Use @ref setSearchProviders instead.
*/
#ifndef KDE_NO_DEPRECATED
- KDE_DEPRECATED void setPreferredSearchProviders(KUriFilterData& data, const ProviderInfoList& providers) const;
+ KIO_DEPRECATED void setPreferredSearchProviders(KUriFilterData& data, const ProviderInfoList& providers) const;
#endif
/**
* Sets the information about the search @p providers in @p data.
*
* @since 4.6
*/
void setSearchProviders(KUriFilterData& data, const QList<KUriFilterSearchProvider*>& providers) const;
/**
* Returns the icon name for the given @p url and URI @p type.
*
* @since 4.5
*/
QString iconNameFor(const KUrl& url, KUriFilterData::UriTypes type) const;
/**
* Performs a DNS lookup for @p hostname and returns the result.
*
* This function uses the KIO/KHTML DNS cache to speed up the
* lookup. It also avoids doing a reverse lookup if the given
* host name is already an ip address.
*
* \note All uri filter plugins that need to perform a hostname
* lookup should use this function.
*
* @param hostname the hostname to lookup.
* @param timeout the amount of time in msecs to wait for the lookup.
* @return the result of the host name lookup.
*
* @since 4.7
*/
QHostInfo resolveName (const QString& hostname, unsigned long timeout) const;
private:
class KUriFilterPluginPrivate * const d;
};
/**
* KUriFilter applies a number of filters to a URI and returns a filtered version if any
* filter matches.
* A simple example is "kde.org" to "http://www.kde.org", which is commonplace in web browsers.
*
* The filters are implemented as plugins in @ref KUriFilterPlugin subclasses.
*
* KUriFilter is a singleton object: obtain the instance by calling
* @p KUriFilter::self() and use the public member functions to
* perform the filtering.
*
* \b Example
*
* To simply filter a given string:
*
* \code
* QString url("kde.org");
* bool filtered = KUriFilter::self()->filteredUri( url );
* \endcode
*
* You can alternatively use a KUrl:
*
* \code
* KUrl url("kde.org");
* bool filtered = KUriFilter::self()->filterUri( url );
* \endcode
*
* If you have a constant string or a constant URL, simply invoke the
* corresponding function to obtain the filtered string or URL instead
* of a boolean flag:
*
* \code
* QString filteredText = KUriFilter::self()->filteredUri( "kde.org" );
* \endcode
*
* All of the above examples should result in "kde.org" being filtered into
* "http://kde.org".
*
* You can also restrict the filters to be used by supplying the name of the
* filters you want to use. By defualt all available filters are used.
*
* To use specific filters, add the names of the filters you want to use to a
* QStringList and invoke the appropriate filtering function.
*
* The examples below show the use of specific filters. KDE ships with the
* following filter plugins by default:
*
* kshorturifilter:
* This is used for filtering potentially valid url inputs such as "kde.org"
* Additionally it filters shell variables and shortcuts such as $HOME and
* ~ as well as man and info page shortcuts, # and ## respectively.
*
* kuriikwsfilter:
* This is used for filtering normal input text into a web search url using the
* configured fallback search engine selected by the user.
*
* kurisearchfilter:
* This is used for filtering KDE webshortcuts. For example "gg:KDE" will be
* converted to a url for searching the work "KDE" using the Google search
* engine.
*
* localdomainfilter:
* This is used for doing a DNS lookup to determine whether the input is a valid
* local address.
*
* fixuphosturifilter:
* This is used to append "www." to the host name of a pre filtered http url
* if the original url cannot be resolved.
*
* \code
* QString text ("kde.org");
* bool filtered = KUriFilter::self()->filterUri(text, QLatin1String("kshorturifilter"));
* \endcode
*
* The above code should result in "kde.org" being filtered into "http://kde.org".
*
* \code
* QStringList list;
* list << QLatin1String("kshorturifilter") << QLatin1String("localdomainfilter");
* bool filtered = KUriFilter::self()->filterUri( text, list );
* \endcode
*
* Additionally if you only want to do search related filtering, you can use the
* search specific function, @ref filterSearchUri, that is available in KDE
* 4.5 and higher. For example, to search for a given input on the web you
* can do the following:
*
* KUriFilterData filterData ("foo");
* bool filtered = KUriFilter::self()->filterSearchUri(filterData, KUriFilterData::NormalTextFilter);
*
* KUriFilter converts all filtering requests to use @ref KUriFilterData
* internally. The use of this bi-directional class allows you to send specific
* instructions to the filter plugins as well as receive detailed information
* about the filtered request from them. See the documentation of KUriFilterData
* class for more examples and details.
*
* All functions in this class are thread safe and reentrant.
*
* @short Filters the given input into a valid url whenever possible.
*/
class KIO_EXPORT KUriFilter
{
public:
/**
* This enum describes the types of search plugin filters available.
*
* @li NormalTextFilter The plugin used to filter normal text, e.g. "some term to search".
* @li WebShortcutFilter The plugin used to filter web shortcuts, e.g. gg:KDE.
*/
enum SearchFilterType {
NormalTextFilter = 0x01,
WebShortcutFilter = 0x02
};
Q_DECLARE_FLAGS(SearchFilterTypes, SearchFilterType)
/**
* Destructor
*/
~KUriFilter ();
/**
* Returns an instance of KUriFilter.
*/
static KUriFilter* self();
/**
* Filters @p data using the specified @p filters.
*
* If no named filters are specified, the default, then all the
* URI filter plugins found will be used.
*
* @param data object that contains the URI to be filtered.
* @param filters specify the list of filters to be used.
*
* @return a boolean indicating whether the URI has been changed
*/
bool filterUri( KUriFilterData& data, const QStringList& filters = QStringList() );
/**
* Filters the URI given by the URL.
*
* The given URL is filtered based on the specified list of filters.
* If the list is empty all available filters would be used.
*
* @param uri the URI to filter.
* @param filters specify the list of filters to be used.
*
* @return a boolean indicating whether the URI has been changed
*/
bool filterUri( KUrl &uri, const QStringList& filters = QStringList() );
/**
* Filters a string representing a URI.
*
* The given URL is filtered based on the specified list of filters.
* If the list is empty all available filters would be used.
*
* @param uri The URI to filter.
* @param filters specify the list of filters to be used.
*
* @return a boolean indicating whether the URI has been changed
*/
bool filterUri( QString &uri, const QStringList& filters = QStringList() );
/**
* Returns the filtered URI.
*
* The given URL is filtered based on the specified list of filters.
* If the list is empty all available filters would be used.
*
* @param uri The URI to filter.
* @param filters specify the list of filters to be used.
*
* @return the filtered URI or null if it cannot be filtered
*/
KUrl filteredUri( const KUrl &uri, const QStringList& filters = QStringList() );
/**
* Return a filtered string representation of a URI.
*
* The given URL is filtered based on the specified list of filters.
* If the list is empty all available filters would be used.
*
* @param uri the URI to filter.
* @param filters specify the list of filters to be used.
*
* @return the filtered URI or null if it cannot be filtered
*/
QString filteredUri( const QString &uri, const QStringList& filters = QStringList() );
/**
* See @ref filterSearchUri(KUriFilterData&, SearchFilterTypes)
*
* @since 4.5
* @deprecated Use filterSearchUri(KUriFilterData&, SearchFilterTypes) instead.
*/
#ifndef KDE_NO_DEPRECATED
- KDE_DEPRECATED bool filterSearchUri(KUriFilterData &data);
+ KIO_DEPRECATED bool filterSearchUri(KUriFilterData &data);
#endif
/**
* Filter @p data using the criteria specified by @p types.
*
* The search filter type can be individual value of @ref SearchFilterTypes
* or a combination of those types using the bitwise OR operator.
*
* You can also use the flags from @ref KUriFilterData::SearchFilterOption
* to alter the filtering mechanisms of the search filter providers.
*
* @param data object that contains the URI to be filtered.
* @param types the search filters used to filter the request.
* @return true if the specified @p data was successfully filtered.
*
* @see KUriFilterData::setSearchFilteringOptions
* @since 4.6
*/
bool filterSearchUri(KUriFilterData &data, SearchFilterTypes types);
/**
* Return a list of the names of all loaded plugins.
*
* @return a QStringList of plugin names
*/
QStringList pluginNames() const;
protected:
/**
* Constructor.
*
* Creates a KUriFilter object and calls @ref loadPlugins to load all
* available URI filter plugins.
*/
KUriFilter();
/**
* Loads all allowed plugins.
*
* This function only loads URI filter plugins that have not been disabled.
*/
void loadPlugins();
private:
KUriFilterPrivate * const d;
};
Q_DECLARE_OPERATORS_FOR_FLAGS(KUriFilterData::SearchFilterOptions)
Q_DECLARE_OPERATORS_FOR_FLAGS(KUriFilter::SearchFilterTypes)
#endif
diff --git a/kio/kio/metainfojob.h b/kio/kio/metainfojob.h
index 00c176475b..c2623069c7 100644
--- a/kio/kio/metainfojob.h
+++ b/kio/kio/metainfojob.h
@@ -1,127 +1,127 @@
// -*- c++ -*-
// vim: ts=4 sw=4 et
/* This file is part of the KDE libraries
Copyright (C) 2001 Rolf Magnus <ramagnus@kde.org>
parts of this taken from previewjob.h
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation version 2.0.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KIO_METAINFOJOB_H
#define KIO_METAINFOJOB_H
#include <kio/job.h>
#include <kfileitem.h>
namespace KIO {
class MetaInfoJobPrivate;
/**
* MetaInfoJob is a KIO Job to retrieve meta information from files.
*
* @short KIO Job to retrieve meta information from files.
*/
class KIO_EXPORT MetaInfoJob : public KIO::Job
{
Q_OBJECT
public:
/**
* Creates a new MetaInfoJob.
* @param items A list of KFileItems to get the metainfo for
* @param w Flags which serve as a preset which can be customized
* with other parameters.
* @param iocost The allowed cost in terms of io to retrieve the
* metainfo. The approximate maximum number of bytes to
* be read is 10^iocost. Negative values mean that
* there is no limit on the cost. 0 means that no fields
* other than the required fields will be retrieved.
* The default value of 3 means about 1024 bytes per
* file may be read. This is merely a suggestion and not
* a hard limit.
* @param cpucost The allowed cost in terms of cpu to determine the
* information in the fields. The number mean the amount
* of instructions allowed is 10^cpucost and is a suggestion only.
* The default value of 6 means that about a million
* instructions (10^6) are allowed. This is useful for
* expensive fields like md5 or thumbnails.
* @param requiredfields The names of fields or groups of fields that should
* be retrieved regardless of cost.
* @param requestedfields The names of fields or groups of fields that should
* be retrieved first.
*/
explicit MetaInfoJob(const KFileItemList& items, KFileMetaInfo::WhatFlags w = KFileMetaInfo::Everything,
int iocost = 3, int cpucost = 6, const QStringList& requiredfields = QStringList(),
const QStringList& requestedfields = QStringList());
virtual ~MetaInfoJob();
/**
* Removes an item from metainfo extraction.
*
* @param item the item that should be removed from the queue
*/
void removeItem( const KFileItem& item );
Q_SIGNALS:
/**
* Emitted when the meta info for @p item has been successfully
* retrieved.
* @param item the KFileItem describing the fetched item
*/
void gotMetaInfo( const KFileItem& item );
/**
* Emitted when metainfo for @p item could not be extracted,
* either because a plugin for its MIME type does not
* exist, or because something went wrong.
* @param item the KFileItem of the file that failed
*/
void failed( const KFileItem& item );
protected:
void getMetaInfo();
protected Q_SLOTS:
virtual void slotResult( KJob *job );
private Q_SLOTS:
void start();
void slotMetaInfo(KIO::Job *, const QByteArray &);
private:
void determineNextFile();
// void saveMetaInfo(const QByteArray info);
private:
Q_DECLARE_PRIVATE(MetaInfoJob)
};
/**
* Retrieves meta information for the given items.
*
* @param items files to get metainfo for
* @return the MetaInfoJob to retrieve the items
* @deprecated use strigi or KFileMetaInfo
*/
- KIO_EXPORT_DEPRECATED MetaInfoJob* fileMetaInfo(const KFileItemList& items);
+ KIO_DEPRECATED_EXPORT MetaInfoJob* fileMetaInfo(const KFileItemList& items);
/**
* Retrieves meta information for the given items.
*
* @param items files to get metainfo for
* @return the MetaInfoJob to retrieve the items
* @deprecated use strigi or KFileMetaInfo
*/
- KIO_EXPORT_DEPRECATED MetaInfoJob* fileMetaInfo(const KUrl::List& items);
+ KIO_DEPRECATED_EXPORT MetaInfoJob* fileMetaInfo(const KUrl::List& items);
}
#endif
diff --git a/kio/kio/netaccess.h b/kio/kio/netaccess.h
index 53118f44dd..49acefab93 100644
--- a/kio/kio/netaccess.h
+++ b/kio/kio/netaccess.h
@@ -1,484 +1,484 @@
/*
This file is part of the KDE libraries
Copyright (C) 1997 Torben Weis (weis@kde.org)
Copyright (C) 1998 Matthias Ettrich (ettrich@kde.org)
Copyright (C) 1999-2004 David Faure (faure@kde.org)
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KIO_NETACCESS_h
#define KIO_NETACCESS_h
#include <QtCore/QObject>
#include <QtCore/QString>
#include <kio/global.h>
#include <kio/udsentry.h>
#include <kurl.h>
#include <kio/jobclasses.h> // for KIO::JobFlags
class QStringList;
class QWidget;
template<typename T, typename K> class QMap;
class KJob;
namespace KIO {
class Job;
class NetAccessPrivate;
/**
* Net Transparency.
*
* NetAccess allows you to do simple file operation (load, save,
* copy, delete...) without working with KIO::Job directly.
* Whereas a KIO::Job is asynchronous, meaning that the
* developer has to connect slots for it, KIO::NetAccess provides
* synchronous downloads and uploads, as well as temporary file
* creation and removal. The functions appear to be blocking,
* but the Qt event loop continues running while the operations
* are handled. More precisely, the GUI will still repaint, but no user
* interaction will be possible. If you can, please use async KIO jobs instead!
* See the documentation of KJob::exec() for more about the dangers of NetAccess.
*
* This class isn't meant to be used as a class but only as a simple
* namespace for static functions, though an instance of the class
* is built for internal purposes. TODO KDE5: turn into namespace,
* and make the qobject class private.
*
* Port to kio done by David Faure, faure@kde.org
*
* @short Provides a blocking interface to KIO file operations.
*/
class KIO_EXPORT NetAccess : public QObject
{
Q_OBJECT
public:
enum StatSide {
SourceSide,
DestinationSide
};
/**
* Downloads a file from an arbitrary URL (@p src) to a
* temporary file on the local filesystem (@p target).
*
* If the argument
* for @p target is an empty string, download will generate a
* unique temporary filename in /tmp. Since @p target is a reference
* to QString you can access this filename easily. Download will
* return true if the download was successful, otherwise false.
*
* Special case:
* If the URL is of kind file:, then no downloading is
* processed but the full filename is returned in @p target.
* That means you @em have to take care about the @p target argument.
* (This is very easy to do, please see the example below.)
*
* Download is synchronous. That means you can use it like this:
* (assuming your application has a loadFile() function)
*
* \code
* QString tmpFile;
* if( KIO::NetAccess::download(url, tmpFile, window)) {
* loadFile(tmpFile);
* KIO::NetAccess::removeTempFile(tmpFile);
* } else {
* KMessageBox::error(this, KIO::NetAccess::lastErrorString());
* }
* \endcode
*
* Of course, your user interface will still process exposure/repaint
* events during the download.
*
* If the download fails, lastError() and lastErrorString() will be set.
*
* If the url is always remote, then you could also just write the more usual way:
* \code
* QTemporaryFile tmpFile;
* if (tmpFile.open()) {
* KIO::Job* getJob = KIO::file_copy(url, KUrl(tmpFile.fileName()), -1, KIO::Overwrite | KIO::HideProgressInfo);
* getJob->ui()->setWindow(window);
* if (KIO::NetAccess::synchronousRun(getJob, 0)) {
* loadFile(tmpFile.fileName());
* } else {
* getJob->ui()->showErrorMessage();
* }
* }
* \endcode
*
* @param src URL Reference to the file to download.
* @param target String containing the final local location of the
* file. If you insert an empty string, it will
* return a location in a temporary spot. <B>Note:</B>
* you are responsible for the removal of this file when
* you are finished reading it using removeTempFile.
* @param window main window associated with this job. This is used to
* automatically cache and discard authentication information
* as needed. If NULL, authentication information will be
* cached only for a short duration after which the user will
* again be prompted for passwords as needed.
* @return true if successful, false for failure. Use lastErrorString() to
* get the reason it failed.
*
* @see lastErrorString()
*/
static bool download(const KUrl& src, QString & target, QWidget* window);
/**
* Removes the specified file if and only if it was created
* by KIO::NetAccess as a temporary file for a former download.
*
* Note: This means that if you created your temporary with KTempFile,
* use KTempFile::unlink() or KTempFile::setAutoDelete() to have
* it removed.
*
* @param name Path to temporary file to remove. May not be
* empty.
*/
static void removeTempFile(const QString& name);
/**
* Uploads file @p src to URL @p target.
*
* Both must be specified, unlike download.
* Note that this is assumed to be used for saving a file over
* the network, so overwriting is set to true. This is not the
* case with copy.
*
* @param src URL Referencing the file to upload.
* @param target URL containing the final location of the file.
* @param window main window associated with this job. This is used to
* automatically cache and discard authentication information
* as needed. If NULL, authentication information will be cached
* only for a short duration after which the user will again be
* prompted for passwords as needed.
*
* @return true if successful, false for failure
*/
static bool upload(const QString& src, const KUrl& target, QWidget* window);
/**
* Alternative to upload for copying over the network.
* Overwrite is false, so this will fail if @p target exists.
*
* This one takes two URLs and is a direct equivalent of KIO::file_copy.
*
* @param src URL Referencing the file to upload.
* @param target URL containing the final location of the file.
* @param window main window associated with this job. This is used to
* automatically cache and discard authentication information
* as needed. If NULL, authentication information will be cached
* only for a short duration after which the user will again be
* prompted for passwords as needed.
*
* @return true if successful, false for failure
*/
static bool file_copy( const KUrl& src, const KUrl& target, QWidget* window = 0 );
/// @deprecated, use file_copy instead
#ifndef KDE_NO_DEPRECATED
- static KDE_DEPRECATED bool copy( const KUrl& src, const KUrl& target,
+ static KIO_DEPRECATED bool copy( const KUrl& src, const KUrl& target,
QWidget* window = 0 );
#endif
/**
* Alternative method for copying over the network.
*
* This one takes two URLs and is a direct equivalent
* of KIO::copy!.
* This means that it can copy files and directories alike
* (it should have been named copy()).
*
* This method will bring up a dialog if the destination already exists.
*
* @param src URL Referencing the file to upload.
* @param target URL containing the final location of the
* file.
* @param window main window associated with this job. This is used to
* automatically cache and discard authentication information
* as needed. If NULL, authentication information will be cached
* only for a short duration after which the user will again be
* prompted for passwords as needed.
* @return true if successful, false for failure
*/
static bool dircopy( const KUrl& src, const KUrl& target, QWidget* window ); // TODO deprecate in favor of KIO::copy + synchronousRun (or job->exec())
/**
* Overloaded method, which takes a list of source URLs
*/
static bool dircopy( const KUrl::List& src, const KUrl& target, QWidget* window = 0L ); // TODO deprecate in favor of KIO::copy + synchronousRun (or job->exec())
/**
* Full-fledged equivalent of KIO::move.
* Moves or renames one file or directory.
* @deprecated use KIO::move and then KIO::NetAccess::synchronousRun (or job->exec())
*/
#ifndef KDE_NO_DEPRECATED
- static KDE_DEPRECATED bool move( const KUrl& src, const KUrl& target, QWidget* window = 0L );
+ static KIO_DEPRECATED bool move( const KUrl& src, const KUrl& target, QWidget* window = 0L );
#endif
/**
* Full-fledged equivalent of KIO::move.
* Moves or renames a list of files or directories.
* @deprecated use KIO::move and then KIO::NetAccess::synchronousRun (or job->exec())
*/
#ifndef KDE_NO_DEPRECATED
- static KDE_DEPRECATED bool move( const KUrl::List& src, const KUrl& target, QWidget* window = 0L );
+ static KIO_DEPRECATED bool move( const KUrl::List& src, const KUrl& target, QWidget* window = 0L );
#endif
/**
* Tests whether a URL exists.
*
* @param url the URL we are testing
* @param source if true, we want to read from that URL.
* If false, we want to write to it.
* IMPORTANT: see documentation for KIO::stat for more details about this.
* @param window main window associated with this job. This is used to
* automatically cache and discard authentication information
* as needed. If NULL, authentication information will be
* cached only for a short duration after which the user will
* again be prompted for passwords as needed.
* @return true if the URL exists and we can do the operation specified by
* @p source, false otherwise
*
* @deprecated use the StatSide enum instead of the bool source
*/
#ifndef KDE_NO_DEPRECATED
- static KDE_DEPRECATED bool exists(const KUrl& url, bool source, QWidget* window);
+ static KIO_DEPRECATED bool exists(const KUrl& url, bool source, QWidget* window);
#endif
/**
* Tests whether a URL exists.
*
* @param url the URL we are testing
* @param statSide determines if we want to read or write.
* IMPORTANT: see documentation for KIO::stat for more details about this.
* @param window main window associated with this job. This is used to
* automatically cache and discard authentication information
* as needed. If NULL, authentication information will be
* cached only for a short duration after which the user will
* again be prompted for passwords as needed.
* @return true if the URL exists and we can do the operation specified by
* @p source, false otherwise
*/
static bool exists(const KUrl& url, StatSide statSide, QWidget* window);
/**
* Tests whether a URL exists and return information on it.
*
* This is a convenience function for KIO::stat
* (it saves creating a slot and testing for the job result).
*
* @param url The URL we are testing.
* @param entry The result of the stat. Iterate over the list
* of atoms to get hold of name, type, size, etc., or use KFileItem.
* @param window main window associated with this job. This is used to
* automatically cache and discard authentication information
* as needed. If NULL, authentication information will be
* cached only for a short duration after which the user will
* again be prompted for passwords as needed.
* @return true if successful, false for failure
*/
static bool stat(const KUrl& url, KIO::UDSEntry & entry, QWidget* window);
/**
* Tries to map a local URL for the given URL.
*
* This is a convenience function for KIO::stat + parsing the
* resulting UDSEntry.
*
* @param url The URL we are testing.
* @param window main window associated with this job. This is used to
* automatically cache and discard authentication information
* as needed. If NULL, authentication information will be
* cached only for a short duration after which the user will
* again be prompted for passwords as needed.
* @return a local URL corresponding to the same resource than the
* original URL, or the original URL if no local URL can be mapped
*/
static KUrl mostLocalUrl(const KUrl& url, QWidget* window);
/**
* Deletes a file or a directory in a synchronous way.
*
* This is a convenience function for KIO::del
* (it saves creating a slot and testing for the job result).
*
* @param url The file or directory to delete.
* @param window main window associated with this job. This is used to
* automatically cache and discard authentication information
* as needed. If NULL, authentication information will be
* cached only for a short duration after which the user will
* again be prompted for passwords as needed.
* @return true on success, false on failure.
*/
static bool del( const KUrl & url, QWidget* window );
/**
* Creates a directory in a synchronous way.
*
* This is a convenience function for @p KIO::mkdir
* (it saves creating a slot and testing for the job result).
*
* @param url The directory to create.
* @param window main window associated with this job. This is used to
* automatically cache and discard authentication information
* as needed. If NULL, authentication information will be
* cached only for a short duration after which the user will
* again be prompted for passwords as needed.
* @param permissions directory permissions.
* @return true on success, false on failure.
*/
static bool mkdir( const KUrl & url, QWidget* window, int permissions = -1 );
/**
* Executes a remote process via the fish ioslave in a synchronous way.
*
* @param url The remote machine where the command should be executed.
* e.g. fish://someuser\@somehost:sshport/
* some special cases exist.
* fish://someuser\@localhost/
* will use su instead of ssh to connect and execute the command.
* fish://someuser\@localhost:port/
* will use ssh to connect and execute the command.
* @param command The command to be executed.
* @param window main window associated with this job. This is used to
* automatically cache and discard authentication information
* as needed. If NULL, authentication information will be
* cached only for a short duration after which the user will
* again be prompted for passwords as needed.
* @return The resulting output of the @p command that is executed.
*/
static QString fish_execute( const KUrl & url, const QString &command, QWidget* window );
/**
* This function executes a job in a synchronous way.
* If a job fetches some data, pass a QByteArray pointer as data parameter to this function
* and after the function returns it will contain all the data fetched by this job.
*
* @code
* KIO::Job *job = KIO::get( url );
* QMap<QString, QString> metaData;
* metaData.insert( "PropagateHttpHeader", "true" );
* if ( NetAccess::synchronousRun( job, 0, &data, &url, &metaData ) ) {
* QString responseHeaders = metaData[ "HTTP-Headers" ];
* kDebug()<<"Response header = "<< responseHeaders;
* }
* @endcode
*
* @param job job which the function will run. Note that after this function
* finishes running, job is deleted and you can't access it anymore!
* @param window main window associated with this job. This is used to
* automatically cache and discard authentication information
* as needed. If NULL, authentication information will be
* cached only for a short duration after which the user will
* again be prompted for passwords as needed.
* @param data if passed and relevant to this job then it will contain the data
* that was fetched by the job
* @param finalURL if passed will contain the final url of this job (it might differ
* from the one it was created with if there was a redirection)
* @param metaData you can pass a pointer to the map with meta data you wish to
* set on the job. After the job finishes this map will hold all the
* meta data from the job.
*
* @return true on success, false on failure.
*/
static bool synchronousRun( Job* job, QWidget* window, QByteArray* data=0,
KUrl* finalURL=0, QMap<QString,QString>* metaData=0 );
/**
* Determines the mimetype of a given URL.
*
* This is a convenience function for KIO::mimetype. You
* should call this only when really necessary.
* KMimeType::findByUrl can determine extension a lot faster, but
* less reliably for remote files. Only when findByUrl() returns
* unknown (application/octet-stream) then this one should be
* used.
*
* @param url The URL whose mimetype we are interested in.
* @param window main window associated with this job. This is used to
* automatically cache and discard authentication information
* as needed. If NULL, authentication information will be
* cached only for a short duration after which the user will
* again be prompted for passwords as needed.
* @return The mimetype name.
*/
static QString mimetype( const KUrl & url, QWidget* window );
/**
* Returns the error string for the last job, in case it failed.
* Note that this is already translated.
* @return the last error string, or QString()
*/
static QString lastErrorString();
/**
* Returns the error code for the last job, in case it failed.
* @return the last error code
*/
static int lastError();
Q_SIGNALS:
void leaveModality();
private:
/**
* Private constructor
*/
NetAccess();
/**
* Private destructor
*/
~NetAccess();
/**
* Internal methods
*/
bool filecopyInternal(const KUrl& src, const KUrl& target, int permissions,
KIO::JobFlags flags, QWidget* window, bool move);
bool dircopyInternal(const KUrl::List& src, const KUrl& target,
QWidget* window, bool move);
bool statInternal(const KUrl & url, int details, StatSide side, QWidget* window = 0);
bool delInternal(const KUrl & url, QWidget* window = 0);
bool mkdirInternal(const KUrl & url, int permissions, QWidget* window = 0);
QString fish_executeInternal(const KUrl & url, const QString &command, QWidget* window = 0);
bool synchronousRunInternal( Job* job, QWidget* window, QByteArray* data,
KUrl* finalURL, QMap<QString,QString>* metaData );
QString mimetypeInternal(const KUrl & url, QWidget* window = 0);
void enter_loop();
friend class I_like_this_class;
private Q_SLOTS:
void slotResult( KJob * job );
void slotMimetype( KIO::Job * job, const QString & type );
void slotData( KIO::Job*, const QByteArray& );
void slotRedirection( KIO::Job*, const KUrl& );
private:
NetAccessPrivate * const d;
};
}
#endif
diff --git a/kio/kio/passworddialog.h b/kio/kio/passworddialog.h
index fb5c6b9f1d..f9d7edda2b 100644
--- a/kio/kio/passworddialog.h
+++ b/kio/kio/passworddialog.h
@@ -1,88 +1,88 @@
/* This file is part of the KDE libraries
Copyright (C) 2000 David Faure <faure@kde.org>
Copyright (C) 2000 Dawit Alemayehu <adawit@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; see the file COPYING.LIB. If
not, write to the Free Software Foundation, Inc., 51 Franklin Street,
Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef kio_pass_word_dialog_h
#define kio_pass_word_dialog_h
#include <kio/kio_export.h>
#include <kpassworddialog.h>
namespace KIO {
/**
* @deprecated use KPasswordDialog
* A dialog for requesting a login and a password from the end user.
*
* KIO-Slave authors are encouraged to use SlaveBase::openPassDlg
* instead of directly instantiating this dialog.
* @short dialog for requesting login and password from the end user
*/
-class KIO_EXPORT_DEPRECATED PasswordDialog : public KPasswordDialog
+class KIO_DEPRECATED_EXPORT PasswordDialog : public KPasswordDialog
{
Q_OBJECT
public:
/**
* Create a password dialog.
*
* @param prompt instructional text to be shown.
* @param user username, if known initially.
* @param enableKeep if true, shows checkbox that makes password persistent until KDE is shutdown.
* @param modal if true, the dialog will be modal (default:true).
* @param parent the parent widget (default:NULL).
*/
PasswordDialog( const QString& prompt, const QString& user,
bool enableKeep = false, bool modal=true,
QWidget* parent=0 );
/**
* Destructor
*/
~PasswordDialog();
/**
* A convienence static method for obtaining authorization
* information from the end user.
*
*
* @param user username
* @param pass password
* @param keep pointer to flag that indicates whether to keep password (can be null)
* @param prompt text to display to user.
* @param readOnly make the username field read-only.
* @param caption set the title bar to given text.
* @param comment extra comment to display to user.
* @param label optinal label for extra comment.
*
* @return Accepted/Rejected based on the user choice.
*/
static int getNameAndPassword( QString& user, QString& pass, bool* keep,
const QString& prompt = QString(),
bool readOnly = false,
const QString& caption = QString(),
const QString& comment = QString(),
const QString& label = QString() );
};
}
#endif
diff --git a/kio/kio/paste.h b/kio/kio/paste.h
index cc265f9abd..171709d436 100644
--- a/kio/kio/paste.h
+++ b/kio/kio/paste.h
@@ -1,126 +1,126 @@
/* This file is part of the KDE libraries
Copyright (C) 2000-2005 David Faure <faure@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KIO_PASTE_H
#define KIO_PASTE_H
#include <kio/kio_export.h>
#include <QtCore/QString>
#include <kurl.h>
class QWidget;
class QMimeSource;
namespace KIO {
class Job;
class CopyJob;
/**
* Pastes the content of the clipboard to the given destination URL.
* URLs are treated separately (performing a file copy)
* from other data (which is saved into a file after asking the user
* to choose a filename and the preferred data format)
*
* @param destURL the URL to receive the data
* @param widget parent widget to use for dialogs
* @param move true to move the data, false to copy -- now ignored and handled automatically
* @return the job that handles the operation
* @see pasteData()
*/
KIO_EXPORT Job *pasteClipboard( const KUrl& destURL, QWidget* widget, bool move = false );
/**
* Pastes the given @p data to the given destination URL.
* NOTE: This method is blocking (uses NetAccess for saving the data).
* Please consider using pasteDataAsync instead.
*
* @param destURL the URL of the directory where the data will be pasted.
* The filename to use in that directory is prompted by this method.
* @param data the data to copy
* @param widget parent widget to use for dialogs
* @see pasteClipboard()
*
* This method is a candidate for disappearing in KDE5, email faure at kde.org if you
* are using it in your application, then I'll reconsider.
*/
KIO_EXPORT void pasteData( const KUrl& destURL, const QByteArray& data, QWidget* widget );
/**
* Pastes the given @p data to the given destination URL.
* Note that this method requires the caller to have chosen the QByteArray
* to paste before hand, unlike pasteClipboard and pasteMimeSource.
*
* @param destURL the URL of the directory where the data will be pasted.
* The filename to use in that directory is prompted by this method.
* @param data the data to copy
* @param dialogText the text to show in the dialog
* @see pasteClipboard()
*
* This method is a candidate for disappearing in KDE5, email faure at kde.org if you
* are using it in your application, then I'll reconsider.
*/
KIO_EXPORT CopyJob *pasteDataAsync( const KUrl& destURL, const QByteArray& data, QWidget *widget, const QString& dialogText = QString() );
/**
* Save the given mime @p data to the given destination URL
* after offering the user to choose a data format.
* This is the method used when handling drops (of anything else than URLs)
* onto dolphin and konqueror.
*
* @param data the QMimeData, usually from a QDropEvent
* @param destUrl the URL of the directory where the data will be pasted.
* The filename to use in that directory is prompted by this method.
* @param dialogText the text to show in the dialog
* @param widget parent widget to use for dialogs
* @param clipboard whether the QMimeData comes from QClipboard. If you
* use pasteClipboard for that case, you never have to worry about this parameter.
*
* @see pasteClipboard()
*/
KIO_EXPORT Job* pasteMimeData(const QMimeData* data, const KUrl& destUrl,
const QString& dialogText, QWidget* widget);
/**
* @deprecated because it returns a CopyJob*, and this is better implemented
* without a copy job. Use pasteMimeData instead.
* Note that you'll have to tell the user in case of an error (no data to paste),
* while pasteMimeSource did that.
*/
- KIO_EXPORT_DEPRECATED CopyJob* pasteMimeSource( const QMimeData* data, const KUrl& destURL,
+ KIO_DEPRECATED_EXPORT CopyJob* pasteMimeSource( const QMimeData* data, const KUrl& destURL,
const QString& dialogText, QWidget* widget,
bool clipboard = false );
/**
* Returns true if pasteMimeSource finds any interesting format in @p data.
* You can use this method to enable/disable the paste action appropriately.
* @since 4.3
*/
KIO_EXPORT bool canPasteMimeSource(const QMimeData* data);
/**
* Returns the text to use for the Paste action, when the application supports
* pasting files, urls, and clipboard data, using pasteClipboard().
* @return a string suitable for KAction::setText, or an empty string if pasting
* isn't possible right now.
*/
KIO_EXPORT QString pasteActionText();
}
#endif
diff --git a/kio/kio/predicateproperties.h b/kio/kio/predicateproperties.h
index eec0958382..7d935507d0 100644
--- a/kio/kio/predicateproperties.h
+++ b/kio/kio/predicateproperties.h
@@ -1,106 +1,106 @@
/* This file is part of the KDE libraries
Copyright (c) 2007 Jos van den Oever <jos@vandenoever.info>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License (LGPL) as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef PREDICATEPROPERTIES_H
#define PREDICATEPROPERTIES_H
#include <kio/kio_export.h>
#include <QtCore/QSharedData>
#include <QtCore/QVariant>
class QValidator;
/**
* A predicate is part of the RDF trinity: subject, predicate, object.
* It is identified by URI and it defines the type of the relationship.
* For file metadata, a predicate can be seen as a fieldname.
* It has a data type, a description, a short id, a cardinality
*
* @deprecated use Nepomuk::Types::Property instead
**/
class KIO_EXPORT PredicateProperties {
friend class PredicatePropertyProvider;
public:
#ifndef KDE_NO_DEPRECATED
- KDE_DEPRECATED PredicateProperties(const QString& predicate = QString());
+ KIO_DEPRECATED PredicateProperties(const QString& predicate = QString());
#endif
PredicateProperties(const PredicateProperties& p);
~PredicateProperties();
const PredicateProperties& operator=(const PredicateProperties& p);
/**
* This enum is used to specify some attributes that an item can have,
* which fit neither in the Hint nor in the Unit enum.
*/
enum Attributes
{
Addable = 1, ///< The item or group can be added by a user
Removable = 2, ///< It can be removed
Modifiable = 4, ///< The value can be edited (no meaning for a group)
Cumulative = 8, /**< If an application wants to display information
for more than one file, it may add up the values
for this item (e.g. play time of an mp3 file) */
Averaged = 16, /**< Similar to Cumulative, but the average should
be calculated instead of the sum */
MultiLine = 32, /**< This attribute says that a string item is likely
to be more than one line long, so for editing, a
widget capable for multline text should be used
*/
SqueezeText = 64 /**< If the text for this item is very long, it
should be squeezed to the size of the widget
where it's displayed
*/
};
/**
* Get the attributes of this group (see Attributes)
*
* @return the attributes
*/
uint attributes() const;
/**
* Key associated with this value.
**/
const QString& key() const;
/**
* The type for this field.
**/
QVariant::Type type() const;
/**
* Localized name of the predicate.
**/
const QString& name() const;
/**
* Localized description of the predicate.
**/
const QString& description() const;
QValidator* createValidator() const;
const QStringList& suggestedValues() const;
uint minCardinality() const;
uint maxCardinality() const;
const PredicateProperties& parent() const;
/**
* Return a url that identifies the unit in which this property
* is expressed.
**/
const QString& unit() const;
bool isValid() const;
private:
class Private;
QSharedDataPointer<Private> d;
};
#endif
diff --git a/kio/kio/previewjob.h b/kio/kio/previewjob.h
index 0b2c5eef54..1c1cef690a 100644
--- a/kio/kio/previewjob.h
+++ b/kio/kio/previewjob.h
@@ -1,302 +1,302 @@
// -*- c++ -*-
// vim: ts=4 sw=4 et
/* This file is part of the KDE libraries
Copyright (C) 2000 David Faure <faure@kde.org>
2000 Carsten Pfeiffer <pfeiffer@kde.org>
2001 Malte Starostik <malte.starostik@t-online.de>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KIO_PREVIEWJOB_H
#define KIO_PREVIEWJOB_H
#include <kfileitem.h>
#include <kio/job.h>
class QPixmap;
namespace KIO {
class PreviewJobPrivate;
/*!
* This class catches a preview (thumbnail) for files.
* @short KIO Job to get a thumbnail picture
*/
class KIO_EXPORT PreviewJob : public KIO::Job
{
Q_OBJECT
public:
/**
* Specifies the type of scaling that is applied to the generated preview.
* @since 4.7
*/
enum ScaleType {
/**
* The original size of the preview will be returned. Most previews
* will return a size of 256 x 256 pixels.
*/
Unscaled,
/**
* The preview will be scaled to the size specified when constructing
* the PreviewJob. The aspect ratio will be kept.
*/
Scaled,
/**
* The preview will be scaled to the size specified when constructing
* the PreviewJob. The result will be cached for later use. Per default
* ScaledAndCached is set.
*/
ScaledAndCached
};
#ifndef KDE_NO_DEPRECATED
/**
* Creates a new PreviewJob.
* @param items a list of files to create previews for
* @param width the desired width
* @param height the desired height, 0 to use the @p width
* @param iconSize the size of the mimetype icon to overlay over the
* preview or zero to not overlay an icon. This has no effect if the
* preview plugin that will be used doesn't use icon overlays.
* @param iconAlpha transparency to use for the icon overlay
* @param scale if the image is to be scaled to the requested size or
* returned in its original size
* @param save if the image should be cached for later use
* @param enabledPlugins If non-zero, this points to a list containing
* the names of the plugins that may be used. If enabledPlugins is zero
* all available plugins are used.
*
* @deprecated Use PreviewJob(KFileItemList, QSize, QStringList) in combination
* with the setter-methods instead. Note that the semantics of
* \p enabledPlugins has been slightly changed.
*/
- KDE_DEPRECATED PreviewJob(const KFileItemList& items, int width, int height,
+ KIO_DEPRECATED PreviewJob(const KFileItemList& items, int width, int height,
int iconSize, int iconAlpha, bool scale, bool save,
const QStringList *enabledPlugins);
#endif
/**
* @param items List of files to create previews for.
* @param size Desired size of the preview.
* @param enabledPlugins If non-zero it defines the list of plugins that
* are considered for generating the preview. If
* enabledPlugins is zero the plugins specified in the
* KConfigGroup "PreviewSettings" are used.
* @since 4.7
*/
PreviewJob(const KFileItemList &items,
const QSize &size,
const QStringList *enabledPlugins = 0);
virtual ~PreviewJob();
/**
* Sets the size of the MIME-type icon which overlays the preview. If zero
* is passed no overlay will be shown at all. The setting has no effect if
* the preview plugin that will be used does not use icon overlays. Per
* default the size is set to 0.
* @since 4.7
*/
void setOverlayIconSize(int size);
/**
* @return The size of the MIME-type icon which overlays the preview.
* @see PreviewJob::setOverlayIconSize()
* @since 4.7
*/
int overlayIconSize() const;
/**
* Sets the alpha-value for the MIME-type icon which overlays the preview.
* The alpha-value may range from 0 (= fully transparent) to 255 (= opaque).
* Per default the value is set to 70.
* @see PreviewJob::setOverlayIconSize()
* @since 4.7
*/
void setOverlayIconAlpha(int alpha);
/**
* @return The alpha-value for the MIME-type icon which overlays the preview.
* Per default 70 is returned.
* @see PreviewJob::setOverlayIconAlpha()
* @since 4.7
*/
int overlayIconAlpha() const;
/**
* Sets the scale type for the generated preview. Per default
* PreviewJob::ScaledAndCached is set.
* @see PreviewJob::ScaleType
* @since 4.7
*/
void setScaleType(ScaleType type);
/**
* @return The scale type for the generated preview.
* @see PreviewJob::ScaleType
* @since 4.7
*/
ScaleType scaleType() const;
/**
* Removes an item from preview processing. Use this if you passed
* an item to filePreview and want to delete it now.
*
* @param url the url of the item that should be removed from the preview queue
*/
void removeItem( const KUrl& url );
/**
* If @p ignoreSize is true, then the preview is always
* generated regardless of the settings
**/
void setIgnoreMaximumSize(bool ignoreSize = true);
/**
* Sets the sequence index given to the thumb creators.
* Use the sequence index, it is possible to create alternative
* icons for the same item. For example it may allow iterating through
* the items of a directory, or the frames of a video.
*
* @since KDE 4.3
**/
void setSequenceIndex(int index);
/**
* Returns the currently set sequence index
*
* @since KDE 4.3
**/
int sequenceIndex() const;
/**
* Returns a list of all available preview plugins. The list
* contains the basenames of the plugins' .desktop files (no path,
* no .desktop).
* @return the list of plugins
*/
static QStringList availablePlugins();
/**
* Returns a list of all supported MIME types. The list can
* contain entries like text/ * (without the space).
* @return the list of mime types
*/
static QStringList supportedMimeTypes();
/**
* Returns the default "maximum file size", in bytes, used by PreviewJob.
* This is useful for applications providing a GUI for letting the user change the size.
* @since 4.1
* @deprecated PreviewJob uses different maximum file sizes dependent on the URL since 4.5.
* The returned file size is only valid for local URLs.
*/
#ifndef KDE_NO_DEPRECATED
- KDE_DEPRECATED static KIO::filesize_t maximumFileSize();
+ KIO_DEPRECATED static KIO::filesize_t maximumFileSize();
#endif
Q_SIGNALS:
/**
* Emitted when a thumbnail picture for @p item has been successfully
* retrieved.
* @param item the file of the preview
* @param preview the preview image
*/
void gotPreview( const KFileItem& item, const QPixmap &preview );
/**
* Emitted when a thumbnail for @p item could not be created,
* either because a ThumbCreator for its MIME type does not
* exist, or because something went wrong.
* @param item the file that failed
*/
void failed( const KFileItem& item );
protected Q_SLOTS:
virtual void slotResult( KJob *job );
private:
Q_PRIVATE_SLOT(d_func(), void startPreview())
Q_PRIVATE_SLOT(d_func(), void slotThumbData(KIO::Job *, const QByteArray &))
Q_DECLARE_PRIVATE(PreviewJob)
};
#ifndef KDE_NO_DEPRECATED
/**
* Creates a PreviewJob to generate or retrieve a preview image
* for the given URL.
*
* @param items files to get previews for
* @param width the maximum width to use
* @param height the maximum height to use, if this is 0, the same
* value as width is used.
* @param iconSize the size of the mimetype icon to overlay over the
* preview or zero to not overlay an icon. This has no effect if the
* preview plugin that will be used doesn't use icon overlays.
* @param iconAlpha transparency to use for the icon overlay
* @param scale if the image is to be scaled to the requested size or
* returned in its original size
* @param save if the image should be cached for later use
* @param enabledPlugins if non-zero, this points to a list containing
* the names of the plugins that may be used.
* @return the new PreviewJob
* @see PreviewJob::availablePlugins()
* @deprecated Use KIO::filePreview(KFileItemList, QSize, QStringList) in combination
* with the setter-methods instead. Note that the semantics of
* \p enabledPlugins has been slightly changed.
*/
- KIO_EXPORT_DEPRECATED PreviewJob *filePreview( const KFileItemList &items, int width, int height = 0, int iconSize = 0, int iconAlpha = 70, bool scale = true, bool save = true, const QStringList *enabledPlugins = 0 ); // KDE5: use enums instead of bool scale + bool save
+ KIO_DEPRECATED_EXPORT PreviewJob *filePreview( const KFileItemList &items, int width, int height = 0, int iconSize = 0, int iconAlpha = 70, bool scale = true, bool save = true, const QStringList *enabledPlugins = 0 ); // KDE5: use enums instead of bool scale + bool save
/**
* Creates a PreviewJob to generate or retrieve a preview image
* for the given URL.
*
* @param items files to get previews for
* @param width the maximum width to use
* @param height the maximum height to use, if this is 0, the same
* value as width is used.
* @param iconSize the size of the mimetype icon to overlay over the
* preview or zero to not overlay an icon. This has no effect if the
* preview plugin that will be used doesn't use icon overlays.
* @param iconAlpha transparency to use for the icon overlay
* @param scale if the image is to be scaled to the requested size or
* returned in its original size
* @param save if the image should be cached for later use
* @param enabledPlugins if non-zero, this points to a list containing
* the names of the plugins that may be used.
* @return the new PreviewJob
* @see PreviewJob::availablePlugins()
* @deprecated Use KIO::filePreview(KFileItemList, QSize, QStringList) in combination
* with the setter-methods instead. Note that the semantics of
* \p enabledPlugins has been slightly changed.
*/
- KIO_EXPORT_DEPRECATED PreviewJob *filePreview( const KUrl::List &items, int width, int height = 0, int iconSize = 0, int iconAlpha = 70, bool scale = true, bool save = true, const QStringList *enabledPlugins = 0 );
+ KIO_DEPRECATED_EXPORT PreviewJob *filePreview( const KUrl::List &items, int width, int height = 0, int iconSize = 0, int iconAlpha = 70, bool scale = true, bool save = true, const QStringList *enabledPlugins = 0 );
#endif
/**
* Creates a PreviewJob to generate a preview image for the given items.
* @param items List of files to create previews for.
* @param size Desired size of the preview.
* @param enabledPlugins If non-zero it defines the list of plugins that
* are considered for generating the preview. If
* enabledPlugins is zero the plugins specified in the
* KConfigGroup "PreviewSettings" are used.
* @since 4.7
*/
KIO_EXPORT PreviewJob *filePreview(const KFileItemList &items, const QSize &size, const QStringList *enabledPlugins = 0);
}
#endif
diff --git a/kio/kio/scheduler.h b/kio/kio/scheduler.h
index a677a926d6..4466759076 100644
--- a/kio/kio/scheduler.h
+++ b/kio/kio/scheduler.h
@@ -1,316 +1,316 @@
// -*- c++ -*-
/* This file is part of the KDE libraries
Copyright (C) 2000 Stephan Kulow <coolo@kde.org>
Waldo Bastian <bastian@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef _kio_scheduler_h
#define _kio_scheduler_h
#include "kio/job.h"
#include "kio/jobclasses.h"
#include <QtCore/QTimer>
#include <QtCore/QMap>
#include <QWidgetList>
#include <sys/types.h> // pid_t
namespace KIO {
class Slave;
class SlaveConfig;
class SchedulerPrivate;
/**
* The KIO::Scheduler manages io-slaves for the application.
* It also queues jobs and assigns the job to a slave when one
* becomes available.
*
* There are 3 possible ways for a job to get a slave:
*
* <h3>1. Direct</h3>
* This is the default. When you create a job the
* KIO::Scheduler will be notified and will find either an existing
* slave that is idle or it will create a new slave for the job.
*
* Example:
* \code
* TransferJob *job = KIO::get(KUrl("http://www.kde.org"));
* \endcode
*
*
* <h3>2. Scheduled</h3>
* If you create a lot of jobs, you might want not want to have a
* slave for each job. If you schedule a job, a maximum number
* of slaves will be created. When more jobs arrive, they will be
* queued. When a slave is finished with a job, it will be assigned
* a job from the queue.
*
* Example:
* \code
* TransferJob *job = KIO::get(KUrl("http://www.kde.org"));
* KIO::Scheduler::setJobPriority(job, 1);
* \endcode
*
* <h3>3. Connection Oriented</h3>
* For some operations it is important that multiple jobs use
* the same connection. This can only be ensured if all these jobs
* use the same slave.
*
* You can ask the scheduler to open a slave for connection oriented
* operations. You can then use the scheduler to assign jobs to this
* slave. The jobs will be queued and the slave will handle these jobs
* one after the other.
*
* Example:
* \code
* Slave *slave = KIO::Scheduler::getConnectedSlave(
* KUrl("pop3://bastian:password@mail.kde.org"));
* TransferJob *job1 = KIO::get(
* KUrl("pop3://bastian:password@mail.kde.org/msg1"));
* KIO::Scheduler::assignJobToSlave(slave, job1);
* TransferJob *job2 = KIO::get(
* KUrl("pop3://bastian:password@mail.kde.org/msg2"));
* KIO::Scheduler::assignJobToSlave(slave, job2);
* TransferJob *job3 = KIO::get(
* KUrl("pop3://bastian:password@mail.kde.org/msg3"));
* KIO::Scheduler::assignJobToSlave(slave, job3);
*
* // ... Wait for jobs to finish...
*
* KIO::Scheduler::disconnectSlave(slave);
* \endcode
*
* Note that you need to explicitly disconnect the slave when the
* connection goes down, so your error handler should contain:
* \code
* if (error == KIO::ERR_CONNECTION_BROKEN)
* KIO::Scheduler::disconnectSlave(slave);
* \endcode
*
* @see KIO::Slave
* @see KIO::Job
**/
class KIO_EXPORT Scheduler : public QObject
{
Q_OBJECT
Q_CLASSINFO("D-Bus Interface", "org.kde.KIO.Scheduler")
public:
/**
* Register @p job with the scheduler.
* The default is to create a new slave for the job if no slave
* is available. This can be changed by calling setJobPriority.
* @param job the job to register
*/
static void doJob(SimpleJob *job);
/**
* Schedules @p job scheduled for later execution.
* This method is deprecated and just sets the job's priority to 1. It is
* recommended to replace calls to scheduleJob(job) with setJobPriority(job, 1).
* @param job the job to schedule
*/
#ifndef KDE_NO_DEPRECATED
- KDE_DEPRECATED static void scheduleJob(SimpleJob *job);
+ KIO_DEPRECATED static void scheduleJob(SimpleJob *job);
#endif
/**
* Changes the priority of @p job; jobs of the same priority run in the order in which
* they were created. Jobs of lower numeric priority always run before any
* waiting jobs of higher numeric priority. The range of priority is -10 to 10,
* the default priority of jobs is 0.
* @param job the job to change
* @param priority new priority of @p job, lower runs earlier
*/
static void setJobPriority(SimpleJob *job, int priority);
/**
* Stop the execution of a job.
* @param job the job to cancel
*/
static void cancelJob(SimpleJob *job);
/**
* Called when a job is done.
* @param job the finished job
* @param slave the slave that executed the @p job
*/
static void jobFinished(KIO::SimpleJob *job, KIO::Slave *slave);
/**
* Puts a slave on notice. A next job may reuse this slave if it
* requests the same URL.
*
* A job can be put on hold after it has emit'ed its mimetype.
* Based on the mimetype, the program can give control to another
* component in the same process which can then resume the job
* by simply asking for the same URL again.
* @param job the job that should be stopped
* @param url the URL that is handled by the @p url
*/
static void putSlaveOnHold(KIO::SimpleJob *job, const KUrl &url);
/**
* Removes any slave that might have been put on hold. If a slave
* was put on hold it will be killed.
*/
static void removeSlaveOnHold();
/**
* Send the slave that was put on hold back to KLauncher. This
* allows another process to take over the slave and resume the job
* that was started.
*/
static void publishSlaveOnHold();
/**
* Requests a slave for use in connection-oriented mode.
*
* @param url This defines the username,password,host & port to
* connect with.
* @param config Configuration data for the slave.
*
* @return A pointer to a connected slave or 0 if an error occurred.
* @see assignJobToSlave()
* @see disconnectSlave()
*/
static KIO::Slave *getConnectedSlave(const KUrl &url,
const KIO::MetaData &config = MetaData() );
/**
* Uses @p slave to do @p job.
* This function should be called immediately after creating a Job.
*
* @param slave The slave to use. The slave must have been obtained
* with a call to getConnectedSlave and must not
* be currently assigned to any other job.
* @param job The job to do.
*
* @return true is successful, false otherwise.
*
* @see getConnectedSlave()
* @see disconnectSlave()
* @see slaveConnected()
* @see slaveError()
*/
static bool assignJobToSlave(KIO::Slave *slave, KIO::SimpleJob *job);
/**
* Disconnects @p slave.
*
* @param slave The slave to disconnect. The slave must have been
* obtained with a call to getConnectedSlave
* and must not be assigned to any job.
*
* @return true is successful, false otherwise.
*
* @see getConnectedSlave
* @see assignJobToSlave
*/
static bool disconnectSlave(KIO::Slave *slave);
/**
* Register the mainwindow @p wid with the KIO subsystem
* Do not call this, it is called automatically from
* void KIO::Job::setWindow(QWidget*).
* @param wid the window to register
*/
static void registerWindow(QWidget *wid);
/**
* @internal
* Unregisters the window registered by registerWindow().
*/
static void unregisterWindow(QObject *wid);
/**
* Function to connect signals emitted by the scheduler.
*
* @see slaveConnected()
* @see slaveError()
*/
// KDE5: those methods should probably be removed, ugly and only marginally useful
static bool connect( const char *signal, const QObject *receiver,
const char *member);
static bool connect( const QObject* sender, const char* signal,
const QObject* receiver, const char* member );
static bool disconnect( const QObject* sender, const char* signal,
const QObject* receiver, const char* member );
bool connect( const QObject *sender, const char *signal,
const char *member );
/**
* When true, the next job will check whether KLauncher has a slave
* on hold that is suitable for the job.
* @param b true when KLauncher has a job on hold
*/
static void checkSlaveOnHold(bool b);
static void emitReparseSlaveConfiguration();
/**
* Returns true if there is a slave on hold for @p url.
*
* @since 4.7
*/
static bool isSlaveOnHoldFor(const KUrl& url);
/**
* Updates the internal metadata from job.
*
* @since 4.6.5
*/
static void updateInternalMetaData(SimpleJob* job);
Q_SIGNALS:
void slaveConnected(KIO::Slave *slave);
void slaveError(KIO::Slave *slave, int error, const QString &errorMsg);
// DBUS
Q_SCRIPTABLE void reparseSlaveConfiguration(const QString &);
Q_SCRIPTABLE void slaveOnHoldListChanged();
private:
Q_DISABLE_COPY(Scheduler)
Scheduler();
~Scheduler();
static Scheduler *self();
Q_PRIVATE_SLOT(d_func(), void slotSlaveDied(KIO::Slave *slave))
Q_PRIVATE_SLOT(d_func(), void slotSlaveStatus(pid_t pid, const QByteArray &protocol,
const QString &host, bool connected))
// connected to D-Bus signal:
Q_PRIVATE_SLOT(d_func(), void slotReparseSlaveConfiguration(const QString &, const QDBusMessage&))
Q_PRIVATE_SLOT(d_func(), void slotSlaveOnHoldListChanged())
Q_PRIVATE_SLOT(d_func(), void slotSlaveConnected())
Q_PRIVATE_SLOT(d_func(), void slotSlaveError(int error, const QString &errorMsg))
Q_PRIVATE_SLOT(d_func(), void slotUnregisterWindow(QObject *))
private:
friend class SchedulerPrivate;
SchedulerPrivate *const removeMe; // for BC only, KDE5: remove
SchedulerPrivate *d_func();
};
}
#endif
diff --git a/kio/kio/thumbcreator.cpp b/kio/kio/thumbcreator.cpp
index a1b2640d3e..7d3c52bb0f 100644
--- a/kio/kio/thumbcreator.cpp
+++ b/kio/kio/thumbcreator.cpp
@@ -1,43 +1,45 @@
/* This file is part of the KDE project
Copyright (C) 2009 Patrick Spendrin <ps_ml@gmx.de>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#include "thumbcreator.h"
+#include <qglobal.h>
+
ThumbCreator::~ThumbCreator()
{
}
ThumbCreator::Flags ThumbCreator::flags() const
{
return None;
}
ThumbCreatorV2::~ThumbCreatorV2()
{
}
QWidget *ThumbCreatorV2::createConfigurationWidget()
{
return 0;
}
void ThumbCreatorV2::writeConfiguration(const QWidget *configurationWidget)
{
Q_UNUSED(configurationWidget);
}
diff --git a/kio/kio/thumbsequencecreator.h b/kio/kio/thumbsequencecreator.h
index 12de941c1d..3d0280a85b 100644
--- a/kio/kio/thumbsequencecreator.h
+++ b/kio/kio/thumbsequencecreator.h
@@ -1,78 +1,81 @@
/* This file is part of the KDE libraries
Copyright (C) 2009 David Nolden <david.nolden.kdevelop@art-master.de>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef _THUMBSEQUENCECREATOR_H_
#define _THUMBSEQUENCECREATOR_H_
#include "thumbcreator.h"
+#include <qglobal.h>
+
+
/**
* @see ThumbCreator
*
* This is an extension of ThumbCreator that allows creating a thumbnail sequence for
* a file. If your thumbnail plugin can create a thumbnail sequence, you should base it
* on ThumbSequenceCreator instead of ThumbCreator, and should use sequenceIndex()
* to decide what thumbnail you generate.
- *
+ *
* You also need to set the following key in the thumbcreator .desktop file
* \code
* HandleSequences=true;
* \endcode
*
* @since 4.3
*/
class KIO_EXPORT ThumbSequenceCreator : public ThumbCreator
{
public:
Q_DISABLE_COPY(ThumbSequenceCreator)
ThumbSequenceCreator();
virtual ~ThumbSequenceCreator();
/**
* If this thumb-creator can create a sequence of thumbnails,
* it should use this to decide what sequence item to use.
- *
+ *
* If the value is zero, the standard thumbnail should be created.
*
* This can be used for example to create thumbnails for different
* timeframes in videos(For example 0m, 10m, 20m, ...).
*
* If your thumb-creator supports a high granularity, like a video,
* you can respect the sub-integer precision coming from the float.
* Else, just round the index to an integer.
*
* If the end of your sequence is reached, the sequence should start
* from the beginning, or continue in some other way.
*/
float sequenceIndex() const;
/**
* Sets the sequence-index for this thumb creator.
* @see sequenceIndex
*/
void setSequenceIndex(float index);
private:
class Private;
Private* d;
};
typedef ThumbCreator *(*newCreator)();
#endif
diff --git a/kio/kssl/ksslcertdialog.h b/kio/kssl/ksslcertdialog.h
index 6de2b58909..2742cd2dcd 100644
--- a/kio/kssl/ksslcertdialog.h
+++ b/kio/kssl/ksslcertdialog.h
@@ -1,144 +1,144 @@
/* This file is part of the KDE project
*
* Copyright (C) 2001-2003 George Staikos <staikos@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _KSSLCERTDIALOG_H
#define _KSSLCERTDIALOG_H
#include <kio/kio_export.h>
#include <QtCore/QStringList>
#include <kdialog.h>
class QWidget;
class QCheckBox;
class QRadioButton;
class QListWidget;
class QPushButton;
/**
* KDE X.509 Certificate Dialog
*
* This class is used to create and display a dialog which contains the user's
* X.509 certificates and allows the user to present it during SSL sessions.
*
* @author George Staikos <staikos@kde.org>
* @see KSSL
* @short KDE X.509 Certificate Dialog
*/
class KIO_EXPORT KSSLCertDialog : public KDialog {
Q_OBJECT
public:
/**
* Construct a KSSL certificate dialog
*
* @param parent the parent widget
* @param name the internal name of this instance
* @param modal create a modal dialog if set to true
*/
explicit KSSLCertDialog(QWidget *parent=0L, const char *name=0L,
bool modal=false);
/**
* Destroy this object and close the dialog
*/
virtual ~KSSLCertDialog();
/**
* Setup the dialog. Call this before you display the dialog.
*
* @param certs the list of possible certificates
* @param saveChecked save the checked item for the future
* @param sendChecked send the checked item to the remote host
* @deprecated
*/
#ifndef KDE_NO_DEPRECATED
- KDE_DEPRECATED void setup(QStringList certs, bool saveChecked = false, bool sendChecked = true);
+ KIO_DEPRECATED void setup(QStringList certs, bool saveChecked = false, bool sendChecked = true);
#endif
/**
* Setup the dialog. Call this before you display the dialog.
*
* @param certs the list of possible certificates
* @param saveChecked save the checked item for the future
* @param sendChecked send the checked item to the remote host
*/
void setupDialog(const QStringList& certs, bool saveChecked = false, bool sendChecked = true);
/**
* Obtain the name of the certificate the user wants to send
*
* @return the name of the certificate
*/
QString getChoice();
/**
* Determine if the user wants to send a certificate.
*
* @return true if the user wants to send a certificate
*/
bool wantsToSend();
/**
* Determine if the user wants to save the choice for the future.
*
* @return true if the user wants to save the choice.
*/
bool saveChoice();
/**
* Set the hostname that we are connecting to.
*
* @param host the hostname
*/
void setHost(const QString& host);
private Q_SLOTS:
void slotSend();
void slotDont();
private:
class KSSLCertDialogPrivate;
KSSLCertDialogPrivate* const d;
QCheckBox *_save;
QRadioButton *_send, *_dont;
QListWidget *_certs;
QPushButton *_ok;
QString _host;
};
/**
* This class is used in the internal DCOP communication between TPCSlaveBase and kuiserver.
* Don't use it directly.
* \internal
*/
class KIO_EXPORT KSSLCertDialogRet {
public:
QString choice;
bool ok;
bool send;
bool save;
};
KIO_EXPORT QDataStream& operator<<(QDataStream& s, const KSSLCertDialogRet& r);
KIO_EXPORT QDataStream& operator>>(QDataStream& s, KSSLCertDialogRet& r);
#endif

File Metadata

Mime Type
text/x-diff
Expires
Fri, Nov 1, 9:06 AM (1 d, 12 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
10075530
Default Alt Text
(365 KB)

Event Timeline