From: Emmanuel Pescosta Date: Thu, 10 Jul 2014 20:49:05 +0000 (+0200) Subject: Merge branch 'master' into frameworks X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/commitdiff_plain/fc4315d57e8fe64d05aad2a1c24800f0149b21da?hp=1dfafcb176797e5075d0043e70ad07bde8bcc372 Merge branch 'master' into frameworks Conflicts: dolphin/src/dolphinmainwindow.cpp dolphin/src/dolphinviewcontainer.cpp --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 4b43d67e3..859a65d20 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,2 +1,63 @@ +cmake_minimum_required(VERSION 2.8.12) + +project(Dolphin) + +# ECM setup +find_package(ECM 0.0.14 CONFIG REQUIRED) +set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH}) + +set(DOLPHIN_VERSION "4.97.0") + +include(ECMSetupVersion) +include(GenerateExportHeader) +include(FeatureSummary) +include(KDEInstallDirs) +include(KDECMakeSettings) +include(KDEFrameworkCompilerSettings) + +ecm_setup_version(${DOLPHIN_VERSION} VARIABLE_PREFIX DOLPHINPRIVATE + SOVERSION 5 +) + +find_package(KF5 REQUIRED COMPONENTS DocTools Init KCMUtils KDELibs4Support NewStuff) +find_package(KF5 COMPONENTS Activities) + +find_package(Phonon4Qt5 CONFIG REQUIRED) + +if ("${CMAKE_SOURCE_DIR}" STREQUAL "${Dolphin_SOURCE_DIR}") + find_package(KF5Konq CONFIG REQUIRED) +else() + include_directories(${LibKonq_SOURCE_DIR}/src) +endif() + +find_package(KF5Baloo 4.97) +set_package_properties(KF5Baloo PROPERTIES DESCRIPTION "Baloo Core libraries" + URL "http://www.kde.org" + TYPE OPTIONAL + PURPOSE "For adding desktop-wide search and tagging support to dolphin" + ) + +find_package(KF5BalooWidgets 4.97) +set_package_properties(KF5BalooWidgets PROPERTIES DESCRIPTION "Baloos Widgets" + URL "http://www.kde.org" + TYPE OPTIONAL + ) + +find_package(KF5FileMetaData 4.97) +set_package_properties(KF5FileMetaData PROPERTIES + URL "https://projects.kde.org/kfilemetadata" + TYPE OPTIONAL + PURPOSE "For accessing file metadata labels" + ) + +if (KF5Baloo_FOUND AND KF5BalooWidgets_FOUND AND KF5FileMetaData_FOUND) + set(HAVE_BALOO TRUE) +endif() add_subdirectory(src) +add_subdirectory(docs) + +# TODO Remove the if/endif lines if Dolphin is split. +if ("${CMAKE_SOURCE_DIR}" STREQUAL "${Dolphin_SOURCE_DIR}") + feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES) +endif() diff --git a/docs/CMakeLists.txt b/docs/CMakeLists.txt new file mode 100644 index 000000000..57e195bce --- /dev/null +++ b/docs/CMakeLists.txt @@ -0,0 +1,2 @@ + +kdoctools_create_handbook(index.docbook INSTALL_DESTINATION ${HTML_INSTALL_DIR}/en SUBDIR dolphin) diff --git a/docs/default-ui.png b/docs/default-ui.png new file mode 100644 index 000000000..611b8bd26 Binary files /dev/null and b/docs/default-ui.png differ diff --git a/docs/grouping-view.png b/docs/grouping-view.png new file mode 100644 index 000000000..b0ac00cb9 Binary files /dev/null and b/docs/grouping-view.png differ diff --git a/docs/index.docbook b/docs/index.docbook new file mode 100644 index 000000000..5fe85f5d1 --- /dev/null +++ b/docs/index.docbook @@ -0,0 +1,2134 @@ + +Dolphin"> + + + + +]> + + + + +The &dolphin; Handbook + + + +Peter + +Penz + +
peter.penz@gmx.at
+
+
+ +Orville +Bennett + +
&Orville.Bennett.mail;
+
+
+ +Michael +Austin + +
tuxedup@users.sourceforge.net
+
+
+ +David +Edmundson + +
kde@davidedmundson.co.uk
+
+
+ +Alan +Blanchflower + + +Frank +Reininghaus + +
frank78ac@googlemail.com
+
+
+ + +
+ + +2006 +Peter Penz + + +2006 +&Orville.Bennett; +Michael Austin + + +2009 +Frank Reininghaus + + +&FDLNotice; + +2013-06-28 +2.3 (&kde; 4.11) + + + +&dolphin; is the default file manager for &kde;, designed with usability as a primary focus. + + + + +KDE +Dolphin +Filemanager +file +management + + +
+ + +Introduction + + +&dolphin; is &kde;'s default file manager. It aims to improve usability at the +user interface level. &dolphin; focuses only on being a file manager whereas +&konqueror;, which was &kde;'s default file manager in &kde; 3 and can still be +used for file management, is a universal viewer for many file types. + + + +This design approach allows the developers to concentrate on optimizing the user +interface for the specific task of file management. + + + +Please report any problems or feature requests to the &dolphin; author via the +bug report dialog. This is accessible either from the Control +button at the right of the toolbar in the default mode without +menubar; or from HelpReport Bug... +menu of the application, if the menubar is shown. + + + + + +Using &dolphin; + + +&dolphin; User Interface + + +The screenshot below shows &dolphin;'s default user interface: + + + +Screenshot of &dolphin;'s default user interface + + + + + +&dolphin;'s default user interface. + +&dolphin;'s default user interface. + + + + +The elements of the default user interface are: + + + + +The toolbar, which can be used for quick access to frequently used actions. The +toolbar can be customized by clicking it with the &RMB; and choosing +Configure Toolbars... +from the context menu, with Configure Toolbars... +from the Control button at the +right of the toolbar or via Settings +Configure Toolbars... +from the main menu. + + +Screenshot of &dolphin;'s toolbar + + + + + +The default toolbar. + + + +Toolbar items where the icon is sufficient for knowing the command do not have text +alongside the icons. This can be changed by a &RMB; click and selecting the item text +below Show Text. The Control +button at the right side of the toolbar is only displayed if the menubar is hidden. + + + + + + + +The location bar, which always displays the path to the current folder. It can +be switched between two different modes, see the +section on the location bar for details. + + + +The view, which shows all files +and folders in the current folder. + + + +The Places panel, which +provides quick access to bookmarked locations and disks or other media. + +If desktop search and file indexing are enabled in the Desktop Search +module in the &systemsettings; the panel provides Recently Accessed +items and allows you to search for Documents, Images, +Audio Files and Video. + + + +The status bar. It displays the name, size and type of the file which is +currently hovered over with the mouse, or the number and size of the files which are +selected. At the right, there is a zoom slider that allows you to adjust the size +of the icons in the view. + + + +The menubar (hidden by default), which provides access to all commands and configuration options. +See the Command Reference for a list of +all menu commands. The menubar can be toggled with +Show Menubar (&Ctrl;M) +from the Settings menu or the Control button. + +If the menubar is hidden, all its actions are available from the +Control button. + + + +The additional Information, Folders +and Terminal panels are hidden +by default, for more information see Panels. + + + + + + + + + +The &dolphin; View + + +Using the View + + +The view displays all files and folders in the current folder. These items +can be accessed or manipulated in different ways: + + + + +A file or folder can be opened by clicking it with the &LMB; (or +double-clicking, if Double-click to open files and folders +is enabled in the Navigation +section of the settings). + + + +Clicking any item or the white area around the items with the &RMB; opens a +context menu which provides access to many frequently used actions for the item +or the current folder, respectively. + + + +If the &LMB; is pressed on an item, but not immediately released, the item can +be dragged and dropped in another folder in the current view or in another +&dolphin; view (in another &dolphin; window or in the same window if the +view is split, see below) to move or copy it or to create a symbolic link. +Items can even be dropped in another application to open them in that application. + + + + +&dolphin; remembers the history of visited folders. To navigate backward or +forward in the history, the corresponding buttons in the toolbar can be used: + + + +Screenshot of &dolphin;'s toolbar + + + + + +The Back and Forward buttons in the toolbar. + + + +The Back and Forward buttons in +the toolbar can be used to navigate in the history. + + + + + + + + +&dolphin; View Appearance + + +The toolbar contains buttons to control the appearance of the view: + + + +Screenshot of &dolphin;'s toolbar + + + + + +The buttons in the toolbar which control the appearance of the view. + + +The buttons in the toolbar which control the appearance of the view. + + + + + +All the settings discussed below and other options concerning, ⪚ the +sorting of the files in the current folder, can also be modified in the +View menu and in the +View Properties dialog. By +default, these settings are remembered for each folder separately. This +behavior can be changed in the +General section of the settings. + + + +View Modes + + +The first three buttons in the above screenshot switch between &dolphin;'s +view modes. + + + + +In the Icons view, which is the default, files will be +represented by an icon that visualizes the file type, and a folder icon will be +shown for subfolders. The names of folders and files, and the items enabled in +ViewAdditional Information, +are displayed below the icons. + + + +The Compact view shows the folder contents as icons with +the name beside it and the items enabled in +ViewAdditional Information +below the name. The items are grouped in columns similar to the Short View +in the &kde; file dialog. + + + +In the Details view, the folder contents are displayed +as a detailed list which contains the name, size and last modification time of +each item. Additional columns can be added by clicking a column header with the +&RMB;. + +In the context menu of the header line you can choose between custom or automatic +column width. Automatic width adjusts the width of all columns once to display the longest +item in the column completely, except for the Name column where +the extension is replaced by ... + +The order of columns can be changed by drag and drop of column headers, except for +the Name header, which is always the first column in this view. + + +The details view allows you to view the current directory +in a tree-like fashion if +Expandable folders are enabled: +Each subfolder of the current folder can be +expanded or collapsed by clicking on the > +or v icon next to it. + + + + +Grouped View + + + + + +Grouped View + +All view modes support grouping by the sort type selected +in ViewSort by + + + + + + + +Information in the View + +In all view modes &kappname; shows at least an icon and a name for each item. +Using Additional Information in the View +menu or the context menu of the header in Details mode, you can select +more information for each item to be shown: + + + +Size, Date, +Type, Rating, +Tags or Comment. + + +Depending on the file type, additionally, sorting criteria can be selected: + + Document: Number of words and lines + Image: Size and orientation + Audio: Artist, album, duration and track + + + +The Other submenu allows you to select +Path, Link Destination, +Copied From, +Permissions, Owner or +User Group. + + + + + +Preview + + +If Preview is enabled, the icons are based on the actual +file or folder contents; ⪚ for images a scaled down preview of the image is +shown. + + + + + +Split + + +If Split is clicked, two views are shown which can +display the contents of different folders. This can be convenient for moving or +copying files. + + + + + + + +Selecting Items in the View + + +There are several ways to select items in the view. Once a group of items +is selected, all actions, such as +Cut, +Copy, +Move to Trash, +and drag and drop operations, affect all selected items. + + + +Selecting Items Using the Mouse + + + + +You can press the &LMB; somewhere in the view and draw a rectangle around +a group of items before releasing the button. This will select all items in the +rectangle and clear the previous selection. If the &Shift; key is pressed during +the selection process, the previous selection is kept. + + + +If the &Ctrl; key is pressed while an item is clicked with the &LMB;, the +selection state of this item is toggled. If the &Ctrl; key is pressed while a +rectangle is drawn around a group of items as described above, the selection +state of all items in the rectangle will be toggled. + + + +If the &Shift; key is pressed while an item is clicked with the &LMB;, all items +between the previous current item and the clicked item will be selected. + + + +If Show selection marker is enabled in the +Behavior +tab of the General section of the settings, a small ++ or - button appears in the top +left corner of the item which is currently hovered over with the mouse. Clicking +this sign selects or deselects the item, respectively. + + + + + + + +Selecting Items Using the Keyboard + + + + +If an arrow key, Page Up, Page Down, +Home, or End is pressed, the new current item +is selected, and the previous selection is cleared. + + + +If the &Ctrl; key is held while one of the above keys is pressed, the selection +remains unchanged. + + + +If the &Shift; key is held while one of the above keys is pressed, all items +between the previous current item and the new current item will be selected. + + + +If &Ctrl;Space is pressed, +the selection state of the current item is toggled. + + + +&Ctrl;A selects all items +in the view. + + + +&Ctrl;&Shift;A toggles the +selection state of all items in the view. + + + +Select a file or folder by typing the first few letters of its name and the +first matching item is selected. +To clear the selection and cancel the keyboard search press &Esc; or wait longer than +the timeout of 1 second. + + + + + + + + + + + + +Location Bar + + +The location bar, which can be found above &dolphin;'s view, displays +the path to the current folder. The location bar has two modes. + + + +Bread Crumb Mode + + +In the bread crumb mode, which is the default, each folder name in +the path to the current folder is a button which can be clicked to quickly open +that folder. Moreover, clicking the > sign to the right of a +folder opens a menu which allows you to quickly open a subfolder of that folder. + + + +Screenshot of the location bar in bread crumb mode + + + + + +Location bar in bread crumb mode. + +Location bar in bread crumb mode. + + + + + + +Editable Mode + + +When in bread crumb mode, clicking in the gray area to the right of the path +with the &LMB; switches the location bar to editable mode, +in which the path can be edited using the keyboard. To switch back to bread +crumb mode, click the check mark at the right of the location bar with the &LMB;. + + + +Screenshot of the location bar in editable mode + + + + + +Location bar in editable mode. + +Location bar in editable mode. + + + + +Using Kioslaves + +If the location bar is empty in editable mode, a drop down box appears in +front of the bar listing all available kioslaves on your system. Kioslaves are +programs built into &kde; which add support for many different protocols to +&dolphin; and other &kde; applications. + +For example with the fish kioslave &dolphin; can be +used to manage files and folders on a remote host that is accessible +via SSH. To do this you would type fish://username@remotehost +into the location bar. Similar remote file management can be done on +remote hosts accessible via the &FTP;, NFS, SFTP, SMB (CIFS) or webdav protocols. + +It is also possible to use the kioslaves drop down list to access +&systemsettings;, fonts, trash, other programs and devices attached to your computer. +See the drop down list for the full list of capabilities available from kioslaves on your system. + + +Screenshot of the list of kioslaves + + + + + +Location bar showing list of available kioslaves. + +List of available kioslaves. + + + + + + + +Places and Context + + +If the Places panel is hidden; in both modes an additional icon +in front of the path is displayed. This icon can be clicked with the &LMB; to open a +menu which offers quick access to places and storage media. See the +section about the Places Panel for details. + + + +Location bar with Places icon + + + + + +Location bar with Places icon + + + + +The context menu of the location bar offers actions to switch between the modes and +to copy and paste the path using the clipboard. Check the last option in this context menu to +display either the full path starting with the root folder of the file system or to display +the path starting with the current places entry. + + + +Location bar context menu + + + + + +Location bar context menu + + + + + + + + + +Panels + + +&dolphin; allows a number of panels to be placed next to the view. These can +be enabled in ViewPanels. +By unlocking the panels and clicking and dragging a panel title, the panel can be moved +to a different position, even outside the window. + + + +Places + + + +The Places panel is located at the left of the window by +default. The Places panel shows any locations you have +bookmarked. It also shows any disk or media attached to the computer, recently accessed items +and allows you to search for certain type of files. The order of these entries can be changed by drag and drop. + + + +The easiest way to add a folder to the Places panel is to +drag it and drop it in the panel. Moreover, you can click inside the panel with +the &RMB; and choose Add Entry... +from the context menu. The first procedure creates a system wide bookmark, the second +procedure can be used to add the current path of the location bar or any desired folder or device. +A dialog opens where label, location and icon can be edited and the usage of this entry +can be restricted to &dolphin;. + + +A &RMB; click opens the context menu to edit, add, hide or remove entries +and change the icon size to one of the predefined values or lock/unlock the panels. + +The context menu has an action to open the entry in a new tab. +Devices can be unmounted using the context menu. + + + + +Information + + +The Information panel shows extended information about the +selected items(s) or about the current folder or the file which is currently hovered +over with the mouse, including size, type, and date of last modification. It also +features a large preview of the selected item and allows you to assign a rating, +tags, and comments to it. + + + + + +Folders + + +The Folders panel shows a tree view structure of the file +system. It only shows folders. Clicking a folder with the &LMB; opens this folder +in the &dolphin; view. + + + + + + +Terminal + + +This panel contains a terminal. The terminal will open at the folder currently +shown in the &dolphin; view. Changing the folder in the active &dolphin; +view will update the working folder of the terminal. The terminal only +works with local media. Note: Changing folder in the terminal will not +affect the &dolphin; view. + + + + + + + +Quick Tips + + +The following are a number of tips to save time when using &dolphin;. + + + +Quick Bookmarking + + +To quickly create a bookmark in the Places panel for the +current folder, &RMB; click in the work space and click +Add to Places in the context menu. + + + + + +Finding Files and Searching in Files + + +&dolphin; is capable of searching for files and for content in files. If +&Ctrl;F is pressed or Edit +Find... is used, the Find +bar will open already set up to search for files within the current folder and any sub-folders. +Start to type into the find input box and the search starts immediately. + +Search files and for content in files + + + + + +Search files and for content in files + +&dolphin; searching files and for content in files. + + + +The search is case insensitive, and does not require surrounding wildcards +(*foo* and foo are equivalent), +but you can use wildcards inside the search term. * will match +zero or more characters, ? only one single character. +This feature can be used with running Nepomuk/Strigi services; without these services +a KIOSlave is launched to provide the search results. +The option from Everywhere with activated Nepomuk/Strigi +services searches in all indexed folders, without Nepomuk/Strigi this option +starts the search from the user's Home folder. + + +Search with More Options + + + + + +Search with More Options + +&dolphin; searching with More Options. + + + + +Use the More Options button to extend the Find +bar. This provides a very comfortable way for +the user to shrink the number of search results. +To start a search select one or more file types (Documents, +Audio, Video, Images), + a time period and rating + +Alternatively you can use these options in the Places panel +together with the Filter bar to find files using Nepomuk or limit +the search to files matching the filter expression. + + + + +Mounting Storage Media + + +A quick way to mount Storage Media is to click on the device in the +Places panel. This will mount and open the device in &dolphin;. + + + + + +Undo Actions + + +&dolphin; is capable of undoing changes you have made to files. For example if +you moved a file to the Trash, &dolphin; can undo this and move it back to its +original location. To undo an action, press &Ctrl;Z +or select Edit Undo: (action name) +in the menu, ⪚ Undo: Rename. + + + + + +Renaming A Batch Of Files + +&dolphin; is capable of renaming a number of files at the same time. Each file +will have the file name specified, including a number, ⪚, Image1.jpg, +Image2.jpg, Image3.jpg. This can be useful, ⪚, for pictures taken with a digital camera. + + + +If you wish to rename a batch of files, first select the files to be renamed. +This can be done by pressing the &LMB; and drawing a rectangle around the files +to be renamed before releasing it, or by holding &Ctrl; and clicking each file +to be renamed (see Selecting Items in the View +for more details on item selection). Then open the batch-rename dialog by pressing +F2 or via the File menu: + File Rename... + + + +Then enter the name you wish to give the files. The # character must be present +within the name. The files will then be renamed, where the # +character is replaced by a different consecutive number for each file. + + +If all file extensions in your selection are different, the name of all files +can be changed without using a # placeholder while preserving +the file extensions. This is ⪚ useful to rename a video file and all associated +subtitle files, which have the same filename, but different extensions. + + + + +Comparing A Selection Of Files or Folders + + +If the &kompare; application is installed, you can use it to see the differences +between two files or folders. + + + +First select the two files or folders to be compared. Then launch the &kompare; application +via the Tools menu: Tools Compare Files . +&kompare; will then open showing the differences between the files or folders. + + + + + +Filtering Files + + +&dolphin; is capable of filtering files, &ie; showing only those items in the +view whose name contains a given text. For example, if you wish to show +only the MP3 files within a folder, you could filter for .mp3. +This would then filter out all files whose name does not contain .mp3. + + + +To filter files, first enable the filter bar, either by pressing &Ctrl;I +or via the menu: Tools Show Filter Bar . +You can then enter the text to be filtered for in the filter bar. The filter bar can +be disabled either by pressing &Esc;, or with a &LMB; click on the +Hide Filter Bar icon. + + + + + + + + + +Configuring &dolphin; + + +&dolphin; distinguishes two different kinds of settings: + + + + +Settings which affect the general behavior of &dolphin;. These can be configured +using the Preferences Dialog. + + + +Settings which determine how the contents of a folder are displayed in &dolphin;. +These settings are called View Properties +and can be controlled with toolbar buttons, via the View menu, +and with the View Properties Dialog. +In the default configuration, the view properties are remembered for each folder, +but &dolphin; can also be configured to use common view properties for all folders +in the General +section of the settings. + + + + + + + +The &dolphin; Preferences Dialog + +The Preferences Dialog is opened via Settings +Configure &dolphin;... in the menu in +&dolphin;'s main window. The settings are divided into several groups which can +be accessed by clicking the corresponding icon on the left of the dialog. + + +All settings except for the Startup page and the Status Bar +tab on the General page are shared with &konqueror; in filemanager mode. + + + +Startup + + +This group contains settings which control the appearance of &dolphin; on startup. + + +Screenshot of the Startup settings in &dolphin;'s preferences dialog + + + + + +Startup Settings. + +Startup Settings in &dolphin;'s Preferences Dialog. + + + + + + +The Home Folder is the folder which is opened on startup. The +location of the folder can be entered directly or chosen in a dialog which can +be opened by clicking the button showing a folder icon. Moreover, +the current location or the default location (which is the user's home folder) +can be used as the Home Folder by clicking the corresponding button. + + + +Split View Mode controls if the +&dolphin; view is split on startup +or not. + + + +Editable location bar controls if the location bar is in +editable mode on startup. The bread crumb mode of the location bar is used +otherwise. See the section about the location bar +for details about the two modes. + + + +If Show full path inside location bar is enabled, the full +path of the current location is shown in the bread crumb mode of the location bar. +Otherwise, a shortened version of the path is shown if it begins with the path of +one of the places in the Places panel. + + + +Show filter bar controls if the filter bar is shown on +startup or not. See the section on the filter bar +for details. + + + + + + + + + +View Modes + + +This group contains settings which control the behavior of &dolphin;'s view +modes. The three view modes (Icons, Compact, and Details) are accessible via the +tab bar at the top. + + +Screenshot of the Icons View settings in &dolphin;'s preferences dialog + + + + + +View Modes Settings. + +View Modes Settings in &dolphin;'s Preferences Dialog. + + + + + + +Common settings for all view modes + + +All three view modes have some common settings: + + + + +Sliders which control the size of the icons. The Default or +Preview sizes are used if previews are disabled or enabled, +respectively. Note that the icon size can be changed easily with the zoom slider +in the status bar if the corresponding option is enabled in the +General +section of the settings. + + + +A setting for the font used in the view mode: either the system font or a +custom font can be chosen. + + + + +The other settings in the Text section which apply to only +one of the view modes are discussed below. + + + + + +Icons + + + +Width controls the minimum width that is reserved for +the text of a file item. + + + Maximum lines means maximum number of text lines below the icon. + + + + + + +Compact + + + +Maximum width controls the maximum width that is reserved for +the text of a file item. + + + + + + +Details + + + +Expandable folders determines whether any folders that have subfolders +are displayed in a tree view, where the sub items can be expanded by &LMB; clicking the +> icon and collapsed by clicking the v icon. + + + + + + + + +Navigation + + +This group contains settings which control how navigation in the folder +structure and in archives works. + + +Screenshot of the Navigation settings in &dolphin;'s preferences dialog + + + + + +Navigation Settings. + +Navigation Settings in &dolphin;'s Preferences Dialog. + + + + + + +&dolphin; can be configured to open items with a single mouse click +(Single-click to open files and folders) or a double mouse +click (Double-click to open files and folders). In the +latter case, a single mouse click will select the file or folder. + + +This is a system wide setting and can be changed in the &systemsettings; in the +Input Devices Mouse +module as well. + + + + +Archives will be opened inside &dolphin;, and not in an external application, if +Open Archives as folder is enabled. + + + +If Open folders during drag operations is enabled, dragging +an item with the mouse and hovering over a folder with it for a short time will open +that folder. This allows you to move or copy items quickly to folders which are +several levels deeper in the folder hierarchy. + + + + + + + + + +Services + + +This group offers a selection of services that can be shown in the +Actions submenu of &dolphin;'s context menu which +appears when clicking a file or folder with the &RMB;. + + + +Screenshot of the Services settings in &dolphin;'s preferences dialog + + + + + +Services Settings. + +Services Settings in &dolphin;'s Preferences Dialog. + + + + +Using the Download New Services you can fetch additional +services for the context menu. + + +If you have installed &dolphin;'s plugins for Bazaar, +Mercurial, Git or +Subversion from the kdesdk module these services are shown in the list. +If these plugins are enabled and you enter a folder which is under version control, +the version state (locally changed, up to date &etc;) is indicated by icons +and you have additional entries in the +context menu like commit, update, add, remove &etc; + + +In the service list you can also choose if the Delete, +Copy To, and Move To +commands are shown in the context menu. + + +&dolphin; has to be restarted to activate the changes for some of these settings. + + + + + + +Trash + + +This group contains settings which control the behavior of the trash. + + +Screenshot of the Trash settings in &dolphin;'s preferences dialog + + + + + +Trash Settings. + +Trash Settings in &dolphin;'s Preferences Dialog. + + + + + + +Files which are older than a configurable number of days can be deleted automatically. + + + +The size of the trash can be limited to a configurable percentage of the disk +size. If this limit is reached, a warning can be issued, or the oldest or +largest files can be deleted automatically. + + + + + + + + + +General + + +This group contains settings which control the general behavior of &dolphin;. +The group is divided further into four subgroups which can be accessed using the +tab bar at the top. + + +Screenshot of the General settings in &dolphin;'s preferences dialog + + + + + +General Settings. + +General Settings in &dolphin;'s Preferences Dialog. + + + + + + +Behavior Tab + + + + + + +In the View section, you can configure whether the + view properties are stored for each +folder or if common view properties are to be used for all folders. + + +When hovering over a file or folder with the mouse, a small window with relevant +information is shown if Show tooltips is enabled. + + + +Show selection marker shows a small + +or - button above an item's icon if the item is hovered over +with the mouse. These can be used to select or deselect the item. + + + +Natural sorting of items controls how items are sorted in +the view. If this option is enabled, the sort order of three example files +will be + +File1, +File2, +File10. + +If this option is disabled, the normal alphabetical sorting will be used, which +leads to the sort order + +File1, +File10, +File2. + + + + +Enable Rename inline to use this mode if only one item is currently selected. +If this option is disabled or several items are selected, a dialog will be displayed for renaming. + + + + + + + + + +Previews Tab + + +In this tab, you can configure for which file types previews are shown. +Moreover, the maximum size of remote files for which previews are generated can be chosen. + + +If previews are enabled for folders, previews of some files in the folder will +be shown inside a folder's icon. + + + + +Confirmations Tab + +In the ask for confirmation section, you can enable warning dialogs that +are shown before potentially harmful actions . + +The confirmation settings for Moving files or folders to trash and +Deleting files or folders affect file operations in &dolphin;, &konqueror;, +Gwenview and all &kde; applications using the default &kde; file dialog, +whereas Closing Dolphin windows + with multiple tabs is a &dolphin; specific setting. + + + +Status Bar Tab + + +In this tab, some additional items can be enabled for the status bar, provided +the status bar is wide enough: + + + + +A zoom slider which can be used to change the icon size quickly. + + + +A bar that shows how much space is free on the current drive. + + + + + + +Since &dolphin; 4.9 the Delete, +Copy To, and Move To +commands of the context menu have to be enabled on the Services page. + + + + + + + + + +Folder View Properties + + +The following settings control how the contents of a folder are displayed in the +&kappname; view, and are stored on a per-folder basis by default: + + + + +The view mode (Icons, Compact, Details) + + + +The sorting of items, which is determined by the sort order (ascending, +descending) and the attribute (such as name, size,...) that the items are +sorted by + + + +Sorting of folders and files – are folders shown first or not? + + + +Previews – are they shown instead of icons (based on the settings made in +Previews +tab of &kappname;'s General settings) or not? + + + +Are items shown in groups in the views? + + + +Are hidden files shown? + + + +What additional information (besides the name) is shown in the Icons or Details view? + + + + +The view properties can be configured in the +View menu, some (such as the view +mode) can also be changed using toolbar buttons. + + + +The View Properties Dialog + + + + +Screenshot of the View Properties dialog + + + + + +The View Properties dialog. + +The View Properties Dialog. + + + +The View Properties dialog can be used to quickly modify +several view properties at once. This is done for the current folder, for the +current folder including all subfolders, or even for all folders, depending on +the choice made in the Apply View Properties To section. + + + +If Use these view properties as default is enabled, the chosen view +properties will also be used for all folders which do not have customized view +properties yet. + + + + + + + + + +Command Reference +By default the menubar is not shown. All actions described here either can +be accessed with toolbar buttons or with items in the menu of the +Control toolbar button. + + +The Menubar in &dolphin;'s Main Window + + +The File Menu + + + + + +File +Create New + +Creates a new object (such as a folder or a text file) in the current +folder. +You will find an explanation of all available objects in &konqueror;'s handbook in the chapter +Create New. + + + + + + +&Ctrl;N + +File +New Window + +Opens a new &dolphin; window. + + + + + +&Ctrl;T + +File +New Tab + +Opens a new tab. + + + + + +&Ctrl;W + +File +Close Tab + +Closes the current tab. + + + + + +F2 + +File +Rename + +Renames one currently selected item inline. +Opens the batch rename dialog if several +items are selected. + + + + + +Del + +File +Move to Trash + +Moves the currently selected item(s) to the +trash. + + + + + +&Shift;Del + +File +Delete + +Permanently deletes the currently selected item(s). The items are not moved +to the trash and cannot be restored. + + + + + +&Alt;Return + +File +Properties + +Shows the properties dialog for the currently selected +item(s). + + + + + +&Ctrl;Q + +File +Quit + +Exits &dolphin;. + + + + + + + +The Edit Menu + + + + + + +&Ctrl;Z + +Edit +Undo + +Undoes the last action performed by &dolphin;. + + + + + +&Ctrl;X + +Edit +Cut + +Cuts the currently selected item(s). + + + + + +&Ctrl;C + +Edit +Copy + +Copies the currently selected item(s). + + + + + +&Ctrl;V + +Edit +Paste Clipboard Contents... + +Pastes the currently copied/cut items to the current +folder. If the clipboard does not contain files or folders, the clipboard +contents (such as text or image data) will be pasted into a new file. +The name of this file has to be entered in a dialog. + + + + + + +&Ctrl;F + +Edit +Find... + +Opens the find bar. Enter a search term into the edit box and select to search for filename +or in contents of files starting from the current folder or everywhere. + + + + + +&Ctrl;A + +Edit +Select All + +Selects all files and folders in the current +folder. + + + + + +&Ctrl;&Shift;A + +Edit +Invert Selection + + +Selects all unselected items and deselects all selected items in the current folder. + + + + + + + +The View Menu + + + + + + +&Ctrl;+ + +View +Zoom In + +Increases the size of icons in the view. + + + + + +&Ctrl;- + +View +Zoom Out + +Decreases the size of icons in the view. + + + + +View +View Mode + +Changes the view mode to Icons +(&Ctrl;1), Compact +(&Ctrl;2) or Details +(&Ctrl;3). + + + + +View +Sort By + +Changes whether items are sorted by Name +or other criteria described in Information in the View. +Descending reverses the sort order. +Folders First sorts folders before files. + + + + + +View +Additional Information + +Displays additional information +described in Information in the View. + + + + + +View +Preview + +Displays a symbolic preview of the file contents in the different +view modes. + + + + +View +Show in Groups + +Displays the content of the +current folder grouped by the option selected in Sort By. + + + + + + +&Alt;. + +View +Show Hidden Files + +Shows all the hidden files and sub-folders within the current +folder. + + + + + +F3 + +View +Split + +Enables and disables the split view mode. + + + + + +F5 + +View +Reload + +Reloads the current folder. + + + + +View +Stop + +Stops loading/reading the contents of the current +folder. + + + + +View +Panels + +Enables and disables the different panels: +Places (F9), Information +(F11), Folders (F7), +Terminal (F4). +With Lock Panels the panel header with caption and two buttons is +hidden to save space and the panels are immutable, with Unlock Panels +the header is visible and the panel can be moved to the right or left or even +outside the main window. + + + + + + + +F6 + +View +Location Bar +Editable Location + +Changes the location bar between the two modes; the +bread crumb mode and the +editable mode. + + + + + + +&Ctrl;L + +View +Location Bar +Replace Location + +Switches the location bar to editable mode, +if necessary, and selects the location such that it can be replaced quickly. + + + + + +View +Adjust View Properties... + +Opens the View Properties +Dialog. + + + + + + + +The Go Menu + + + + + + +&Alt;Up + +Go +Up + +Changes to the folder above the current folder. + + + + + +&Alt;Left + +Go +Back + +Changes to the previously viewed folder. + + + + + +&Alt;Right + +Go +Forward + +Undoes a Go Back action. + + + + + +&Alt;Home + +Go +Home + +Changes to the users home folder, ⪚ +/home/Peter/. + + + + +Go +Recently Closed Tabs + +Shows a list of recently closed tabs which can +be reopened. + + + + + + +The Tools Menu + + + + + + +&Ctrl;I + +Tools +Show Filter Bar + +Enables and disables the filter bar. + + + + + +&Shift;F4 + +Tools +Open Terminal + +Opens &konsole; within the current folder. + + + + +Tools +Compare Files + +Compare the currently selected files or folders with +&kompare;. This action is only enabled if two files or folders are selected. + + + + +Tools +Select Remote Charset + +Allows you to choose the charset used by a remote +connection manually. + + + + + + +The Settings and Help Menu + +&dolphin; has the common &kde; Settings and Help +menu items, for more information read the sections about the Settings Menu and Help Menu +of the &kde; Fundamentals. + + + + + + + +Miscellaneous Questions + + + + +Has &dolphin; replaced &konqueror;? + + + +&dolphin; is not intended to be a competitor to &konqueror;: &konqueror; acts as +a universal viewer being able to show &HTML; pages, text documents, folders and a +lot more, whereas &dolphin; focuses on being only a file manager. This approach +allows the optimization of the user interface for the task of file management. + + + + + + +How can I get involved with the development of &dolphin;? + + + +The easiest way to get involved with &dolphin; is to subscribe to the developer +mailing list kfm-devel +and drop an email to the developer mailing list. Email what you can do, how much time +you can devote &etc;, the developers will let you know what you can do in the +project. If you wish to contribute to the documentation please email the +&kde; Documentation Team list. + + + + + + +How can I submit bug reports? + + + +The official channel for submitting bug reports is via the &kde; bug tracking +system. The &kde; bug tracker can be found at +http://bugs.kde.org. + + + + + + +How can I submit feature requests? + + + +The official channel for submitting feature requests is via the &kde; bug +tracking system. The &kde; bug tracker can be found at +http://bugs.kde.org. + + + + + + + + + + +Credits and License + + +&dolphin; + + +Program copyright 2006–2013 Peter Penz peter.penz@gmx.at and +Frank Reininghaus frank78ac@googlemail.com + +Contributors: + +Cvetoslav Ludmiloff ludmiloff@gmail.com +Stefan Monov logixoul@gmail.com +Michael Austin tuxedup@users.sourceforge.net +&Orville.Bennett; &Orville.Bennett.mail; + + + + +Documentation copyright 2005 Peter Penz peter.penz@gmx.at + + +Documentation copyright 2006 &Orville.Bennett; &Orville.Bennett.mail; + + +Documentation copyright 2006 Michael Austin tuxedup@users.sourceforge.net + + +Documentation copyright 2009 Frank Reininghaus frank78ac@googlemail.com + + + + +&underFDL; +&underGPL; + + + + +How to get &dolphin; +&dolphin; is part of the &package; package which is an essential part of +&kde;. + +For instructions on acquiring &kde; please see http://www.kde.org or read the chapter +Installing &kde; +in the &kde; Fundamentals. + +For further information about &dolphin; you might want to visit +http://dolphin.kde.org or +http://userbase.kde.org/Dolphin. + + + +&documentation.index; +
+ + diff --git a/docs/locationbar-breadcrumb.png b/docs/locationbar-breadcrumb.png new file mode 100644 index 000000000..e6970bdb5 Binary files /dev/null and b/docs/locationbar-breadcrumb.png differ diff --git a/docs/locationbar-context-menu.png b/docs/locationbar-context-menu.png new file mode 100644 index 000000000..7635427fa Binary files /dev/null and b/docs/locationbar-context-menu.png differ diff --git a/docs/locationbar-editable.png b/docs/locationbar-editable.png new file mode 100644 index 000000000..8af9e6931 Binary files /dev/null and b/docs/locationbar-editable.png differ diff --git a/docs/locationbar-kioslaves-menu.png b/docs/locationbar-kioslaves-menu.png new file mode 100644 index 000000000..3bbd14eb2 Binary files /dev/null and b/docs/locationbar-kioslaves-menu.png differ diff --git a/docs/locationbar-places-icon.png b/docs/locationbar-places-icon.png new file mode 100644 index 000000000..37ec23505 Binary files /dev/null and b/docs/locationbar-places-icon.png differ diff --git a/docs/nepomuk-search-more-options.png b/docs/nepomuk-search-more-options.png new file mode 100644 index 000000000..9e80d37ed Binary files /dev/null and b/docs/nepomuk-search-more-options.png differ diff --git a/docs/nepomuk-search.png b/docs/nepomuk-search.png new file mode 100644 index 000000000..1554ad759 Binary files /dev/null and b/docs/nepomuk-search.png differ diff --git a/docs/preferences-general-behavior.png b/docs/preferences-general-behavior.png new file mode 100644 index 000000000..843ebac52 Binary files /dev/null and b/docs/preferences-general-behavior.png differ diff --git a/docs/preferences-navigation.png b/docs/preferences-navigation.png new file mode 100644 index 000000000..d7d3d93ec Binary files /dev/null and b/docs/preferences-navigation.png differ diff --git a/docs/preferences-services.png b/docs/preferences-services.png new file mode 100644 index 000000000..84dd9632d Binary files /dev/null and b/docs/preferences-services.png differ diff --git a/docs/preferences-startup.png b/docs/preferences-startup.png new file mode 100644 index 000000000..86bf27086 Binary files /dev/null and b/docs/preferences-startup.png differ diff --git a/docs/preferences-trash.png b/docs/preferences-trash.png new file mode 100644 index 000000000..0ea1ec24c Binary files /dev/null and b/docs/preferences-trash.png differ diff --git a/docs/preferences-viewmodes-icons.png b/docs/preferences-viewmodes-icons.png new file mode 100644 index 000000000..1b8b970dd Binary files /dev/null and b/docs/preferences-viewmodes-icons.png differ diff --git a/docs/toolbar-navigation.png b/docs/toolbar-navigation.png new file mode 100644 index 000000000..0fdfa74f8 Binary files /dev/null and b/docs/toolbar-navigation.png differ diff --git a/docs/toolbar-view-appearance.png b/docs/toolbar-view-appearance.png new file mode 100644 index 000000000..5606fcfc7 Binary files /dev/null and b/docs/toolbar-view-appearance.png differ diff --git a/docs/toolbar.png b/docs/toolbar.png new file mode 100644 index 000000000..7b8919c56 Binary files /dev/null and b/docs/toolbar.png differ diff --git a/docs/viewproperties-dialog.png b/docs/viewproperties-dialog.png new file mode 100644 index 000000000..99567cc50 Binary files /dev/null and b/docs/viewproperties-dialog.png differ diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 7b0210aef..62f8e8c4a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,39 +1,17 @@ -macro_optional_find_package(Baloo) -set_package_properties(Baloo PROPERTIES DESCRIPTION "Baloo Core libraries" - URL "http://www.kde.org" - TYPE OPTIONAL - PURPOSE "For adding desktop-wide search and tagging support to dolphin" - ) - -macro_optional_find_package(BalooWidgets) -set_package_properties(BalooWidgets PROPERTIES DESCRIPTION "Baloos Widgets" - URL "http://www.kde.org" - TYPE OPTIONAL - ) - -macro_optional_find_package(KFileMetaData) -set_package_properties(KFileMetaData PROPERTIES - URL "https://projects.kde.org/kfilemetadata" - TYPE OPTIONAL - PURPOSE "For accessing file metadata labels" - ) - -if (Baloo_FOUND AND BalooWidgets_FOUND AND KFileMetaData_FOUND) - set(HAVE_BALOO TRUE) -endif() -configure_file(config-baloo.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-baloo.h ) +configure_file(config-baloo.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-baloo.h) -macro_bool_to_01(X11_Xrender_FOUND HAVE_XRENDER) -configure_file(config-X11.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-X11.h ) +configure_file(config-dolphin.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-dolphin.h) -include_directories( ${KACTIVITIES_INCLUDE_DIRS} ${CMAKE_CURRENT_BINARY_DIR} ) +add_definitions(-DTRANSLATION_DOMAIN=\"dolphin\") +add_definitions(-Wno-deprecated-declarations) +remove_definitions(-DQT_NO_CAST_FROM_BYTEARRAY -DQT_NO_URL_CAST_FROM_STRING) -if(HAVE_BALOO) - include_directories(${BALOO_INCLUDE_DIR} ${BALOO_WIDGETS_INCLUDE_DIR} ${KFILEMETADATA_INCLUDE_DIR}) +if(X11_Xrender_FOUND) + set(HAVE_XRENDER TRUE) endif() -add_subdirectory(tests) +configure_file(config-X11.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-X11.h) ########### next target ############### @@ -49,7 +27,7 @@ set(dolphinprivate_LIB_SRCS kitemviews/kitemlistselectionmanager.cpp kitemviews/kitemliststyleoption.cpp kitemviews/kitemlistview.cpp - kitemviews/kitemlistviewaccessible.cpp +# kitemviews/kitemlistviewaccessible.cpp kitemviews/kitemlistwidget.cpp kitemviews/kitemmodelbase.cpp kitemviews/kitemset.cpp @@ -104,7 +82,7 @@ if(HAVE_BALOO) ) endif() -kde4_add_kcfg_files(dolphinprivate_LIB_SRCS +kconfig_add_kcfg_files(dolphinprivate_LIB_SRCS settings/dolphin_compactmodesettings.kcfgc settings/dolphin_directoryviewpropertysettings.kcfgc settings/dolphin_detailsmodesettings.kcfgc @@ -113,21 +91,22 @@ kde4_add_kcfg_files(dolphinprivate_LIB_SRCS settings/dolphin_versioncontrolsettings.kcfgc ) -kde4_add_library(dolphinprivate SHARED ${dolphinprivate_LIB_SRCS}) +add_library(dolphinprivate ${dolphinprivate_LIB_SRCS}) target_link_libraries( - dolphinprivate - ${KDE4_KFILE_LIBS} - konq - ${KDE4_KNEWSTUFF3_LIBS} + dolphinprivate PUBLIC + KF5::KDELibs4Support + KF5::Konq + KF5::NewStuff ) if(HAVE_BALOO) target_link_libraries( - dolphinprivate - ${BALOO_LIBRARIES} - ${BALOO_WIDGETS_LIBRARY} - ${KFILEMETADATA_LIBRARY} + dolphinprivate PUBLIC + KF5::FileMetaData + KF5::BalooCore + KF5::BalooFiles + KF5::BalooWidgets ) endif() @@ -135,32 +114,32 @@ if(X11_Xrender_FOUND) target_link_libraries(dolphinprivate ${X11_Xrender_LIB}) endif(X11_Xrender_FOUND) -target_link_libraries(dolphinprivate ${KDE4_PLASMA_LIBS}) +set_target_properties(dolphinprivate PROPERTIES + VERSION ${DOLPHINPRIVATE_VERSION_STRING} + SOVERSION ${DOLPHINPRIVATE_SOVERSION} +) -set_target_properties(dolphinprivate PROPERTIES VERSION ${GENERIC_LIB_VERSION} SOVERSION ${GENERIC_LIB_SOVERSION} ) -install(TARGETS dolphinprivate ${INSTALL_TARGETS_DEFAULT_ARGS}) +install(TARGETS dolphinprivate ${KF5_INSTALL_TARGETS_DEFAULT_ARGS}) ########################################## set(dolphinpart_SRCS dolphinpart.cpp + dolphinpart_ext.cpp ) -# Add dolphinpart_ext.cpp conditionally, only with KDE > 4.9.1. -if (${KDE_VERSION} VERSION_GREATER "4.9.1") -set(dolphinpart_SRCS - ${dolphinpart_SRCS} - dolphinpart_ext.cpp) -endif (${KDE_VERSION} VERSION_GREATER "4.9.1") - -kde4_add_plugin(dolphinpart ${dolphinpart_SRCS}) +add_library(dolphinpart MODULE ${dolphinpart_SRCS}) -target_link_libraries(dolphinpart dolphinprivate konq ${KDE4_KPARTS_LIBS} ${KDE4_KFILE_LIBS}) +target_link_libraries(dolphinpart + dolphinprivate + KF5::Konq + KF5::KDELibs4Support +) install(TARGETS dolphinpart DESTINATION ${PLUGIN_INSTALL_DIR}) install(FILES dolphinpart.rc DESTINATION ${DATA_INSTALL_DIR}/dolphinpart) -install(FILES dolphinpart.desktop DESTINATION ${SERVICES_INSTALL_DIR} ) +install(FILES dolphinpart.desktop DESTINATION ${SERVICES_INSTALL_DIR}) install(FILES views/versioncontrol/fileviewversioncontrolplugin.desktop DESTINATION ${SERVICETYPES_INSTALL_DIR}) ########################################## @@ -221,7 +200,7 @@ set(dolphin_SRCS views/zoomlevelinfo.cpp ) -kde4_add_kcfg_files(dolphin_SRCS +kconfig_add_kcfg_files(dolphin_SRCS panels/folders/dolphin_folderspanelsettings.kcfgc panels/information/dolphin_informationpanelsettings.kcfgc panels/places/dolphin_placespanelsettings.kcfgc @@ -235,40 +214,35 @@ kde4_add_kcfg_files(dolphin_SRCS if(NOT WIN32) set(dolphin_SRCS ${dolphin_SRCS} panels/terminal/terminalpanel.cpp) -endif(NOT WIN32) +endif() -kde4_add_app_icon(dolphin_SRCS "${KDE4_ICON_INSTALL_DIR}/oxygen/*/apps/system-file-manager.png") +# TODO Does anything replace kde4_add_app_icon ? +#kde4_add_app_icon(dolphin_SRCS "${KDE4_ICON_INSTALL_DIR}/oxygen/*/apps/system-file-manager.png") -kde4_add_kdeinit_executable(dolphin ${dolphin_SRCS}) +kf5_add_kdeinit_executable(dolphin ${dolphin_SRCS}) + +target_include_directories(kdeinit_dolphin PRIVATE ${PHONON_INCLUDES}) target_link_libraries(kdeinit_dolphin - ${KDE4_KDEPRINT_LIBS} - ${KDE4_KFILE_LIBS} - ${KDE4_KPARTS_LIBS} - ${KDE4_KCMUTILS_LIBRARY} - konq + KF5::Konq dolphinprivate - knewstuff3 - ${KDE4_SOLID_LIBS} - ${KDE4_PHONON_LIBS} + KF5::NewStuff + KF5::Parts + KF5::KCMUtils + KF5::Solid + Phonon::phonon4qt5 + KF5::KDELibs4Support ) -if(HAVE_BALOO) - target_link_libraries(kdeinit_dolphin - ${BALOO_LIBRARIES} - ${BALOO_WIDGETS_LIBRARY} - ) -endif() - -if (KActivities_FOUND) +if (KF5Activities_FOUND) target_link_libraries( kdeinit_dolphin - ${KACTIVITIES_LIBRARY} + KF5::Activities ) -endif (KActivities_FOUND) +endif() -install(TARGETS kdeinit_dolphin ${INSTALL_TARGETS_DEFAULT_ARGS}) -install(TARGETS dolphin ${INSTALL_TARGETS_DEFAULT_ARGS}) +install(TARGETS kdeinit_dolphin ${KF5_INSTALL_TARGETS_DEFAULT_ARGS}) +install(TARGETS dolphin ${KF5_INSTALL_TARGETS_DEFAULT_ARGS}) ########################################## @@ -301,7 +275,7 @@ set(kcm_dolphingeneral_PART_SRCS settings/serviceitemdelegate.cpp settings/servicemodel.cpp) -kde4_add_kcfg_files(kcm_dolphinviewmodes_PART_SRCS +kconfig_add_kcfg_files(kcm_dolphinviewmodes_PART_SRCS settings/dolphin_compactmodesettings.kcfgc settings/dolphin_directoryviewpropertysettings.kcfgc settings/dolphin_detailsmodesettings.kcfgc @@ -310,25 +284,25 @@ kde4_add_kcfg_files(kcm_dolphinviewmodes_PART_SRCS settings/dolphin_versioncontrolsettings.kcfgc ) -kde4_add_kcfg_files(kcm_dolphinnavigation_PART_SRCS +kconfig_add_kcfg_files(kcm_dolphinnavigation_PART_SRCS settings/dolphin_generalsettings.kcfgc) -kde4_add_kcfg_files(kcm_dolphinservices_PART_SRCS +kconfig_add_kcfg_files(kcm_dolphinservices_PART_SRCS settings/dolphin_generalsettings.kcfgc settings/dolphin_versioncontrolsettings.kcfgc) -kde4_add_kcfg_files(kcm_dolphingeneral_PART_SRCS +kconfig_add_kcfg_files(kcm_dolphingeneral_PART_SRCS settings/dolphin_generalsettings.kcfgc) -kde4_add_plugin(kcm_dolphinviewmodes ${kcm_dolphinviewmodes_PART_SRCS}) -kde4_add_plugin(kcm_dolphinnavigation ${kcm_dolphinnavigation_PART_SRCS}) -kde4_add_plugin(kcm_dolphinservices ${kcm_dolphinservices_PART_SRCS}) -kde4_add_plugin(kcm_dolphingeneral ${kcm_dolphingeneral_PART_SRCS}) +add_library(kcm_dolphinviewmodes MODULE ${kcm_dolphinviewmodes_PART_SRCS}) +add_library(kcm_dolphinnavigation MODULE ${kcm_dolphinnavigation_PART_SRCS}) +add_library(kcm_dolphinservices MODULE ${kcm_dolphinservices_PART_SRCS}) +add_library(kcm_dolphingeneral MODULE ${kcm_dolphingeneral_PART_SRCS}) -target_link_libraries(kcm_dolphinviewmodes ${KDE4_KDEUI_LIBS} ${KDE4_KFILE_LIBS} dolphinprivate) -target_link_libraries(kcm_dolphinnavigation ${KDE4_KDEUI_LIBS} ${KDE4_KFILE_LIBS} dolphinprivate) -target_link_libraries(kcm_dolphinservices ${KDE4_KDEUI_LIBS} ${KDE4_KFILE_LIBS} ${KDE4_KIO_LIBS} ${KDE4_KNEWSTUFF3_LIBRARY} dolphinprivate) -target_link_libraries(kcm_dolphingeneral ${KDE4_KDEUI_LIBS} ${KDE4_KFILE_LIBS} ${KDE4_KIO_LIBS} dolphinprivate) +target_link_libraries(kcm_dolphinviewmodes KF5::KDELibs4Support dolphinprivate) +target_link_libraries(kcm_dolphinnavigation KF5::KDELibs4Support dolphinprivate) +target_link_libraries(kcm_dolphinservices KF5::KDELibs4Support dolphinprivate) +target_link_libraries(kcm_dolphingeneral KF5::KDELibs4Support dolphinprivate) install(TARGETS kcm_dolphinviewmodes DESTINATION ${PLUGIN_INSTALL_DIR} ) install(TARGETS kcm_dolphinnavigation DESTINATION ${PLUGIN_INSTALL_DIR} ) @@ -339,8 +313,11 @@ install(TARGETS kcm_dolphingeneral DESTINATION ${PLUGIN_INSTALL_DIR} ) set(kio_search_PART_SRCS search/filenamesearchprotocol.cpp) -kde4_add_plugin(kio_filenamesearch ${kio_search_PART_SRCS}) -target_link_libraries(kio_filenamesearch ${KDE4_KIO_LIBS}) + +add_library(kio_filenamesearch MODULE ${kio_search_PART_SRCS}) + +target_link_libraries(kio_filenamesearch KF5::KDELibs4Support) + install(TARGETS kio_filenamesearch DESTINATION ${PLUGIN_INSTALL_DIR}) ########### install files ############### @@ -365,3 +342,4 @@ install( FILES settings/services/servicemenu.knsrc DESTINATION ${CONFIG_INSTALL_ install( PROGRAMS settings/services/servicemenuinstallation DESTINATION ${BIN_INSTALL_DIR} ) install( PROGRAMS settings/services/servicemenudeinstallation DESTINATION ${BIN_INSTALL_DIR} ) +add_subdirectory(tests) diff --git a/src/config-dolphin.h.cmake b/src/config-dolphin.h.cmake new file mode 100644 index 000000000..45e7208e1 --- /dev/null +++ b/src/config-dolphin.h.cmake @@ -0,0 +1,4 @@ + +/* Define to 1 if you have the KActivities library. */ +#cmakedefine KF5Activities_FOUND 1 + diff --git a/src/dolphinapplication.cpp b/src/dolphinapplication.cpp index a4b105b90..4576318bb 100644 --- a/src/dolphinapplication.cpp +++ b/src/dolphinapplication.cpp @@ -26,6 +26,7 @@ #include #include #include +#include DolphinApplication::DolphinApplication() : m_mainWindow(0) @@ -103,4 +104,3 @@ void DolphinApplication::restoreSession() } } -#include "dolphinapplication.moc" diff --git a/src/dolphincontextmenu.cpp b/src/dolphincontextmenu.cpp index e692c8fa9..cf9270fa8 100644 --- a/src/dolphincontextmenu.cpp +++ b/src/dolphincontextmenu.cpp @@ -39,6 +39,7 @@ #include #include #include +#include #include #include #include @@ -143,7 +144,7 @@ void DolphinContextMenu::openTrashContextMenu() { Q_ASSERT(m_context & TrashContext); - QAction* emptyTrashAction = new QAction(KIcon("trash-empty"), i18nc("@action:inmenu", "Empty Trash"), this); + QAction* emptyTrashAction = new QAction(QIcon::fromTheme("trash-empty"), i18nc("@action:inmenu", "Empty Trash"), this); KConfig trashConfig("trashrc", KConfig::SimpleConfig); emptyTrashAction->setEnabled(!trashConfig.group("Status").readEntry("Empty", true)); addAction(emptyTrashAction); @@ -202,12 +203,12 @@ void DolphinContextMenu::openItemContextMenu() newFileMenu->checkUpToDate(); newFileMenu->setPopupFiles(m_fileInfo.url()); newFileMenu->setEnabled(selectedItemsProps.supportsWriting()); - connect(newFileMenu, SIGNAL(fileCreated(KUrl)), newFileMenu, SLOT(deleteLater())); - connect(newFileMenu, SIGNAL(directoryCreated(KUrl)), newFileMenu, SLOT(deleteLater())); + connect(newFileMenu, &DolphinNewFileMenu::fileCreated, newFileMenu, &DolphinNewFileMenu::deleteLater); + connect(newFileMenu, &DolphinNewFileMenu::directoryCreated, newFileMenu, &DolphinNewFileMenu::deleteLater); - KMenu* menu = newFileMenu->menu(); + QMenu* menu = newFileMenu->menu(); menu->setTitle(i18nc("@title:menu Create new folder, file, link, etc.", "Create New")); - menu->setIcon(KIcon("document-new")); + menu->setIcon(QIcon::fromTheme("document-new")); addMenu(menu); addSeparator(); @@ -217,20 +218,20 @@ void DolphinContextMenu::openItemContextMenu() // insert 'Add to Places' entry if (!placeExists(m_fileInfo.url())) { - addToPlacesAction = addAction(KIcon("bookmark-new"), + addToPlacesAction = addAction(QIcon::fromTheme("bookmark-new"), i18nc("@action:inmenu Add selected folder to places", "Add to Places")); } addSeparator(); } else if (m_baseUrl.protocol().contains("search")) { - openParentInNewWindowAction = new QAction(KIcon("window-new"), + openParentInNewWindowAction = new QAction(QIcon::fromTheme("window-new"), i18nc("@action:inmenu", "Open Path in New Window"), this); addAction(openParentInNewWindowAction); - openParentInNewTabAction = new QAction(KIcon("tab-new"), + openParentInNewTabAction = new QAction(QIcon::fromTheme("tab-new"), i18nc("@action:inmenu", "Open Path in New Tab"), this); @@ -321,7 +322,7 @@ void DolphinContextMenu::openViewportContextMenu() // Insert 'Add to Places' entry if exactly one item is selected QAction* addToPlacesAction = 0; if (!placeExists(m_mainWindow->activeViewContainer()->url())) { - addToPlacesAction = addAction(KIcon("bookmark-new"), + addToPlacesAction = addAction(QIcon::fromTheme("bookmark-new"), i18nc("@action:inmenu Add current folder to places", "Add to Places")); } @@ -430,9 +431,9 @@ QAction* DolphinContextMenu::createPasteAction() const bool isDir = !m_fileInfo.isNull() && m_fileInfo.isDir(); if (isDir && (m_selectedItems.count() == 1)) { const QPair pasteInfo = KonqOperations::pasteInfo(m_fileInfo.url()); - action = new QAction(KIcon("edit-paste"), i18nc("@action:inmenu", "Paste Into Folder"), this); + action = new QAction(QIcon::fromTheme("edit-paste"), i18nc("@action:inmenu", "Paste Into Folder"), this); action->setEnabled(pasteInfo.first); - connect(action, SIGNAL(triggered()), m_mainWindow, SLOT(pasteIntoFolder())); + connect(action, &QAction::triggered, m_mainWindow, &DolphinMainWindow::pasteIntoFolder); } else { action = m_mainWindow->actionCollection()->action(KStandardAction::name(KStandardAction::Paste)); } @@ -489,7 +490,7 @@ void DolphinContextMenu::addFileItemPluginActions() const KConfig config("kservicemenurc", KConfig::NoGlobals); const KConfigGroup showGroup = config.group("Show"); - foreach (const KSharedPtr& service, pluginServices) { + foreach (const KService::Ptr& service, pluginServices) { if (!showGroup.readEntry(service->desktopEntryName(), true)) { // The plugin has been disabled continue; @@ -529,4 +530,3 @@ void DolphinContextMenu::addCustomActions() } } -#include "dolphincontextmenu.moc" diff --git a/src/dolphindockwidget.cpp b/src/dolphindockwidget.cpp index 6495c8da9..1e83ef841 100644 --- a/src/dolphindockwidget.cpp +++ b/src/dolphindockwidget.cpp @@ -91,4 +91,3 @@ bool DolphinDockWidget::isLocked() const return m_locked; } -#include "dolphindockwidget.moc" diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp index 41bd626ee..3b084ac8b 100644 --- a/src/dolphinmainwindow.cpp +++ b/src/dolphinmainwindow.cpp @@ -56,9 +56,10 @@ #include #include #include +#include +#include #include #include -#include #include #include #include @@ -78,7 +79,6 @@ #include #include #include -#include #include #include @@ -87,6 +87,9 @@ #include #include #include +#include +#include +#include namespace { // Used for GeneralSettings::version() to determine whether @@ -111,20 +114,20 @@ DolphinMainWindow::DolphinMainWindow() : { setObjectName("Dolphin#"); - connect(&DolphinNewFileMenuObserver::instance(), SIGNAL(errorMessage(QString)), - this, SLOT(showErrorMessage(QString))); + connect(&DolphinNewFileMenuObserver::instance(), &DolphinNewFileMenuObserver::errorMessage, + this, &DolphinMainWindow::showErrorMessage); KIO::FileUndoManager* undoManager = KIO::FileUndoManager::self(); undoManager->setUiInterface(new UndoUiInterface()); - connect(undoManager, SIGNAL(undoAvailable(bool)), - this, SLOT(slotUndoAvailable(bool))); - connect(undoManager, SIGNAL(undoTextChanged(QString)), - this, SLOT(slotUndoTextChanged(QString))); - connect(undoManager, SIGNAL(jobRecordingStarted(CommandType)), - this, SLOT(clearStatusBar())); - connect(undoManager, SIGNAL(jobRecordingFinished(CommandType)), - this, SLOT(showCommand(CommandType))); + connect(undoManager, static_cast(&KIO::FileUndoManager::undoAvailable), + this, &DolphinMainWindow::slotUndoAvailable); + connect(undoManager, &KIO::FileUndoManager::undoTextChanged, + this, &DolphinMainWindow::slotUndoTextChanged); + connect(undoManager, &KIO::FileUndoManager::jobRecordingStarted, + this, &DolphinMainWindow::clearStatusBar); + connect(undoManager, &KIO::FileUndoManager::jobRecordingFinished, + this, &DolphinMainWindow::showCommand); GeneralSettings* generalSettings = GeneralSettings::self(); const bool firstRun = (generalSettings->version() < 200); @@ -137,12 +140,12 @@ DolphinMainWindow::DolphinMainWindow() : setupActions(); m_actionHandler = new DolphinViewActionHandler(actionCollection(), this); - connect(m_actionHandler, SIGNAL(actionBeingHandled()), SLOT(clearStatusBar())); - connect(m_actionHandler, SIGNAL(createDirectory()), SLOT(createDirectory())); + connect(m_actionHandler, &DolphinViewActionHandler::actionBeingHandled, this, &DolphinMainWindow::clearStatusBar); + connect(m_actionHandler, &DolphinViewActionHandler::createDirectory, this, &DolphinMainWindow::createDirectory); m_remoteEncoding = new DolphinRemoteEncoding(this, m_actionHandler); - connect(this, SIGNAL(urlChanged(KUrl)), - m_remoteEncoding, SLOT(slotAboutToOpenUrl())); + connect(this, &DolphinMainWindow::urlChanged, + m_remoteEncoding, &DolphinRemoteEncoding::slotAboutToOpenUrl); m_tabBar = new DolphinTabBar(this); connect(m_tabBar, SIGNAL(currentChanged(int)), @@ -174,8 +177,8 @@ DolphinMainWindow::DolphinMainWindow() : stateChanged("new_file"); QClipboard* clipboard = QApplication::clipboard(); - connect(clipboard, SIGNAL(dataChanged()), - this, SLOT(updatePasteAction())); + connect(clipboard, &QClipboard::dataChanged, + this, &DolphinMainWindow::updatePasteAction); QAction* showFilterBarAction = actionCollection()->action("show_filter_bar"); showFilterBarAction->setChecked(generalSettings->filterBar()); @@ -296,8 +299,8 @@ void DolphinMainWindow::changeUrl(const KUrl& url) updateGoActions(); setUrlAsCaption(url); - const QString iconName = KMimeType::iconNameForUrl(url); - m_tabBar->setTabIcon(m_tabIndex, KIcon(iconName)); + const QString iconName = KIO::iconNameForUrl(url); + m_tabBar->setTabIcon(m_tabIndex, QIcon::fromTheme(iconName)); m_tabBar->setTabText(m_tabIndex, squeezedText(tabName(view->url()))); emit urlChanged(url); @@ -413,7 +416,7 @@ void DolphinMainWindow::openNewTab(const KUrl& primaryUrl, const KUrl& secondary tabPage->hide(); - m_tabBar->addTab(KIcon(KMimeType::iconNameForUrl(primaryUrl)), + m_tabBar->addTab(QIcon::fromTheme(KIO::iconNameForUrl(primaryUrl)), squeezedText(tabName(primaryUrl))); if (m_viewTab.count() > 1) { @@ -491,7 +494,7 @@ void DolphinMainWindow::openInNewWindow() } if (!newWindowUrl.isEmpty()) { - KRun::run("dolphin %u", KUrl::List() << newWindowUrl, this); + KRun::run("dolphin %u", QList() << newWindowUrl, this); } } @@ -526,18 +529,19 @@ void DolphinMainWindow::closeEvent(QCloseEvent* event) // KDialog::Yes -> Quit // KDialog::No -> Close only the current tab // KDialog::Cancel -> do nothing - KDialog *dialog = new KDialog(this, Qt::Dialog); - dialog->setCaption(i18nc("@title:window", "Confirmation")); - dialog->setButtons(KDialog::Yes | KDialog::No | KDialog::Cancel); + QDialog *dialog = new QDialog(this, Qt::Dialog); + dialog->setWindowTitle(i18nc("@title:window", "Confirmation")); dialog->setModal(true); - dialog->setButtonGuiItem(KDialog::Yes, KStandardGuiItem::quit()); - dialog->setButtonGuiItem(KDialog::No, KGuiItem(i18n("C&lose Current Tab"), KIcon("tab-close"))); - dialog->setButtonGuiItem(KDialog::Cancel, KStandardGuiItem::cancel()); - dialog->setDefaultButton(KDialog::Yes); + QDialogButtonBox* buttons = new QDialogButtonBox(QDialogButtonBox::Yes | QDialogButtonBox::No | QDialogButtonBox::Cancel); + KGuiItem::assign(buttons->button(QDialogButtonBox::Yes), KStandardGuiItem::quit()); + KGuiItem::assign(buttons->button(QDialogButtonBox::No), KGuiItem(i18n("C&lose Current Tab"), QIcon::fromTheme("tab-close"))); + KGuiItem::assign(buttons->button(QDialogButtonBox::Cancel), KStandardGuiItem::cancel()); + buttons->button(QDialogButtonBox::Yes)->setDefault(true); bool doNotAskAgainCheckboxResult = false; const int result = KMessageBox::createKMessageBox(dialog, + buttons, QMessageBox::Warning, i18n("You have multiple tabs open in this window, are you sure you want to quit?"), QStringList(), @@ -550,10 +554,10 @@ void DolphinMainWindow::closeEvent(QCloseEvent* event) } switch (result) { - case KDialog::Yes: + case QDialogButtonBox::Yes: // Quit break; - case KDialog::No: + case QDialogButtonBox::No: // Close only the current tab closeTab(); default: @@ -893,7 +897,7 @@ void DolphinMainWindow::editSettings() const KUrl url = container->url(); DolphinSettingsDialog* settingsDialog = new DolphinSettingsDialog(url, this); - connect(settingsDialog, SIGNAL(settingsChanged()), this, SLOT(refreshViews())); + connect(settingsDialog, &DolphinSettingsDialog::settingsChanged, this, &DolphinMainWindow::refreshViews); settingsDialog->setAttribute(Qt::WA_DeleteOnClose); settingsDialog->show(); m_settingsDialog = settingsDialog; @@ -1018,10 +1022,10 @@ void DolphinMainWindow::handleUrl(const KUrl& url) // stat the URL to see if it is a dir or not m_lastHandleUrlStatJob = KIO::stat(url, KIO::HideProgressInfo); if (m_lastHandleUrlStatJob->ui()) { - m_lastHandleUrlStatJob->ui()->setWindow(this); + KJobWidgets::setWindow(m_lastHandleUrlStatJob, this); } - connect(m_lastHandleUrlStatJob, SIGNAL(result(KJob*)), - this, SLOT(slotHandleUrlStatFinished(KJob*))); + connect(m_lastHandleUrlStatJob, &KIO::Job::result, + this, &DolphinMainWindow::slotHandleUrlStatFinished); } else { new KRun(url, this); // Automatically deletes itself after being finished @@ -1070,12 +1074,13 @@ void DolphinMainWindow::openContextMenu(const QPoint& pos, switch (command) { case DolphinContextMenu::OpenParentFolderInNewWindow: { - KRun::run("dolphin %u", KUrl::List() << item.url().upUrl(), this); + + KRun::run("dolphin %u", QList() << KIO::upUrl(item.url()), this); break; } case DolphinContextMenu::OpenParentFolderInNewTab: - openNewTab(item.url().upUrl()); + openNewTab(KIO::upUrl(item.url())); break; case DolphinContextMenu::None: @@ -1142,7 +1147,7 @@ void DolphinMainWindow::updateControlMenu() // Add "Go" menu KMenu* goMenu = new KMenu(i18nc("@action:inmenu", "Go"), menu); - connect(menu, SIGNAL(aboutToHide()), goMenu, SLOT(deleteLater())); + connect(menu, &KMenu::aboutToHide, goMenu, &KMenu::deleteLater); goMenu->addAction(ac->action(KStandardAction::name(KStandardAction::Back))); goMenu->addAction(ac->action(KStandardAction::name(KStandardAction::Forward))); goMenu->addAction(ac->action(KStandardAction::name(KStandardAction::Up))); @@ -1152,7 +1157,7 @@ void DolphinMainWindow::updateControlMenu() // Add "Tool" menu KMenu* toolsMenu = new KMenu(i18nc("@action:inmenu", "Tools"), menu); - connect(menu, SIGNAL(aboutToHide()), toolsMenu, SLOT(deleteLater())); + connect(menu, &KMenu::aboutToHide, toolsMenu, &KMenu::deleteLater); toolsMenu->addAction(ac->action("show_filter_bar")); toolsMenu->addAction(ac->action("compare_files")); toolsMenu->addAction(ac->action("open_terminal")); @@ -1166,7 +1171,7 @@ void DolphinMainWindow::updateControlMenu() // Add "Help" menu KMenu* helpMenu = new KMenu(i18nc("@action:inmenu", "Help"), menu); - connect(menu, SIGNAL(aboutToHide()), helpMenu, SLOT(deleteLater())); + connect(menu, &KMenu::aboutToHide, helpMenu, &KMenu::deleteLater); helpMenu->addAction(ac->action(KStandardAction::name(KStandardAction::HelpContents))); helpMenu->addAction(ac->action(KStandardAction::name(KStandardAction::WhatsThis))); helpMenu->addSeparator(); @@ -1240,7 +1245,7 @@ void DolphinMainWindow::setActiveViewContainer(DolphinViewContainer* viewContain const KUrl url = m_activeViewContainer->url(); setUrlAsCaption(url); m_tabBar->setTabText(m_tabIndex, squeezedText(tabName(url))); - m_tabBar->setTabIcon(m_tabIndex, KIcon(KMimeType::iconNameForUrl(url))); + m_tabBar->setTabIcon(m_tabIndex, QIcon::fromTheme(KIO::iconNameForUrl(url))); emit urlChanged(url); } @@ -1249,31 +1254,31 @@ void DolphinMainWindow::setupActions() { // setup 'File' menu m_newFileMenu = new DolphinNewFileMenu(actionCollection(), this); - KMenu* menu = m_newFileMenu->menu(); + QMenu* menu = m_newFileMenu->menu(); menu->setTitle(i18nc("@title:menu Create new folder, file, link, etc.", "Create New")); - menu->setIcon(KIcon("document-new")); + menu->setIcon(QIcon::fromTheme("document-new")); m_newFileMenu->setDelayed(false); - connect(menu, SIGNAL(aboutToShow()), - this, SLOT(updateNewMenu())); + connect(menu, &QMenu::aboutToShow, + this, &DolphinMainWindow::updateNewMenu); - KAction* newWindow = actionCollection()->addAction("new_window"); - newWindow->setIcon(KIcon("window-new")); + QAction* newWindow = actionCollection()->addAction("new_window"); + newWindow->setIcon(QIcon::fromTheme("window-new")); newWindow->setText(i18nc("@action:inmenu File", "New &Window")); newWindow->setShortcut(Qt::CTRL | Qt::Key_N); - connect(newWindow, SIGNAL(triggered()), this, SLOT(openNewMainWindow())); + connect(newWindow, &QAction::triggered, this, &DolphinMainWindow::openNewMainWindow); - KAction* newTab = actionCollection()->addAction("new_tab"); - newTab->setIcon(KIcon("tab-new")); + QAction* newTab = actionCollection()->addAction("new_tab"); + newTab->setIcon(QIcon::fromTheme("tab-new")); newTab->setText(i18nc("@action:inmenu File", "New Tab")); - newTab->setShortcut(KShortcut(Qt::CTRL | Qt::Key_T, Qt::CTRL | Qt::SHIFT | Qt::Key_N)); - connect(newTab, SIGNAL(triggered()), this, SLOT(openNewTab())); + newTab->setShortcuts(QList() << QKeySequence(Qt::CTRL | Qt::Key_T) << QKeySequence(Qt::CTRL | Qt::SHIFT | Qt::Key_N)); + connect(newTab, &QAction::triggered, this, static_cast(&DolphinMainWindow::openNewTab)); - KAction* closeTab = actionCollection()->addAction("close_tab"); - closeTab->setIcon(KIcon("tab-close")); + QAction* closeTab = actionCollection()->addAction("close_tab"); + closeTab->setIcon(QIcon::fromTheme("tab-close")); closeTab->setText(i18nc("@action:inmenu File", "Close Tab")); closeTab->setShortcut(Qt::CTRL | Qt::Key_W); closeTab->setEnabled(false); - connect(closeTab, SIGNAL(triggered()), this, SLOT(closeTab())); + connect(closeTab, &QAction::triggered, this, static_cast(&DolphinMainWindow::closeTab)); KStandardAction::quit(this, SLOT(quit()), actionCollection()); @@ -1284,12 +1289,12 @@ void DolphinMainWindow::setupActions() // need to remove shift+del from cut action, else the shortcut for deletejob // doesn't work - KAction* cut = KStandardAction::cut(this, SLOT(cut()), actionCollection()); - KShortcut cutShortcut = cut->shortcut(); - cutShortcut.remove(Qt::SHIFT | Qt::Key_Delete, KShortcut::KeepEmpty); - cut->setShortcut(cutShortcut); + QAction* cut = KStandardAction::cut(this, SLOT(cut()), actionCollection()); + auto cutShortcuts = cut->shortcuts(); + cutShortcuts.removeAll(QKeySequence(Qt::SHIFT | Qt::Key_Delete)); + cut->setShortcuts(cutShortcuts); KStandardAction::copy(this, SLOT(copy()), actionCollection()); - KAction* paste = KStandardAction::paste(this, SLOT(paste()), actionCollection()); + QAction* paste = KStandardAction::paste(this, SLOT(paste()), actionCollection()); // The text of the paste-action is modified dynamically by Dolphin // (e. g. to "Paste One Folder"). To prevent that the size of the toolbar changes // due to the long text, the text "Paste" is used: @@ -1297,51 +1302,50 @@ void DolphinMainWindow::setupActions() KStandardAction::find(this, SLOT(find()), actionCollection()); - KAction* selectAll = actionCollection()->addAction("select_all"); + QAction* selectAll = actionCollection()->addAction("select_all"); selectAll->setText(i18nc("@action:inmenu Edit", "Select All")); selectAll->setShortcut(Qt::CTRL | Qt::Key_A); - connect(selectAll, SIGNAL(triggered()), this, SLOT(selectAll())); + connect(selectAll, &QAction::triggered, this, &DolphinMainWindow::selectAll); - KAction* invertSelection = actionCollection()->addAction("invert_selection"); + QAction* invertSelection = actionCollection()->addAction("invert_selection"); invertSelection->setText(i18nc("@action:inmenu Edit", "Invert Selection")); invertSelection->setShortcut(Qt::CTRL | Qt::SHIFT | Qt::Key_A); - connect(invertSelection, SIGNAL(triggered()), this, SLOT(invertSelection())); + connect(invertSelection, &QAction::triggered, this, &DolphinMainWindow::invertSelection); // setup 'View' menu // (note that most of it is set up in DolphinViewActionHandler) - KAction* split = actionCollection()->addAction("split_view"); + QAction* split = actionCollection()->addAction("split_view"); split->setShortcut(Qt::Key_F3); - connect(split, SIGNAL(triggered()), this, SLOT(toggleSplitView())); + connect(split, &QAction::triggered, this, &DolphinMainWindow::toggleSplitView); - KAction* reload = actionCollection()->addAction("reload"); + QAction* reload = actionCollection()->addAction("reload"); reload->setText(i18nc("@action:inmenu View", "Reload")); reload->setShortcut(Qt::Key_F5); - reload->setIcon(KIcon("view-refresh")); - connect(reload, SIGNAL(triggered()), this, SLOT(reloadView())); + reload->setIcon(QIcon::fromTheme("view-refresh")); + connect(reload, &QAction::triggered, this, &DolphinMainWindow::reloadView); - KAction* stop = actionCollection()->addAction("stop"); + QAction* stop = actionCollection()->addAction("stop"); stop->setText(i18nc("@action:inmenu View", "Stop")); stop->setToolTip(i18nc("@info", "Stop loading")); - stop->setIcon(KIcon("process-stop")); - connect(stop, SIGNAL(triggered()), this, SLOT(stopLoading())); + stop->setIcon(QIcon::fromTheme("process-stop")); + connect(stop, &QAction::triggered, this, &DolphinMainWindow::stopLoading); KToggleAction* editableLocation = actionCollection()->add("editable_location"); editableLocation->setText(i18nc("@action:inmenu Navigation Bar", "Editable Location")); editableLocation->setShortcut(Qt::Key_F6); - connect(editableLocation, SIGNAL(triggered()), this, SLOT(toggleEditLocation())); + connect(editableLocation, &KToggleAction::triggered, this, &DolphinMainWindow::toggleEditLocation); - KAction* replaceLocation = actionCollection()->addAction("replace_location"); + QAction* replaceLocation = actionCollection()->addAction("replace_location"); replaceLocation->setText(i18nc("@action:inmenu Navigation Bar", "Replace Location")); replaceLocation->setShortcut(Qt::CTRL | Qt::Key_L); - connect(replaceLocation, SIGNAL(triggered()), this, SLOT(replaceLocation())); + connect(replaceLocation, &QAction::triggered, this, &DolphinMainWindow::replaceLocation); // setup 'Go' menu - KAction* backAction = KStandardAction::back(this, SLOT(goBack()), actionCollection()); - connect(backAction, SIGNAL(triggered(Qt::MouseButtons,Qt::KeyboardModifiers)), this, SLOT(goBack(Qt::MouseButtons))); - KShortcut backShortcut = backAction->shortcut(); - backShortcut.setAlternate(Qt::Key_Backspace); - backAction->setShortcut(backShortcut); + QAction* backAction = KStandardAction::back(this, SLOT(goBack()), actionCollection()); + auto backShortcuts = backAction->shortcuts(); + backShortcuts.append(QKeySequence(Qt::Key_Backspace)); + backAction->setShortcuts(backShortcuts); DolphinRecentTabsMenu* recentTabsMenu = new DolphinRecentTabsMenu(this); actionCollection()->addAction("closed_tabs", recentTabsMenu); @@ -1350,78 +1354,73 @@ void DolphinMainWindow::setupActions() connect(recentTabsMenu, SIGNAL(restoreClosedTab(KUrl,KUrl)), this, SLOT(openNewActivatedTab(KUrl,KUrl))); - KAction* forwardAction = KStandardAction::forward(this, SLOT(goForward()), actionCollection()); - connect(forwardAction, SIGNAL(triggered(Qt::MouseButtons,Qt::KeyboardModifiers)), this, SLOT(goForward(Qt::MouseButtons))); - - KAction* upAction = KStandardAction::up(this, SLOT(goUp()), actionCollection()); - connect(upAction, SIGNAL(triggered(Qt::MouseButtons,Qt::KeyboardModifiers)), this, SLOT(goUp(Qt::MouseButtons))); - - KAction* homeAction = KStandardAction::home(this, SLOT(goHome()), actionCollection()); - connect(homeAction, SIGNAL(triggered(Qt::MouseButtons,Qt::KeyboardModifiers)), this, SLOT(goHome(Qt::MouseButtons))); + KStandardAction::forward(this, SLOT(goForward()), actionCollection()); + KStandardAction::up(this, SLOT(goUp()), actionCollection()); + KStandardAction::home(this, SLOT(goHome()), actionCollection()); // setup 'Tools' menu - KAction* showFilterBar = actionCollection()->addAction("show_filter_bar"); + QAction* showFilterBar = actionCollection()->addAction("show_filter_bar"); showFilterBar->setText(i18nc("@action:inmenu Tools", "Show Filter Bar")); - showFilterBar->setIcon(KIcon("view-filter")); + showFilterBar->setIcon(QIcon::fromTheme("view-filter")); showFilterBar->setShortcut(Qt::CTRL | Qt::Key_I); - connect(showFilterBar, SIGNAL(triggered()), this, SLOT(showFilterBar())); + connect(showFilterBar, &QAction::triggered, this, &DolphinMainWindow::showFilterBar); - KAction* compareFiles = actionCollection()->addAction("compare_files"); + QAction* compareFiles = actionCollection()->addAction("compare_files"); compareFiles->setText(i18nc("@action:inmenu Tools", "Compare Files")); - compareFiles->setIcon(KIcon("kompare")); + compareFiles->setIcon(QIcon::fromTheme("kompare")); compareFiles->setEnabled(false); - connect(compareFiles, SIGNAL(triggered()), this, SLOT(compareFiles())); + connect(compareFiles, &QAction::triggered, this, &DolphinMainWindow::compareFiles); - KAction* openTerminal = actionCollection()->addAction("open_terminal"); + QAction* openTerminal = actionCollection()->addAction("open_terminal"); openTerminal->setText(i18nc("@action:inmenu Tools", "Open Terminal")); - openTerminal->setIcon(KIcon("utilities-terminal")); + openTerminal->setIcon(QIcon::fromTheme("utilities-terminal")); openTerminal->setShortcut(Qt::SHIFT | Qt::Key_F4); - connect(openTerminal, SIGNAL(triggered()), this, SLOT(openTerminal())); + connect(openTerminal, &QAction::triggered, this, &DolphinMainWindow::openTerminal); // setup 'Settings' menu KToggleAction* showMenuBar = KStandardAction::showMenubar(0, 0, actionCollection()); - connect(showMenuBar, SIGNAL(triggered(bool)), // Fixes #286822 - this, SLOT(toggleShowMenuBar()), Qt::QueuedConnection); + connect(showMenuBar, &KToggleAction::triggered, // Fixes #286822 + this, &DolphinMainWindow::toggleShowMenuBar, Qt::QueuedConnection); KStandardAction::preferences(this, SLOT(editSettings()), actionCollection()); // not in menu actions QList nextTabKeys; - nextTabKeys.append(KStandardShortcut::tabNext().primary()); + nextTabKeys.append(KStandardShortcut::tabNext().first()); //TODO: is this correct nextTabKeys.append(QKeySequence(Qt::CTRL | Qt::Key_Tab)); QList prevTabKeys; - prevTabKeys.append(KStandardShortcut::tabPrev().primary()); + prevTabKeys.append(KStandardShortcut::tabPrev().first()); //TODO: is this correct prevTabKeys.append(QKeySequence(Qt::CTRL | Qt::SHIFT | Qt::Key_Tab)); - KAction* activateNextTab = actionCollection()->addAction("activate_next_tab"); + QAction* activateNextTab = actionCollection()->addAction("activate_next_tab"); activateNextTab->setIconText(i18nc("@action:inmenu", "Next Tab")); activateNextTab->setText(i18nc("@action:inmenu", "Activate Next Tab")); activateNextTab->setEnabled(false); - connect(activateNextTab, SIGNAL(triggered()), SLOT(activateNextTab())); + connect(activateNextTab, &QAction::triggered, this, &DolphinMainWindow::activateNextTab); activateNextTab->setShortcuts(QApplication::isRightToLeft() ? prevTabKeys : nextTabKeys); - KAction* activatePrevTab = actionCollection()->addAction("activate_prev_tab"); + QAction* activatePrevTab = actionCollection()->addAction("activate_prev_tab"); activatePrevTab->setIconText(i18nc("@action:inmenu", "Previous Tab")); activatePrevTab->setText(i18nc("@action:inmenu", "Activate Previous Tab")); activatePrevTab->setEnabled(false); - connect(activatePrevTab, SIGNAL(triggered()), SLOT(activatePrevTab())); + connect(activatePrevTab, &QAction::triggered, this, &DolphinMainWindow::activatePrevTab); activatePrevTab->setShortcuts(QApplication::isRightToLeft() ? nextTabKeys : prevTabKeys); // for context menu - KAction* openInNewTab = actionCollection()->addAction("open_in_new_tab"); + QAction* openInNewTab = actionCollection()->addAction("open_in_new_tab"); openInNewTab->setText(i18nc("@action:inmenu", "Open in New Tab")); - openInNewTab->setIcon(KIcon("tab-new")); - connect(openInNewTab, SIGNAL(triggered()), this, SLOT(openInNewTab())); + openInNewTab->setIcon(QIcon::fromTheme("tab-new")); + connect(openInNewTab, &QAction::triggered, this, &DolphinMainWindow::openInNewTab); - KAction* openInNewTabs = actionCollection()->addAction("open_in_new_tabs"); + QAction* openInNewTabs = actionCollection()->addAction("open_in_new_tabs"); openInNewTabs->setText(i18nc("@action:inmenu", "Open in New Tabs")); - openInNewTabs->setIcon(KIcon("tab-new")); - connect(openInNewTabs, SIGNAL(triggered()), this, SLOT(openInNewTab())); + openInNewTabs->setIcon(QIcon::fromTheme("tab-new")); + connect(openInNewTabs, &QAction::triggered, this, &DolphinMainWindow::openInNewTab); - KAction* openInNewWindow = actionCollection()->addAction("open_in_new_window"); + QAction* openInNewWindow = actionCollection()->addAction("open_in_new_window"); openInNewWindow->setText(i18nc("@action:inmenu", "Open in New Window")); - openInNewWindow->setIcon(KIcon("window-new")); - connect(openInNewWindow, SIGNAL(triggered()), this, SLOT(openInNewWindow())); + openInNewWindow->setIcon(QIcon::fromTheme("window-new")); + connect(openInNewWindow, &QAction::triggered, this, &DolphinMainWindow::openInNewWindow); } void DolphinMainWindow::setupDockWidgets() @@ -1430,32 +1429,32 @@ void DolphinMainWindow::setupDockWidgets() KDualAction* lockLayoutAction = actionCollection()->add("lock_panels"); lockLayoutAction->setActiveText(i18nc("@action:inmenu Panels", "Unlock Panels")); - lockLayoutAction->setActiveIcon(KIcon("object-unlocked")); + lockLayoutAction->setActiveIcon(QIcon::fromTheme("object-unlocked")); lockLayoutAction->setInactiveText(i18nc("@action:inmenu Panels", "Lock Panels")); - lockLayoutAction->setInactiveIcon(KIcon("object-locked")); + lockLayoutAction->setInactiveIcon(QIcon::fromTheme("object-locked")); lockLayoutAction->setActive(lock); - connect(lockLayoutAction, SIGNAL(triggered()), this, SLOT(togglePanelLockState())); + connect(lockLayoutAction, &KDualAction::triggered, this, &DolphinMainWindow::togglePanelLockState); // Setup "Information" DolphinDockWidget* infoDock = new DolphinDockWidget(i18nc("@title:window", "Information")); infoDock->setLocked(lock); infoDock->setObjectName("infoDock"); infoDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea); - Panel* infoPanel = new InformationPanel(infoDock); + InformationPanel* infoPanel = new InformationPanel(infoDock); infoPanel->setCustomContextMenuActions(QList() << lockLayoutAction); - connect(infoPanel, SIGNAL(urlActivated(KUrl)), this, SLOT(handleUrl(KUrl))); + connect(infoPanel, &InformationPanel::urlActivated, this, &DolphinMainWindow::handleUrl); infoDock->setWidget(infoPanel); QAction* infoAction = infoDock->toggleViewAction(); - createPanelAction(KIcon("dialog-information"), Qt::Key_F11, infoAction, "show_information_panel"); + createPanelAction(QIcon::fromTheme("dialog-information"), Qt::Key_F11, infoAction, "show_information_panel"); addDockWidget(Qt::RightDockWidgetArea, infoDock); - connect(this, SIGNAL(urlChanged(KUrl)), - infoPanel, SLOT(setUrl(KUrl))); - connect(this, SIGNAL(selectionChanged(KFileItemList)), - infoPanel, SLOT(setSelection(KFileItemList))); - connect(this, SIGNAL(requestItemInfo(KFileItem)), - infoPanel, SLOT(requestDelayedItemInfo(KFileItem))); + connect(this, &DolphinMainWindow::urlChanged, + infoPanel, &InformationPanel::setUrl); + connect(this, &DolphinMainWindow::selectionChanged, + infoPanel, &InformationPanel::setSelection); + connect(this, &DolphinMainWindow::requestItemInfo, + infoPanel, &InformationPanel::requestDelayedItemInfo); // Setup "Folders" DolphinDockWidget* foldersDock = new DolphinDockWidget(i18nc("@title:window", "Folders")); @@ -1467,17 +1466,17 @@ void DolphinMainWindow::setupDockWidgets() foldersDock->setWidget(foldersPanel); QAction* foldersAction = foldersDock->toggleViewAction(); - createPanelAction(KIcon("folder"), Qt::Key_F7, foldersAction, "show_folders_panel"); + createPanelAction(QIcon::fromTheme("folder"), Qt::Key_F7, foldersAction, "show_folders_panel"); addDockWidget(Qt::LeftDockWidgetArea, foldersDock); - connect(this, SIGNAL(urlChanged(KUrl)), - foldersPanel, SLOT(setUrl(KUrl))); - connect(foldersPanel, SIGNAL(folderActivated(KUrl)), - this, SLOT(changeUrl(KUrl))); + connect(this, &DolphinMainWindow::urlChanged, + foldersPanel, &FoldersPanel::setUrl); + connect(foldersPanel, &FoldersPanel::folderActivated, + this, &DolphinMainWindow::changeUrl); connect(foldersPanel, SIGNAL(folderMiddleClicked(KUrl)), this, SLOT(openNewTab(KUrl))); - connect(foldersPanel, SIGNAL(errorMessage(QString)), - this, SLOT(slotPanelErrorMessage(QString))); + connect(foldersPanel, &FoldersPanel::errorMessage, + this, &DolphinMainWindow::slotPanelErrorMessage); // Setup "Terminal" #ifndef Q_OS_WIN @@ -1485,21 +1484,21 @@ void DolphinMainWindow::setupDockWidgets() terminalDock->setLocked(lock); terminalDock->setObjectName("terminalDock"); terminalDock->setAllowedAreas(Qt::TopDockWidgetArea | Qt::BottomDockWidgetArea); - Panel* terminalPanel = new TerminalPanel(terminalDock); + TerminalPanel* terminalPanel = new TerminalPanel(terminalDock); terminalPanel->setCustomContextMenuActions(QList() << lockLayoutAction); terminalDock->setWidget(terminalPanel); - connect(terminalPanel, SIGNAL(hideTerminalPanel()), terminalDock, SLOT(hide())); - connect(terminalPanel, SIGNAL(changeUrl(KUrl)), this, SLOT(slotTerminalDirectoryChanged(KUrl))); - connect(terminalDock, SIGNAL(visibilityChanged(bool)), - terminalPanel, SLOT(dockVisibilityChanged())); + connect(terminalPanel, &TerminalPanel::hideTerminalPanel, terminalDock, &DolphinDockWidget::hide); + connect(terminalPanel, &TerminalPanel::changeUrl, this, &DolphinMainWindow::slotTerminalDirectoryChanged); + connect(terminalDock, &DolphinDockWidget::visibilityChanged, + terminalPanel, &TerminalPanel::dockVisibilityChanged); QAction* terminalAction = terminalDock->toggleViewAction(); - createPanelAction(KIcon("utilities-terminal"), Qt::Key_F4, terminalAction, "show_terminal_panel"); + createPanelAction(QIcon::fromTheme("utilities-terminal"), Qt::Key_F4, terminalAction, "show_terminal_panel"); addDockWidget(Qt::BottomDockWidgetArea, terminalDock); - connect(this, SIGNAL(urlChanged(KUrl)), - terminalPanel, SLOT(setUrl(KUrl))); + connect(this, &DolphinMainWindow::urlChanged, + terminalPanel, &TerminalPanel::setUrl); #endif if (GeneralSettings::version() < 200) { @@ -1521,21 +1520,21 @@ void DolphinMainWindow::setupDockWidgets() placesDock->setWidget(placesPanel); QAction* placesAction = placesDock->toggleViewAction(); - createPanelAction(KIcon("bookmarks"), Qt::Key_F9, placesAction, "show_places_panel"); + createPanelAction(QIcon::fromTheme("bookmarks"), Qt::Key_F9, placesAction, "show_places_panel"); addDockWidget(Qt::LeftDockWidgetArea, placesDock); - connect(placesPanel, SIGNAL(placeActivated(KUrl)), - this, SLOT(slotPlaceActivated(KUrl))); + connect(placesPanel, &PlacesPanel::placeActivated, + this, &DolphinMainWindow::slotPlaceActivated); connect(placesPanel, SIGNAL(placeMiddleClicked(KUrl)), this, SLOT(openNewTab(KUrl))); - connect(placesPanel, SIGNAL(errorMessage(QString)), - this, SLOT(slotPanelErrorMessage(QString))); - connect(this, SIGNAL(urlChanged(KUrl)), - placesPanel, SLOT(setUrl(KUrl))); - connect(placesDock, SIGNAL(visibilityChanged(bool)), - this, SLOT(slotPlacesPanelVisibilityChanged(bool))); - connect(this, SIGNAL(settingsChanged()), - placesPanel, SLOT(readSettings())); + connect(placesPanel, &PlacesPanel::errorMessage, + this, &DolphinMainWindow::slotPanelErrorMessage); + connect(this, &DolphinMainWindow::urlChanged, + placesPanel, &PlacesPanel::setUrl); + connect(placesDock, &DolphinDockWidget::visibilityChanged, + this, &DolphinMainWindow::slotPlacesPanelVisibilityChanged); + connect(this, &DolphinMainWindow::settingsChanged, + placesPanel, &PlacesPanel::readSettings); // Add actions into the "Panels" menu KActionMenu* panelsMenu = new KActionMenu(i18nc("@action:inmenu View", "Panels"), this); @@ -1607,29 +1606,29 @@ void DolphinMainWindow::createControlButton() Q_ASSERT(!m_controlButton); m_controlButton = new QToolButton(this); - m_controlButton->setIcon(KIcon("applications-system")); + m_controlButton->setIcon(QIcon::fromTheme("applications-system")); m_controlButton->setText(i18nc("@action", "Control")); m_controlButton->setPopupMode(QToolButton::InstantPopup); m_controlButton->setToolButtonStyle(toolBar()->toolButtonStyle()); KMenu* controlMenu = new KMenu(m_controlButton); - connect(controlMenu, SIGNAL(aboutToShow()), this, SLOT(updateControlMenu())); + connect(controlMenu, &KMenu::aboutToShow, this, &DolphinMainWindow::updateControlMenu); m_controlButton->setMenu(controlMenu); toolBar()->addWidget(m_controlButton); - connect(toolBar(), SIGNAL(iconSizeChanged(QSize)), - m_controlButton, SLOT(setIconSize(QSize))); - connect(toolBar(), SIGNAL(toolButtonStyleChanged(Qt::ToolButtonStyle)), - m_controlButton, SLOT(setToolButtonStyle(Qt::ToolButtonStyle))); + connect(toolBar(), &KToolBar::iconSizeChanged, + m_controlButton, &QToolButton::setIconSize); + connect(toolBar(), &KToolBar::toolButtonStyleChanged, + m_controlButton, &QToolButton::setToolButtonStyle); // The added widgets are owned by the toolbar and may get deleted when e.g. the toolbar // gets edited. In this case we must add them again. The adding is done asynchronously by // m_updateToolBarTimer. - connect(m_controlButton, SIGNAL(destroyed()), this, SLOT(slotControlButtonDeleted())); + connect(m_controlButton, &QToolButton::destroyed, this, &DolphinMainWindow::slotControlButtonDeleted); m_updateToolBarTimer = new QTimer(this); m_updateToolBarTimer->setInterval(500); - connect(m_updateToolBarTimer, SIGNAL(timeout()), this, SLOT(updateToolBar())); + connect(m_updateToolBarTimer, &QTimer::timeout, this, &DolphinMainWindow::updateToolBar); } void DolphinMainWindow::deleteControlButton() @@ -1681,36 +1680,36 @@ void DolphinMainWindow::clearStatusBar() void DolphinMainWindow::connectViewSignals(DolphinViewContainer* container) { - connect(container, SIGNAL(showFilterBarChanged(bool)), - this, SLOT(updateFilterBarAction(bool))); - connect(container, SIGNAL(writeStateChanged(bool)), - this, SLOT(slotWriteStateChanged(bool))); + connect(container, &DolphinViewContainer::showFilterBarChanged, + this, &DolphinMainWindow::updateFilterBarAction); + connect(container, &DolphinViewContainer::writeStateChanged, + this, &DolphinMainWindow::slotWriteStateChanged); const DolphinView* view = container->view(); - connect(view, SIGNAL(selectionChanged(KFileItemList)), - this, SLOT(slotSelectionChanged(KFileItemList))); - connect(view, SIGNAL(requestItemInfo(KFileItem)), - this, SLOT(slotRequestItemInfo(KFileItem))); + connect(view, &DolphinView::selectionChanged, + this, &DolphinMainWindow::slotSelectionChanged); + connect(view, &DolphinView::requestItemInfo, + this, &DolphinMainWindow::slotRequestItemInfo); connect(view, SIGNAL(tabRequested(KUrl)), this, SLOT(openNewTab(KUrl))); - connect(view, SIGNAL(requestContextMenu(QPoint,KFileItem,KUrl,QList)), - this, SLOT(openContextMenu(QPoint,KFileItem,KUrl,QList))); - connect(view, SIGNAL(directoryLoadingStarted()), - this, SLOT(enableStopAction())); - connect(view, SIGNAL(directoryLoadingCompleted()), - this, SLOT(disableStopAction())); - connect(view, SIGNAL(goBackRequested()), - this, SLOT(goBack())); - connect(view, SIGNAL(goForwardRequested()), - this, SLOT(goForward())); + connect(view, &DolphinView::requestContextMenu, + this, &DolphinMainWindow::openContextMenu); + connect(view, &DolphinView::directoryLoadingStarted, + this, &DolphinMainWindow::enableStopAction); + connect(view, &DolphinView::directoryLoadingCompleted, + this, &DolphinMainWindow::disableStopAction); + connect(view, &DolphinView::goBackRequested, + this, static_cast(&DolphinMainWindow::goBack)); + connect(view, &DolphinView::goForwardRequested, + this, static_cast(&DolphinMainWindow::goForward)); const KUrlNavigator* navigator = container->urlNavigator(); - connect(navigator, SIGNAL(urlChanged(KUrl)), - this, SLOT(changeUrl(KUrl))); - connect(navigator, SIGNAL(historyChanged()), - this, SLOT(updateHistory())); - connect(navigator, SIGNAL(editableStateChanged(bool)), - this, SLOT(slotEditableStateChanged(bool))); + connect(navigator, &KUrlNavigator::urlChanged, + this, &DolphinMainWindow::changeUrl); + connect(navigator, &KUrlNavigator::historyChanged, + this, &DolphinMainWindow::updateHistory); + connect(navigator, &KUrlNavigator::editableStateChanged, + this, &DolphinMainWindow::slotEditableStateChanged); connect(navigator, SIGNAL(tabRequested(KUrl)), this, SLOT(openNewTab(KUrl))); } @@ -1732,7 +1731,7 @@ void DolphinMainWindow::updateSplitAction() } else { splitAction->setText(i18nc("@action:intoolbar Split view", "Split")); splitAction->setToolTip(i18nc("@info", "Split view")); - splitAction->setIcon(KIcon("view-right-new")); + splitAction->setIcon(QIcon::fromTheme("view-right-new")); } } @@ -1789,20 +1788,20 @@ QString DolphinMainWindow::squeezedText(const QString& text) const return fm.elidedText(text, Qt::ElideMiddle, fm.maxWidth() * 10); } -void DolphinMainWindow::createPanelAction(const KIcon& icon, +void DolphinMainWindow::createPanelAction(const QIcon& icon, const QKeySequence& shortcut, QAction* dockAction, const QString& actionName) { - KAction* panelAction = actionCollection()->addAction(actionName); + QAction* panelAction = actionCollection()->addAction(actionName); panelAction->setCheckable(true); panelAction->setChecked(dockAction->isChecked()); panelAction->setText(dockAction->text()); panelAction->setIcon(icon); panelAction->setShortcut(shortcut); - connect(panelAction, SIGNAL(triggered()), dockAction, SLOT(trigger())); - connect(dockAction, SIGNAL(toggled(bool)), panelAction, SLOT(setChecked(bool))); + connect(panelAction, &QAction::triggered, dockAction, &QAction::trigger); + connect(dockAction, &QAction::toggled, panelAction, &QAction::setChecked); } DolphinMainWindow::UndoUiInterface::UndoUiInterface() : @@ -1825,4 +1824,3 @@ void DolphinMainWindow::UndoUiInterface::jobError(KIO::Job* job) } } -#include "dolphinmainwindow.moc" diff --git a/src/dolphinmainwindow.h b/src/dolphinmainwindow.h index 9c7f185bc..4816837fc 100644 --- a/src/dolphinmainwindow.h +++ b/src/dolphinmainwindow.h @@ -29,6 +29,7 @@ #include #include #include +#include #include #include @@ -47,10 +48,10 @@ class KFileItem; class KFileItemList; class KJob; class KNewFileMenu; -class KUrl; class QSplitter; class QToolButton; class QVBoxLayout; +class QIcon; /** * @short Main window for Dolphin. @@ -529,7 +530,7 @@ private: * as the action for toggling the dock visibility is done by Qt which * is no KAction instance. */ - void createPanelAction(const KIcon& icon, + void createPanelAction(const QIcon &icon, const QKeySequence& shortcut, QAction* dockAction, const QString& actionName); diff --git a/src/dolphinnewfilemenu.cpp b/src/dolphinnewfilemenu.cpp index da57ca946..87f0932d8 100644 --- a/src/dolphinnewfilemenu.cpp +++ b/src/dolphinnewfilemenu.cpp @@ -45,4 +45,3 @@ void DolphinNewFileMenu::slotResult(KJob* job) } } -#include "dolphinnewfilemenu.moc" diff --git a/src/dolphinpart.cpp b/src/dolphinpart.cpp index 908173193..479b80951 100644 --- a/src/dolphinpart.cpp +++ b/src/dolphinpart.cpp @@ -34,6 +34,7 @@ #include #include #include +#include #include #include #include @@ -42,9 +43,7 @@ #include #include -#if KDE_IS_VERSION(4, 9, 2) #include "dolphinpart_ext.h" -#endif #include "dolphinnewfilemenu.h" #include "views/dolphinview.h" @@ -69,7 +68,8 @@ DolphinPart::DolphinPart(QWidget* parentWidget, QObject* parent, const QVariantL ,m_removeAction(0) { Q_UNUSED(args) - setComponentData(DolphinPartFactory::componentData(), false); +#pragma message("TODO: port to KF5") + //setComponentData(DolphinPartFactory::componentData(), false); m_extension = new DolphinPartBrowserExtension(this); // make sure that other apps using this part find Dolphin's view-file-columns icons @@ -79,73 +79,71 @@ DolphinPart::DolphinPart(QWidget* parentWidget, QObject* parent, const QVariantL m_view->setTabsForFilesEnabled(true); setWidget(m_view); - connect(&DolphinNewFileMenuObserver::instance(), SIGNAL(errorMessage(QString)), - this, SLOT(slotErrorMessage(QString))); + connect(&DolphinNewFileMenuObserver::instance(), &DolphinNewFileMenuObserver::errorMessage, + this, &DolphinPart::slotErrorMessage); - connect(m_view, SIGNAL(directoryLoadingCompleted()), this, SIGNAL(completed())); - connect(m_view, SIGNAL(directoryLoadingProgress(int)), this, SLOT(updateProgress(int))); - connect(m_view, SIGNAL(errorMessage(QString)), this, SLOT(slotErrorMessage(QString))); + connect(m_view, &DolphinView::directoryLoadingCompleted, this, static_cast(&DolphinPart::completed)); + connect(m_view, &DolphinView::directoryLoadingProgress, this, &DolphinPart::updateProgress); + connect(m_view, &DolphinView::errorMessage, this, &DolphinPart::slotErrorMessage); setXMLFile("dolphinpart.rc"); - connect(m_view, SIGNAL(infoMessage(QString)), - this, SLOT(slotMessage(QString))); - connect(m_view, SIGNAL(operationCompletedMessage(QString)), - this, SLOT(slotMessage(QString))); - connect(m_view, SIGNAL(errorMessage(QString)), - this, SLOT(slotErrorMessage(QString))); - connect(m_view, SIGNAL(itemActivated(KFileItem)), - this, SLOT(slotItemActivated(KFileItem))); - connect(m_view, SIGNAL(itemsActivated(KFileItemList)), - this, SLOT(slotItemsActivated(KFileItemList))); - connect(m_view, SIGNAL(tabRequested(KUrl)), - this, SLOT(createNewWindow(KUrl))); - connect(m_view, SIGNAL(requestContextMenu(QPoint,KFileItem,KUrl,QList)), - this, SLOT(slotOpenContextMenu(QPoint,KFileItem,KUrl,QList))); - connect(m_view, SIGNAL(selectionChanged(KFileItemList)), - m_extension, SIGNAL(selectionInfo(KFileItemList))); - connect(m_view, SIGNAL(selectionChanged(KFileItemList)), - this, SLOT(slotSelectionChanged(KFileItemList))); - connect(m_view, SIGNAL(requestItemInfo(KFileItem)), - this, SLOT(slotRequestItemInfo(KFileItem))); - connect(m_view, SIGNAL(modeChanged(DolphinView::Mode,DolphinView::Mode)), - this, SIGNAL(viewModeChanged())); // relay signal - connect(m_view, SIGNAL(redirection(KUrl,KUrl)), - this, SLOT(slotDirectoryRedirection(KUrl,KUrl))); + connect(m_view, &DolphinView::infoMessage, + this, &DolphinPart::slotMessage); + connect(m_view, &DolphinView::operationCompletedMessage, + this, &DolphinPart::slotMessage); + connect(m_view, &DolphinView::errorMessage, + this, &DolphinPart::slotErrorMessage); + connect(m_view, &DolphinView::itemActivated, + this, &DolphinPart::slotItemActivated); + connect(m_view, &DolphinView::itemsActivated, + this, &DolphinPart::slotItemsActivated); + connect(m_view, &DolphinView::tabRequested, + this, &DolphinPart::createNewWindow); + connect(m_view, &DolphinView::requestContextMenu, + this, &DolphinPart::slotOpenContextMenu); + connect(m_view, &DolphinView::selectionChanged, + m_extension, static_cast(&DolphinPartBrowserExtension::selectionInfo)); + connect(m_view, &DolphinView::selectionChanged, + this, &DolphinPart::slotSelectionChanged); + connect(m_view, &DolphinView::requestItemInfo, + this, &DolphinPart::slotRequestItemInfo); + connect(m_view, &DolphinView::modeChanged, + this, &DolphinPart::viewModeChanged); // relay signal + connect(m_view, &DolphinView::redirection, + this, &DolphinPart::slotDirectoryRedirection); // Watch for changes that should result in updates to the // status bar text. - connect(m_view, SIGNAL(itemCountChanged()), this, SLOT(updateStatusBar())); - connect(m_view, SIGNAL(selectionChanged(KFileItemList)), this, SLOT(updateStatusBar())); + connect(m_view, &DolphinView::itemCountChanged, this, &DolphinPart::updateStatusBar); + connect(m_view, &DolphinView::selectionChanged, this, &DolphinPart::updateStatusBar); m_actionHandler = new DolphinViewActionHandler(actionCollection(), this); m_actionHandler->setCurrentView(m_view); - connect(m_actionHandler, SIGNAL(createDirectory()), SLOT(createDirectory())); + connect(m_actionHandler, &DolphinViewActionHandler::createDirectory, this, &DolphinPart::createDirectory); m_remoteEncoding = new DolphinRemoteEncoding(this, m_actionHandler); - connect(this, SIGNAL(aboutToOpenURL()), - m_remoteEncoding, SLOT(slotAboutToOpenUrl())); + connect(this, &DolphinPart::aboutToOpenURL, + m_remoteEncoding, &DolphinRemoteEncoding::slotAboutToOpenUrl); QClipboard* clipboard = QApplication::clipboard(); - connect(clipboard, SIGNAL(dataChanged()), - this, SLOT(updatePasteAction())); + connect(clipboard, &QClipboard::dataChanged, + this, &DolphinPart::updatePasteAction); // Create file info and listing filter extensions. // NOTE: Listing filter needs to be instantiated after the creation of the view. new DolphinPartFileInfoExtension(this); -#if KDE_IS_VERSION(4, 9, 2) new DolphinPartListingFilterExtension(this); KDirLister* lister = m_view->m_model->m_dirLister; if (lister) { DolphinPartListingNotificationExtension* notifyExt = new DolphinPartListingNotificationExtension(this); - connect(lister, SIGNAL(newItems(KFileItemList)), notifyExt, SLOT(slotNewItems(KFileItemList))); - connect(lister, SIGNAL(itemsDeleted(KFileItemList)), notifyExt, SLOT(slotItemsDeleted(KFileItemList))); + connect(lister, &KDirLister::newItems, notifyExt, &DolphinPartListingNotificationExtension::slotNewItems); + connect(lister, &KDirLister::itemsDeleted, notifyExt, &DolphinPartListingNotificationExtension::slotItemsDeleted); } else { kWarning() << "NULL KDirLister object! KParts::ListingNotificationExtension will NOT be supported"; } -#endif createActions(); m_actionHandler->updateViewActions(); @@ -171,40 +169,40 @@ void DolphinPart::createActions() m_newFileMenu = new DolphinNewFileMenu(actionCollection(), this); m_newFileMenu->setParentWidget(widget()); - connect(m_newFileMenu->menu(), SIGNAL(aboutToShow()), - this, SLOT(updateNewMenu())); + connect(m_newFileMenu->menu(), &QMenu::aboutToShow, + this, &DolphinPart::updateNewMenu); - KAction *editMimeTypeAction = actionCollection()->addAction( "editMimeType" ); + QAction *editMimeTypeAction = actionCollection()->addAction( "editMimeType" ); editMimeTypeAction->setText( i18nc("@action:inmenu Edit", "&Edit File Type..." ) ); - connect(editMimeTypeAction, SIGNAL(triggered()), SLOT(slotEditMimeType())); + connect(editMimeTypeAction, &QAction::triggered, this, &DolphinPart::slotEditMimeType); - KAction* selectItemsMatching = actionCollection()->addAction("select_items_matching"); + QAction* selectItemsMatching = actionCollection()->addAction("select_items_matching"); selectItemsMatching->setText(i18nc("@action:inmenu Edit", "Select Items Matching...")); selectItemsMatching->setShortcut(Qt::CTRL | Qt::Key_S); - connect(selectItemsMatching, SIGNAL(triggered()), this, SLOT(slotSelectItemsMatchingPattern())); + connect(selectItemsMatching, &QAction::triggered, this, &DolphinPart::slotSelectItemsMatchingPattern); - KAction* unselectItemsMatching = actionCollection()->addAction("unselect_items_matching"); + QAction* unselectItemsMatching = actionCollection()->addAction("unselect_items_matching"); unselectItemsMatching->setText(i18nc("@action:inmenu Edit", "Unselect Items Matching...")); - connect(unselectItemsMatching, SIGNAL(triggered()), this, SLOT(slotUnselectItemsMatchingPattern())); + connect(unselectItemsMatching, &QAction::triggered, this, &DolphinPart::slotUnselectItemsMatchingPattern); actionCollection()->addAction(KStandardAction::SelectAll, "select_all", m_view, SLOT(selectAll())); - KAction* unselectAll = actionCollection()->addAction("unselect_all"); + QAction* unselectAll = actionCollection()->addAction("unselect_all"); unselectAll->setText(i18nc("@action:inmenu Edit", "Unselect All")); - connect(unselectAll, SIGNAL(triggered()), m_view, SLOT(clearSelection())); + connect(unselectAll, &QAction::triggered, m_view, &DolphinView::clearSelection); - KAction* invertSelection = actionCollection()->addAction("invert_selection"); + QAction* invertSelection = actionCollection()->addAction("invert_selection"); invertSelection->setText(i18nc("@action:inmenu Edit", "Invert Selection")); invertSelection->setShortcut(Qt::CTRL | Qt::SHIFT | Qt::Key_A); - connect(invertSelection, SIGNAL(triggered()), m_view, SLOT(invertSelection())); + connect(invertSelection, &QAction::triggered, m_view, &DolphinView::invertSelection); // View menu: all done by DolphinViewActionHandler // Go menu QActionGroup* goActionGroup = new QActionGroup(this); - connect(goActionGroup, SIGNAL(triggered(QAction*)), - this, SLOT(slotGoTriggered(QAction*))); + connect(goActionGroup, &QActionGroup::triggered, + this, &DolphinPart::slotGoTriggered); createGoAction("go_applications", "start-here-kde", i18nc("@action:inmenu Go", "App&lications"), QString("programs:/"), @@ -219,21 +217,21 @@ void DolphinPart::createActions() i18nc("@action:inmenu Go", "Trash"), QString("trash:/"), goActionGroup); createGoAction("go_autostart", "", - i18nc("@action:inmenu Go", "Autostart"), KGlobalSettings::autostartPath(), + i18nc("@action:inmenu Go", "Autostart"), QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation) + "/autostart", goActionGroup); // Tools menu m_findFileAction = actionCollection()->addAction("find_file"); m_findFileAction->setText(i18nc("@action:inmenu Tools", "Find File...")); m_findFileAction->setShortcut(Qt::CTRL | Qt::Key_F); - m_findFileAction->setIcon(KIcon("edit-find")); - connect(m_findFileAction, SIGNAL(triggered()), this, SLOT(slotFindFile())); + m_findFileAction->setIcon(QIcon::fromTheme("edit-find")); + connect(m_findFileAction, &QAction::triggered, this, &DolphinPart::slotFindFile); if (KAuthorized::authorizeKAction("shell_access")) { m_openTerminalAction = actionCollection()->addAction("open_terminal"); - m_openTerminalAction->setIcon(KIcon("utilities-terminal")); + m_openTerminalAction->setIcon(QIcon::fromTheme("utilities-terminal")); m_openTerminalAction->setText(i18nc("@action:inmenu Tools", "Open &Terminal")); - connect(m_openTerminalAction, SIGNAL(triggered()), SLOT(slotOpenTerminal())); + connect(m_openTerminalAction, &QAction::triggered, this, &DolphinPart::slotOpenTerminal); m_openTerminalAction->setShortcut(Qt::Key_F4); } } @@ -242,8 +240,8 @@ void DolphinPart::createGoAction(const char* name, const char* iconName, const QString& text, const QString& url, QActionGroup* actionGroup) { - KAction* action = actionCollection()->addAction(name); - action->setIcon(KIcon(iconName)); + QAction* action = actionCollection()->addAction(name); + action->setIcon(QIcon::fromTheme(iconName)); action->setText(text); action->setData(url); action->setActionGroup(actionGroup); @@ -301,10 +299,10 @@ void DolphinPart::updatePasteAction() KAboutData* DolphinPart::createAboutData() { - return new KAboutData("dolphinpart", "dolphin", ki18nc("@title", "Dolphin Part"), "0.1"); + return new KAboutData("dolphinpart", i18nc("@title", "Dolphin Part"), "0.1"); } -bool DolphinPart::openUrl(const KUrl& url) +bool DolphinPart::openUrl(const QUrl &url) { bool reload = arguments().reload(); // A bit of a workaround so that changing the namefilter works: force reload. @@ -559,7 +557,7 @@ void DolphinPart::slotOpenTerminal() void DolphinPart::slotFindFile() { - KRun::run("kfind", url(), widget()); + KRun::run("kfind", QList() << url(), widget()); } void DolphinPart::updateNewMenu() diff --git a/src/dolphinpart.h b/src/dolphinpart.h index 7146b46af..9ab1e80ce 100644 --- a/src/dolphinpart.h +++ b/src/dolphinpart.h @@ -20,14 +20,14 @@ #ifndef DOLPHINPART_H #define DOLPHINPART_H -#include +#include +#include #include class DolphinNewFileMenu; class DolphinViewActionHandler; class QActionGroup; -class KAction; class KFileItemList; class KFileItem; class DolphinPartBrowserExtension; @@ -65,7 +65,7 @@ public: * Standard KParts::ReadOnlyPart openUrl method. * Called by Konqueror to view a directory in DolphinPart. */ - virtual bool openUrl(const KUrl& url); + virtual bool openUrl(const QUrl& url) Q_DECL_OVERRIDE; /// see the supportsUndo property bool supportsUndo() const { return true; } @@ -243,8 +243,8 @@ private: DolphinRemoteEncoding* m_remoteEncoding; DolphinPartBrowserExtension* m_extension; DolphinNewFileMenu* m_newFileMenu; - KAction* m_findFileAction; - KAction* m_openTerminalAction; + QAction* m_findFileAction; + QAction* m_openTerminalAction; QString m_nameFilter; DolphinRemoveAction* m_removeAction; Q_DISABLE_COPY(DolphinPart) diff --git a/src/dolphinpart_ext.cpp b/src/dolphinpart_ext.cpp index fb7a4d2ea..8e2985878 100644 --- a/src/dolphinpart_ext.cpp +++ b/src/dolphinpart_ext.cpp @@ -190,4 +190,3 @@ void DolphinPartListingNotificationExtension::slotItemsDeleted(const KFileItemLi emit listingEvent(KParts::ListingNotificationExtension::ItemsDeleted, items); } -#include "dolphinpart_ext.moc" diff --git a/src/dolphinpart_ext.h b/src/dolphinpart_ext.h index c05962cd9..5272df69d 100644 --- a/src/dolphinpart_ext.h +++ b/src/dolphinpart_ext.h @@ -23,6 +23,7 @@ #include #include #include +#include class DolphinPart; diff --git a/src/dolphinrecenttabsmenu.cpp b/src/dolphinrecenttabsmenu.cpp index a39f9945b..d0b694c03 100644 --- a/src/dolphinrecenttabsmenu.cpp +++ b/src/dolphinrecenttabsmenu.cpp @@ -25,13 +25,13 @@ #include DolphinRecentTabsMenu::DolphinRecentTabsMenu(QObject* parent) : - KActionMenu(KIcon("edit-undo"), i18n("Recently Closed Tabs"), parent) + KActionMenu(QIcon::fromTheme("edit-undo"), i18n("Recently Closed Tabs"), parent) { setDelayed(false); setEnabled(false); m_clearListAction = new QAction(i18n("Empty Recently Closed Tabs"), this); - m_clearListAction->setIcon(KIcon("edit-clear-list")); + m_clearListAction->setIcon(QIcon::fromTheme("edit-clear-list")); addAction(m_clearListAction); addSeparator(); @@ -46,7 +46,7 @@ void DolphinRecentTabsMenu::rememberClosedTab(const KUrl& primaryUrl, const KUrl action->setText(primaryUrl.path()); const QString iconName = KMimeType::iconNameForUrl(primaryUrl); - action->setIcon(KIcon(iconName)); + action->setIcon(QIcon::fromTheme(iconName)); KUrl::List urls; urls << primaryUrl; diff --git a/src/dolphinremoveaction.cpp b/src/dolphinremoveaction.cpp index 7d7c2f043..1ce292604 100644 --- a/src/dolphinremoveaction.cpp +++ b/src/dolphinremoveaction.cpp @@ -29,7 +29,7 @@ DolphinRemoveAction::DolphinRemoveAction(QObject* parent, KActionCollection* col m_collection(collection) { update(); - connect(this, SIGNAL(triggered()), this, SLOT(slotRemoveActionTriggered())); + connect(this, &DolphinRemoveAction::triggered, this, &DolphinRemoveAction::slotRemoveActionTriggered); } void DolphinRemoveAction::slotRemoveActionTriggered() diff --git a/src/dolphinviewcontainer.cpp b/src/dolphinviewcontainer.cpp index 2a45152bd..87a2ceb4d 100644 --- a/src/dolphinviewcontainer.cpp +++ b/src/dolphinviewcontainer.cpp @@ -26,6 +26,7 @@ #include #include #include +#include #include #include @@ -82,91 +83,115 @@ DolphinViewContainer::DolphinViewContainer(const KUrl& url, QWidget* parent) : m_topLayout->setMargin(0); m_urlNavigator = new KUrlNavigator(new KFilePlacesModel(this), url, this); - connect(m_urlNavigator, SIGNAL(urlsDropped(KUrl,QDropEvent*)), - this, SLOT(dropUrls(KUrl,QDropEvent*))); - connect(m_urlNavigator, SIGNAL(activated()), - this, SLOT(activate())); - connect(m_urlNavigator->editor(), SIGNAL(completionModeChanged(KGlobalSettings::Completion)), - this, SLOT(saveUrlCompletionMode(KGlobalSettings::Completion))); + connect(m_urlNavigator, &KUrlNavigator::urlsDropped, + this, &DolphinViewContainer::dropUrls); + connect(m_urlNavigator, &KUrlNavigator::activated, + this, &DolphinViewContainer::activate); + connect(m_urlNavigator->editor(), &KUrlComboBox::completionModeChanged, + this, &DolphinViewContainer::saveUrlCompletionMode); const GeneralSettings* settings = GeneralSettings::self(); m_urlNavigator->setUrlEditable(settings->editableUrl()); m_urlNavigator->setShowFullPath(settings->showFullPath()); m_urlNavigator->setHomeUrl(KUrl(settings->homeUrl())); KUrlComboBox* editor = m_urlNavigator->editor(); - editor->setCompletionMode(KGlobalSettings::Completion(settings->urlCompletionMode())); + editor->setCompletionMode(KCompletion::CompletionMode(settings->urlCompletionMode())); m_searchBox = new DolphinSearchBox(this); m_searchBox->hide(); - connect(m_searchBox, SIGNAL(activated()), this, SLOT(activate())); - connect(m_searchBox, SIGNAL(closeRequest()), this, SLOT(closeSearchBox())); - connect(m_searchBox, SIGNAL(searchRequest()), this, SLOT(startSearching())); - connect(m_searchBox, SIGNAL(returnPressed(QString)), this, SLOT(requestFocus())); + connect(m_searchBox, &DolphinSearchBox::activated, this, &DolphinViewContainer::activate); + connect(m_searchBox, &DolphinSearchBox::closeRequest, this, &DolphinViewContainer::closeSearchBox); + connect(m_searchBox, &DolphinSearchBox::searchRequest, this, &DolphinViewContainer::startSearching); + connect(m_searchBox, &DolphinSearchBox::returnPressed, this, &DolphinViewContainer::requestFocus); m_messageWidget = new KMessageWidget(this); m_messageWidget->setCloseButtonVisible(true); m_messageWidget->hide(); m_view = new DolphinView(url, this); - connect(m_view, SIGNAL(urlChanged(KUrl)), m_urlNavigator, SLOT(setUrl(KUrl))); - connect(m_view, SIGNAL(urlChanged(KUrl)), m_messageWidget, SLOT(hide())); - connect(m_view, SIGNAL(writeStateChanged(bool)), this, SIGNAL(writeStateChanged(bool))); - connect(m_view, SIGNAL(requestItemInfo(KFileItem)), this, SLOT(showItemInfo(KFileItem))); - connect(m_view, SIGNAL(itemActivated(KFileItem)), this, SLOT(slotItemActivated(KFileItem))); - connect(m_view, SIGNAL(itemsActivated(KFileItemList)), this, SLOT(slotItemsActivated(KFileItemList))); - connect(m_view, SIGNAL(redirection(KUrl,KUrl)), this, SLOT(redirect(KUrl,KUrl))); - connect(m_view, SIGNAL(directoryLoadingStarted()), this, SLOT(slotDirectoryLoadingStarted())); - connect(m_view, SIGNAL(directoryLoadingCompleted()), this, SLOT(slotDirectoryLoadingCompleted())); - connect(m_view, SIGNAL(directoryLoadingCanceled()), this, SLOT(slotDirectoryLoadingCanceled())); - connect(m_view, SIGNAL(itemCountChanged()), this, SLOT(delayedStatusBarUpdate())); - connect(m_view, SIGNAL(directoryLoadingProgress(int)), this, SLOT(updateDirectoryLoadingProgress(int))); - connect(m_view, SIGNAL(directorySortingProgress(int)), this, SLOT(updateDirectorySortingProgress(int))); - connect(m_view, SIGNAL(selectionChanged(KFileItemList)), this, SLOT(delayedStatusBarUpdate())); - connect(m_view, SIGNAL(urlAboutToBeChanged(KUrl)), this, SLOT(slotViewUrlAboutToBeChanged(KUrl))); - connect(m_view, SIGNAL(errorMessage(QString)), this, SLOT(showErrorMessage(QString))); - connect(m_view, SIGNAL(urlIsFileError(KUrl)), this, SLOT(slotUrlIsFileError(KUrl))); - connect(m_view, SIGNAL(activated()), this, SLOT(activate())); - - connect(m_urlNavigator, SIGNAL(urlAboutToBeChanged(KUrl)), - this, SLOT(slotUrlNavigatorLocationAboutToBeChanged(KUrl))); - connect(m_urlNavigator, SIGNAL(urlChanged(KUrl)), - this, SLOT(slotUrlNavigatorLocationChanged(KUrl))); - connect(m_urlNavigator, SIGNAL(historyChanged()), - this, SLOT(slotHistoryChanged())); - connect(m_urlNavigator, SIGNAL(returnPressed()), - this, SLOT(slotReturnPressed())); + connect(m_view, &DolphinView::urlChanged, + m_urlNavigator, &KUrlNavigator::setUrl); + connect(m_view, &DolphinView::urlChanged, + m_messageWidget, &KMessageWidget::hide); + connect(m_view, &DolphinView::writeStateChanged, + this, &DolphinViewContainer::writeStateChanged); + connect(m_view, &DolphinView::requestItemInfo, + this, &DolphinViewContainer::showItemInfo); + connect(m_view, &DolphinView::itemActivated, + this, &DolphinViewContainer::slotItemActivated); + connect(m_view, &DolphinView::itemsActivated, + this, &DolphinViewContainer::slotItemsActivated); + connect(m_view, &DolphinView::redirection, + this, &DolphinViewContainer::redirect); + connect(m_view, &DolphinView::directoryLoadingStarted, + this, &DolphinViewContainer::slotDirectoryLoadingStarted); + connect(m_view, &DolphinView::directoryLoadingCompleted, + this, &DolphinViewContainer::slotDirectoryLoadingCompleted); + connect(m_view, &DolphinView::directoryLoadingCanceled, + this, &DolphinViewContainer::slotDirectoryLoadingCanceled); + connect(m_view, &DolphinView::itemCountChanged, + this, &DolphinViewContainer::delayedStatusBarUpdate); + connect(m_view, &DolphinView::directoryLoadingProgress, + this, &DolphinViewContainer::updateDirectoryLoadingProgress); + connect(m_view, &DolphinView::directorySortingProgress, + this, &DolphinViewContainer::updateDirectorySortingProgress); + connect(m_view, &DolphinView::selectionChanged, + this, &DolphinViewContainer::delayedStatusBarUpdate); + connect(m_view, &DolphinView::urlAboutToBeChanged, + this, &DolphinViewContainer::slotViewUrlAboutToBeChanged); + connect(m_view, &DolphinView::errorMessage, + this, &DolphinViewContainer::showErrorMessage); + connect(m_view, &DolphinView::urlIsFileError, + this, &DolphinViewContainer::slotUrlIsFileError); + connect(m_view, &DolphinView::activated, + this, &DolphinViewContainer::activate); + + connect(m_urlNavigator, &KUrlNavigator::urlAboutToBeChanged, + this, &DolphinViewContainer::slotUrlNavigatorLocationAboutToBeChanged); + connect(m_urlNavigator, &KUrlNavigator::urlChanged, + this, &DolphinViewContainer::slotUrlNavigatorLocationChanged); + connect(m_urlNavigator, &KUrlNavigator::historyChanged, + this, &DolphinViewContainer::slotHistoryChanged); + connect(m_urlNavigator, &KUrlNavigator::returnPressed, + this, &DolphinViewContainer::slotReturnPressed); // Initialize status bar m_statusBar = new DolphinStatusBar(this); m_statusBar->setUrl(m_view->url()); m_statusBar->setZoomLevel(m_view->zoomLevel()); - connect(m_view, SIGNAL(urlChanged(KUrl)), m_statusBar, SLOT(setUrl(KUrl))); - connect(m_view, SIGNAL(zoomLevelChanged(int,int)), m_statusBar, SLOT(setZoomLevel(int))); - connect(m_view, SIGNAL(infoMessage(QString)), m_statusBar, SLOT(setText(QString))); - connect(m_view, SIGNAL(operationCompletedMessage(QString)), m_statusBar, SLOT(setText(QString))); - connect(m_statusBar, SIGNAL(stopPressed()), this, SLOT(stopDirectoryLoading())); - connect(m_statusBar, SIGNAL(zoomLevelChanged(int)), this, SLOT(slotStatusBarZoomLevelChanged(int))); + connect(m_view, &DolphinView::urlChanged, + m_statusBar, &DolphinStatusBar::setUrl); + connect(m_view, &DolphinView::zoomLevelChanged, + m_statusBar, &DolphinStatusBar::setZoomLevel); + connect(m_view, &DolphinView::infoMessage, + m_statusBar, &DolphinStatusBar::setText); + connect(m_view, &DolphinView::operationCompletedMessage, + m_statusBar, &DolphinStatusBar::setText); + connect(m_statusBar, &DolphinStatusBar::stopPressed, + this, &DolphinViewContainer::stopDirectoryLoading); + connect(m_statusBar, &DolphinStatusBar::zoomLevelChanged, + this, &DolphinViewContainer::slotStatusBarZoomLevelChanged); m_statusBarTimer = new QTimer(this); m_statusBarTimer->setSingleShot(true); m_statusBarTimer->setInterval(300); - connect(m_statusBarTimer, SIGNAL(timeout()), this, SLOT(updateStatusBar())); + connect(m_statusBarTimer, &QTimer::timeout, this, &DolphinViewContainer::updateStatusBar); KIO::FileUndoManager* undoManager = KIO::FileUndoManager::self(); - connect(undoManager, SIGNAL(jobRecordingFinished(CommandType)), - this, SLOT(delayedStatusBarUpdate())); + connect(undoManager, &KIO::FileUndoManager::jobRecordingFinished, + this, &DolphinViewContainer::delayedStatusBarUpdate); // Initialize filter bar m_filterBar = new FilterBar(this); m_filterBar->setVisible(settings->filterBar()); - connect(m_filterBar, SIGNAL(filterChanged(QString)), - this, SLOT(setNameFilter(QString))); - connect(m_filterBar, SIGNAL(closeRequest()), - this, SLOT(closeFilterBar())); - connect(m_filterBar, SIGNAL(focusViewRequest()), - this, SLOT(requestFocus())); - connect(m_view, SIGNAL(urlChanged(KUrl)), - m_filterBar, SLOT(slotUrlChanged())); + connect(m_filterBar, &FilterBar::filterChanged, + this, &DolphinViewContainer::setNameFilter); + connect(m_filterBar, &FilterBar::closeRequest, + this, &DolphinViewContainer::closeFilterBar); + connect(m_filterBar, &FilterBar::focusViewRequest, + this, &DolphinViewContainer::requestFocus); + connect(m_view, &DolphinView::urlChanged, + m_filterBar, &FilterBar::slotUrlChanged); m_topLayout->addWidget(m_urlNavigator); m_topLayout->addWidget(m_searchBox); @@ -475,7 +500,7 @@ void DolphinViewContainer::slotItemActivated(const KFileItem& item) return; } - item.run(); + new KRun(item.targetUrl(), this); } void DolphinViewContainer::slotItemsActivated(const KFileItemList& items) @@ -637,7 +662,7 @@ void DolphinViewContainer::requestFocus() m_view->setFocus(); } -void DolphinViewContainer::saveUrlCompletionMode(KGlobalSettings::Completion completion) +void DolphinViewContainer::saveUrlCompletionMode(KCompletion::CompletionMode completion) { GeneralSettings::setUrlCompletionMode(completion); } @@ -702,4 +727,3 @@ void DolphinViewContainer::saveViewState() m_urlNavigator->saveLocationState(locationState); } -#include "dolphinviewcontainer.moc" diff --git a/src/dolphinviewcontainer.h b/src/dolphinviewcontainer.h index 31612f10a..4ca76961c 100644 --- a/src/dolphinviewcontainer.h +++ b/src/dolphinviewcontainer.h @@ -22,7 +22,7 @@ #include #include -#include +#include #include #include @@ -31,9 +31,9 @@ #include #include -#include +#include -#ifdef KActivities_FOUND +#ifdef KF5Activities_FOUND namespace KActivities { class ResourceInstance; } @@ -290,7 +290,7 @@ private slots: * Saves the currently used URL completion mode of * the URL navigator. */ - void saveUrlCompletionMode(KGlobalSettings::Completion completion); + void saveUrlCompletionMode(KCompletion::CompletionMode completion); void slotHistoryChanged(); @@ -345,7 +345,7 @@ private: KUrl m_dropDestination; QScopedPointer m_dropEvent; -#ifdef KActivities_FOUND +#ifdef KF5Activities_FOUND private: KActivities::ResourceInstance * m_activityResourceInstance; #endif diff --git a/src/filterbar/filterbar.cpp b/src/filterbar/filterbar.cpp index 6de6fbe5c..827721360 100644 --- a/src/filterbar/filterbar.cpp +++ b/src/filterbar/filterbar.cpp @@ -38,7 +38,7 @@ FilterBar::FilterBar(QWidget* parent) : closeButton->setAutoRaise(true); closeButton->setIcon(KIcon("dialog-close")); closeButton->setToolTip(i18nc("@info:tooltip", "Hide Filter Bar")); - connect(closeButton, SIGNAL(clicked()), this, SIGNAL(closeRequest())); + connect(closeButton, &QToolButton::clicked, this, &FilterBar::closeRequest); // Create button to lock text when changing folders m_lockButton = new QToolButton(this); @@ -46,7 +46,7 @@ FilterBar::FilterBar(QWidget* parent) : m_lockButton->setCheckable(true); m_lockButton->setIcon(KIcon("object-unlocked")); m_lockButton->setToolTip(i18nc("@info:tooltip", "Keep Filter When Changing Folders")); - connect(m_lockButton, SIGNAL(toggled(bool)), this, SLOT(slotToggleLockButton(bool))); + connect(m_lockButton, &QToolButton::toggled, this, &FilterBar::slotToggleLockButton); // Create label QLabel* filterLabel = new QLabel(i18nc("@label:textbox", "Filter:"), this); @@ -55,8 +55,8 @@ FilterBar::FilterBar(QWidget* parent) : m_filterInput = new KLineEdit(this); m_filterInput->setLayoutDirection(Qt::LeftToRight); m_filterInput->setClearButtonShown(true); - connect(m_filterInput, SIGNAL(textChanged(QString)), - this, SIGNAL(filterChanged(QString))); + connect(m_filterInput, &KLineEdit::textChanged, + this, &FilterBar::filterChanged); setFocusProxy(m_filterInput); // Apply layout @@ -140,4 +140,3 @@ void FilterBar::keyReleaseEvent(QKeyEvent* event) } } -#include "filterbar.moc" diff --git a/src/kitemviews/kfileitemlistview.cpp b/src/kitemviews/kfileitemlistview.cpp index fd01f2c4c..0a92e75e5 100644 --- a/src/kitemviews/kfileitemlistview.cpp +++ b/src/kitemviews/kfileitemlistview.cpp @@ -29,6 +29,8 @@ #include #include #include +#include +#include #include #include @@ -62,12 +64,12 @@ KFileItemListView::KFileItemListView(QGraphicsWidget* parent) : m_updateVisibleIndexRangeTimer = new QTimer(this); m_updateVisibleIndexRangeTimer->setSingleShot(true); m_updateVisibleIndexRangeTimer->setInterval(ShortInterval); - connect(m_updateVisibleIndexRangeTimer, SIGNAL(timeout()), this, SLOT(updateVisibleIndexRange())); + connect(m_updateVisibleIndexRangeTimer, &QTimer::timeout, this, &KFileItemListView::updateVisibleIndexRange); m_updateIconSizeTimer = new QTimer(this); m_updateIconSizeTimer->setSingleShot(true); m_updateIconSizeTimer->setInterval(LongInterval); - connect(m_updateIconSizeTimer, SIGNAL(timeout()), this, SLOT(updateIconSize())); + connect(m_updateIconSizeTimer, &QTimer::timeout, this, &KFileItemListView::updateIconSize); setVisibleRoles(QList() << "text"); } @@ -421,4 +423,3 @@ QSize KFileItemListView::availableIconSize() const return QSize(iconSize, iconSize); } -#include "kfileitemlistview.moc" diff --git a/src/kitemviews/kfileitemlistwidget.cpp b/src/kitemviews/kfileitemlistwidget.cpp index fe8c7e997..1ea537d1d 100644 --- a/src/kitemviews/kfileitemlistwidget.cpp +++ b/src/kitemviews/kfileitemlistwidget.cpp @@ -161,4 +161,3 @@ int KFileItemListWidget::selectionLength(const QString& text) const return selectionLength; } -#include "kfileitemlistwidget.moc" diff --git a/src/kitemviews/kfileitemmodel.cpp b/src/kitemviews/kfileitemmodel.cpp index 72acf776a..4d5879f4d 100644 --- a/src/kitemviews/kfileitemmodel.cpp +++ b/src/kitemviews/kfileitemmodel.cpp @@ -25,6 +25,7 @@ #include #include #include +#include //TODO: port to QCollator #include "private/kfileitemmodelsortalgorithm.h" #include "private/kfileitemmodeldirlister.h" @@ -68,17 +69,17 @@ KFileItemModel::KFileItemModel(QObject* parent) : m_dirLister->setMainWindow(parentWidget->window()); } - connect(m_dirLister, SIGNAL(started(KUrl)), this, SIGNAL(directoryLoadingStarted())); - connect(m_dirLister, SIGNAL(canceled()), this, SLOT(slotCanceled())); - connect(m_dirLister, SIGNAL(completed(KUrl)), this, SLOT(slotCompleted())); - connect(m_dirLister, SIGNAL(itemsAdded(KUrl,KFileItemList)), this, SLOT(slotItemsAdded(KUrl,KFileItemList))); - connect(m_dirLister, SIGNAL(itemsDeleted(KFileItemList)), this, SLOT(slotItemsDeleted(KFileItemList))); - connect(m_dirLister, SIGNAL(refreshItems(QList >)), this, SLOT(slotRefreshItems(QList >))); - connect(m_dirLister, SIGNAL(clear()), this, SLOT(slotClear())); - connect(m_dirLister, SIGNAL(infoMessage(QString)), this, SIGNAL(infoMessage(QString))); - connect(m_dirLister, SIGNAL(errorMessage(QString)), this, SIGNAL(errorMessage(QString))); - connect(m_dirLister, SIGNAL(redirection(KUrl,KUrl)), this, SIGNAL(directoryRedirection(KUrl,KUrl))); - connect(m_dirLister, SIGNAL(urlIsFileError(KUrl)), this, SIGNAL(urlIsFileError(KUrl))); + connect(m_dirLister, &KFileItemModelDirLister::started, this, &KFileItemModel::directoryLoadingStarted); + connect(m_dirLister, static_cast(&KFileItemModelDirLister::canceled), this, &KFileItemModel::slotCanceled); + connect(m_dirLister, static_cast(&KFileItemModelDirLister::completed), this, &KFileItemModel::slotCompleted); + connect(m_dirLister, &KFileItemModelDirLister::itemsAdded, this, &KFileItemModel::slotItemsAdded); + connect(m_dirLister, &KFileItemModelDirLister::itemsDeleted, this, &KFileItemModel::slotItemsDeleted); + connect(m_dirLister, &KFileItemModelDirLister::refreshItems, this, &KFileItemModel::slotRefreshItems); + connect(m_dirLister, static_cast(&KFileItemModelDirLister::clear), this, &KFileItemModel::slotClear); + connect(m_dirLister, &KFileItemModelDirLister::infoMessage, this, &KFileItemModel::infoMessage); + connect(m_dirLister, &KFileItemModelDirLister::errorMessage, this, &KFileItemModel::errorMessage); + connect(m_dirLister, static_cast(&KFileItemModelDirLister::redirection), this, &KFileItemModel::directoryRedirection); + connect(m_dirLister, &KFileItemModelDirLister::urlIsFileError, this, &KFileItemModel::urlIsFileError); // Apply default roles that should be determined resetRoles(); @@ -94,7 +95,7 @@ KFileItemModel::KFileItemModel(QObject* parent) : m_maximumUpdateIntervalTimer = new QTimer(this); m_maximumUpdateIntervalTimer->setInterval(2000); m_maximumUpdateIntervalTimer->setSingleShot(true); - connect(m_maximumUpdateIntervalTimer, SIGNAL(timeout()), this, SLOT(dispatchPendingItemsToInsert())); + connect(m_maximumUpdateIntervalTimer, &QTimer::timeout, this, &KFileItemModel::dispatchPendingItemsToInsert); // When changing the value of an item which represents the sort-role a resorting must be // triggered. Especially in combination with KFileItemModelRolesUpdater this might be done @@ -103,9 +104,10 @@ KFileItemModel::KFileItemModel(QObject* parent) : m_resortAllItemsTimer = new QTimer(this); m_resortAllItemsTimer->setInterval(500); m_resortAllItemsTimer->setSingleShot(true); - connect(m_resortAllItemsTimer, SIGNAL(timeout()), this, SLOT(resortAllItems())); + connect(m_resortAllItemsTimer, &QTimer::timeout, this, &KFileItemModel::resortAllItems); - connect(KGlobalSettings::self(), SIGNAL(naturalSortingChanged()), this, SLOT(slotNaturalSortingChanged())); + connect(KGlobalSettings::self(), &KGlobalSettings::naturalSortingChanged, + this, &KFileItemModel::slotNaturalSortingChanged); } KFileItemModel::~KFileItemModel() @@ -363,7 +365,7 @@ KFileItem KFileItemModel::fileItem(const KUrl& url) const int KFileItemModel::index(const KFileItem& item) const { - return index(item.url()); + return index(KUrl(item.url())); } int KFileItemModel::index(const KUrl& url) const @@ -915,7 +917,7 @@ void KFileItemModel::slotItemsAdded(const KUrl& directoryUrl, const KFileItemLis // might result in emitting the same items twice due to the Keep-parameter. // This case happens if an item gets expanded, collapsed and expanded again // before the items could be loaded for the first expansion. - if (index(items.first().url()) >= 0) { + if (index(KUrl(items.first().url())) >= 0) { // The items are already part of the model. return; } @@ -1510,8 +1512,8 @@ QHash KFileItemModel::retrieveData(const KFileItem& item, // Don't use KFileItem::timeString() as this is too expensive when // having several thousands of items. Instead the formatting of the // date-time will be done on-demand by the view when the date will be shown. - const KDateTime dateTime = item.time(KFileItem::ModificationTime); - data.insert(sharedValue("date"), dateTime.dateTime()); + const QDateTime dateTime = item.time(KFileItem::ModificationTime); + data.insert(sharedValue("date"), dateTime); } if (m_requestRole[PermissionsRole]) { @@ -1536,7 +1538,7 @@ QHash KFileItemModel::retrieveData(const KFileItem& item, if (m_requestRole[PathRole]) { QString path; - if (item.url().protocol() == QLatin1String("trash")) { + if (item.url().scheme() == QLatin1String("trash")) { path = item.entry().stringValue(KIO::UDSEntry::UDS_EXTRA); } else { // For performance reasons cache the home-path in a static QString @@ -1715,8 +1717,8 @@ int KFileItemModel::sortRoleCompare(const ItemData* a, const ItemData* b) const } case DateRole: { - const KDateTime dateTimeA = itemA.time(KFileItem::ModificationTime); - const KDateTime dateTimeB = itemB.time(KFileItem::ModificationTime); + const QDateTime dateTimeA = itemA.time(KFileItem::ModificationTime); + const QDateTime dateTimeB = itemB.time(KFileItem::ModificationTime); if (dateTimeA < dateTimeB) { result = -1; } else if (dateTimeA > dateTimeB) { @@ -1908,7 +1910,7 @@ QList > KFileItemModel::dateRoleGroups() const const int maxIndex = count() - 1; QList > groups; - const QDate currentDate = KDateTime::currentLocalDateTime().date(); + const QDate currentDate = QDate::currentDate(); QDate previousModifiedDate; QString groupValue; @@ -1917,7 +1919,7 @@ QList > KFileItemModel::dateRoleGroups() const continue; } - const KDateTime modifiedTime = m_itemData.at(i)->item.time(KFileItem::ModificationTime); + const QDateTime modifiedTime = m_itemData.at(i)->item.time(KFileItem::ModificationTime); const QDate modifiedDate = modifiedTime.date(); if (modifiedDate == previousModifiedDate) { // The current item is in the same group as the previous item @@ -2004,7 +2006,7 @@ QList > KFileItemModel::permissionRoleGroups() const } permissionsString = newPermissionsString; - const QFileInfo info(itemData->item.url().pathOrUrl()); + const QFileInfo info(itemData->item.url().toLocalFile()); // Set user string QString user; @@ -2245,4 +2247,3 @@ bool KFileItemModel::isConsistent() const return true; } -#include "kfileitemmodel.moc" diff --git a/src/kitemviews/kfileitemmodelrolesupdater.cpp b/src/kitemviews/kfileitemmodelrolesupdater.cpp index 0865d40e7..5c212a984 100644 --- a/src/kitemviews/kfileitemmodelrolesupdater.cpp +++ b/src/kitemviews/kfileitemmodelrolesupdater.cpp @@ -26,6 +26,8 @@ #include #include #include +#include +#include #include #include @@ -42,9 +44,9 @@ #ifdef HAVE_BALOO #include "private/kbaloorolesprovider.h" - #include - #include - #include + #include + #include + #include #endif // #define KFILEITEMMODELROLESUPDATER_DEBUG @@ -101,23 +103,23 @@ KFileItemModelRolesUpdater::KFileItemModelRolesUpdater(KFileItemModel* model, QO << "imagethumbnail" << "jpegthumbnail"); - connect(m_model, SIGNAL(itemsInserted(KItemRangeList)), - this, SLOT(slotItemsInserted(KItemRangeList))); - connect(m_model, SIGNAL(itemsRemoved(KItemRangeList)), - this, SLOT(slotItemsRemoved(KItemRangeList))); - connect(m_model, SIGNAL(itemsChanged(KItemRangeList,QSet)), - this, SLOT(slotItemsChanged(KItemRangeList,QSet))); - connect(m_model, SIGNAL(itemsMoved(KItemRange,QList)), - this, SLOT(slotItemsMoved(KItemRange,QList))); - connect(m_model, SIGNAL(sortRoleChanged(QByteArray,QByteArray)), - this, SLOT(slotSortRoleChanged(QByteArray,QByteArray))); + connect(m_model, &KFileItemModel::itemsInserted, + this, &KFileItemModelRolesUpdater::slotItemsInserted); + connect(m_model, &KFileItemModel::itemsRemoved, + this, &KFileItemModelRolesUpdater::slotItemsRemoved); + connect(m_model, &KFileItemModel::itemsChanged, + this, &KFileItemModelRolesUpdater::slotItemsChanged); + connect(m_model, &KFileItemModel::itemsMoved, + this, &KFileItemModelRolesUpdater::slotItemsMoved); + connect(m_model, &KFileItemModel::sortRoleChanged, + this, &KFileItemModelRolesUpdater::slotSortRoleChanged); // Use a timer to prevent that each call of slotItemsChanged() results in a synchronous // resolving of the roles. Postpone the resolving until no update has been done for 1 second. m_recentlyChangedItemsTimer = new QTimer(this); m_recentlyChangedItemsTimer->setInterval(1000); m_recentlyChangedItemsTimer->setSingleShot(true); - connect(m_recentlyChangedItemsTimer, SIGNAL(timeout()), this, SLOT(resolveRecentlyChangedItems())); + connect(m_recentlyChangedItemsTimer, &QTimer::timeout, this, &KFileItemModelRolesUpdater::resolveRecentlyChangedItems); m_resolvableRoles.insert("size"); m_resolvableRoles.insert("type"); @@ -127,8 +129,8 @@ KFileItemModelRolesUpdater::KFileItemModelRolesUpdater(KFileItemModel* model, QO #endif m_directoryContentsCounter = new KDirectoryContentsCounter(m_model, this); - connect(m_directoryContentsCounter, SIGNAL(result(QString,int)), - this, SLOT(slotDirectoryContentsCountReceived(QString,int))); + connect(m_directoryContentsCounter, &KDirectoryContentsCounter::result, + this, &KFileItemModelRolesUpdater::slotDirectoryContentsCountReceived); } KFileItemModelRolesUpdater::~KFileItemModelRolesUpdater() @@ -280,8 +282,8 @@ void KFileItemModelRolesUpdater::setRoles(const QSet& roles) if (hasBalooRole && !m_balooFileMonitor) { m_balooFileMonitor = new Baloo::FileMonitor(this); - connect(m_balooFileMonitor, SIGNAL(fileMetaDataChanged(QString)), - this, SLOT(applyChangedBalooRoles(QString))); + connect(m_balooFileMonitor, &Baloo::FileMonitor::fileMetaDataChanged, + this, &KFileItemModelRolesUpdater::applyChangedBalooRoles); } else if (!hasBalooRole && m_balooFileMonitor) { delete m_balooFileMonitor; m_balooFileMonitor = 0; @@ -543,11 +545,11 @@ void KFileItemModelRolesUpdater::slotGotPreview(const KFileItem& item, const QPi data.insert("iconPixmap", scaledPixmap); - disconnect(m_model, SIGNAL(itemsChanged(KItemRangeList,QSet)), - this, SLOT(slotItemsChanged(KItemRangeList,QSet))); + disconnect(m_model, &KFileItemModel::itemsChanged, + this, &KFileItemModelRolesUpdater::slotItemsChanged); m_model->setData(index, data); - connect(m_model, SIGNAL(itemsChanged(KItemRangeList,QSet)), - this, SLOT(slotItemsChanged(KItemRangeList,QSet))); + connect(m_model, &KFileItemModel::itemsChanged, + this, &KFileItemModelRolesUpdater::slotItemsChanged); m_finishedItems.insert(item); } @@ -565,11 +567,11 @@ void KFileItemModelRolesUpdater::slotPreviewFailed(const KFileItem& item) QHash data; data.insert("iconPixmap", QPixmap()); - disconnect(m_model, SIGNAL(itemsChanged(KItemRangeList,QSet)), - this, SLOT(slotItemsChanged(KItemRangeList,QSet))); + disconnect(m_model, &KFileItemModel::itemsChanged, + this, &KFileItemModelRolesUpdater::slotItemsChanged); m_model->setData(index, data); - connect(m_model, SIGNAL(itemsChanged(KItemRangeList,QSet)), - this, SLOT(slotItemsChanged(KItemRangeList,QSet))); + connect(m_model, &KFileItemModel::itemsChanged, + this, &KFileItemModelRolesUpdater::slotItemsChanged); applyResolvedRoles(index, ResolveAll); m_finishedItems.insert(item); @@ -625,11 +627,11 @@ void KFileItemModelRolesUpdater::resolveNextSortRole() m_state = Idle; // Prevent that we try to update the items twice. - disconnect(m_model, SIGNAL(itemsMoved(KItemRange,QList)), - this, SLOT(slotItemsMoved(KItemRange,QList))); + disconnect(m_model, &KFileItemModel::itemsMoved, + this, &KFileItemModelRolesUpdater::slotItemsMoved); applySortProgressToModel(); - connect(m_model, SIGNAL(itemsMoved(KItemRange,QList)), - this, SLOT(slotItemsMoved(KItemRange,QList))); + connect(m_model, &KFileItemModel::itemsMoved, + this, &KFileItemModelRolesUpdater::slotItemsMoved); startUpdating(); } } @@ -665,15 +667,15 @@ void KFileItemModelRolesUpdater::resolveNextPendingRoles() QHash data; data.insert("iconPixmap", QPixmap()); - disconnect(m_model, SIGNAL(itemsChanged(KItemRangeList,QSet)), - this, SLOT(slotItemsChanged(KItemRangeList,QSet))); + disconnect(m_model, &KFileItemModel::itemsChanged, + this, &KFileItemModelRolesUpdater::slotItemsChanged); for (int index = 0; index <= m_model->count(); ++index) { if (m_model->data(index).contains("iconPixmap")) { m_model->setData(index, data); } } - connect(m_model, SIGNAL(itemsChanged(KItemRangeList,QSet)), - this, SLOT(slotItemsChanged(KItemRangeList,QSet))); + connect(m_model, &KFileItemModel::itemsChanged, + this, &KFileItemModelRolesUpdater::slotItemsChanged); } m_clearPreviews = false; @@ -704,7 +706,7 @@ void KFileItemModelRolesUpdater::applyChangedBalooRoles(const QString& itemUrl) } Baloo::FileFetchJob* job = new Baloo::FileFetchJob(item.localPath()); - connect(job, SIGNAL(finished(KJob*)), this, SLOT(applyChangedBalooRolesJobFinished(KJob*))); + connect(job, &Baloo::FileFetchJob::finished, this, &KFileItemModelRolesUpdater::applyChangedBalooRolesJobFinished); job->setProperty("item", QVariant::fromValue(item)); job->start(); #else @@ -736,12 +738,12 @@ void KFileItemModelRolesUpdater::applyChangedBalooRolesJobFinished(KJob* kjob) data.insert(it.key(), it.value()); } - disconnect(m_model, SIGNAL(itemsChanged(KItemRangeList,QSet)), - this, SLOT(slotItemsChanged(KItemRangeList,QSet))); + disconnect(m_model, &KFileItemModel::itemsChanged, + this, &KFileItemModelRolesUpdater::slotItemsChanged); const int index = m_model->index(item); m_model->setData(index, data); - connect(m_model, SIGNAL(itemsChanged(KItemRangeList,QSet)), - this, SLOT(slotItemsChanged(KItemRangeList,QSet))); + connect(m_model, &KFileItemModel::itemsChanged, + this, &KFileItemModelRolesUpdater::slotItemsChanged); #endif } @@ -762,11 +764,11 @@ void KFileItemModelRolesUpdater::slotDirectoryContentsCountReceived(const QStrin data.insert("isExpandable", count > 0); } - disconnect(m_model, SIGNAL(itemsChanged(KItemRangeList,QSet)), - this, SLOT(slotItemsChanged(KItemRangeList,QSet))); + disconnect(m_model, &KFileItemModel::itemsChanged, + this, &KFileItemModelRolesUpdater::slotItemsChanged); m_model->setData(index, data); - connect(m_model, SIGNAL(itemsChanged(KItemRangeList,QSet)), - this, SLOT(slotItemsChanged(KItemRangeList,QSet))); + connect(m_model, &KFileItemModel::itemsChanged, + this, &KFileItemModelRolesUpdater::slotItemsChanged); } } } @@ -897,15 +899,15 @@ void KFileItemModelRolesUpdater::startPreviewJob() job->setIgnoreMaximumSize(itemSubSet.first().isLocalFile()); if (job->ui()) { - job->ui()->setWindow(qApp->activeWindow()); + KJobWidgets::setWindow(job, qApp->activeWindow()); } - connect(job, SIGNAL(gotPreview(KFileItem,QPixmap)), - this, SLOT(slotGotPreview(KFileItem,QPixmap))); - connect(job, SIGNAL(failed(KFileItem)), - this, SLOT(slotPreviewFailed(KFileItem))); - connect(job, SIGNAL(finished(KJob*)), - this, SLOT(slotPreviewJobFinished())); + connect(job, &KIO::PreviewJob::gotPreview, + this, &KFileItemModelRolesUpdater::slotGotPreview); + connect(job, &KIO::PreviewJob::failed, + this, &KFileItemModelRolesUpdater::slotPreviewFailed); + connect(job, &KIO::PreviewJob::finished, + this, &KFileItemModelRolesUpdater::slotPreviewJobFinished); m_previewJob = job; } @@ -998,11 +1000,11 @@ void KFileItemModelRolesUpdater::applySortRole(int index) data = rolesData(item); } - disconnect(m_model, SIGNAL(itemsChanged(KItemRangeList,QSet)), - this, SLOT(slotItemsChanged(KItemRangeList,QSet))); + disconnect(m_model, &KFileItemModel::itemsChanged, + this, &KFileItemModelRolesUpdater::slotItemsChanged); m_model->setData(index, data); - connect(m_model, SIGNAL(itemsChanged(KItemRangeList,QSet)), - this, SLOT(slotItemsChanged(KItemRangeList,QSet))); + connect(m_model, &KFileItemModel::itemsChanged, + this, &KFileItemModelRolesUpdater::slotItemsChanged); } void KFileItemModelRolesUpdater::applySortProgressToModel() @@ -1042,11 +1044,11 @@ bool KFileItemModelRolesUpdater::applyResolvedRoles(int index, ResolveHint hint) data.insert("iconPixmap", QPixmap()); } - disconnect(m_model, SIGNAL(itemsChanged(KItemRangeList,QSet)), - this, SLOT(slotItemsChanged(KItemRangeList,QSet))); + disconnect(m_model, &KFileItemModel::itemsChanged, + this, &KFileItemModelRolesUpdater::slotItemsChanged); m_model->setData(index, data); - connect(m_model, SIGNAL(itemsChanged(KItemRangeList,QSet)), - this, SLOT(slotItemsChanged(KItemRangeList,QSet))); + connect(m_model, &KFileItemModel::itemsChanged, + this, &KFileItemModelRolesUpdater::slotItemsChanged); return true; } @@ -1099,12 +1101,12 @@ void KFileItemModelRolesUpdater::updateAllPreviews() void KFileItemModelRolesUpdater::killPreviewJob() { if (m_previewJob) { - disconnect(m_previewJob, SIGNAL(gotPreview(KFileItem,QPixmap)), - this, SLOT(slotGotPreview(KFileItem,QPixmap))); - disconnect(m_previewJob, SIGNAL(failed(KFileItem)), - this, SLOT(slotPreviewFailed(KFileItem))); - disconnect(m_previewJob, SIGNAL(finished(KJob*)), - this, SLOT(slotPreviewJobFinished())); + disconnect(m_previewJob, &KIO::PreviewJob::gotPreview, + this, &KFileItemModelRolesUpdater::slotGotPreview); + disconnect(m_previewJob, &KIO::PreviewJob::failed, + this, &KFileItemModelRolesUpdater::slotPreviewFailed); + disconnect(m_previewJob, &KIO::PreviewJob::finished, + this, &KFileItemModelRolesUpdater::slotPreviewJobFinished); m_previewJob->kill(); m_previewJob = 0; m_pendingPreviewItems.clear(); @@ -1168,4 +1170,3 @@ QList KFileItemModelRolesUpdater::indexesToResolve() const return result; } -#include "kfileitemmodelrolesupdater.moc" diff --git a/src/kitemviews/kfileitemmodelrolesupdater.h b/src/kitemviews/kfileitemmodelrolesupdater.h index a9e979ae1..e9652e3b5 100644 --- a/src/kitemviews/kfileitemmodelrolesupdater.h +++ b/src/kitemviews/kfileitemmodelrolesupdater.h @@ -38,6 +38,10 @@ class KJob; class QPixmap; class QTimer; +namespace KIO { + class PreviewJob; +} + #ifdef HAVE_BALOO namespace Baloo { @@ -316,7 +320,7 @@ private: // A new preview job will be started from them once the first one finishes. KFileItemList m_pendingPreviewItems; - KJob* m_previewJob; + KIO::PreviewJob* m_previewJob; // When downloading or copying large files, the slot slotItemsChanged() // will be called periodically within a quite short delay. To prevent diff --git a/src/kitemviews/kitemlistcontainer.cpp b/src/kitemviews/kitemlistcontainer.cpp index 8498286c9..5e45a1766 100644 --- a/src/kitemviews/kitemlistcontainer.cpp +++ b/src/kitemviews/kitemlistcontainer.cpp @@ -89,10 +89,10 @@ KItemListContainer::KItemListContainer(KItemListController* controller, QWidget* slotViewChanged(controller->view(), 0); } - connect(controller, SIGNAL(modelChanged(KItemModelBase*,KItemModelBase*)), - this, SLOT(slotModelChanged(KItemModelBase*,KItemModelBase*))); - connect(controller, SIGNAL(viewChanged(KItemListView*,KItemListView*)), - this, SLOT(slotViewChanged(KItemListView*,KItemListView*))); + connect(controller, &KItemListController::modelChanged, + this, &KItemListContainer::slotModelChanged); + connect(controller, &KItemListController::viewChanged, + this, &KItemListContainer::slotViewChanged); } KItemListContainer::~KItemListContainer() @@ -185,11 +185,15 @@ void KItemListContainer::wheelEvent(QWheelEvent* event) KItemListSmoothScroller* smoothScroller = scrollHorizontally ? m_horizontalSmoothScroller : m_verticalSmoothScroller; - const int numDegrees = event->delta() / 8; - const int numSteps = numDegrees / 15; - const QScrollBar* scrollBar = smoothScroller->scrollBar(); - smoothScroller->scrollTo(scrollBar->value() - numSteps * scrollBar->pageStep() / 4); + if (!event->pixelDelta().isNull()) { + const int numPixels = event->pixelDelta().y(); + smoothScroller->scrollTo(scrollBar->value() - numPixels); + } else { + const int numDegrees = event->angleDelta().y() / 8; + const int numSteps = numDegrees / 15; + smoothScroller->scrollTo(scrollBar->value() - numSteps * scrollBar->pageStep() / 4); + } event->accept(); } @@ -211,23 +215,33 @@ void KItemListContainer::slotViewChanged(KItemListView* current, KItemListView* QGraphicsScene* scene = static_cast(viewport())->scene(); if (previous) { scene->removeItem(previous); - disconnect(previous, SIGNAL(scrollOrientationChanged(Qt::Orientation,Qt::Orientation)), this, SLOT(slotScrollOrientationChanged(Qt::Orientation,Qt::Orientation))); - disconnect(previous, SIGNAL(scrollOffsetChanged(qreal,qreal)), this, SLOT(updateScrollOffsetScrollBar())); - disconnect(previous, SIGNAL(maximumScrollOffsetChanged(qreal,qreal)), this, SLOT(updateScrollOffsetScrollBar())); - disconnect(previous, SIGNAL(itemOffsetChanged(qreal,qreal)), this, SLOT(updateItemOffsetScrollBar())); - disconnect(previous, SIGNAL(maximumItemOffsetChanged(qreal,qreal)), this, SLOT(updateItemOffsetScrollBar())); - disconnect(previous, SIGNAL(scrollTo(qreal)), this, SLOT(scrollTo(qreal))); + disconnect(previous, &KItemListView::scrollOrientationChanged, + this, &KItemListContainer::slotScrollOrientationChanged); + disconnect(previous, &KItemListView::scrollOffsetChanged, + this, &KItemListContainer::updateScrollOffsetScrollBar); + disconnect(previous, &KItemListView::maximumScrollOffsetChanged, + this, &KItemListContainer::updateScrollOffsetScrollBar); + disconnect(previous, &KItemListView::itemOffsetChanged, + this, &KItemListContainer::updateItemOffsetScrollBar); + disconnect(previous, &KItemListView::maximumItemOffsetChanged, + this, &KItemListContainer::updateItemOffsetScrollBar); + disconnect(previous, &KItemListView::scrollTo, this, &KItemListContainer::scrollTo); m_horizontalSmoothScroller->setTargetObject(0); m_verticalSmoothScroller->setTargetObject(0); } if (current) { scene->addItem(current); - connect(current, SIGNAL(scrollOrientationChanged(Qt::Orientation,Qt::Orientation)), this, SLOT(slotScrollOrientationChanged(Qt::Orientation,Qt::Orientation))); - connect(current, SIGNAL(scrollOffsetChanged(qreal,qreal)), this, SLOT(updateScrollOffsetScrollBar())); - connect(current, SIGNAL(maximumScrollOffsetChanged(qreal,qreal)), this, SLOT(updateScrollOffsetScrollBar())); - connect(current, SIGNAL(itemOffsetChanged(qreal,qreal)), this, SLOT(updateItemOffsetScrollBar())); - connect(current, SIGNAL(maximumItemOffsetChanged(qreal,qreal)), this, SLOT(updateItemOffsetScrollBar())); - connect(current, SIGNAL(scrollTo(qreal)), this, SLOT(scrollTo(qreal))); + connect(current, &KItemListView::scrollOrientationChanged, + this, &KItemListContainer::slotScrollOrientationChanged); + connect(current, &KItemListView::scrollOffsetChanged, + this, &KItemListContainer::updateScrollOffsetScrollBar); + connect(current, &KItemListView::maximumScrollOffsetChanged, + this, &KItemListContainer::updateScrollOffsetScrollBar); + connect(current, &KItemListView::itemOffsetChanged, + this, &KItemListContainer::updateItemOffsetScrollBar); + connect(current, &KItemListView::maximumItemOffsetChanged, + this, &KItemListContainer::updateItemOffsetScrollBar); + connect(current, &KItemListView::scrollTo, this, &KItemListContainer::scrollTo); m_horizontalSmoothScroller->setTargetObject(current); m_verticalSmoothScroller->setTargetObject(current); updateSmoothScrollers(current->scrollOrientation()); @@ -403,4 +417,3 @@ void KItemListContainer::updateScrollOffsetScrollBarPolicy() } } -#include "kitemlistcontainer.moc" diff --git a/src/kitemviews/kitemlistcontroller.cpp b/src/kitemviews/kitemlistcontroller.cpp index 8e2ef5ef3..854a0087a 100644 --- a/src/kitemviews/kitemlistcontroller.cpp +++ b/src/kitemviews/kitemlistcontroller.cpp @@ -61,15 +61,15 @@ KItemListController::KItemListController(KItemModelBase* model, KItemListView* v m_keyboardAnchorIndex(-1), m_keyboardAnchorPos(0) { - connect(m_keyboardManager, SIGNAL(changeCurrentItem(QString,bool)), - this, SLOT(slotChangeCurrentItem(QString,bool))); - connect(m_selectionManager, SIGNAL(currentChanged(int,int)), - m_keyboardManager, SLOT(slotCurrentChanged(int,int))); + connect(m_keyboardManager, &KItemListKeyboardSearchManager::changeCurrentItem, + this, &KItemListController::slotChangeCurrentItem); + connect(m_selectionManager, &KItemListSelectionManager::currentChanged, + m_keyboardManager, &KItemListKeyboardSearchManager::slotCurrentChanged); m_autoActivationTimer = new QTimer(this); m_autoActivationTimer->setSingleShot(true); m_autoActivationTimer->setInterval(-1); - connect(m_autoActivationTimer, SIGNAL(timeout()), this, SLOT(slotAutoActivationTimeout())); + connect(m_autoActivationTimer, &QTimer::timeout, this, &KItemListController::slotAutoActivationTimeout); setModel(model); setView(view); @@ -127,7 +127,7 @@ void KItemListController::setView(KItemListView* view) KItemListView* oldView = m_view; if (oldView) { - disconnect(oldView, SIGNAL(scrollOffsetChanged(qreal,qreal)), this, SLOT(slotViewScrollOffsetChanged(qreal,qreal))); + disconnect(oldView, &KItemListView::scrollOffsetChanged, this, &KItemListController::slotViewScrollOffsetChanged); oldView->deleteLater(); } @@ -137,7 +137,7 @@ void KItemListController::setView(KItemListView* view) m_view->setParent(this); m_view->setController(this); m_view->setModel(m_model); - connect(m_view, SIGNAL(scrollOffsetChanged(qreal,qreal)), this, SLOT(slotViewScrollOffsetChanged(qreal,qreal))); + connect(m_view, &KItemListView::scrollOffsetChanged, this, &KItemListController::slotViewScrollOffsetChanged); updateExtendedSelectionRegion(); } @@ -655,7 +655,7 @@ bool KItemListController::mousePressEvent(QGraphicsSceneMouseEvent* event, const rubberBand->setStartPosition(startPos); rubberBand->setEndPosition(startPos); rubberBand->setActive(true); - connect(rubberBand, SIGNAL(endPositionChanged(QPointF,QPointF)), this, SLOT(slotRubberBandChanged())); + connect(rubberBand, &KItemListRubberBand::endPositionChanged, this, &KItemListController::slotRubberBandChanged); m_view->setAutoScroll(true); } @@ -743,7 +743,7 @@ bool KItemListController::mouseReleaseEvent(QGraphicsSceneMouseEvent* event, con KItemListRubberBand* rubberBand = m_view->rubberBand(); if (rubberBand->isActive()) { - disconnect(rubberBand, SIGNAL(endPositionChanged(QPointF,QPointF)), this, SLOT(slotRubberBandChanged())); + disconnect(rubberBand, &KItemListRubberBand::endPositionChanged, this, &KItemListController::slotRubberBandChanged); rubberBand->setActive(false); m_oldSelection.clear(); m_view->setAutoScroll(false); @@ -1310,4 +1310,3 @@ void KItemListController::updateExtendedSelectionRegion() } } -#include "kitemlistcontroller.moc" diff --git a/src/kitemviews/kitemlistgroupheader.cpp b/src/kitemviews/kitemlistgroupheader.cpp index 17c95a97c..accaf9ecf 100644 --- a/src/kitemviews/kitemlistgroupheader.cpp +++ b/src/kitemviews/kitemlistgroupheader.cpp @@ -233,4 +233,3 @@ QColor KItemListGroupHeader::baseColor() const return styleOption().palette.color(group, normalBaseColorRole()); } -#include "kitemlistgroupheader.moc" diff --git a/src/kitemviews/kitemlistheader.cpp b/src/kitemviews/kitemlistheader.cpp index e89ece0a1..a3fa14d35 100644 --- a/src/kitemviews/kitemlistheader.cpp +++ b/src/kitemviews/kitemlistheader.cpp @@ -81,8 +81,7 @@ KItemListHeader::KItemListHeader(KItemListView* listView) : m_headerWidget = m_view->m_headerWidget; Q_ASSERT(m_headerWidget); - connect(m_headerWidget, SIGNAL(columnWidthChanged(QByteArray,qreal,qreal)), - this, SIGNAL(columnWidthChanged(QByteArray,qreal,qreal))); + connect(m_headerWidget, &KItemListHeaderWidget::columnWidthChanged, + this, &KItemListHeader::columnWidthChanged); } -#include "kitemlistheader.moc" diff --git a/src/kitemviews/kitemlistselectionmanager.cpp b/src/kitemviews/kitemlistselectionmanager.cpp index 1f0a89d06..ba524a6bf 100644 --- a/src/kitemviews/kitemlistselectionmanager.cpp +++ b/src/kitemviews/kitemlistselectionmanager.cpp @@ -396,4 +396,4 @@ int KItemListSelectionManager::indexAfterRangesRemoving(int index, const KItemRa } return qBound(-1, index - dec, m_model->count() - 1); } -#include "kitemlistselectionmanager.moc" + diff --git a/src/kitemviews/kitemlistview.cpp b/src/kitemviews/kitemlistview.cpp index 756f9e39a..d35dd896e 100644 --- a/src/kitemviews/kitemlistview.cpp +++ b/src/kitemviews/kitemlistview.cpp @@ -46,7 +46,12 @@ #include +#if 0 #include "kitemlistviewaccessible.h" +#else +#define QT_NO_ACCESSIBILITY 1 +#pragma message("TODO: port accessibility to Qt5") +#endif namespace { // Time in ms until reaching the autoscroll margin triggers @@ -114,16 +119,16 @@ KItemListView::KItemListView(QGraphicsWidget* parent) : m_layouter = new KItemListViewLayouter(m_sizeHintResolver, this); m_animation = new KItemListViewAnimation(this); - connect(m_animation, SIGNAL(finished(QGraphicsWidget*,KItemListViewAnimation::AnimationType)), - this, SLOT(slotAnimationFinished(QGraphicsWidget*,KItemListViewAnimation::AnimationType))); + connect(m_animation, &KItemListViewAnimation::finished, + this, &KItemListView::slotAnimationFinished); m_layoutTimer = new QTimer(this); m_layoutTimer->setInterval(300); m_layoutTimer->setSingleShot(true); - connect(m_layoutTimer, SIGNAL(timeout()), this, SLOT(slotLayoutTimerFinished())); + connect(m_layoutTimer, &QTimer::timeout, this, &KItemListView::slotLayoutTimerFinished); m_rubberBand = new KItemListRubberBand(this); - connect(m_rubberBand, SIGNAL(activationChanged(bool)), this, SLOT(slotRubberBandActivationChanged(bool))); + connect(m_rubberBand, &KItemListRubberBand::activationChanged, this, &KItemListView::slotRubberBandActivationChanged); m_headerWidget = new KItemListHeaderWidget(this); m_headerWidget->setVisible(false); @@ -267,7 +272,7 @@ void KItemListView::setAutoScroll(bool enabled) if (enabled && !m_autoScrollTimer) { m_autoScrollTimer = new QTimer(this); m_autoScrollTimer->setSingleShot(true); - connect(m_autoScrollTimer, SIGNAL(timeout()), this, SLOT(triggerAutoScrolling())); + connect(m_autoScrollTimer, &QTimer::timeout, this, &KItemListView::triggerAutoScrolling); m_autoScrollTimer->start(InitialAutoScrollDelay); } else if (!enabled && m_autoScrollTimer) { delete m_autoScrollTimer; @@ -572,26 +577,26 @@ void KItemListView::setHeaderVisible(bool visible) m_headerWidget->setColumns(m_visibleRoles); m_headerWidget->setZValue(1); - connect(m_headerWidget, SIGNAL(columnWidthChanged(QByteArray,qreal,qreal)), - this, SLOT(slotHeaderColumnWidthChanged(QByteArray,qreal,qreal))); - connect(m_headerWidget, SIGNAL(columnMoved(QByteArray,int,int)), - this, SLOT(slotHeaderColumnMoved(QByteArray,int,int))); - connect(m_headerWidget, SIGNAL(sortOrderChanged(Qt::SortOrder,Qt::SortOrder)), - this, SIGNAL(sortOrderChanged(Qt::SortOrder,Qt::SortOrder))); - connect(m_headerWidget, SIGNAL(sortRoleChanged(QByteArray,QByteArray)), - this, SIGNAL(sortRoleChanged(QByteArray,QByteArray))); + connect(m_headerWidget, &KItemListHeaderWidget::columnWidthChanged, + this, &KItemListView::slotHeaderColumnWidthChanged); + connect(m_headerWidget, &KItemListHeaderWidget::columnMoved, + this, &KItemListView::slotHeaderColumnMoved); + connect(m_headerWidget, &KItemListHeaderWidget::sortOrderChanged, + this, &KItemListView::sortOrderChanged); + connect(m_headerWidget, &KItemListHeaderWidget::sortRoleChanged, + this, &KItemListView::sortRoleChanged); m_layouter->setHeaderHeight(headerSize.height()); m_headerWidget->setVisible(true); } else if (!visible && m_headerWidget->isVisible()) { - disconnect(m_headerWidget, SIGNAL(columnWidthChanged(QByteArray,qreal,qreal)), - this, SLOT(slotHeaderColumnWidthChanged(QByteArray,qreal,qreal))); - disconnect(m_headerWidget, SIGNAL(columnMoved(QByteArray,int,int)), - this, SLOT(slotHeaderColumnMoved(QByteArray,int,int))); - disconnect(m_headerWidget, SIGNAL(sortOrderChanged(Qt::SortOrder,Qt::SortOrder)), - this, SIGNAL(sortOrderChanged(Qt::SortOrder,Qt::SortOrder))); - disconnect(m_headerWidget, SIGNAL(sortRoleChanged(QByteArray,QByteArray)), - this, SIGNAL(sortRoleChanged(QByteArray,QByteArray))); + disconnect(m_headerWidget, &KItemListHeaderWidget::columnWidthChanged, + this, &KItemListView::slotHeaderColumnWidthChanged); + disconnect(m_headerWidget, &KItemListHeaderWidget::columnMoved, + this, &KItemListView::slotHeaderColumnMoved); + disconnect(m_headerWidget, &KItemListHeaderWidget::sortOrderChanged, + this, &KItemListView::sortOrderChanged); + disconnect(m_headerWidget, &KItemListHeaderWidget::sortRoleChanged, + this, &KItemListView::sortRoleChanged); m_layouter->setHeaderHeight(0); m_headerWidget->setVisible(false); @@ -637,10 +642,10 @@ void KItemListView::editRole(int index, const QByteArray& role) m_editingRole = true; widget->setEditedRole(role); - connect(widget, SIGNAL(roleEditingCanceled(int,QByteArray,QVariant)), - this, SLOT(slotRoleEditingCanceled(int,QByteArray,QVariant))); - connect(widget, SIGNAL(roleEditingFinished(int,QByteArray,QVariant)), - this, SLOT(slotRoleEditingFinished(int,QByteArray,QVariant))); + connect(widget, &KItemListWidget::roleEditingCanceled, + this, &KItemListView::slotRoleEditingCanceled); + connect(widget, &KItemListWidget::roleEditingFinished, + this, &KItemListView::slotRoleEditingFinished); } void KItemListView::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget) @@ -1269,7 +1274,8 @@ void KItemListView::slotItemsChanged(const KItemRangeList& itemRanges, doLayout(NoAnimation); } } - QAccessible::updateAccessibility(this, 0, QAccessible::TableModelChanged); +#pragma message("TODO: port accessibility otherwise the following line asserts") + //QAccessible::updateAccessibility(this, 0, QAccessible::TableModelChanged); } void KItemListView::slotGroupsChanged() @@ -1345,7 +1351,8 @@ void KItemListView::slotCurrentChanged(int current, int previous) currentWidget->setCurrent(true); } } - QAccessible::updateAccessibility(this, current+1, QAccessible::Focus); +#pragma message("TODO: port accessibility otherwise the following line asserts") + //QAccessible::updateAccessibility(this, current+1, QAccessible::Focus); } void KItemListView::slotSelectionChanged(const KItemSet& current, const KItemSet& previous) @@ -1412,12 +1419,12 @@ void KItemListView::slotRubberBandPosChanged() void KItemListView::slotRubberBandActivationChanged(bool active) { if (active) { - connect(m_rubberBand, SIGNAL(startPositionChanged(QPointF,QPointF)), this, SLOT(slotRubberBandPosChanged())); - connect(m_rubberBand, SIGNAL(endPositionChanged(QPointF,QPointF)), this, SLOT(slotRubberBandPosChanged())); + connect(m_rubberBand, &KItemListRubberBand::startPositionChanged, this, &KItemListView::slotRubberBandPosChanged); + connect(m_rubberBand, &KItemListRubberBand::endPositionChanged, this, &KItemListView::slotRubberBandPosChanged); m_skipAutoScrollForRubberBand = true; } else { - disconnect(m_rubberBand, SIGNAL(startPositionChanged(QPointF,QPointF)), this, SLOT(slotRubberBandPosChanged())); - disconnect(m_rubberBand, SIGNAL(endPositionChanged(QPointF,QPointF)), this, SLOT(slotRubberBandPosChanged())); + disconnect(m_rubberBand, &KItemListRubberBand::startPositionChanged, this, &KItemListView::slotRubberBandPosChanged); + disconnect(m_rubberBand, &KItemListRubberBand::endPositionChanged, this, &KItemListView::slotRubberBandPosChanged); m_skipAutoScrollForRubberBand = false; } @@ -1544,16 +1551,16 @@ void KItemListView::setController(KItemListController* controller) KItemListController* previous = m_controller; if (previous) { KItemListSelectionManager* selectionManager = previous->selectionManager(); - disconnect(selectionManager, SIGNAL(currentChanged(int,int)), this, SLOT(slotCurrentChanged(int,int))); - disconnect(selectionManager, SIGNAL(selectionChanged(KItemSet,KItemSet)), this, SLOT(slotSelectionChanged(KItemSet,KItemSet))); + disconnect(selectionManager, &KItemListSelectionManager::currentChanged, this, &KItemListView::slotCurrentChanged); + disconnect(selectionManager, &KItemListSelectionManager::selectionChanged, this, &KItemListView::slotSelectionChanged); } m_controller = controller; if (controller) { KItemListSelectionManager* selectionManager = controller->selectionManager(); - connect(selectionManager, SIGNAL(currentChanged(int,int)), this, SLOT(slotCurrentChanged(int,int))); - connect(selectionManager, SIGNAL(selectionChanged(KItemSet,KItemSet)), this, SLOT(slotSelectionChanged(KItemSet,KItemSet))); + connect(selectionManager, &KItemListSelectionManager::currentChanged, this, &KItemListView::slotCurrentChanged); + connect(selectionManager, &KItemListSelectionManager::selectionChanged, this, &KItemListView::slotSelectionChanged); } onControllerChanged(controller, previous); @@ -1569,22 +1576,22 @@ void KItemListView::setModel(KItemModelBase* model) KItemModelBase* previous = m_model; if (m_model) { - disconnect(m_model, SIGNAL(itemsChanged(KItemRangeList,QSet)), - this, SLOT(slotItemsChanged(KItemRangeList,QSet))); - disconnect(m_model, SIGNAL(itemsInserted(KItemRangeList)), - this, SLOT(slotItemsInserted(KItemRangeList))); - disconnect(m_model, SIGNAL(itemsRemoved(KItemRangeList)), - this, SLOT(slotItemsRemoved(KItemRangeList))); - disconnect(m_model, SIGNAL(itemsMoved(KItemRange,QList)), - this, SLOT(slotItemsMoved(KItemRange,QList))); - disconnect(m_model, SIGNAL(groupsChanged()), - this, SLOT(slotGroupsChanged())); - disconnect(m_model, SIGNAL(groupedSortingChanged(bool)), - this, SLOT(slotGroupedSortingChanged(bool))); - disconnect(m_model, SIGNAL(sortOrderChanged(Qt::SortOrder,Qt::SortOrder)), - this, SLOT(slotSortOrderChanged(Qt::SortOrder,Qt::SortOrder))); - disconnect(m_model, SIGNAL(sortRoleChanged(QByteArray,QByteArray)), - this, SLOT(slotSortRoleChanged(QByteArray,QByteArray))); + disconnect(m_model, &KItemModelBase::itemsChanged, + this, &KItemListView::slotItemsChanged); + disconnect(m_model, &KItemModelBase::itemsInserted, + this, &KItemListView::slotItemsInserted); + disconnect(m_model, &KItemModelBase::itemsRemoved, + this, &KItemListView::slotItemsRemoved); + disconnect(m_model, &KItemModelBase::itemsMoved, + this, &KItemListView::slotItemsMoved); + disconnect(m_model, &KItemModelBase::groupsChanged, + this, &KItemListView::slotGroupsChanged); + disconnect(m_model, &KItemModelBase::groupedSortingChanged, + this, &KItemListView::slotGroupedSortingChanged); + disconnect(m_model, &KItemModelBase::sortOrderChanged, + this, &KItemListView::slotSortOrderChanged); + disconnect(m_model, &KItemModelBase::sortRoleChanged, + this, &KItemListView::slotSortRoleChanged); m_sizeHintResolver->itemsRemoved(KItemRangeList() << KItemRange(0, m_model->count())); } @@ -1594,22 +1601,22 @@ void KItemListView::setModel(KItemModelBase* model) m_grouped = model->groupedSorting(); if (m_model) { - connect(m_model, SIGNAL(itemsChanged(KItemRangeList,QSet)), - this, SLOT(slotItemsChanged(KItemRangeList,QSet))); - connect(m_model, SIGNAL(itemsInserted(KItemRangeList)), - this, SLOT(slotItemsInserted(KItemRangeList))); - connect(m_model, SIGNAL(itemsRemoved(KItemRangeList)), - this, SLOT(slotItemsRemoved(KItemRangeList))); - connect(m_model, SIGNAL(itemsMoved(KItemRange,QList)), - this, SLOT(slotItemsMoved(KItemRange,QList))); - connect(m_model, SIGNAL(groupsChanged()), - this, SLOT(slotGroupsChanged())); - connect(m_model, SIGNAL(groupedSortingChanged(bool)), - this, SLOT(slotGroupedSortingChanged(bool))); - connect(m_model, SIGNAL(sortOrderChanged(Qt::SortOrder,Qt::SortOrder)), - this, SLOT(slotSortOrderChanged(Qt::SortOrder,Qt::SortOrder))); - connect(m_model, SIGNAL(sortRoleChanged(QByteArray,QByteArray)), - this, SLOT(slotSortRoleChanged(QByteArray,QByteArray))); + connect(m_model, &KItemModelBase::itemsChanged, + this, &KItemListView::slotItemsChanged); + connect(m_model, &KItemModelBase::itemsInserted, + this, &KItemListView::slotItemsInserted); + connect(m_model, &KItemModelBase::itemsRemoved, + this, &KItemListView::slotItemsRemoved); + connect(m_model, &KItemModelBase::itemsMoved, + this, &KItemListView::slotItemsMoved); + connect(m_model, &KItemModelBase::groupsChanged, + this, &KItemListView::slotGroupsChanged); + connect(m_model, &KItemModelBase::groupedSortingChanged, + this, &KItemListView::slotGroupedSortingChanged); + connect(m_model, &KItemModelBase::sortOrderChanged, + this, &KItemListView::slotSortOrderChanged); + connect(m_model, &KItemModelBase::sortRoleChanged, + this, &KItemListView::slotSortRoleChanged); const int itemCount = m_model->count(); if (itemCount > 0) { @@ -2023,7 +2030,7 @@ void KItemListView::updateGroupHeaderForWidget(KItemListWidget* widget) groupHeader = groupHeaderCreator()->create(this); groupHeader->setParentItem(widget); m_visibleGroups.insert(widget, groupHeader); - connect(widget, SIGNAL(geometryChanged()), this, SLOT(slotGeometryOfGroupHeaderParentChanged())); + connect(widget, &KItemListWidget::geometryChanged, this, &KItemListView::slotGeometryOfGroupHeaderParentChanged); } Q_ASSERT(groupHeader->parentItem() == widget); @@ -2070,7 +2077,7 @@ void KItemListView::recycleGroupHeaderForWidget(KItemListWidget* widget) header->setParentItem(0); groupHeaderCreator()->recycle(header); m_visibleGroups.remove(widget); - disconnect(widget, SIGNAL(geometryChanged()), this, SLOT(slotGeometryOfGroupHeaderParentChanged())); + disconnect(widget, &KItemListWidget::geometryChanged, this, &KItemListView::slotGeometryOfGroupHeaderParentChanged); } } @@ -2624,8 +2631,8 @@ void KItemListView::disconnectRoleEditingSignals(int index) return; } - widget->disconnect(SIGNAL(roleEditingCanceled(int,QByteArray,QVariant)), this); - widget->disconnect(SIGNAL(roleEditingFinished(int,QByteArray,QVariant)), this); + disconnect(widget, &KItemListWidget::roleEditingCanceled, this, nullptr); + disconnect(widget, &KItemListWidget::roleEditingFinished, this, nullptr); } int KItemListView::calculateAutoScrollingIncrement(int pos, int range, int oldInc) @@ -2719,4 +2726,3 @@ void KItemListGroupHeaderCreatorBase::recycle(KItemListGroupHeader* header) pushRecycleableWidget(header); } -#include "kitemlistview.moc" diff --git a/src/kitemviews/kitemlistwidget.cpp b/src/kitemviews/kitemlistwidget.cpp index e7d2951b9..df19d49b1 100644 --- a/src/kitemviews/kitemlistwidget.cpp +++ b/src/kitemviews/kitemlistwidget.cpp @@ -252,7 +252,7 @@ void KItemListWidget::setHovered(bool hovered) m_hoverAnimation = new QPropertyAnimation(this, "hoverOpacity", this); const int duration = (KGlobalSettings::graphicEffectsLevel() == KGlobalSettings::NoEffects) ? 1 : 200; m_hoverAnimation->setDuration(duration); - connect(m_hoverAnimation, SIGNAL(finished()), this, SLOT(slotHoverAnimationFinished())); + connect(m_hoverAnimation, &QPropertyAnimation::finished, this, &KItemListWidget::slotHoverAnimationFinished); } m_hoverAnimation->stop(); @@ -526,4 +526,3 @@ void KItemListWidget::drawItemStyleOption(QPainter* painter, QWidget* widget, QS widget->style()->drawPrimitive(QStyle::PE_PanelItemViewItem, &viewItemOption, painter, widget); } -#include "kitemlistwidget.moc" diff --git a/src/kitemviews/kitemmodelbase.cpp b/src/kitemviews/kitemmodelbase.cpp index 4312640e4..bf41b1c84 100644 --- a/src/kitemviews/kitemmodelbase.cpp +++ b/src/kitemviews/kitemmodelbase.cpp @@ -159,4 +159,3 @@ void KItemModelBase::onSortOrderChanged(Qt::SortOrder current, Qt::SortOrder pre Q_UNUSED(previous); } -#include "kitemmodelbase.moc" diff --git a/src/kitemviews/kstandarditemlistgroupheader.cpp b/src/kitemviews/kstandarditemlistgroupheader.cpp index 1e23c0a56..99457c9b8 100644 --- a/src/kitemviews/kstandarditemlistgroupheader.cpp +++ b/src/kitemviews/kstandarditemlistgroupheader.cpp @@ -122,4 +122,3 @@ void KStandardItemListGroupHeader::updateCache() } } -#include "kstandarditemlistgroupheader.moc" diff --git a/src/kitemviews/kstandarditemlistview.cpp b/src/kitemviews/kstandarditemlistview.cpp index 135cd0b7d..1c07d5327 100644 --- a/src/kitemviews/kstandarditemlistview.cpp +++ b/src/kitemviews/kstandarditemlistview.cpp @@ -179,4 +179,3 @@ void KStandardItemListView::updateLayoutOfVisibleItems() } } -#include "kstandarditemlistview.moc" diff --git a/src/kitemviews/kstandarditemlistwidget.cpp b/src/kitemviews/kstandarditemlistwidget.cpp index 998acc066..88286120a 100644 --- a/src/kitemviews/kstandarditemlistwidget.cpp +++ b/src/kitemviews/kstandarditemlistwidget.cpp @@ -758,10 +758,10 @@ void KStandardItemListWidget::editedRoleChanged(const QByteArray& current, const if (m_roleEditor) { emit roleEditingCanceled(index(), current, data().value(current)); - disconnect(m_roleEditor, SIGNAL(roleEditingCanceled(QByteArray,QVariant)), - this, SLOT(slotRoleEditingCanceled(QByteArray,QVariant))); - disconnect(m_roleEditor, SIGNAL(roleEditingFinished(QByteArray,QVariant)), - this, SLOT(slotRoleEditingFinished(QByteArray,QVariant))); + disconnect(m_roleEditor, &KItemListRoleEditor::roleEditingCanceled, + this, &KStandardItemListWidget::slotRoleEditingCanceled); + disconnect(m_roleEditor, &KItemListRoleEditor::roleEditingFinished, + this, &KStandardItemListWidget::slotRoleEditingFinished); if (m_oldRoleEditor) { m_oldRoleEditor->deleteLater(); @@ -796,10 +796,10 @@ void KStandardItemListWidget::editedRoleChanged(const QByteArray& current, const m_roleEditor->setTextCursor(cursor); } - connect(m_roleEditor, SIGNAL(roleEditingCanceled(QByteArray,QVariant)), - this, SLOT(slotRoleEditingCanceled(QByteArray,QVariant))); - connect(m_roleEditor, SIGNAL(roleEditingFinished(QByteArray,QVariant)), - this, SLOT(slotRoleEditingFinished(QByteArray,QVariant))); + connect(m_roleEditor, &KItemListRoleEditor::roleEditingCanceled, + this, &KStandardItemListWidget::slotRoleEditingCanceled); + connect(m_roleEditor, &KItemListRoleEditor::roleEditingFinished, + this, &KStandardItemListWidget::slotRoleEditingFinished); // Adjust the geometry of the editor QRectF rect = roleEditingRect(current); @@ -836,14 +836,14 @@ void KStandardItemListWidget::showEvent(QShowEvent* event) const KUrl itemUrl = data().value("url").value(); m_isCut = clipboard->isCut(itemUrl); - connect(clipboard, SIGNAL(cutItemsChanged()), - this, SLOT(slotCutItemsChanged())); + connect(clipboard, &KFileItemClipboard::cutItemsChanged, + this, &KStandardItemListWidget::slotCutItemsChanged); } void KStandardItemListWidget::hideEvent(QHideEvent* event) { - disconnect(KFileItemClipboard::instance(), SIGNAL(cutItemsChanged()), - this, SLOT(slotCutItemsChanged())); + disconnect(KFileItemClipboard::instance(), &KFileItemClipboard::cutItemsChanged, + this, &KStandardItemListWidget::slotCutItemsChanged); KItemListWidget::hideEvent(event); } @@ -1405,10 +1405,10 @@ QRectF KStandardItemListWidget::roleEditingRect(const QByteArray& role) const void KStandardItemListWidget::closeRoleEditor() { - disconnect(m_roleEditor, SIGNAL(roleEditingCanceled(QByteArray,QVariant)), - this, SLOT(slotRoleEditingCanceled(QByteArray,QVariant))); - disconnect(m_roleEditor, SIGNAL(roleEditingFinished(QByteArray,QVariant)), - this, SLOT(slotRoleEditingFinished(QByteArray,QVariant))); + disconnect(m_roleEditor, &KItemListRoleEditor::roleEditingCanceled, + this, &KStandardItemListWidget::slotRoleEditingCanceled); + disconnect(m_roleEditor, &KItemListRoleEditor::roleEditingFinished, + this, &KStandardItemListWidget::slotRoleEditingFinished); if (m_roleEditor->hasFocus()) { // If the editing was not ended by a FocusOut event, we have @@ -1487,4 +1487,3 @@ qreal KStandardItemListWidget::columnPadding(const KItemListStyleOption& option) return option.padding * 6; } -#include "kstandarditemlistwidget.moc" diff --git a/src/kitemviews/kstandarditemmodel.cpp b/src/kitemviews/kstandarditemmodel.cpp index e8c1b6204..060440aec 100644 --- a/src/kitemviews/kstandarditemmodel.cpp +++ b/src/kitemviews/kstandarditemmodel.cpp @@ -237,5 +237,3 @@ void KStandardItemModel::onItemRemoved(int index, KStandardItem* removedItem) Q_UNUSED(removedItem); } - -#include "kstandarditemmodel.moc" diff --git a/src/kitemviews/private/kbaloorolesprovider.cpp b/src/kitemviews/private/kbaloorolesprovider.cpp index c0ae0c544..5096ef096 100644 --- a/src/kitemviews/private/kbaloorolesprovider.cpp +++ b/src/kitemviews/private/kbaloorolesprovider.cpp @@ -24,8 +24,8 @@ #include #include -#include -#include +#include +#include #include #include diff --git a/src/kitemviews/private/kdirectorycontentscounter.cpp b/src/kitemviews/private/kdirectorycontentscounter.cpp index 7d1e76999..cd448e233 100644 --- a/src/kitemviews/private/kdirectorycontentscounter.cpp +++ b/src/kitemviews/private/kdirectorycontentscounter.cpp @@ -35,8 +35,8 @@ KDirectoryContentsCounter::KDirectoryContentsCounter(KFileItemModel* model, QObj m_dirWatcher(0), m_watchedDirs() { - connect(m_model, SIGNAL(itemsRemoved(KItemRangeList)), - this, SLOT(slotItemsRemoved())); + connect(m_model, &KFileItemModel::itemsRemoved, + this, &KDirectoryContentsCounter::slotItemsRemoved); if (!m_workerThread) { m_workerThread = new QThread(); @@ -47,13 +47,13 @@ KDirectoryContentsCounter::KDirectoryContentsCounter(KFileItemModel* model, QObj m_worker->moveToThread(m_workerThread); ++m_workersCount; - connect(this, SIGNAL(requestDirectoryContentsCount(QString,KDirectoryContentsCounterWorker::Options)), - m_worker, SLOT(countDirectoryContents(QString,KDirectoryContentsCounterWorker::Options))); - connect(m_worker, SIGNAL(result(QString,int)), - this, SLOT(slotResult(QString,int))); + connect(this, &KDirectoryContentsCounter::requestDirectoryContentsCount, + m_worker, &KDirectoryContentsCounterWorker::countDirectoryContents); + connect(m_worker, &KDirectoryContentsCounterWorker::result, + this, &KDirectoryContentsCounter::slotResult); m_dirWatcher = new KDirWatch(this); - connect(m_dirWatcher, SIGNAL(dirty(QString)), this, SLOT(slotDirWatchDirty(QString))); + connect(m_dirWatcher, &KDirWatch::dirty, this, &KDirectoryContentsCounter::slotDirWatchDirty); } KDirectoryContentsCounter::~KDirectoryContentsCounter() diff --git a/src/kitemviews/private/kfileitemclipboard.cpp b/src/kitemviews/private/kfileitemclipboard.cpp index 0dcc81f4f..1fb147716 100644 --- a/src/kitemviews/private/kfileitemclipboard.cpp +++ b/src/kitemviews/private/kfileitemclipboard.cpp @@ -79,8 +79,7 @@ KFileItemClipboard::KFileItemClipboard() : { updateCutItems(); - connect(QApplication::clipboard(), SIGNAL(dataChanged()), - this, SLOT(updateCutItems())); + connect(QApplication::clipboard(), &QClipboard::dataChanged, + this, &KFileItemClipboard::updateCutItems); } -#include "kfileitemclipboard.moc" diff --git a/src/kitemviews/private/kfileitemmodeldirlister.cpp b/src/kitemviews/private/kfileitemmodeldirlister.cpp index 3d36386a9..9dfd17d8e 100644 --- a/src/kitemviews/private/kfileitemmodeldirlister.cpp +++ b/src/kitemviews/private/kfileitemmodeldirlister.cpp @@ -45,4 +45,3 @@ void KFileItemModelDirLister::handleError(KIO::Job* job) } } -#include "kfileitemmodeldirlister.moc" diff --git a/src/kitemviews/private/kfileitemmodeldirlister.h b/src/kitemviews/private/kfileitemmodeldirlister.h index 688ee9c5b..da01d20bd 100644 --- a/src/kitemviews/private/kfileitemmodeldirlister.h +++ b/src/kitemviews/private/kfileitemmodeldirlister.h @@ -22,6 +22,7 @@ #include #include +#include /** * @brief Extends the class KDirLister by emitting a signal when an diff --git a/src/kitemviews/private/kfileitemmodelsortalgorithm.h b/src/kitemviews/private/kfileitemmodelsortalgorithm.h index 1d5689432..3c875ce5a 100644 --- a/src/kitemviews/private/kfileitemmodelsortalgorithm.h +++ b/src/kitemviews/private/kfileitemmodelsortalgorithm.h @@ -23,6 +23,7 @@ #define KFILEITEMMODELSORTALGORITHM_H #include +#include #include diff --git a/src/kitemviews/private/kitemlistheaderwidget.cpp b/src/kitemviews/private/kitemlistheaderwidget.cpp index 1f210ab5a..01d0084c8 100644 --- a/src/kitemviews/private/kitemlistheaderwidget.cpp +++ b/src/kitemviews/private/kitemlistheaderwidget.cpp @@ -62,19 +62,19 @@ void KItemListHeaderWidget::setModel(KItemModelBase* model) } if (m_model) { - disconnect(m_model, SIGNAL(sortRoleChanged(QByteArray,QByteArray)), - this, SLOT(slotSortRoleChanged(QByteArray,QByteArray))); - disconnect(m_model, SIGNAL(sortOrderChanged(Qt::SortOrder,Qt::SortOrder)), - this, SLOT(slotSortOrderChanged(Qt::SortOrder,Qt::SortOrder))); + disconnect(m_model, &KItemModelBase::sortRoleChanged, + this, &KItemListHeaderWidget::slotSortRoleChanged); + disconnect(m_model, &KItemModelBase::sortOrderChanged, + this, &KItemListHeaderWidget::slotSortOrderChanged); } m_model = model; if (m_model) { - connect(m_model, SIGNAL(sortRoleChanged(QByteArray,QByteArray)), - this, SLOT(slotSortRoleChanged(QByteArray,QByteArray))); - connect(m_model, SIGNAL(sortOrderChanged(Qt::SortOrder,Qt::SortOrder)), - this, SLOT(slotSortOrderChanged(Qt::SortOrder,Qt::SortOrder))); + connect(m_model, &KItemModelBase::sortRoleChanged, + this, &KItemListHeaderWidget::slotSortRoleChanged); + connect(m_model, &KItemModelBase::sortOrderChanged, + this, &KItemListHeaderWidget::slotSortOrderChanged); } } @@ -569,4 +569,3 @@ qreal KItemListHeaderWidget::roleXPosition(const QByteArray& role) const return -1; } -#include "kitemlistheaderwidget.moc" diff --git a/src/kitemviews/private/kitemlistroleeditor.cpp b/src/kitemviews/private/kitemlistroleeditor.cpp index 0a48f1ba0..6e7e89c17 100644 --- a/src/kitemviews/private/kitemlistroleeditor.cpp +++ b/src/kitemviews/private/kitemlistroleeditor.cpp @@ -38,7 +38,7 @@ KItemListRoleEditor::KItemListRoleEditor(QWidget *parent) : parent->installEventFilter(this); } - connect(this, SIGNAL(textChanged()), this, SLOT(autoAdjustSize())); + connect(this, &KItemListRoleEditor::textChanged, this, &KItemListRoleEditor::autoAdjustSize); } KItemListRoleEditor::~KItemListRoleEditor() @@ -148,4 +148,3 @@ void KItemListRoleEditor::emitRoleEditingFinished() } } -#include "kitemlistroleeditor.moc" diff --git a/src/kitemviews/private/kitemlistrubberband.cpp b/src/kitemviews/private/kitemlistrubberband.cpp index 58567c460..702873126 100644 --- a/src/kitemviews/private/kitemlistrubberband.cpp +++ b/src/kitemviews/private/kitemlistrubberband.cpp @@ -88,4 +88,3 @@ bool KItemListRubberBand::isActive() const return m_active; } -#include "kitemlistrubberband.moc" diff --git a/src/kitemviews/private/kitemlistselectiontoggle.cpp b/src/kitemviews/private/kitemlistselectiontoggle.cpp index accbe5181..c33c15ec2 100644 --- a/src/kitemviews/private/kitemlistselectiontoggle.cpp +++ b/src/kitemviews/private/kitemlistselectiontoggle.cpp @@ -115,4 +115,3 @@ int KItemListSelectionToggle::iconSize() const return iconSize; } -#include "kitemlistselectiontoggle.moc" diff --git a/src/kitemviews/private/kitemlistsmoothscroller.cpp b/src/kitemviews/private/kitemlistsmoothscroller.cpp index 491461b80..24eea0cef 100644 --- a/src/kitemviews/private/kitemlistsmoothscroller.cpp +++ b/src/kitemviews/private/kitemlistsmoothscroller.cpp @@ -38,8 +38,8 @@ KItemListSmoothScroller::KItemListSmoothScroller(QScrollBar* scrollBar, m_animation = new QPropertyAnimation(this); const int duration = (KGlobalSettings::graphicEffectsLevel() == KGlobalSettings::NoEffects) ? 1 : 100; m_animation->setDuration(duration); - connect(m_animation, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)), - this, SLOT(slotAnimationStateChanged(QAbstractAnimation::State,QAbstractAnimation::State))); + connect(m_animation, &QPropertyAnimation::stateChanged, + this, &KItemListSmoothScroller::slotAnimationStateChanged); m_scrollBar->installEventFilter(this); } @@ -209,4 +209,3 @@ void KItemListSmoothScroller::handleWheelEvent(QWheelEvent* event) event->accept(); } -#include "kitemlistsmoothscroller.moc" diff --git a/src/kitemviews/private/kitemlistviewanimation.cpp b/src/kitemviews/private/kitemlistviewanimation.cpp index 5a00c8c3a..336ba38ad 100644 --- a/src/kitemviews/private/kitemlistviewanimation.cpp +++ b/src/kitemviews/private/kitemlistviewanimation.cpp @@ -172,7 +172,7 @@ void KItemListViewAnimation::start(QGraphicsWidget* widget, AnimationType type, } Q_ASSERT(propertyAnim); - connect(propertyAnim, SIGNAL(finished()), this, SLOT(slotFinished())); + connect(propertyAnim, &QPropertyAnimation::finished, this, &KItemListViewAnimation::slotFinished); m_animation[type].insert(widget, propertyAnim); propertyAnim->start(); @@ -242,4 +242,3 @@ void KItemListViewAnimation::slotFinished() Q_ASSERT(false); } -#include "kitemlistviewanimation.moc" diff --git a/src/kitemviews/private/kitemlistviewlayouter.cpp b/src/kitemviews/private/kitemlistviewlayouter.cpp index 04325c7d0..e2dcc62e7 100644 --- a/src/kitemviews/private/kitemlistviewlayouter.cpp +++ b/src/kitemviews/private/kitemlistviewlayouter.cpp @@ -621,4 +621,3 @@ qreal KItemListViewLayouter::minimumGroupHeaderWidth() const return 100; } -#include "kitemlistviewlayouter.moc" diff --git a/src/main.cpp b/src/main.cpp index a8e785a0d..c7c863e32 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -22,20 +22,22 @@ #include "dolphinmainwindow.h" -#include +#include #include #include #include +#include +#include #include extern "C" KDE_EXPORT int kdemain(int argc, char **argv) { - KAboutData about("dolphin", 0, + K4AboutData about("dolphin", 0, ki18nc("@title", "Dolphin"), - KDE_VERSION_STRING, + "4.60", ki18nc("@title", "File Manager"), - KAboutData::License_GPL, + K4AboutData::License_GPL, ki18nc("@info:credit", "(C) 2006-2014 Peter Penz and Frank Reininghaus")); about.setHomepage("http://dolphin.kde.org"); about.addAuthor(ki18nc("@info:credit", "Frank Reininghaus"), diff --git a/src/panels/folders/foldersitemlistwidget.cpp b/src/panels/folders/foldersitemlistwidget.cpp index b4f9a5be8..5b2b20698 100644 --- a/src/panels/folders/foldersitemlistwidget.cpp +++ b/src/panels/folders/foldersitemlistwidget.cpp @@ -33,4 +33,3 @@ QPalette::ColorRole FoldersItemListWidget::normalTextColorRole() const return QPalette::WindowText; } -#include "foldersitemlistwidget.moc" diff --git a/src/panels/folders/folderspanel.cpp b/src/panels/folders/folderspanel.cpp index 46c1b3450..1f7d007ca 100644 --- a/src/panels/folders/folderspanel.cpp +++ b/src/panels/folders/folderspanel.cpp @@ -137,15 +137,15 @@ void FoldersPanel::showEvent(QShowEvent* event) // opening the folders panel. view->setOpacity(0); - connect(view, SIGNAL(roleEditingFinished(int,QByteArray,QVariant)), - this, SLOT(slotRoleEditingFinished(int,QByteArray,QVariant))); + connect(view, &KFileItemListView::roleEditingFinished, + this, &FoldersPanel::slotRoleEditingFinished); m_model = new KFileItemModel(this); m_model->setShowDirectoriesOnly(true); m_model->setShowHiddenFiles(FoldersPanelSettings::hiddenFilesShown()); // Use a QueuedConnection to give the view the possibility to react first on the // finished loading. - connect(m_model, SIGNAL(directoryLoadingCompleted()), this, SLOT(slotLoadingCompleted()), Qt::QueuedConnection); + connect(m_model, &KFileItemModel::directoryLoadingCompleted, this, &FoldersPanel::slotLoadingCompleted, Qt::QueuedConnection); m_controller = new KItemListController(m_model, view, this); m_controller->setSelectionBehavior(KItemListController::SingleSelection); @@ -154,11 +154,11 @@ void FoldersPanel::showEvent(QShowEvent* event) m_controller->setAutoActivationDelay(750); m_controller->setSingleClickActivationEnforced(true); - connect(m_controller, SIGNAL(itemActivated(int)), this, SLOT(slotItemActivated(int))); - connect(m_controller, SIGNAL(itemMiddleClicked(int)), this, SLOT(slotItemMiddleClicked(int))); - connect(m_controller, SIGNAL(itemContextMenuRequested(int,QPointF)), this, SLOT(slotItemContextMenuRequested(int,QPointF))); - connect(m_controller, SIGNAL(viewContextMenuRequested(QPointF)), this, SLOT(slotViewContextMenuRequested(QPointF))); - connect(m_controller, SIGNAL(itemDropEvent(int,QGraphicsSceneDragDropEvent*)), this, SLOT(slotItemDropEvent(int,QGraphicsSceneDragDropEvent*))); + connect(m_controller, &KItemListController::itemActivated, this, &FoldersPanel::slotItemActivated); + connect(m_controller, &KItemListController::itemMiddleClicked, this, &FoldersPanel::slotItemMiddleClicked); + connect(m_controller, &KItemListController::itemContextMenuRequested, this, &FoldersPanel::slotItemContextMenuRequested); + connect(m_controller, &KItemListController::viewContextMenuRequested, this, &FoldersPanel::slotViewContextMenuRequested); + connect(m_controller, &KItemListController::itemDropEvent, this, &FoldersPanel::slotItemDropEvent); KItemListContainer* container = new KItemListContainer(m_controller, this); container->setEnabledFrame(false); @@ -328,4 +328,3 @@ void FoldersPanel::updateCurrentItem(int index) m_controller->view()->scrollToItem(index); } -#include "folderspanel.moc" diff --git a/src/panels/folders/treeviewcontextmenu.cpp b/src/panels/folders/treeviewcontextmenu.cpp index 83ffa87a7..ff0801d1a 100644 --- a/src/panels/folders/treeviewcontextmenu.cpp +++ b/src/panels/folders/treeviewcontextmenu.cpp @@ -24,6 +24,9 @@ #include #include #include +#include +#include +#include #include #include #include @@ -34,6 +37,7 @@ #include #include +#include TreeViewContextMenu::TreeViewContextMenu(FoldersPanel* parent, const KFileItem& fileInfo) : @@ -57,14 +61,14 @@ void TreeViewContextMenu::open() // insert 'Cut', 'Copy' and 'Paste' QAction* cutAction = new QAction(KIcon("edit-cut"), i18nc("@action:inmenu", "Cut"), this); cutAction->setEnabled(capabilities.supportsMoving()); - connect(cutAction, SIGNAL(triggered()), this, SLOT(cut())); + connect(cutAction, &QAction::triggered, this, &TreeViewContextMenu::cut); QAction* copyAction = new QAction(KIcon("edit-copy"), i18nc("@action:inmenu", "Copy"), this); - connect(copyAction, SIGNAL(triggered()), this, SLOT(copy())); + connect(copyAction, &QAction::triggered, this, &TreeViewContextMenu::copy); const QPair pasteInfo = KonqOperations::pasteInfo(m_fileItem.url()); QAction* pasteAction = new QAction(KIcon("edit-paste"), pasteInfo.second, this); - connect(pasteAction, SIGNAL(triggered()), this, SLOT(paste())); + connect(pasteAction, &QAction::triggered, this, &TreeViewContextMenu::paste); pasteAction->setEnabled(pasteInfo.first); popup->addAction(cutAction); @@ -76,7 +80,7 @@ void TreeViewContextMenu::open() QAction* renameAction = new QAction(i18nc("@action:inmenu", "Rename..."), this); renameAction->setEnabled(capabilities.supportsMoving()); renameAction->setIcon(KIcon("edit-rename")); - connect(renameAction, SIGNAL(triggered()), this, SLOT(rename())); + connect(renameAction, &QAction::triggered, this, &TreeViewContextMenu::rename); popup->addAction(renameAction); // insert 'Move to Trash' and (optionally) 'Delete' @@ -90,7 +94,7 @@ void TreeViewContextMenu::open() i18nc("@action:inmenu", "Move to Trash"), this); const bool enableMoveToTrash = capabilities.isLocal() && capabilities.supportsMoving(); moveToTrashAction->setEnabled(enableMoveToTrash); - connect(moveToTrashAction, SIGNAL(triggered()), this, SLOT(moveToTrash())); + connect(moveToTrashAction, &QAction::triggered, this, &TreeViewContextMenu::moveToTrash); popup->addAction(moveToTrashAction); } else { showDeleteCommand = true; @@ -99,7 +103,7 @@ void TreeViewContextMenu::open() if (showDeleteCommand) { QAction* deleteAction = new QAction(KIcon("edit-delete"), i18nc("@action:inmenu", "Delete"), this); deleteAction->setEnabled(capabilities.supportsDeleting()); - connect(deleteAction, SIGNAL(triggered()), this, SLOT(deleteItem())); + connect(deleteAction, &QAction::triggered, this, &TreeViewContextMenu::deleteItem); popup->addAction(deleteAction); } @@ -111,7 +115,7 @@ void TreeViewContextMenu::open() showHiddenFilesAction->setCheckable(true); showHiddenFilesAction->setChecked(m_parent->showHiddenFiles()); popup->addAction(showHiddenFilesAction); - connect(showHiddenFilesAction, SIGNAL(toggled(bool)), this, SLOT(setShowHiddenFiles(bool))); + connect(showHiddenFilesAction, &QAction::toggled, this, &TreeViewContextMenu::setShowHiddenFiles); // insert 'Automatic Scrolling' QAction* autoScrollingAction = new QAction(i18nc("@action:inmenu", "Automatic Scrolling"), this); @@ -120,13 +124,13 @@ void TreeViewContextMenu::open() // TODO: Temporary disabled. Horizontal autoscrolling will be implemented later either // in KItemViews or manually as part of the FoldersPanel //popup->addAction(autoScrollingAction); - connect(autoScrollingAction, SIGNAL(toggled(bool)), this, SLOT(setAutoScrolling(bool))); + connect(autoScrollingAction, &QAction::toggled, this, &TreeViewContextMenu::setAutoScrolling); if (!m_fileItem.isNull()) { // insert 'Properties' entry QAction* propertiesAction = new QAction(i18nc("@action:inmenu", "Properties"), this); propertiesAction->setIcon(KIcon("document-properties")); - connect(propertiesAction, SIGNAL(triggered()), this, SLOT(showProperties())); + connect(propertiesAction, &QAction::triggered, this, &TreeViewContextMenu::showProperties); popup->addAction(propertiesAction); } @@ -181,12 +185,12 @@ void TreeViewContextMenu::rename() void TreeViewContextMenu::moveToTrash() { - KonqOperations::del(m_parent, KonqOperations::TRASH, m_fileItem.url()); + KonqOperations::del(m_parent, KonqOperations::TRASH, KUrl::List() << m_fileItem.url()); } void TreeViewContextMenu::deleteItem() { - KonqOperations::del(m_parent, KonqOperations::DEL, m_fileItem.url()); + KonqOperations::del(m_parent, KonqOperations::DEL, KUrl::List() << m_fileItem.url()); } void TreeViewContextMenu::showProperties() @@ -206,4 +210,3 @@ void TreeViewContextMenu::setAutoScrolling(bool enable) m_parent->setAutoScrolling(enable); } -#include "treeviewcontextmenu.moc" diff --git a/src/panels/folders/treeviewcontextmenu.h b/src/panels/folders/treeviewcontextmenu.h index 0b3fd79bd..598ffaed6 100644 --- a/src/panels/folders/treeviewcontextmenu.h +++ b/src/panels/folders/treeviewcontextmenu.h @@ -23,6 +23,7 @@ #include #include +class QMimeData; class FoldersPanel; /** diff --git a/src/panels/information/filemetadataconfigurationdialog.cpp b/src/panels/information/filemetadataconfigurationdialog.cpp index 4ad9066c4..15f1f4f5f 100644 --- a/src/panels/information/filemetadataconfigurationdialog.cpp +++ b/src/panels/information/filemetadataconfigurationdialog.cpp @@ -22,7 +22,7 @@ #ifndef HAVE_BALOO #include #else -#include +#include #endif #include @@ -99,4 +99,3 @@ QString FileMetaDataConfigurationDialog::description() const return m_descriptionLabel->text(); } -#include "filemetadataconfigurationdialog.moc" diff --git a/src/panels/information/informationpanel.cpp b/src/panels/information/informationpanel.cpp index eda74f3b5..5c4da7fbc 100644 --- a/src/panels/information/informationpanel.cpp +++ b/src/panels/information/informationpanel.cpp @@ -22,10 +22,12 @@ #include "informationpanelcontent.h" #include #include +#include #include #include #include #include +#include InformationPanel::InformationPanel(QWidget* parent) : Panel(parent), @@ -184,10 +186,10 @@ void InformationPanel::showItemInfo() // an item for the currently shown directory. m_folderStatJob = KIO::stat(url(), KIO::HideProgressInfo); if (m_folderStatJob->ui()) { - m_folderStatJob->ui()->setWindow(this); + KJobWidgets::setWindow(m_folderStatJob, this); } - connect(m_folderStatJob, SIGNAL(result(KJob*)), - this, SLOT(slotFolderStatFinished(KJob*))); + connect(m_folderStatJob, &KIO::Job::result, + this, &InformationPanel::slotFolderStatFinished); } else { m_content->showItem(item); } @@ -322,35 +324,35 @@ void InformationPanel::init() m_infoTimer = new QTimer(this); m_infoTimer->setInterval(300); m_infoTimer->setSingleShot(true); - connect(m_infoTimer, SIGNAL(timeout()), - this, SLOT(slotInfoTimeout())); + connect(m_infoTimer, &QTimer::timeout, + this, &InformationPanel::slotInfoTimeout); m_urlChangedTimer = new QTimer(this); m_urlChangedTimer->setInterval(200); m_urlChangedTimer->setSingleShot(true); - connect(m_urlChangedTimer, SIGNAL(timeout()), - this, SLOT(showItemInfo())); + connect(m_urlChangedTimer, &QTimer::timeout, + this, &InformationPanel::showItemInfo); m_resetUrlTimer = new QTimer(this); m_resetUrlTimer->setInterval(1000); m_resetUrlTimer->setSingleShot(true); - connect(m_resetUrlTimer, SIGNAL(timeout()), - this, SLOT(reset())); + connect(m_resetUrlTimer, &QTimer::timeout, + this, &InformationPanel::reset); Q_ASSERT(m_urlChangedTimer->interval() < m_infoTimer->interval()); Q_ASSERT(m_urlChangedTimer->interval() < m_resetUrlTimer->interval()); org::kde::KDirNotify* dirNotify = new org::kde::KDirNotify(QString(), QString(), QDBusConnection::sessionBus(), this); - connect(dirNotify, SIGNAL(FileRenamed(QString,QString)), SLOT(slotFileRenamed(QString,QString))); - connect(dirNotify, SIGNAL(FilesAdded(QString)), SLOT(slotFilesAdded(QString))); - connect(dirNotify, SIGNAL(FilesChanged(QStringList)), SLOT(slotFilesChanged(QStringList))); - connect(dirNotify, SIGNAL(FilesRemoved(QStringList)), SLOT(slotFilesRemoved(QStringList))); - connect(dirNotify, SIGNAL(enteredDirectory(QString)), SLOT(slotEnteredDirectory(QString))); - connect(dirNotify, SIGNAL(leftDirectory(QString)), SLOT(slotLeftDirectory(QString))); + connect(dirNotify, &OrgKdeKDirNotifyInterface::FileRenamed, this, &InformationPanel::slotFileRenamed); + connect(dirNotify, &OrgKdeKDirNotifyInterface::FilesAdded, this, &InformationPanel::slotFilesAdded); + connect(dirNotify, &OrgKdeKDirNotifyInterface::FilesChanged, this, &InformationPanel::slotFilesChanged); + connect(dirNotify, &OrgKdeKDirNotifyInterface::FilesRemoved, this, &InformationPanel::slotFilesRemoved); + connect(dirNotify, &OrgKdeKDirNotifyInterface::enteredDirectory, this, &InformationPanel::slotEnteredDirectory); + connect(dirNotify, &OrgKdeKDirNotifyInterface::leftDirectory, this, &InformationPanel::slotLeftDirectory); m_content = new InformationPanelContent(this); - connect(m_content, SIGNAL(urlActivated(KUrl)), this, SIGNAL(urlActivated(KUrl))); + connect(m_content, &InformationPanelContent::urlActivated, this, &InformationPanel::urlActivated); QVBoxLayout* layout = new QVBoxLayout(this); layout->setContentsMargins(0, 0, 0, 0); @@ -359,4 +361,3 @@ void InformationPanel::init() m_initialized = true; } -#include "informationpanel.moc" diff --git a/src/panels/information/informationpanelcontent.cpp b/src/panels/information/informationpanelcontent.cpp index 4fb0d9442..75052021b 100644 --- a/src/panels/information/informationpanelcontent.cpp +++ b/src/panels/information/informationpanelcontent.cpp @@ -24,8 +24,10 @@ #include #include #include +#include #include #include +#include #include #include #include @@ -34,7 +36,7 @@ #ifndef HAVE_BALOO #include #else -#include +#include #endif #include @@ -81,8 +83,8 @@ InformationPanelContent::InformationPanelContent(QWidget* parent) : m_outdatedPreviewTimer = new QTimer(this); m_outdatedPreviewTimer->setInterval(300); m_outdatedPreviewTimer->setSingleShot(true); - connect(m_outdatedPreviewTimer, SIGNAL(timeout()), - this, SLOT(markOutdatedPreview())); + connect(m_outdatedPreviewTimer, &QTimer::timeout, + this, &InformationPanelContent::markOutdatedPreview); QVBoxLayout* layout = new QVBoxLayout(this); layout->setSpacing(KDialog::spacingHint()); @@ -97,8 +99,8 @@ InformationPanelContent::InformationPanelContent(QWidget* parent) : m_phononWidget = new PhononWidget(parent); m_phononWidget->hide(); m_phononWidget->setMinimumWidth(minPreviewWidth); - connect(m_phononWidget, SIGNAL(hasVideoChanged(bool)), - this, SLOT(slotHasVideoChanged(bool))); + connect(m_phononWidget, &PhononWidget::hasVideoChanged, + this, &InformationPanelContent::slotHasVideoChanged); // name m_nameLabel = new QLabel(parent); @@ -114,12 +116,15 @@ InformationPanelContent::InformationPanelContent(QWidget* parent) : #ifndef HAVE_BALOO m_metaDataWidget = new KFileMetaDataWidget(parent); + connect(m_metaDataWidget, &KFileMetaDataWidget::urlActivated, + this, &InformationPanelContent::urlActivated); #else m_metaDataWidget = new Baloo::FileMetaDataWidget(parent); + connect(m_metaDataWidget, &Baloo::FileMetaDataWidget::urlActivated, + this, &InformationPanelContent::urlActivated); #endif m_metaDataWidget->setFont(KGlobalSettings::smallestReadableFont()); m_metaDataWidget->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Minimum); - connect(m_metaDataWidget, SIGNAL(urlActivated(KUrl)), this, SIGNAL(urlActivated(KUrl))); // Encapsulate the MetaDataWidget inside a container that has a dummy widget // at the bottom. This prevents that the meta data widget gets vertically stretched @@ -193,13 +198,13 @@ void InformationPanelContent::showItem(const KFileItem& item) m_previewJob->setScaleType(KIO::PreviewJob::Unscaled); m_previewJob->setIgnoreMaximumSize(item.isLocalFile()); if (m_previewJob->ui()) { - m_previewJob->ui()->setWindow(this); + KJobWidgets::setWindow(m_previewJob, this); } - connect(m_previewJob, SIGNAL(gotPreview(KFileItem,QPixmap)), - this, SLOT(showPreview(KFileItem,QPixmap))); - connect(m_previewJob, SIGNAL(failed(KFileItem)), - this, SLOT(showIcon(KFileItem))); + connect(m_previewJob.data(), &KIO::PreviewJob::gotPreview, + this, &InformationPanelContent::showPreview); + connect(m_previewJob.data(), &KIO::PreviewJob::failed, + this, &InformationPanelContent::showIcon); } } @@ -287,7 +292,7 @@ void InformationPanelContent::configureSettings(const QList& customCon KMenu popup(this); QAction* previewAction = popup.addAction(i18nc("@action:inmenu", "Preview")); - previewAction->setIcon(KIcon("view-preview")); + previewAction->setIcon(QIcon::fromTheme("view-preview")); previewAction->setCheckable(true); previewAction->setChecked(InformationPanelSettings::previewsShown()); @@ -319,7 +324,7 @@ void InformationPanelContent::configureSettings(const QList& customCon dialog->show(); dialog->raise(); dialog->activateWindow(); - connect(dialog, SIGNAL(destroyed()), this, SLOT(refreshMetaData())); + connect(dialog, &FileMetaDataConfigurationDialog::destroyed, this, &InformationPanelContent::refreshMetaData); } } @@ -435,4 +440,3 @@ void InformationPanelContent::adjustWidgetSizes(int width) } } -#include "informationpanelcontent.moc" diff --git a/src/panels/information/phononwidget.cpp b/src/panels/information/phononwidget.cpp index a36ada180..4b2cc28c5 100644 --- a/src/panels/information/phononwidget.cpp +++ b/src/panels/information/phononwidget.cpp @@ -33,6 +33,7 @@ #include #include +#include #include #include @@ -130,14 +131,14 @@ void PhononWidget::showEvent(QShowEvent *event) m_playButton->setIconSize(buttonSize); m_playButton->setIcon(KIcon("media-playback-start")); m_playButton->setAutoRaise(true); - connect(m_playButton, SIGNAL(clicked()), this, SLOT(play())); + connect(m_playButton, &QToolButton::clicked, this, &PhononWidget::play); m_stopButton->setToolTip(i18n("stop")); m_stopButton->setIconSize(buttonSize); m_stopButton->setIcon(KIcon("media-playback-stop")); m_stopButton->setAutoRaise(true); m_stopButton->hide(); - connect(m_stopButton, SIGNAL(clicked()), this, SLOT(stop())); + connect(m_stopButton, &QToolButton::clicked, this, &PhononWidget::stop); m_seekSlider->setIconVisible(false); @@ -177,10 +178,10 @@ void PhononWidget::play() { if (!m_media) { m_media = new Phonon::MediaObject(this); - connect(m_media, SIGNAL(stateChanged(Phonon::State,Phonon::State)), - this, SLOT(stateChanged(Phonon::State))); - connect(m_media, SIGNAL(hasVideoChanged(bool)), - this, SLOT(slotHasVideoChanged(bool))); + connect(m_media, &Phonon::MediaObject::stateChanged, + this, &PhononWidget::stateChanged); + connect(m_media, &Phonon::MediaObject::hasVideoChanged, + this, &PhononWidget::slotHasVideoChanged); m_seekSlider->setMediaObject(m_media); } diff --git a/src/panels/information/pixmapviewer.cpp b/src/panels/information/pixmapviewer.cpp index 8a752c587..221db8c70 100644 --- a/src/panels/information/pixmapviewer.cpp +++ b/src/panels/information/pixmapviewer.cpp @@ -39,8 +39,8 @@ PixmapViewer::PixmapViewer(QWidget* parent, Transition transition) : m_animation.setCurveShape(QTimeLine::LinearCurve); if (m_transition != NoTransition) { - connect(&m_animation, SIGNAL(valueChanged(qreal)), this, SLOT(update())); - connect(&m_animation, SIGNAL(finished()), this, SLOT(checkPendingPixmaps())); + connect(&m_animation, &QTimeLine::valueChanged, this, static_cast(&PixmapViewer::update)); + connect(&m_animation, &QTimeLine::finished, this, &PixmapViewer::checkPendingPixmaps); } } @@ -127,4 +127,3 @@ void PixmapViewer::checkPendingPixmaps() } } -#include "pixmapviewer.moc" diff --git a/src/panels/panel.cpp b/src/panels/panel.cpp index 14b7c0230..767313445 100644 --- a/src/panels/panel.cpp +++ b/src/panels/panel.cpp @@ -76,4 +76,3 @@ void Panel::readSettings() } -#include "panel.moc" diff --git a/src/panels/places/placesitem.cpp b/src/panels/places/placesitem.cpp index 539b9263d..1729bbd19 100644 --- a/src/panels/places/placesitem.cpp +++ b/src/panels/places/placesitem.cpp @@ -69,8 +69,8 @@ void PlacesItem::setUrl(const KUrl& url) m_trashDirLister = new KDirLister(); m_trashDirLister->setAutoErrorHandlingEnabled(false, 0); m_trashDirLister->setDelayedMimeTypes(true); - QObject::connect(m_trashDirLister, SIGNAL(completed()), - m_signalHandler, SLOT(onTrashDirListerCompleted())); + QObject::connect(m_trashDirLister.data(), static_cast(&KDirLister::completed), + m_signalHandler.data(), &PlacesItemSignalHandler::onTrashDirListerCompleted); m_trashDirLister->openUrl(url); } @@ -271,8 +271,8 @@ void PlacesItem::initializeDevice(const QString& udi) if (m_access) { setUrl(m_access->filePath()); - QObject::connect(m_access, SIGNAL(accessibilityChanged(bool,QString)), - m_signalHandler, SLOT(onAccessibilityChanged())); + QObject::connect(m_access.data(), &Solid::StorageAccess::accessibilityChanged, + m_signalHandler.data(), &PlacesItemSignalHandler::onAccessibilityChanged); } else if (m_disc && (m_disc->availableContent() & Solid::OpticalDisc::Audio) != 0) { Solid::Block *block = m_device.as(); if (block) { diff --git a/src/panels/places/placesitemeditdialog.cpp b/src/panels/places/placesitemeditdialog.cpp index 08c910d17..350f39089 100644 --- a/src/panels/places/placesitemeditdialog.cpp +++ b/src/panels/places/placesitemeditdialog.cpp @@ -24,9 +24,11 @@ #include "placesitemeditdialog.h" #include +#include #include #include #include +#include #include #include #include @@ -133,7 +135,7 @@ void PlacesItemEditDialog::initialize() formLayout->addRow(i18nc("@label", "Location:"), m_urlEdit); // Provide room for at least 40 chars (average char width is half of height) m_urlEdit->setMinimumWidth(m_urlEdit->fontMetrics().height() * (40 / 2)); - connect(m_urlEdit->lineEdit(), SIGNAL(textChanged(QString)), this, SLOT(slotUrlChanged(QString))); + connect(m_urlEdit->lineEdit(), &KLineEdit::textChanged, this, &PlacesItemEditDialog::slotUrlChanged); m_iconButton = new KIconButton(mainWidget); formLayout->addRow(i18nc("@label", "Choose an icon:"), m_iconButton); @@ -167,4 +169,3 @@ void PlacesItemEditDialog::initialize() setMainWidget(mainWidget); } -#include "placesitemeditdialog.moc" diff --git a/src/panels/places/placesitemlistgroupheader.cpp b/src/panels/places/placesitemlistgroupheader.cpp index ec7c4b18c..e17fd4d66 100644 --- a/src/panels/places/placesitemlistgroupheader.cpp +++ b/src/panels/places/placesitemlistgroupheader.cpp @@ -42,4 +42,3 @@ QPalette::ColorRole PlacesItemListGroupHeader::normalTextColorRole() const return QPalette::WindowText; } -#include "placesitemlistgroupheader.moc" diff --git a/src/panels/places/placesitemlistwidget.cpp b/src/panels/places/placesitemlistwidget.cpp index e33d1daf9..83b00d798 100644 --- a/src/panels/places/placesitemlistwidget.cpp +++ b/src/panels/places/placesitemlistwidget.cpp @@ -40,4 +40,3 @@ QPalette::ColorRole PlacesItemListWidget::normalTextColorRole() const return QPalette::WindowText; } -#include "placesitemlistwidget.moc" diff --git a/src/panels/places/placesitemmodel.cpp b/src/panels/places/placesitemmodel.cpp index 1f05e07f9..2c984ee40 100644 --- a/src/panels/places/placesitemmodel.cpp +++ b/src/panels/places/placesitemmodel.cpp @@ -35,6 +35,7 @@ #include #include #include +#include #include "placesitem.h" #include #include @@ -52,8 +53,8 @@ #include #ifdef HAVE_BALOO - #include - #include + #include + #include #endif namespace { @@ -98,17 +99,17 @@ PlacesItemModel::PlacesItemModel(QObject* parent) : m_saveBookmarksTimer = new QTimer(this); m_saveBookmarksTimer->setInterval(syncBookmarksTimeout); m_saveBookmarksTimer->setSingleShot(true); - connect(m_saveBookmarksTimer, SIGNAL(timeout()), this, SLOT(saveBookmarks())); + connect(m_saveBookmarksTimer, &QTimer::timeout, this, &PlacesItemModel::saveBookmarks); m_updateBookmarksTimer = new QTimer(this); m_updateBookmarksTimer->setInterval(syncBookmarksTimeout); m_updateBookmarksTimer->setSingleShot(true); - connect(m_updateBookmarksTimer, SIGNAL(timeout()), this, SLOT(updateBookmarks())); + connect(m_updateBookmarksTimer, &QTimer::timeout, this, &PlacesItemModel::updateBookmarks); - connect(m_bookmarkManager, SIGNAL(changed(QString,QString)), - m_updateBookmarksTimer, SLOT(start())); - connect(m_bookmarkManager, SIGNAL(bookmarksChanged(QString)), - m_updateBookmarksTimer, SLOT(start())); + connect(m_bookmarkManager, &KBookmarkManager::changed, + m_updateBookmarksTimer, static_cast(&QTimer::start)); + connect(m_bookmarkManager, &KBookmarkManager::bookmarksChanged, + m_updateBookmarksTimer, static_cast(&QTimer::start)); } PlacesItemModel::~PlacesItemModel() @@ -312,8 +313,8 @@ void PlacesItemModel::requestEject(int index) if (item) { Solid::OpticalDrive* drive = item->device().parent().as(); if (drive) { - connect(drive, SIGNAL(ejectDone(Solid::ErrorType,QVariant,QString)), - this, SLOT(slotStorageTeardownDone(Solid::ErrorType,QVariant))); + connect(drive, &Solid::OpticalDrive::ejectDone, + this, &PlacesItemModel::slotStorageTeardownDone); drive->eject(); } else { const QString label = item->text(); @@ -329,8 +330,8 @@ void PlacesItemModel::requestTeardown(int index) if (item) { Solid::StorageAccess* access = item->device().as(); if (access) { - connect(access, SIGNAL(teardownDone(Solid::ErrorType,QVariant,QString)), - this, SLOT(slotStorageTeardownDone(Solid::ErrorType,QVariant))); + connect(access, &Solid::StorageAccess::teardownDone, + this, &PlacesItemModel::slotStorageTeardownDone); access->teardown(); } } @@ -358,8 +359,8 @@ void PlacesItemModel::requestStorageSetup(int index) m_storageSetupInProgress[access] = index; - connect(access, SIGNAL(setupDone(Solid::ErrorType,QVariant,QString)), - this, SLOT(slotStorageSetupDone(Solid::ErrorType,QVariant,QString))); + connect(access, &Solid::StorageAccess::setupDone, + this, &PlacesItemModel::slotStorageSetupDone); access->setup(); } @@ -968,8 +969,8 @@ void PlacesItemModel::initializeAvailableDevices() Q_ASSERT(m_predicate.isValid()); Solid::DeviceNotifier* notifier = Solid::DeviceNotifier::instance(); - connect(notifier, SIGNAL(deviceAdded(QString)), this, SLOT(slotDeviceAdded(QString))); - connect(notifier, SIGNAL(deviceRemoved(QString)), this, SLOT(slotDeviceRemoved(QString))); + connect(notifier, &Solid::DeviceNotifier::deviceAdded, this, &PlacesItemModel::slotDeviceAdded); + connect(notifier, &Solid::DeviceNotifier::deviceRemoved, this, &PlacesItemModel::slotDeviceRemoved); const QList& deviceList = Solid::Device::listFromQuery(m_predicate); foreach (const Solid::Device& device, deviceList) { @@ -1227,4 +1228,3 @@ void PlacesItemModel::showModelState() } #endif -#include "placesitemmodel.moc" diff --git a/src/panels/places/placesitemsignalhandler.cpp b/src/panels/places/placesitemsignalhandler.cpp index 54a916de7..c9bc0db3f 100644 --- a/src/panels/places/placesitemsignalhandler.cpp +++ b/src/panels/places/placesitemsignalhandler.cpp @@ -47,4 +47,3 @@ void PlacesItemSignalHandler::onTrashDirListerCompleted() } } -#include "placesitemsignalhandler.moc" diff --git a/src/panels/places/placespanel.cpp b/src/panels/places/placespanel.cpp index f19fa1e25..487751931 100644 --- a/src/panels/places/placespanel.cpp +++ b/src/panels/places/placespanel.cpp @@ -30,7 +30,9 @@ #include #include #include +#include #include +#include #include #include #include @@ -48,6 +50,7 @@ #include #include #include +#include PlacesPanel::PlacesPanel(QWidget* parent) : Panel(parent), @@ -101,8 +104,8 @@ void PlacesPanel::showEvent(QShowEvent* event) // used at all and stays invisible. m_model = new PlacesItemModel(this); m_model->setGroupedSorting(true); - connect(m_model, SIGNAL(errorMessage(QString)), - this, SIGNAL(errorMessage(QString))); + connect(m_model, &PlacesItemModel::errorMessage, + this, &PlacesPanel::errorMessage); m_view = new PlacesView(); m_view->setWidgetCreator(new KItemListWidgetCreator()); @@ -114,12 +117,12 @@ void PlacesPanel::showEvent(QShowEvent* event) readSettings(); - connect(m_controller, SIGNAL(itemActivated(int)), this, SLOT(slotItemActivated(int))); - connect(m_controller, SIGNAL(itemMiddleClicked(int)), this, SLOT(slotItemMiddleClicked(int))); - connect(m_controller, SIGNAL(itemContextMenuRequested(int,QPointF)), this, SLOT(slotItemContextMenuRequested(int,QPointF))); - connect(m_controller, SIGNAL(viewContextMenuRequested(QPointF)), this, SLOT(slotViewContextMenuRequested(QPointF))); - connect(m_controller, SIGNAL(itemDropEvent(int,QGraphicsSceneDragDropEvent*)), this, SLOT(slotItemDropEvent(int,QGraphicsSceneDragDropEvent*))); - connect(m_controller, SIGNAL(aboveItemDropEvent(int,QGraphicsSceneDragDropEvent*)), this, SLOT(slotAboveItemDropEvent(int,QGraphicsSceneDragDropEvent*))); + connect(m_controller, &KItemListController::itemActivated, this, &PlacesPanel::slotItemActivated); + connect(m_controller, &KItemListController::itemMiddleClicked, this, &PlacesPanel::slotItemMiddleClicked); + connect(m_controller, &KItemListController::itemContextMenuRequested, this, &PlacesPanel::slotItemContextMenuRequested); + connect(m_controller, &KItemListController::viewContextMenuRequested, this, &PlacesPanel::slotViewContextMenuRequested); + connect(m_controller, &KItemListController::itemDropEvent, this, &PlacesPanel::slotItemDropEvent); + connect(m_controller, &KItemListController::aboveItemDropEvent, this, &PlacesPanel::slotAboveItemDropEvent); KItemListContainer* container = new KItemListContainer(m_controller, this); container->setEnabledFrame(false); @@ -340,8 +343,8 @@ void PlacesPanel::slotItemDropEvent(int index, QGraphicsSceneDragDropEvent* even } if (m_model->storageSetupNeeded(index)) { - connect(m_model, SIGNAL(storageSetupDone(int,bool)), - this, SLOT(slotItemDropEventStorageSetupDone(int,bool))); + connect(m_model, &PlacesItemModel::storageSetupDone, + this, &PlacesPanel::slotItemDropEventStorageSetupDone); m_itemDropEventIndex = index; @@ -379,8 +382,8 @@ void PlacesPanel::slotItemDropEvent(int index, QGraphicsSceneDragDropEvent* even void PlacesPanel::slotItemDropEventStorageSetupDone(int index, bool success) { - disconnect(m_model, SIGNAL(storageSetupDone(int,bool)), - this, SLOT(slotItemDropEventStorageSetupDone(int,bool))); + disconnect(m_model, &PlacesItemModel::storageSetupDone, + this, &PlacesPanel::slotItemDropEventStorageSetupDone); if ((index == m_itemDropEventIndex) && m_itemDropEvent && m_itemDropEventMimeData) { if (success) { @@ -423,13 +426,13 @@ void PlacesPanel::slotTrashUpdated(KJob* job) if (job->error()) { emit errorMessage(job->errorString()); } - org::kde::KDirNotify::emitFilesAdded("trash:/"); + org::kde::KDirNotify::emitFilesAdded(QUrl("trash:/")); } void PlacesPanel::slotStorageSetupDone(int index, bool success) { - disconnect(m_model, SIGNAL(storageSetupDone(int,bool)), - this, SLOT(slotStorageSetupDone(int,bool))); + disconnect(m_model, &PlacesItemModel::storageSetupDone, + this, &PlacesPanel::slotStorageSetupDone); if (m_triggerStorageSetupButton == Qt::NoButton) { return; @@ -460,8 +463,8 @@ void PlacesPanel::emptyTrash() stream << int(1); KIO::Job *job = KIO::special(KUrl("trash:/"), packedArgs); KNotification::event("Trash: emptied", QString() , QPixmap() , 0, KNotification::DefaultEvent); - job->ui()->setWindow(parentWidget()); - connect(job, SIGNAL(result(KJob*)), SLOT(slotTrashUpdated(KJob*))); + KJobWidgets::setWindow(job, parentWidget()); + connect(job, &KIO::Job::result, this, &PlacesPanel::slotTrashUpdated); } } @@ -524,8 +527,8 @@ void PlacesPanel::triggerItem(int index, Qt::MouseButton button) m_triggerStorageSetupButton = button; m_storageSetupFailedUrl = url(); - connect(m_model, SIGNAL(storageSetupDone(int,bool)), - this, SLOT(slotStorageSetupDone(int,bool))); + connect(m_model, &PlacesItemModel::storageSetupDone, + this, &PlacesPanel::slotStorageSetupDone); m_model->requestStorageSetup(index); } else { @@ -543,4 +546,3 @@ void PlacesPanel::triggerItem(int index, Qt::MouseButton button) } -#include "placespanel.moc" diff --git a/src/panels/places/placesview.cpp b/src/panels/places/placesview.cpp index a298a5250..7c455b4bc 100644 --- a/src/panels/places/placesview.cpp +++ b/src/panels/places/placesview.cpp @@ -49,4 +49,3 @@ int PlacesView::iconSize() const return option.iconSize; } -#include "placesview.moc" diff --git a/src/panels/terminal/terminalpanel.cpp b/src/panels/terminal/terminalpanel.cpp index bfd3002f0..1ac5925bf 100644 --- a/src/panels/terminal/terminalpanel.cpp +++ b/src/panels/terminal/terminalpanel.cpp @@ -24,11 +24,12 @@ #include #include #include -#include +#include #include #include #include #include +#include #include #include @@ -109,10 +110,10 @@ void TerminalPanel::showEvent(QShowEvent* event) } m_konsolePart = factory ? (factory->create(this)) : 0; if (m_konsolePart) { - connect(m_konsolePart, SIGNAL(destroyed(QObject*)), this, SLOT(terminalExited())); + connect(m_konsolePart, &KParts::ReadOnlyPart::destroyed, this, &TerminalPanel::terminalExited); m_terminalWidget = m_konsolePart->widget(); m_layout->addWidget(m_terminalWidget); - m_terminal = qobject_cast(m_konsolePart); + m_terminal = qobject_cast(m_konsolePart); } } if (m_terminal) { @@ -136,9 +137,9 @@ void TerminalPanel::changeDir(const KUrl& url) } else { m_mostLocalUrlJob = KIO::mostLocalUrl(url, KIO::HideProgressInfo); if (m_mostLocalUrlJob->ui()) { - m_mostLocalUrlJob->ui()->setWindow(this); + KJobWidgets::setWindow(m_mostLocalUrlJob, this); } - connect(m_mostLocalUrlJob, SIGNAL(result(KJob*)), this, SLOT(slotMostLocalUrlResult(KJob*))); + connect(m_mostLocalUrlJob, &KIO::StatJob::result, this, &TerminalPanel::slotMostLocalUrlResult); } } @@ -194,4 +195,3 @@ void TerminalPanel::slotKonsolePartCurrentDirectoryChanged(const QString& dir) } } -#include "terminalpanel.moc" diff --git a/src/panels/terminal/terminalpanel.h b/src/panels/terminal/terminalpanel.h index 374476e1c..987ee4753 100644 --- a/src/panels/terminal/terminalpanel.h +++ b/src/panels/terminal/terminalpanel.h @@ -22,7 +22,7 @@ #include -class TerminalInterfaceV2; +class TerminalInterface; class QVBoxLayout; class QWidget; @@ -78,7 +78,7 @@ private: KIO::StatJob* m_mostLocalUrlJob; QVBoxLayout* m_layout; - TerminalInterfaceV2* m_terminal; + TerminalInterface* m_terminal; QWidget* m_terminalWidget; KParts::ReadOnlyPart* m_konsolePart; QString m_konsolePartCurrentDirectory; diff --git a/src/search/dolphinfacetswidget.cpp b/src/search/dolphinfacetswidget.cpp index f20ae68d5..8e1a9c470 100644 --- a/src/search/dolphinfacetswidget.cpp +++ b/src/search/dolphinfacetswidget.cpp @@ -295,9 +295,8 @@ QRadioButton* DolphinFacetsWidget::createRadioButton(const QString& text, QButtonGroup* group) { QRadioButton* button = new QRadioButton(text); - connect(button, SIGNAL(clicked()), this, SIGNAL(facetChanged())); + connect(button, &QRadioButton::clicked, this, &DolphinFacetsWidget::facetChanged); group->addButton(button); return button; } -#include "dolphinfacetswidget.moc" diff --git a/src/search/dolphinfacetswidget.h b/src/search/dolphinfacetswidget.h index 757dcd482..46c84ce1a 100644 --- a/src/search/dolphinfacetswidget.h +++ b/src/search/dolphinfacetswidget.h @@ -24,7 +24,7 @@ #include #ifdef HAVE_BALOO - #include + #include #endif class QButtonGroup; diff --git a/src/search/dolphinsearchbox.cpp b/src/search/dolphinsearchbox.cpp index 46ca01a4c..ae93030ac 100644 --- a/src/search/dolphinsearchbox.cpp +++ b/src/search/dolphinsearchbox.cpp @@ -26,6 +26,7 @@ #include #include #include +#include #include #include @@ -41,9 +42,9 @@ #include #ifdef HAVE_BALOO - #include - #include - #include + #include + #include + #include #endif DolphinSearchBox::DolphinSearchBox(QWidget* parent) : @@ -287,7 +288,7 @@ void DolphinSearchBox::initButton(QToolButton* button) button->setAutoExclusive(true); button->setAutoRaise(true); button->setCheckable(true); - connect(button, SIGNAL(clicked(bool)), this, SLOT(slotConfigurationChanged())); + connect(button, &QToolButton::clicked, this, &DolphinSearchBox::slotConfigurationChanged); } void DolphinSearchBox::loadSettings() @@ -322,7 +323,7 @@ void DolphinSearchBox::init() closeButton->setAutoRaise(true); closeButton->setIcon(KIcon("dialog-close")); closeButton->setToolTip(i18nc("@info:tooltip", "Quit searching")); - connect(closeButton, SIGNAL(clicked()), this, SLOT(emitCloseRequest())); + connect(closeButton, &QToolButton::clicked, this, &DolphinSearchBox::emitCloseRequest); // Create search label m_searchLabel = new QLabel(this); @@ -333,10 +334,10 @@ void DolphinSearchBox::init() m_searchInput->setClearButtonShown(true); m_searchInput->setFont(KGlobalSettings::generalFont()); setFocusProxy(m_searchInput); - connect(m_searchInput, SIGNAL(returnPressed(QString)), - this, SLOT(slotReturnPressed(QString))); - connect(m_searchInput, SIGNAL(textChanged(QString)), - this, SLOT(slotSearchTextChanged(QString))); + connect(m_searchInput, static_cast(&KLineEdit::returnPressed), + this, &DolphinSearchBox::slotReturnPressed); + connect(m_searchInput, &KLineEdit::textChanged, + this, &DolphinSearchBox::slotSearchTextChanged); // Apply layout for the search input QHBoxLayout* searchInputLayout = new QHBoxLayout(); @@ -377,12 +378,12 @@ void DolphinSearchBox::init() m_facetsToggleButton = new QToolButton(this); m_facetsToggleButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); initButton(m_facetsToggleButton); - connect(m_facetsToggleButton, SIGNAL(clicked()), this, SLOT(slotFacetsButtonToggled())); + connect(m_facetsToggleButton, &QToolButton::clicked, this, &DolphinSearchBox::slotFacetsButtonToggled); m_facetsWidget = new DolphinFacetsWidget(this); m_facetsWidget->installEventFilter(this); m_facetsWidget->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Maximum); - connect(m_facetsWidget, SIGNAL(facetChanged()), this, SLOT(slotFacetChanged())); + connect(m_facetsWidget, &DolphinFacetsWidget::facetChanged, this, &DolphinSearchBox::slotFacetChanged); // Apply layout for the options QHBoxLayout* optionsLayout = new QHBoxLayout(); @@ -422,7 +423,7 @@ void DolphinSearchBox::init() m_startSearchTimer = new QTimer(this); m_startSearchTimer->setSingleShot(true); m_startSearchTimer->setInterval(1000); - connect(m_startSearchTimer, SIGNAL(timeout()), this, SLOT(emitSearchRequest())); + connect(m_startSearchTimer, &QTimer::timeout, this, &DolphinSearchBox::emitSearchRequest); updateFacetsToggleButton(); } @@ -472,7 +473,7 @@ void DolphinSearchBox::fromBalooSearchUrl(const KUrl& url) // while we adjust the search text and the facet widget. blockSignals(true); - const QVariantHash customOptions = query.customOptions(); + const QVariantMap customOptions = query.customOptions(); if (customOptions.contains("includeFolder")) { setSearchPath(customOptions.value("includeFolder").toString()); } else { @@ -512,4 +513,3 @@ void DolphinSearchBox::updateFacetsToggleButton() m_facetsToggleButton->setText(facetsIsVisible ? i18nc("action:button", "Fewer Options") : i18nc("action:button", "More Options")); } -#include "dolphinsearchbox.moc" diff --git a/src/search/filenamesearchprotocol.cpp b/src/search/filenamesearchprotocol.cpp index 38dd26b23..b56a99580 100644 --- a/src/search/filenamesearchprotocol.cpp +++ b/src/search/filenamesearchprotocol.cpp @@ -25,6 +25,7 @@ #include #include #include +#include #include #include @@ -44,22 +45,22 @@ FileNameSearchProtocol::~FileNameSearchProtocol() cleanup(); } -void FileNameSearchProtocol::listDir(const KUrl& url) +void FileNameSearchProtocol::listDir(const QUrl& url) { cleanup(); - const QString search = url.queryItem("search"); + const QString search = url.queryItemValue("search"); if (!search.isEmpty()) { m_regExp = new QRegExp(search, Qt::CaseInsensitive, QRegExp::Wildcard); } m_checkContent = false; - const QString checkContent = url.queryItem("checkContent"); + const QString checkContent = url.queryItemValue("checkContent"); if (checkContent == QLatin1String("yes")) { m_checkContent = true; } - const QString urlString = url.queryItem("url"); + const QString urlString = url.queryItemValue("url"); searchDirectory(KUrl(urlString)); cleanup(); @@ -80,8 +81,8 @@ void FileNameSearchProtocol::searchDirectory(const KUrl& directory) dirLister->openUrl(directory); QEventLoop eventLoop; - QObject::connect(dirLister, SIGNAL(canceled()), &eventLoop, SLOT(quit())); - QObject::connect(dirLister, SIGNAL(completed()), &eventLoop, SLOT(quit())); + QObject::connect(dirLister, static_cast(&KDirLister::canceled), &eventLoop, &QEventLoop::quit); + QObject::connect(dirLister, static_cast(&KDirLister::completed), &eventLoop, &QEventLoop::quit); eventLoop.exec(); // Visualize all items that match the search pattern @@ -91,7 +92,7 @@ void FileNameSearchProtocol::searchDirectory(const KUrl& directory) bool addItem = false; if (!m_regExp || item.name().contains(*m_regExp)) { addItem = true; - } else if (m_checkContent && item.determineMimeType()->is(QLatin1String("text/plain"))) { + } else if (m_checkContent && item.determineMimeType().inherits(QLatin1String("text/plain"))) { addItem = contentContainsPattern(item.url()); } diff --git a/src/search/filenamesearchprotocol.h b/src/search/filenamesearchprotocol.h index 4a854d729..f691f998b 100644 --- a/src/search/filenamesearchprotocol.h +++ b/src/search/filenamesearchprotocol.h @@ -39,7 +39,7 @@ public: FileNameSearchProtocol(const QByteArray& pool, const QByteArray& app); virtual ~FileNameSearchProtocol(); - virtual void listDir(const KUrl& url); + virtual void listDir(const QUrl& url) Q_DECL_OVERRIDE; private: void searchDirectory(const KUrl& directory); diff --git a/src/settings/additionalinfodialog.cpp b/src/settings/additionalinfodialog.cpp index 0de639540..9cce603f5 100644 --- a/src/settings/additionalinfodialog.cpp +++ b/src/settings/additionalinfodialog.cpp @@ -28,7 +28,7 @@ #include #ifdef HAVE_BALOO - #include + #include #endif AdditionalInfoDialog::AdditionalInfoDialog(QWidget* parent, @@ -81,7 +81,7 @@ AdditionalInfoDialog::AdditionalInfoDialog(QWidget* parent, const KConfigGroup dialogConfig(KSharedConfig::openConfig("dolphinrc"), "AdditionalInfoDialog"); restoreDialogSize(dialogConfig); - connect(this, SIGNAL(okClicked()), this, SLOT(slotOk())); + connect(this, &AdditionalInfoDialog::okClicked, this, &AdditionalInfoDialog::slotOk); } AdditionalInfoDialog::~AdditionalInfoDialog() @@ -110,4 +110,3 @@ void AdditionalInfoDialog::slotOk() } } -#include "additionalinfodialog.moc" diff --git a/src/settings/applyviewpropsjob.cpp b/src/settings/applyviewpropsjob.cpp index 4bc77caee..d33d4430f 100644 --- a/src/settings/applyviewpropsjob.cpp +++ b/src/settings/applyviewpropsjob.cpp @@ -38,8 +38,8 @@ ApplyViewPropsJob::ApplyViewPropsJob(const KUrl& dir, m_viewProps->setSortOrder(viewProps.sortOrder()); KIO::ListJob* listJob = KIO::listRecursive(dir, KIO::HideProgressInfo); - connect(listJob, SIGNAL(entries(KIO::Job*,KIO::UDSEntryList)), - SLOT(slotEntries(KIO::Job*,KIO::UDSEntryList))); + connect(listJob, &KIO::ListJob::entries, + this, &ApplyViewPropsJob::slotEntries); addSubjob(listJob); } @@ -76,4 +76,3 @@ void ApplyViewPropsJob::slotResult(KJob* job) emitResult(); } -#include "applyviewpropsjob.moc" diff --git a/src/settings/dolphinsettingsdialog.cpp b/src/settings/dolphinsettingsdialog.cpp index 609e2ab92..8c20a9148 100644 --- a/src/settings/dolphinsettingsdialog.cpp +++ b/src/settings/dolphinsettingsdialog.cpp @@ -34,6 +34,9 @@ #include #include +#include +#include + DolphinSettingsDialog::DolphinSettingsDialog(const KUrl& url, QWidget* parent) : KPageDialog(parent), m_pages() @@ -43,55 +46,62 @@ DolphinSettingsDialog::DolphinSettingsDialog(const KUrl& url, QWidget* parent) : setMinimumSize(QSize(512, minSize.height())); setFaceType(List); - setCaption(i18nc("@title:window", "Dolphin Preferences")); - setButtons(Ok | Apply | Cancel | Default); - enableButtonApply(false); - setDefaultButton(Ok); + setWindowTitle(i18nc("@title:window", "Dolphin Preferences")); + QDialogButtonBox* box = new QDialogButtonBox(QDialogButtonBox::Ok + | QDialogButtonBox::Apply | QDialogButtonBox::Cancel | QDialogButtonBox::RestoreDefaults); + box->button(QDialogButtonBox::Apply)->setEnabled(false); + box->button(QDialogButtonBox::Ok)->setDefault(true); + setButtonBox(box); + + connect(box->button(QDialogButtonBox::Ok), &QAbstractButton::clicked, this, &DolphinSettingsDialog::applySettings); + connect(box->button(QDialogButtonBox::Apply), &QAbstractButton::clicked, this, &DolphinSettingsDialog::applySettings); + connect(box->button(QDialogButtonBox::RestoreDefaults), &QAbstractButton::clicked, this, &DolphinSettingsDialog::restoreDefaults); // Startup StartupSettingsPage* startupSettingsPage = new StartupSettingsPage(url, this); KPageWidgetItem* startupSettingsFrame = addPage(startupSettingsPage, i18nc("@title:group", "Startup")); startupSettingsFrame->setIcon(KIcon("go-home")); - connect(startupSettingsPage, SIGNAL(changed()), this, SLOT(enableApply())); + connect(startupSettingsPage, &StartupSettingsPage::changed, this, &DolphinSettingsDialog::enableApply); // View Modes ViewSettingsPage* viewSettingsPage = new ViewSettingsPage(this); KPageWidgetItem* viewSettingsFrame = addPage(viewSettingsPage, i18nc("@title:group", "View Modes")); viewSettingsFrame->setIcon(KIcon("view-choose")); - connect(viewSettingsPage, SIGNAL(changed()), this, SLOT(enableApply())); + connect(viewSettingsPage, &ViewSettingsPage::changed, this, &DolphinSettingsDialog::enableApply); // Navigation NavigationSettingsPage* navigationSettingsPage = new NavigationSettingsPage(this); KPageWidgetItem* navigationSettingsFrame = addPage(navigationSettingsPage, i18nc("@title:group", "Navigation")); navigationSettingsFrame->setIcon(KIcon("input-mouse")); - connect(navigationSettingsPage, SIGNAL(changed()), this, SLOT(enableApply())); + connect(navigationSettingsPage, &NavigationSettingsPage::changed, this, &DolphinSettingsDialog::enableApply); // Services ServicesSettingsPage* servicesSettingsPage = new ServicesSettingsPage(this); KPageWidgetItem* servicesSettingsFrame = addPage(servicesSettingsPage, i18nc("@title:group", "Services")); servicesSettingsFrame->setIcon(KIcon("services")); - connect(servicesSettingsPage, SIGNAL(changed()), this, SLOT(enableApply())); + connect(servicesSettingsPage, &ServicesSettingsPage::changed, this, &DolphinSettingsDialog::enableApply); // Trash TrashSettingsPage* trashSettingsPage = new TrashSettingsPage(this); KPageWidgetItem* trashSettingsFrame = addPage(trashSettingsPage, i18nc("@title:group", "Trash")); trashSettingsFrame->setIcon(KIcon("user-trash")); - connect(trashSettingsPage, SIGNAL(changed()), this, SLOT(enableApply())); + connect(trashSettingsPage, &TrashSettingsPage::changed, this, &DolphinSettingsDialog::enableApply); // General GeneralSettingsPage* generalSettingsPage = new GeneralSettingsPage(url, this); KPageWidgetItem* generalSettingsFrame = addPage(generalSettingsPage, i18nc("@title:group General settings", "General")); generalSettingsFrame->setIcon(KIcon("system-run")); - connect(generalSettingsPage, SIGNAL(changed()), this, SLOT(enableApply())); + connect(generalSettingsPage, &GeneralSettingsPage::changed, this, &DolphinSettingsDialog::enableApply); const KConfigGroup dialogConfig(KSharedConfig::openConfig("dolphinrc"), "SettingsDialog"); - restoreDialogSize(dialogConfig); +#pragma message("TODO: port") + //restoreDialogSize(dialogConfig); m_pages.append(startupSettingsPage); m_pages.append(viewSettingsPage); @@ -104,23 +114,13 @@ DolphinSettingsDialog::DolphinSettingsDialog(const KUrl& url, QWidget* parent) : DolphinSettingsDialog::~DolphinSettingsDialog() { KConfigGroup dialogConfig(KSharedConfig::openConfig("dolphinrc"), "SettingsDialog"); - saveDialogSize(dialogConfig); -} - -void DolphinSettingsDialog::slotButtonClicked(int button) -{ - if ((button == Ok) || (button == Apply)) { - applySettings(); - } else if (button == Default) { - restoreDefaults(); - } - - KPageDialog::slotButtonClicked(button); +#pragma message("TODO: port") + //saveDialogSize(dialogConfig); } void DolphinSettingsDialog::enableApply() { - enableButtonApply(true); + buttonBox()->button(QDialogButtonBox::Apply)->setEnabled(true); } void DolphinSettingsDialog::applySettings() @@ -138,8 +138,7 @@ void DolphinSettingsDialog::applySettings() settings->setModifiedStartupSettings(false); settings->writeConfig(); } - - enableButtonApply(false); + buttonBox()->button(QDialogButtonBox::Apply)->setEnabled(false); } void DolphinSettingsDialog::restoreDefaults() @@ -149,4 +148,3 @@ void DolphinSettingsDialog::restoreDefaults() } } -#include "dolphinsettingsdialog.moc" diff --git a/src/settings/dolphinsettingsdialog.h b/src/settings/dolphinsettingsdialog.h index 2de195017..56d924c7d 100644 --- a/src/settings/dolphinsettingsdialog.h +++ b/src/settings/dolphinsettingsdialog.h @@ -42,15 +42,9 @@ public: signals: void settingsChanged(); -protected slots: - /** @see KDialog::slotButtonClicked() */ - virtual void slotButtonClicked(int button); - private slots: /** Enables the Apply button. */ void enableApply(); - -private: void applySettings(); void restoreDefaults(); diff --git a/src/settings/general/behaviorsettingspage.cpp b/src/settings/general/behaviorsettingspage.cpp index cbbde1d7c..635a1b2c4 100644 --- a/src/settings/general/behaviorsettingspage.cpp +++ b/src/settings/general/behaviorsettingspage.cpp @@ -79,12 +79,12 @@ BehaviorSettingsPage::BehaviorSettingsPage(const KUrl& url, QWidget* parent) : loadSettings(); - connect(m_localViewProps, SIGNAL(toggled(bool)), this, SIGNAL(changed())); - connect(m_globalViewProps, SIGNAL(toggled(bool)), this, SIGNAL(changed())); - connect(m_showToolTips, SIGNAL(toggled(bool)), this, SIGNAL(changed())); - connect(m_showSelectionToggle, SIGNAL(toggled(bool)), this, SIGNAL(changed())); - connect(m_naturalSorting, SIGNAL(toggled(bool)), this, SIGNAL(changed())); - connect(m_renameInline, SIGNAL(toggled(bool)), this, SIGNAL(changed())); + connect(m_localViewProps, &QRadioButton::toggled, this, &BehaviorSettingsPage::changed); + connect(m_globalViewProps, &QRadioButton::toggled, this, &BehaviorSettingsPage::changed); + connect(m_showToolTips, &QCheckBox::toggled, this, &BehaviorSettingsPage::changed); + connect(m_showSelectionToggle, &QCheckBox::toggled, this, &BehaviorSettingsPage::changed); + connect(m_naturalSorting, &QCheckBox::toggled, this, &BehaviorSettingsPage::changed); + connect(m_renameInline, &QCheckBox::toggled, this, &BehaviorSettingsPage::changed); } BehaviorSettingsPage::~BehaviorSettingsPage() @@ -115,7 +115,7 @@ void BehaviorSettingsPage::applySettings() const bool naturalSorting = m_naturalSorting->isChecked(); if (KGlobalSettings::naturalSorting() != naturalSorting) { - KConfigGroup group(KGlobal::config(), "KDE"); + KConfigGroup group(KSharedConfig::openConfig(), "KDE"); group.writeEntry("NaturalSorting", naturalSorting, KConfig::Persistent | KConfig::Global); KGlobalSettings::emitChange(KGlobalSettings::NaturalSortingChanged); } @@ -141,4 +141,3 @@ void BehaviorSettingsPage::loadSettings() m_renameInline->setChecked(GeneralSettings::renameInline()); } -#include "behaviorsettingspage.moc" diff --git a/src/settings/general/configurepreviewplugindialog.cpp b/src/settings/general/configurepreviewplugindialog.cpp index 3ca08dfd0..ce70e2bad 100644 --- a/src/settings/general/configurepreviewplugindialog.cpp +++ b/src/settings/general/configurepreviewplugindialog.cpp @@ -27,6 +27,7 @@ #include #include #include +#include ConfigurePreviewPluginDialog::ConfigurePreviewPluginDialog(const QString& pluginName, const QString& desktopEntryName, @@ -59,7 +60,7 @@ ConfigurePreviewPluginDialog::ConfigurePreviewPluginDialog(const QString& plugin setMainWidget(mainWidget); - connect(this, SIGNAL(okClicked()), this, SLOT(slotOk())); + connect(this, &ConfigurePreviewPluginDialog::okClicked, this, &ConfigurePreviewPluginDialog::slotOk); } ConfigurePreviewPluginDialog::~ConfigurePreviewPluginDialog() @@ -73,9 +74,8 @@ void ConfigurePreviewPluginDialog::slotOk() // for a specific MIME-type should be regenerated. As this is not available yet we // delete the whole thumbnails directory. QApplication::changeOverrideCursor(Qt::BusyCursor); - KIO::NetAccess::del(QString(QDir::homePath() + "/.thumbnails/"), this); + KIO::NetAccess::del(QUrl::fromLocalFile(QDir::homePath() + "/.thumbnails/"), this); QApplication::restoreOverrideCursor(); } -#include "configurepreviewplugindialog.moc" diff --git a/src/settings/general/confirmationssettingspage.cpp b/src/settings/general/confirmationssettingspage.cpp index ab23a1908..532821159 100644 --- a/src/settings/general/confirmationssettingspage.cpp +++ b/src/settings/general/confirmationssettingspage.cpp @@ -68,9 +68,9 @@ ConfirmationsSettingsPage::ConfirmationsSettingsPage(QWidget* parent) : loadSettings(); - connect(m_confirmMoveToTrash, SIGNAL(toggled(bool)), this, SIGNAL(changed())); - connect(m_confirmDelete, SIGNAL(toggled(bool)), this, SIGNAL(changed())); - connect(m_confirmClosingMultipleTabs, SIGNAL(toggled(bool)), this, SIGNAL(changed())); + connect(m_confirmMoveToTrash, &QCheckBox::toggled, this, &ConfirmationsSettingsPage::changed); + connect(m_confirmDelete, &QCheckBox::toggled, this, &ConfirmationsSettingsPage::changed); + connect(m_confirmClosingMultipleTabs, &QCheckBox::toggled, this, &ConfirmationsSettingsPage::changed); } ConfirmationsSettingsPage::~ConfirmationsSettingsPage() @@ -111,4 +111,3 @@ void ConfirmationsSettingsPage::loadSettings() m_confirmClosingMultipleTabs->setChecked(GeneralSettings::confirmClosingMultipleTabs()); } -#include "confirmationssettingspage.moc" diff --git a/src/settings/general/generalsettingspage.cpp b/src/settings/general/generalsettingspage.cpp index 18e152880..3b196e837 100644 --- a/src/settings/general/generalsettingspage.cpp +++ b/src/settings/general/generalsettingspage.cpp @@ -46,22 +46,22 @@ GeneralSettingsPage::GeneralSettingsPage(const KUrl& url, QWidget* parent) : // initialize 'Behavior' tab BehaviorSettingsPage* behaviorPage = new BehaviorSettingsPage(url, tabWidget); tabWidget->addTab(behaviorPage, i18nc("@title:tab Behavior settings", "Behavior")); - connect(behaviorPage, SIGNAL(changed()), this, SIGNAL(changed())); + connect(behaviorPage, &BehaviorSettingsPage::changed, this, &GeneralSettingsPage::changed); // initialize 'Previews' tab PreviewsSettingsPage* previewsPage = new PreviewsSettingsPage(tabWidget); tabWidget->addTab(previewsPage, i18nc("@title:tab Previews settings", "Previews")); - connect(previewsPage, SIGNAL(changed()), this, SIGNAL(changed())); + connect(previewsPage, &PreviewsSettingsPage::changed, this, &GeneralSettingsPage::changed); // initialize 'Context Menu' tab ConfirmationsSettingsPage* confirmationsPage = new ConfirmationsSettingsPage(tabWidget); tabWidget->addTab(confirmationsPage, i18nc("@title:tab Confirmations settings", "Confirmations")); - connect(confirmationsPage, SIGNAL(changed()), this, SIGNAL(changed())); + connect(confirmationsPage, &ConfirmationsSettingsPage::changed, this, &GeneralSettingsPage::changed); // initialize 'Status Bar' tab StatusBarSettingsPage* statusBarPage = new StatusBarSettingsPage(tabWidget); tabWidget->addTab(statusBarPage, i18nc("@title:tab Status Bar settings", "Status Bar")); - connect(statusBarPage, SIGNAL(changed()), this, SIGNAL(changed())); + connect(statusBarPage, &StatusBarSettingsPage::changed, this, &GeneralSettingsPage::changed); m_pages.append(behaviorPage); m_pages.append(previewsPage); @@ -89,4 +89,3 @@ void GeneralSettingsPage::restoreDefaults() } } -#include "generalsettingspage.moc" diff --git a/src/settings/general/previewssettingspage.cpp b/src/settings/general/previewssettingspage.cpp index 38b61b996..428e4fe28 100644 --- a/src/settings/general/previewssettingspage.cpp +++ b/src/settings/general/previewssettingspage.cpp @@ -65,8 +65,8 @@ PreviewsSettingsPage::PreviewsSettingsPage(QWidget* parent) : m_listView = new QListView(this); ServiceItemDelegate* delegate = new ServiceItemDelegate(m_listView, m_listView); - connect(delegate, SIGNAL(requestServiceConfiguration(QModelIndex)), - this, SLOT(configureService(QModelIndex))); + connect(delegate, &ServiceItemDelegate::requestServiceConfiguration, + this, &PreviewsSettingsPage::configureService); ServiceModel* serviceModel = new ServiceModel(this); QSortFilterProxyModel* proxyModel = new QSortFilterProxyModel(this); @@ -95,8 +95,8 @@ PreviewsSettingsPage::PreviewsSettingsPage(QWidget* parent) : loadSettings(); - connect(m_listView, SIGNAL(clicked(QModelIndex)), this, SIGNAL(changed())); - connect(m_remoteFileSizeBox, SIGNAL(valueChanged(int)), this, SIGNAL(changed())); + connect(m_listView, &QListView::clicked, this, &PreviewsSettingsPage::changed); + connect(m_remoteFileSizeBox, static_cast(&KIntSpinBox::valueChanged), this, &PreviewsSettingsPage::changed); } PreviewsSettingsPage::~PreviewsSettingsPage() @@ -159,7 +159,7 @@ void PreviewsSettingsPage::loadPreviewPlugins() QAbstractItemModel* model = m_listView->model(); const KService::List plugins = KServiceTypeTrader::self()->query(QLatin1String("ThumbCreator")); - foreach (const KSharedPtr& service, plugins) { + foreach (const KService::Ptr& service, plugins) { const bool configurable = service->property("Configurable", QVariant::Bool).toBool(); const bool show = m_enabledPreviewPlugins.contains(service->desktopEntryName()); @@ -201,4 +201,3 @@ void PreviewsSettingsPage::loadSettings() m_remoteFileSizeBox->setValue(maxRemoteMByteSize); } -#include "previewssettingspage.moc" diff --git a/src/settings/general/statusbarsettingspage.cpp b/src/settings/general/statusbarsettingspage.cpp index 48622ac4c..78ee3856b 100644 --- a/src/settings/general/statusbarsettingspage.cpp +++ b/src/settings/general/statusbarsettingspage.cpp @@ -43,8 +43,8 @@ StatusBarSettingsPage::StatusBarSettingsPage(QWidget* parent) : loadSettings(); - connect(m_showZoomSlider, SIGNAL(toggled(bool)), this, SIGNAL(changed())); - connect(m_showSpaceInfo, SIGNAL(toggled(bool)), this, SIGNAL(changed())); + connect(m_showZoomSlider, &QCheckBox::toggled, this, &StatusBarSettingsPage::changed); + connect(m_showSpaceInfo, &QCheckBox::toggled, this, &StatusBarSettingsPage::changed); } StatusBarSettingsPage::~StatusBarSettingsPage() @@ -73,4 +73,3 @@ void StatusBarSettingsPage::loadSettings() m_showSpaceInfo->setChecked(GeneralSettings::showSpaceInfo()); } -#include "statusbarsettingspage.moc" diff --git a/src/settings/kcm/kcmdolphingeneral.cpp b/src/settings/kcm/kcmdolphingeneral.cpp index 26cb580f0..84b66e956 100644 --- a/src/settings/kcm/kcmdolphingeneral.cpp +++ b/src/settings/kcm/kcmdolphingeneral.cpp @@ -24,6 +24,7 @@ #include #include #include +#include #include #include @@ -36,7 +37,7 @@ K_PLUGIN_FACTORY(KCMDolphinGeneralConfigFactory, registerPluginaddTab(behaviorPage, i18nc("@title:tab Behavior settings", "Behavior")); - connect(behaviorPage, SIGNAL(changed()), this, SLOT(changed())); + connect(behaviorPage, &BehaviorSettingsPage::changed, this, static_cast(&DolphinGeneralConfigModule::changed)); // initialize 'Previews' tab PreviewsSettingsPage* previewsPage = new PreviewsSettingsPage(tabWidget); tabWidget->addTab(previewsPage, i18nc("@title:tab Previews settings", "Previews")); - connect(previewsPage, SIGNAL(changed()), this, SLOT(changed())); + connect(previewsPage, &PreviewsSettingsPage::changed, this, static_cast(&DolphinGeneralConfigModule::changed)); // initialize 'Confirmations' tab ConfirmationsSettingsPage* confirmationsPage = new ConfirmationsSettingsPage(tabWidget); tabWidget->addTab(confirmationsPage, i18nc("@title:tab Confirmations settings", "Confirmations")); - connect(confirmationsPage, SIGNAL(changed()), this, SLOT(changed())); + connect(confirmationsPage, &ConfirmationsSettingsPage::changed, this, static_cast(&DolphinGeneralConfigModule::changed)); m_pages.append(behaviorPage); m_pages.append(previewsPage); diff --git a/src/settings/kcm/kcmdolphinnavigation.cpp b/src/settings/kcm/kcmdolphinnavigation.cpp index 36345a515..8096bc24a 100644 --- a/src/settings/kcm/kcmdolphinnavigation.cpp +++ b/src/settings/kcm/kcmdolphinnavigation.cpp @@ -24,6 +24,7 @@ #include #include #include +#include #include @@ -33,7 +34,7 @@ K_PLUGIN_FACTORY(KCMDolphinNavigationConfigFactory, registerPluginsetSpacing(KDialog::spacingHint()); m_navigation = new NavigationSettingsPage(this); - connect(m_navigation, SIGNAL(changed()), this, SLOT(changed())); + connect(m_navigation, &NavigationSettingsPage::changed, this, static_cast(&DolphinNavigationConfigModule::changed)); topLayout->addWidget(m_navigation, 0, 0); } diff --git a/src/settings/kcm/kcmdolphinservices.cpp b/src/settings/kcm/kcmdolphinservices.cpp index 6d8c76192..87778dd81 100644 --- a/src/settings/kcm/kcmdolphinservices.cpp +++ b/src/settings/kcm/kcmdolphinservices.cpp @@ -24,6 +24,7 @@ #include #include #include +#include #include @@ -33,7 +34,7 @@ K_PLUGIN_FACTORY(KCMDolphinServicesConfigFactory, registerPluginsetSpacing(KDialog::spacingHint()); m_services = new ServicesSettingsPage(this); - connect(m_services, SIGNAL(changed()), this, SLOT(changed())); + connect(m_services, &ServicesSettingsPage::changed, this, static_cast(&DolphinServicesConfigModule::changed)); topLayout->addWidget(m_services, 0, 0); } diff --git a/src/settings/kcm/kcmdolphinviewmodes.cpp b/src/settings/kcm/kcmdolphinviewmodes.cpp index a7a9db36d..44a551544 100644 --- a/src/settings/kcm/kcmdolphinviewmodes.cpp +++ b/src/settings/kcm/kcmdolphinviewmodes.cpp @@ -25,6 +25,7 @@ #include #include #include +#include #include @@ -38,7 +39,7 @@ K_PLUGIN_FACTORY(KCMDolphinViewModesConfigFactory, registerPluginaddTab(iconsTab, KIcon("view-list-icons"), i18nc("@title:tab", "Icons")); - connect(iconsTab, SIGNAL(changed()), this, SLOT(viewModeChanged())); + connect(iconsTab, &ViewSettingsTab::changed, this, &DolphinViewModesConfigModule::viewModeChanged); // Initialize 'Compact' tab ViewSettingsTab* compactTab = new ViewSettingsTab(ViewSettingsTab::CompactMode, tabWidget); tabWidget->addTab(compactTab, KIcon("view-list-details"), i18nc("@title:tab", "Compact")); - connect(compactTab, SIGNAL(changed()), this, SLOT(viewModeChanged())); + connect(compactTab, &ViewSettingsTab::changed, this, &DolphinViewModesConfigModule::viewModeChanged); // Initialize 'Details' tab ViewSettingsTab* detailsTab = new ViewSettingsTab(ViewSettingsTab::DetailsMode, tabWidget); tabWidget->addTab(detailsTab, KIcon("view-list-tree"), i18nc("@title:tab", "Details")); - connect(detailsTab, SIGNAL(changed()), this, SLOT(viewModeChanged())); + connect(detailsTab, &ViewSettingsTab::changed, this, &DolphinViewModesConfigModule::viewModeChanged); m_tabs.append(iconsTab); m_tabs.append(compactTab); diff --git a/src/settings/navigation/navigationsettingspage.cpp b/src/settings/navigation/navigationsettingspage.cpp index 8076d705d..5894599a1 100644 --- a/src/settings/navigation/navigationsettingspage.cpp +++ b/src/settings/navigation/navigationsettingspage.cpp @@ -68,10 +68,10 @@ NavigationSettingsPage::NavigationSettingsPage(QWidget* parent) : loadSettings(); - connect(m_singleClick, SIGNAL(toggled(bool)), this, SIGNAL(changed())); - connect(m_doubleClick, SIGNAL(toggled(bool)), this, SIGNAL(changed())); - connect(m_openArchivesAsFolder, SIGNAL(toggled(bool)), this, SIGNAL(changed())); - connect(m_autoExpandFolders, SIGNAL(toggled(bool)), this, SIGNAL(changed())); + connect(m_singleClick, &QRadioButton::toggled, this, &NavigationSettingsPage::changed); + connect(m_doubleClick, &QRadioButton::toggled, this, &NavigationSettingsPage::changed); + connect(m_openArchivesAsFolder, &QCheckBox::toggled, this, &NavigationSettingsPage::changed); + connect(m_autoExpandFolders, &QCheckBox::toggled, this, &NavigationSettingsPage::changed); } NavigationSettingsPage::~NavigationSettingsPage() @@ -115,4 +115,3 @@ void NavigationSettingsPage::loadSettings() m_autoExpandFolders->setChecked(GeneralSettings::autoExpandFolders()); } -#include "navigationsettingspage.moc" diff --git a/src/settings/serviceitemdelegate.cpp b/src/settings/serviceitemdelegate.cpp index 7538e038b..43406eeda 100644 --- a/src/settings/serviceitemdelegate.cpp +++ b/src/settings/serviceitemdelegate.cpp @@ -66,16 +66,16 @@ void ServiceItemDelegate::paint(QPainter* painter, const QStyleOptionViewItem& o painter->restore(); } -QList ServiceItemDelegate::createItemWidgets() const +QList ServiceItemDelegate::createItemWidgets(const QModelIndex&) const { QCheckBox* checkBox = new QCheckBox(); QPalette palette = checkBox->palette(); palette.setColor(QPalette::WindowText, palette.color(QPalette::Text)); checkBox->setPalette(palette); - connect(checkBox, SIGNAL(clicked(bool)), this, SLOT(slotCheckBoxClicked(bool))); + connect(checkBox, &QCheckBox::clicked, this, &ServiceItemDelegate::slotCheckBoxClicked); KPushButton* configureButton = new KPushButton(); - connect(configureButton, SIGNAL(clicked()), this, SLOT(slotConfigureButtonClicked())); + connect(configureButton, &KPushButton::clicked, this, &ServiceItemDelegate::slotConfigureButtonClicked); return QList() << checkBox << configureButton; } @@ -129,4 +129,3 @@ void ServiceItemDelegate::slotConfigureButtonClicked() emit requestServiceConfiguration(focusedIndex()); } -#include "serviceitemdelegate.moc" diff --git a/src/settings/serviceitemdelegate.h b/src/settings/serviceitemdelegate.h index ea9681a5a..958d0dc57 100644 --- a/src/settings/serviceitemdelegate.h +++ b/src/settings/serviceitemdelegate.h @@ -42,7 +42,7 @@ public: virtual void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const; - virtual QList createItemWidgets() const; + virtual QList createItemWidgets(const QModelIndex&) const Q_DECL_OVERRIDE; virtual void updateItemWidgets(const QList widgets, const QStyleOptionViewItem& option, diff --git a/src/settings/servicemodel.cpp b/src/settings/servicemodel.cpp index 315b90dff..e3b015147 100644 --- a/src/settings/servicemodel.cpp +++ b/src/settings/servicemodel.cpp @@ -105,4 +105,3 @@ int ServiceModel::rowCount(const QModelIndex& parent) const return m_items.count(); } -#include "servicemodel.moc" diff --git a/src/settings/services/servicessettingspage.cpp b/src/settings/services/servicessettingspage.cpp index 48e816be7..481c8af4a 100644 --- a/src/settings/services/servicessettingspage.cpp +++ b/src/settings/services/servicessettingspage.cpp @@ -29,7 +29,7 @@ #include #include #include -#include +#include #include #include #include @@ -78,12 +78,12 @@ ServicesSettingsPage::ServicesSettingsPage(QWidget* parent) : m_listView->setModel(m_sortModel); m_listView->setItemDelegate(delegate); m_listView->setVerticalScrollMode(QListView::ScrollPerPixel); - connect(m_listView, SIGNAL(clicked(QModelIndex)), this, SIGNAL(changed())); + connect(m_listView, &QListView::clicked, this, &ServicesSettingsPage::changed); KNS3::Button* downloadButton = new KNS3::Button(i18nc("@action:button", "Download New Services..."), "servicemenu.knsrc", this); - connect(downloadButton, SIGNAL(dialogFinished(KNS3::Entry::List)), this, SLOT(loadServices())); + connect(downloadButton, &KNS3::Button::dialogFinished, this, &ServicesSettingsPage::loadServices); topLayout->addWidget(label); topLayout->addWidget(m_listView); @@ -194,7 +194,7 @@ void ServicesSettingsPage::loadServices() // Load generic services const KService::List entries = KServiceTypeTrader::self()->query("KonqPopupMenu/Plugin"); - foreach (const KSharedPtr& service, entries) { + foreach (const KService::Ptr& service, entries) { const QString file = KStandardDirs::locate("services", service->entryPath()); const QList serviceActions = KDesktopFileActions::userDefinedServices(file, true); @@ -220,7 +220,7 @@ void ServicesSettingsPage::loadServices() // Load service plugins that implement the KFileItemActionPlugin interface const KService::List pluginServices = KServiceTypeTrader::self()->query("KFileItemAction/Plugin"); - foreach (const KSharedPtr& service, pluginServices) { + foreach (const KService::Ptr& service, pluginServices) { const QString desktopEntryName = service->desktopEntryName(); if (!isInServicesList(desktopEntryName)) { const bool checked = showGroup.readEntry(desktopEntryName, true); @@ -273,4 +273,3 @@ void ServicesSettingsPage::addRow(const QString& icon, m_serviceModel->setData(index, checked, Qt::CheckStateRole); } -#include "servicessettingspage.moc" diff --git a/src/settings/settingspagebase.cpp b/src/settings/settingspagebase.cpp index 6f8dcbfb6..70549fd2c 100644 --- a/src/settings/settingspagebase.cpp +++ b/src/settings/settingspagebase.cpp @@ -28,4 +28,3 @@ SettingsPageBase::~SettingsPageBase() {} -#include "settingspagebase.moc" diff --git a/src/settings/startup/startupsettingspage.cpp b/src/settings/startup/startupsettingspage.cpp index 693826318..8e8cf9e73 100644 --- a/src/settings/startup/startupsettingspage.cpp +++ b/src/settings/startup/startupsettingspage.cpp @@ -64,24 +64,24 @@ StartupSettingsPage::StartupSettingsPage(const KUrl& url, QWidget* parent) : m_homeUrl = new KLineEdit(homeUrlBox); m_homeUrl->setClearButtonShown(true); - QPushButton* selectHomeUrlButton = new QPushButton(KIcon("folder-open"), QString(), homeUrlBox); + QPushButton* selectHomeUrlButton = new QPushButton(QIcon::fromTheme("folder-open"), QString(), homeUrlBox); #ifndef QT_NO_ACCESSIBILITY selectHomeUrlButton->setAccessibleName(i18nc("@action:button", "Select Home Location")); #endif - connect(selectHomeUrlButton, SIGNAL(clicked()), - this, SLOT(selectHomeUrl())); + connect(selectHomeUrlButton, &QPushButton::clicked, + this, &StartupSettingsPage::selectHomeUrl); KHBox* buttonBox = new KHBox(homeBox); buttonBox->setSpacing(spacing); QPushButton* useCurrentButton = new QPushButton(i18nc("@action:button", "Use Current Location"), buttonBox); - connect(useCurrentButton, SIGNAL(clicked()), - this, SLOT(useCurrentLocation())); + connect(useCurrentButton, &QPushButton::clicked, + this, &StartupSettingsPage::useCurrentLocation); QPushButton* useDefaultButton = new QPushButton(i18nc("@action:button", "Use Default Location"), buttonBox); - connect(useDefaultButton, SIGNAL(clicked()), - this, SLOT(useDefaultLocation())); + connect(useDefaultButton, &QPushButton::clicked, + this, &StartupSettingsPage::useDefaultLocation); QVBoxLayout* homeBoxLayout = new QVBoxLayout(homeBox); homeBoxLayout->addWidget(homeUrlBox); @@ -102,11 +102,11 @@ StartupSettingsPage::StartupSettingsPage(const KUrl& url, QWidget* parent) : loadSettings(); - connect(m_homeUrl, SIGNAL(textChanged(QString)), this, SLOT(slotSettingsChanged())); - connect(m_splitView, SIGNAL(toggled(bool)), this, SLOT(slotSettingsChanged())); - connect(m_editableUrl, SIGNAL(toggled(bool)), this, SLOT(slotSettingsChanged())); - connect(m_showFullPath, SIGNAL(toggled(bool)), this, SLOT(slotSettingsChanged())); - connect(m_filterBar, SIGNAL(toggled(bool)), this, SLOT(slotSettingsChanged())); + connect(m_homeUrl, &KLineEdit::textChanged, this, &StartupSettingsPage::slotSettingsChanged); + connect(m_splitView, &QCheckBox::toggled, this, &StartupSettingsPage::slotSettingsChanged); + connect(m_editableUrl, &QCheckBox::toggled, this, &StartupSettingsPage::slotSettingsChanged); + connect(m_showFullPath, &QCheckBox::toggled, this, &StartupSettingsPage::slotSettingsChanged); + connect(m_filterBar, &QCheckBox::toggled, this, &StartupSettingsPage::slotSettingsChanged); } StartupSettingsPage::~StartupSettingsPage() @@ -181,4 +181,3 @@ void StartupSettingsPage::loadSettings() m_filterBar->setChecked(GeneralSettings::filterBar()); } -#include "startupsettingspage.moc" diff --git a/src/settings/trash/trashsettingspage.cpp b/src/settings/trash/trashsettingspage.cpp index cd699856c..bd01d56b5 100644 --- a/src/settings/trash/trashsettingspage.cpp +++ b/src/settings/trash/trashsettingspage.cpp @@ -45,7 +45,7 @@ TrashSettingsPage::TrashSettingsPage(QWidget* parent) : loadSettings(); - connect(m_proxy, SIGNAL(changed(bool)), this, SIGNAL(changed())); + connect(m_proxy, static_cast(&KCModuleProxy::changed), this, &TrashSettingsPage::changed); } TrashSettingsPage::~TrashSettingsPage() @@ -67,4 +67,3 @@ void TrashSettingsPage::loadSettings() m_proxy->load(); } -#include "trashsettingspage.moc" diff --git a/src/settings/viewmodes/dolphinfontrequester.cpp b/src/settings/viewmodes/dolphinfontrequester.cpp index 6cb7b9929..660aacdf9 100644 --- a/src/settings/viewmodes/dolphinfontrequester.cpp +++ b/src/settings/viewmodes/dolphinfontrequester.cpp @@ -41,12 +41,12 @@ DolphinFontRequester::DolphinFontRequester(QWidget* parent) : m_modeCombo = new KComboBox(this); m_modeCombo->addItem(i18nc("@item:inlistbox Font", "System Font")); m_modeCombo->addItem(i18nc("@item:inlistbox Font", "Custom Font")); - connect(m_modeCombo, SIGNAL(activated(int)), - this, SLOT(changeMode(int))); + connect(m_modeCombo, static_cast(&KComboBox::activated), + this, &DolphinFontRequester::changeMode); m_chooseFontButton = new QPushButton(i18nc("@action:button Choose font", "Choose..."), this); - connect(m_chooseFontButton, SIGNAL(clicked()), - this, SLOT(openFontDialog())); + connect(m_chooseFontButton, &QPushButton::clicked, + this, &DolphinFontRequester::openFontDialog); changeMode(m_modeCombo->currentIndex()); @@ -104,4 +104,3 @@ void DolphinFontRequester::changeMode(int index) emit changed(); } -#include "dolphinfontrequester.moc" diff --git a/src/settings/viewmodes/viewsettingspage.cpp b/src/settings/viewmodes/viewsettingspage.cpp index 4f8a3f00d..941b211ef 100644 --- a/src/settings/viewmodes/viewsettingspage.cpp +++ b/src/settings/viewmodes/viewsettingspage.cpp @@ -42,18 +42,18 @@ ViewSettingsPage::ViewSettingsPage(QWidget* parent) : // Initialize 'Icons' tab ViewSettingsTab* iconsTab = new ViewSettingsTab(ViewSettingsTab::IconsMode, tabWidget); - tabWidget->addTab(iconsTab, KIcon("view-list-icons"), i18nc("@title:tab", "Icons")); - connect(iconsTab, SIGNAL(changed()), this, SIGNAL(changed())); + tabWidget->addTab(iconsTab, QIcon::fromTheme("view-list-icons"), i18nc("@title:tab", "Icons")); + connect(iconsTab, &ViewSettingsTab::changed, this, &ViewSettingsPage::changed); // Initialize 'Compact' tab ViewSettingsTab* compactTab = new ViewSettingsTab(ViewSettingsTab::CompactMode, tabWidget); - tabWidget->addTab(compactTab, KIcon("view-list-details"), i18nc("@title:tab", "Compact")); - connect(compactTab, SIGNAL(changed()), this, SIGNAL(changed())); + tabWidget->addTab(compactTab, QIcon::fromTheme("view-list-details"), i18nc("@title:tab", "Compact")); + connect(compactTab, &ViewSettingsTab::changed, this, &ViewSettingsPage::changed); // Initialize 'Details' tab ViewSettingsTab* detailsTab = new ViewSettingsTab(ViewSettingsTab::DetailsMode, tabWidget); - tabWidget->addTab(detailsTab, KIcon("view-list-tree"), i18nc("@title:tab", "Details")); - connect(detailsTab, SIGNAL(changed()), this, SIGNAL(changed())); + tabWidget->addTab(detailsTab, QIcon::fromTheme("view-list-tree"), i18nc("@title:tab", "Details")); + connect(detailsTab, &ViewSettingsTab::changed, this, &ViewSettingsPage::changed); m_tabs.append(iconsTab); m_tabs.append(compactTab); @@ -80,4 +80,3 @@ void ViewSettingsPage::restoreDefaults() } } -#include "viewsettingspage.moc" diff --git a/src/settings/viewmodes/viewsettingstab.cpp b/src/settings/viewmodes/viewsettingstab.cpp index bc124516d..6f442099f 100644 --- a/src/settings/viewmodes/viewsettingstab.cpp +++ b/src/settings/viewmodes/viewsettingstab.cpp @@ -61,16 +61,16 @@ ViewSettingsTab::ViewSettingsTab(Mode mode, QWidget* parent) : m_defaultSizeSlider->setPageStep(1); m_defaultSizeSlider->setTickPosition(QSlider::TicksBelow); m_defaultSizeSlider->setRange(minRange, maxRange); - connect(m_defaultSizeSlider, SIGNAL(valueChanged(int)), - this, SLOT(slotDefaultSliderMoved(int))); + connect(m_defaultSizeSlider, &QSlider::valueChanged, + this, &ViewSettingsTab::slotDefaultSliderMoved); QLabel* previewLabel = new QLabel(i18nc("@label:listbox", "Preview:"), this); m_previewSizeSlider = new QSlider(Qt::Horizontal, this); m_previewSizeSlider->setPageStep(1); m_previewSizeSlider->setTickPosition(QSlider::TicksBelow); m_previewSizeSlider->setRange(minRange, maxRange); - connect(m_previewSizeSlider, SIGNAL(valueChanged(int)), - this, SLOT(slotPreviewSliderMoved(int))); + connect(m_previewSizeSlider, &QSlider::valueChanged, + this, &ViewSettingsTab::slotPreviewSliderMoved); QGridLayout* layout = new QGridLayout(iconSizeGroup); layout->addWidget(defaultLabel, 0, 0, Qt::AlignRight); @@ -138,20 +138,20 @@ ViewSettingsTab::ViewSettingsTab(Mode mode, QWidget* parent) : loadSettings(); - connect(m_defaultSizeSlider, SIGNAL(valueChanged(int)), this, SIGNAL(changed())); - connect(m_previewSizeSlider, SIGNAL(valueChanged(int)), this, SIGNAL(changed())); - connect(m_fontRequester, SIGNAL(changed()), this, SIGNAL(changed())); + connect(m_defaultSizeSlider, &QSlider::valueChanged, this, &ViewSettingsTab::changed); + connect(m_previewSizeSlider, &QSlider::valueChanged, this, &ViewSettingsTab::changed); + connect(m_fontRequester, &DolphinFontRequester::changed, this, &ViewSettingsTab::changed); switch (m_mode) { case IconsMode: - connect(m_widthBox, SIGNAL(currentIndexChanged(int)), this, SIGNAL(changed())); - connect(m_maxLinesBox, SIGNAL(currentIndexChanged(int)), this, SIGNAL(changed())); + connect(m_widthBox, static_cast(&KComboBox::currentIndexChanged), this, &ViewSettingsTab::changed); + connect(m_maxLinesBox, static_cast(&KComboBox::currentIndexChanged), this, &ViewSettingsTab::changed); break; case CompactMode: - connect(m_widthBox, SIGNAL(currentIndexChanged(int)), this, SIGNAL(changed())); + connect(m_widthBox, static_cast(&KComboBox::currentIndexChanged), this, &ViewSettingsTab::changed); break; case DetailsMode: - connect(m_expandableFolders, SIGNAL(toggled(bool)), this, SIGNAL(changed())); + connect(m_expandableFolders, &QCheckBox::toggled, this, &ViewSettingsTab::changed); break; default: break; @@ -289,4 +289,4 @@ void ViewSettingsTab::showToolTip(QSlider* slider, int value) QHelpEvent toolTipEvent(QEvent::ToolTip, QPoint(0, 0), slider->mapToGlobal(global)); QApplication::sendEvent(slider, &toolTipEvent); } -#include "viewsettingstab.moc" + diff --git a/src/settings/viewpropertiesdialog.cpp b/src/settings/viewpropertiesdialog.cpp index 574f8e18e..41a39f2a7 100644 --- a/src/settings/viewpropertiesdialog.cpp +++ b/src/settings/viewpropertiesdialog.cpp @@ -92,9 +92,9 @@ ViewPropertiesDialog::ViewPropertiesDialog(DolphinView* dolphinView) : QLabel* viewModeLabel = new QLabel(i18nc("@label:listbox", "View mode:"), propsGrid); m_viewMode = new KComboBox(propsGrid); - m_viewMode->addItem(KIcon("view-list-icons"), i18nc("@item:inlistbox", "Icons"), DolphinView::IconsView); - m_viewMode->addItem(KIcon("view-list-details"), i18nc("@item:inlistbox", "Compact"), DolphinView::CompactView); - m_viewMode->addItem(KIcon("view-list-tree"), i18nc("@item:inlistbox", "Details"), DolphinView::DetailsView); + m_viewMode->addItem(QIcon::fromTheme("view-list-icons"), i18nc("@item:inlistbox", "Icons"), DolphinView::IconsView); + m_viewMode->addItem(QIcon::fromTheme("view-list-details"), i18nc("@item:inlistbox", "Compact"), DolphinView::CompactView); + m_viewMode->addItem(QIcon::fromTheme("view-list-tree"), i18nc("@item:inlistbox", "Details"), DolphinView::DetailsView); QLabel* sortingLabel = new QLabel(i18nc("@label:listbox", "Sorting:"), propsGrid); QWidget* sortingBox = new QWidget(propsGrid); @@ -138,25 +138,25 @@ ViewPropertiesDialog::ViewPropertiesDialog(DolphinView* dolphinView) : topLayout->addWidget(propsBox); - connect(m_viewMode, SIGNAL(currentIndexChanged(int)), - this, SLOT(slotViewModeChanged(int))); - connect(m_sorting, SIGNAL(currentIndexChanged(int)), - this, SLOT(slotSortingChanged(int))); - connect(m_sortOrder, SIGNAL(currentIndexChanged(int)), - this, SLOT(slotSortOrderChanged(int))); - connect(m_additionalInfo, SIGNAL(clicked()), - this, SLOT(configureAdditionalInfo())); - connect(m_sortFoldersFirst, SIGNAL(clicked()), - this, SLOT(slotSortFoldersFirstChanged())); - connect(m_previewsShown, SIGNAL(clicked()), - this, SLOT(slotShowPreviewChanged())); - connect(m_showInGroups, SIGNAL(clicked()), - this, SLOT(slotGroupedSortingChanged())); - connect(m_showHiddenFiles, SIGNAL(clicked()), - this, SLOT(slotShowHiddenFilesChanged())); - - connect(this, SIGNAL(okClicked()), this, SLOT(slotOk())); - connect(this, SIGNAL(applyClicked()), this, SLOT(slotApply())); + connect(m_viewMode, static_cast(&KComboBox::currentIndexChanged), + this, &ViewPropertiesDialog::slotViewModeChanged); + connect(m_sorting, static_cast(&KComboBox::currentIndexChanged), + this, &ViewPropertiesDialog::slotSortingChanged); + connect(m_sortOrder, static_cast(&KComboBox::currentIndexChanged), + this, &ViewPropertiesDialog::slotSortOrderChanged); + connect(m_additionalInfo, &QPushButton::clicked, + this, &ViewPropertiesDialog::configureAdditionalInfo); + connect(m_sortFoldersFirst, &QCheckBox::clicked, + this, &ViewPropertiesDialog::slotSortFoldersFirstChanged); + connect(m_previewsShown, &QCheckBox::clicked, + this, &ViewPropertiesDialog::slotShowPreviewChanged); + connect(m_showInGroups, &QCheckBox::clicked, + this, &ViewPropertiesDialog::slotGroupedSortingChanged); + connect(m_showHiddenFiles, &QCheckBox::clicked, + this, &ViewPropertiesDialog::slotShowHiddenFilesChanged); + + connect(this, &ViewPropertiesDialog::okClicked, this, &ViewPropertiesDialog::slotOk); + connect(this, &ViewPropertiesDialog::applyClicked, this, &ViewPropertiesDialog::slotApply); // Only show the following settings if the view properties are remembered // for each directory: @@ -187,14 +187,14 @@ ViewPropertiesDialog::ViewPropertiesDialog(DolphinView* dolphinView) : topLayout->addWidget(applyBox); topLayout->addWidget(m_useAsDefault); - connect(m_applyToCurrentFolder, SIGNAL(clicked(bool)), - this, SLOT(markAsDirty(bool))); - connect(m_applyToSubFolders, SIGNAL(clicked(bool)), - this, SLOT(markAsDirty(bool))); - connect(m_applyToAllFolders, SIGNAL(clicked(bool)), - this, SLOT(markAsDirty(bool))); - connect(m_useAsDefault, SIGNAL(clicked(bool)), - this, SLOT(markAsDirty(bool))); + connect(m_applyToCurrentFolder, &QRadioButton::clicked, + this, &ViewPropertiesDialog::markAsDirty); + connect(m_applyToSubFolders, &QRadioButton::clicked, + this, &ViewPropertiesDialog::markAsDirty); + connect(m_applyToAllFolders, &QRadioButton::clicked, + this, &ViewPropertiesDialog::markAsDirty); + connect(m_useAsDefault, &QCheckBox::clicked, + this, &ViewPropertiesDialog::markAsDirty); } main->setLayout(topLayout); @@ -408,4 +408,3 @@ void ViewPropertiesDialog::loadSettings() markAsDirty(false); } -#include "viewpropertiesdialog.moc" diff --git a/src/settings/viewpropsprogressinfo.cpp b/src/settings/viewpropsprogressinfo.cpp index 9b7797d02..13998cf87 100644 --- a/src/settings/viewpropsprogressinfo.cpp +++ b/src/settings/viewpropsprogressinfo.cpp @@ -75,18 +75,18 @@ ViewPropsProgressInfo::ViewPropsProgressInfo(QWidget* parent, // allows to give a progress indication for the user when applying the view // properties later. m_dirSizeJob = KIO::directorySize(dir); - connect(m_dirSizeJob, SIGNAL(result(KJob*)), - this, SLOT(applyViewProperties())); + connect(m_dirSizeJob, &KIO::DirectorySizeJob::result, + this, &ViewPropsProgressInfo::applyViewProperties); // The directory size job cannot emit any progress signal, as it is not aware // about the total number of directories. Therefor a timer is triggered, which // periodically updates the current directory count. m_timer = new QTimer(this); - connect(m_timer, SIGNAL(timeout()), - this, SLOT(updateProgress())); + connect(m_timer, &QTimer::timeout, + this, &ViewPropsProgressInfo::updateProgress); m_timer->start(300); - connect(this, SIGNAL(cancelClicked()), this, SLOT(cancelApplying())); + connect(this, &ViewPropsProgressInfo::cancelClicked, this, &ViewPropsProgressInfo::cancelApplying); } ViewPropsProgressInfo::~ViewPropsProgressInfo() @@ -128,8 +128,8 @@ void ViewPropsProgressInfo::applyViewProperties() m_dirSizeJob = 0; m_applyViewPropsJob = new ApplyViewPropsJob(m_dir, *m_viewProps); - connect(m_applyViewPropsJob, SIGNAL(result(KJob*)), - this, SLOT(close())); + connect(m_applyViewPropsJob, &ApplyViewPropsJob::result, + this, &ViewPropsProgressInfo::close); } void ViewPropsProgressInfo::cancelApplying() @@ -145,4 +145,3 @@ void ViewPropsProgressInfo::cancelApplying() } } -#include "viewpropsprogressinfo.moc" diff --git a/src/statusbar/dolphinstatusbar.cpp b/src/statusbar/dolphinstatusbar.cpp index 169395e63..21f657ada 100644 --- a/src/statusbar/dolphinstatusbar.cpp +++ b/src/statusbar/dolphinstatusbar.cpp @@ -72,9 +72,9 @@ DolphinStatusBar::DolphinStatusBar(QWidget* parent) : m_zoomSlider->setPageStep(1); m_zoomSlider->setRange(ZoomLevelInfo::minimumLevel(), ZoomLevelInfo::maximumLevel()); - connect(m_zoomSlider, SIGNAL(valueChanged(int)), this, SIGNAL(zoomLevelChanged(int))); - connect(m_zoomSlider, SIGNAL(valueChanged(int)), this, SLOT(updateZoomSliderToolTip(int))); - connect(m_zoomSlider, SIGNAL(sliderMoved(int)), this, SLOT(showZoomSliderToolTip(int))); + connect(m_zoomSlider, &QSlider::valueChanged, this, &DolphinStatusBar::zoomLevelChanged); + connect(m_zoomSlider, &QSlider::valueChanged, this, &DolphinStatusBar::updateZoomSliderToolTip); + connect(m_zoomSlider, &QSlider::sliderMoved, this, &DolphinStatusBar::showZoomSliderToolTip); // Initialize space information m_spaceInfo = new StatusBarSpaceInfo(this); @@ -86,7 +86,7 @@ DolphinStatusBar::DolphinStatusBar(QWidget* parent) : m_stopButton->setAutoRaise(true); m_stopButton->setToolTip(i18nc("@tooltip", "Stop loading")); m_stopButton->hide(); - connect(m_stopButton, SIGNAL(clicked()), this, SIGNAL(stopPressed())); + connect(m_stopButton, &QToolButton::clicked, this, &DolphinStatusBar::stopPressed); m_progressTextLabel = new QLabel(this); m_progressTextLabel->hide(); @@ -97,12 +97,12 @@ DolphinStatusBar::DolphinStatusBar(QWidget* parent) : m_showProgressBarTimer = new QTimer(this); m_showProgressBarTimer->setInterval(500); m_showProgressBarTimer->setSingleShot(true); - connect(m_showProgressBarTimer, SIGNAL(timeout()), this, SLOT(updateProgressInfo())); + connect(m_showProgressBarTimer, &QTimer::timeout, this, &DolphinStatusBar::updateProgressInfo); m_resetToDefaultTextTimer = new QTimer(this); m_resetToDefaultTextTimer->setInterval(ResetToDefaultTimeout); m_resetToDefaultTextTimer->setSingleShot(true); - connect(m_resetToDefaultTextTimer, SIGNAL(timeout()), this, SLOT(slotResetToDefaultText())); + connect(m_resetToDefaultTextTimer, &QTimer::timeout, this, &DolphinStatusBar::slotResetToDefaultText); // Initialize top layout and size policies const int fontHeight = QFontMetrics(m_label->font()).height(); @@ -356,4 +356,3 @@ void DolphinStatusBar::setExtensionsVisible(bool visible) m_zoomSlider->setVisible(showZoomSlider); } -#include "dolphinstatusbar.moc" diff --git a/src/statusbar/statusbarspaceinfo.cpp b/src/statusbar/statusbarspaceinfo.cpp index 3692947b1..ea8b4704c 100644 --- a/src/statusbar/statusbarspaceinfo.cpp +++ b/src/statusbar/statusbarspaceinfo.cpp @@ -87,4 +87,3 @@ void StatusBarSpaceInfo::slotValuesChanged() } } -#include "statusbarspaceinfo.moc" diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt index c1f4124ff..60f6517e8 100644 --- a/src/tests/CMakeLists.txt +++ b/src/tests/CMakeLists.txt @@ -1,5 +1,7 @@ set( EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR} ) -include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/.. ${CMAKE_CURRENT_BUILD_DIR}/.. ${KDE4_INCLUDES} ) + +find_package(Qt5Test CONFIG REQUIRED) +include(ECMMarkAsTest) # needed on windows to correctly use the files from dolphinprivate add_definitions(-DLIBDOLPHINPRIVATE_EXPORT=) @@ -9,15 +11,22 @@ set(kitemsettest_SRCS kitemsettest.cpp ../kitemviews/kitemset.cpp ) -kde4_add_unit_test(kitemsettest TEST ${kitemsettest_SRCS}) -target_link_libraries(kitemsettest dolphinprivate ${KDE4_KIO_LIBS} ${QT_QTTEST_LIBRARY}) + +add_executable(kitemsettest ${kitemsettest_SRCS}) +add_test(kitemsettest kitemsettest) +ecm_mark_as_test(kitemsettest) +target_link_libraries(kitemsettest dolphinprivate Qt5::Test) # KItemRangeTest set(kitemrangetest_SRCS kitemrangetest.cpp ) -kde4_add_unit_test(kitemrangetest TEST ${kitemrangetest_SRCS}) -target_link_libraries(kitemrangetest dolphinprivate ${KDE4_KIO_LIBS} ${QT_QTTEST_LIBRARY}) + +add_executable(kitemrangetest ${kitemrangetest_SRCS}) +add_test(kitemrangetest kitemrangetest) +ecm_mark_as_test(kitemrangetest) +target_link_libraries(kitemrangetest dolphinprivate Qt5::Test) + # KItemListSelectionManagerTest set(kitemlistselectionmanagertest_SRCS @@ -26,8 +35,11 @@ set(kitemlistselectionmanagertest_SRCS ../kitemviews/kitemmodelbase.cpp ../kitemviews/kitemset.cpp ) -kde4_add_unit_test(kitemlistselectionmanagertest TEST ${kitemlistselectionmanagertest_SRCS}) -target_link_libraries(kitemlistselectionmanagertest dolphinprivate ${KDE4_KIO_LIBS} ${QT_QTTEST_LIBRARY}) + +add_executable(kitemlistselectionmanagertest ${kitemlistselectionmanagertest_SRCS}) +add_test(kitemlistselectionmanagertest kitemlistselectionmanagertest) +ecm_mark_as_test(kitemlistselectionmanagertest) +target_link_libraries(kitemlistselectionmanagertest dolphinprivate Qt5::Test) # KItemListControllerTest set(kitemlistcontrollertest_SRCS @@ -40,13 +52,16 @@ set(kitemlistcontrollertest_SRCS ../kitemviews/kitemlistview.cpp ../kitemviews/kitemlistcontainer.cpp ../kitemviews/kitemlistwidget.cpp - ../kitemviews/kitemlistviewaccessible.cpp +# ../kitemviews/kitemlistviewaccessible.cpp # TODO: enable once accessibility is ported to Qt5 ../kitemviews/kitemset.cpp ../kitemviews/kstandarditemlistview.cpp ../kitemviews/kstandarditemlistwidget.cpp ) -kde4_add_unit_test(kitemlistcontrollertest TEST ${kitemlistcontrollertest_SRCS}) -target_link_libraries(kitemlistcontrollertest dolphinprivate ${KDE4_KIO_LIBS} ${QT_QTTEST_LIBRARY}) + +add_executable(kitemlistcontrollertest ${kitemlistcontrollertest_SRCS}) +add_test(kitemlistcontrollertest kitemlistcontrollertest) +ecm_mark_as_test(kitemlistcontrollertest) +target_link_libraries(kitemlistcontrollertest dolphinprivate Qt5::Test) # KFileItemListViewTest set(kfileitemlistviewtest_SRCS @@ -56,15 +71,18 @@ set(kfileitemlistviewtest_SRCS ../kitemviews/kfileitemlistview.cpp ../kitemviews/kitemmodelbase.cpp ../kitemviews/kitemlistview.cpp - ../kitemviews/kitemlistviewaccessible.cpp +# ../kitemviews/kitemlistviewaccessible.cpp # TODO: enable once accessibility is ported to Qt5 ../kitemviews/kitemlistcontainer.cpp ../kitemviews/kitemlistwidget.cpp ../kitemviews/kitemset.cpp ../kitemviews/kstandarditemlistview.cpp ../kitemviews/kstandarditemlistwidget.cpp ) -kde4_add_unit_test(kfileitemlistviewtest TEST ${kfileitemlistviewtest_SRCS}) -target_link_libraries(kfileitemlistviewtest dolphinprivate ${KDE4_KIO_LIBS} ${QT_QTTEST_LIBRARY}) + +add_executable(kfileitemlistviewtest ${kfileitemlistviewtest_SRCS}) +add_test(kfileitemlistviewtest kfileitemlistviewtest) +ecm_mark_as_test(kfileitemlistviewtest) +target_link_libraries(kfileitemlistviewtest dolphinprivate Qt5::Test) # KFileItemModelTest set(kfileitemmodeltest_SRCS @@ -74,8 +92,11 @@ set(kfileitemmodeltest_SRCS ../kitemviews/kitemmodelbase.cpp ../kitemviews/kitemset.cpp ) -kde4_add_unit_test(kfileitemmodeltest TEST ${kfileitemmodeltest_SRCS}) -target_link_libraries(kfileitemmodeltest dolphinprivate ${KDE4_KIO_LIBS} ${QT_QTTEST_LIBRARY}) + +add_executable(kfileitemmodeltest ${kfileitemmodeltest_SRCS}) +add_test(kfileitemmodeltest kfileitemmodeltest) +ecm_mark_as_test(kfileitemmodeltest) +target_link_libraries(kfileitemmodeltest dolphinprivate Qt5::Test) # KFileItemModelBenchmark set(kfileitemmodelbenchmark_SRCS @@ -84,30 +105,38 @@ set(kfileitemmodelbenchmark_SRCS ../kitemviews/kfileitemmodel.cpp ../kitemviews/kitemmodelbase.cpp ) -kde4_add_executable(kfileitemmodelbenchmark TEST ${kfileitemmodelbenchmark_SRCS}) -target_link_libraries(kfileitemmodelbenchmark dolphinprivate ${KDE4_KIO_LIBS} ${QT_QTTEST_LIBRARY}) + +add_executable(kfileitemmodelbenchmark ${kfileitemmodelbenchmark_SRCS}) +ecm_mark_as_test(kfileitemmodelbenchmark) +target_link_libraries(kfileitemmodelbenchmark dolphinprivate Qt5::Test) # KItemListKeyboardSearchManagerTest set(kitemlistkeyboardsearchmanagertest_SRCS kitemlistkeyboardsearchmanagertest.cpp ../kitemviews/private/kitemlistkeyboardsearchmanager.cpp ) -kde4_add_unit_test(kitemlistkeyboardsearchmanagertest TEST ${kitemlistkeyboardsearchmanagertest_SRCS}) -target_link_libraries(kitemlistkeyboardsearchmanagertest ${KDE4_KIO_LIBS} ${QT_QTTEST_LIBRARY}) + +add_executable(kitemlistkeyboardsearchmanagertest ${kitemlistkeyboardsearchmanagertest_SRCS}) +add_test(kitemlistkeyboardsearchmanagertest kitemlistkeyboardsearchmanagertest) +ecm_mark_as_test(kitemlistkeyboardsearchmanagertest) +target_link_libraries(kitemlistkeyboardsearchmanagertest dolphinprivate Qt5::Test) # DolphinSearchBox -if (Baloo_FOUND) +if (KF5Baloo_FOUND) set(dolphinsearchboxtest_SRCS dolphinsearchboxtest.cpp ../search/dolphinfacetswidget.cpp ../search/dolphinsearchbox.cpp ) - kde4_add_kcfg_files(dolphinsearchboxtest_SRCS + kconfig_add_kcfg_files(dolphinsearchboxtest_SRCS ../search/dolphin_searchsettings.kcfgc ) - kde4_add_unit_test(dolphinsearchboxtest TEST ${dolphinsearchboxtest_SRCS}) - target_link_libraries(dolphinsearchboxtest ${KDE4_KIO_LIBS} ${BALOO_LIBRARIES} ${QT_QTTEST_LIBRARY}) -endif (Baloo_FOUND) + + add_executable(dolphinsearchboxtest ${dolphinsearchboxtest_SRCS}) + add_test(dolphinsearchboxtest dolphinsearchboxtest) + ecm_mark_as_test(dolphinsearchboxtest) + target_link_libraries(dolphinsearchboxtest dolphinprivate Qt5::Test) +endif() # KStandardItemModelTest set(kstandarditemmodeltest_SRCS @@ -116,8 +145,11 @@ set(kstandarditemmodeltest_SRCS ../kitemviews/kstandarditemmodel.cpp ../kitemviews/kitemmodelbase.cpp ) -kde4_add_unit_test(kstandarditemmodeltest TEST ${kstandarditemmodeltest_SRCS}) -target_link_libraries(kstandarditemmodeltest dolphinprivate ${KDE4_KIO_LIBS} ${QT_QTTEST_LIBRARY}) + +add_executable(kstandarditemmodeltest ${kstandarditemmodeltest_SRCS}) +add_test(kstandarditemmodeltest kstandarditemmodeltest) +ecm_mark_as_test(kstandarditemmodeltest) +target_link_libraries(kstandarditemmodeltest dolphinprivate Qt5::Test) # ViewPropertiesTest set(viewpropertiestest_SRCS @@ -125,9 +157,12 @@ set(viewpropertiestest_SRCS testdir.cpp ../views/viewproperties.cpp ) -kde4_add_kcfg_files(viewpropertiestest_SRCS +kconfig_add_kcfg_files(viewpropertiestest_SRCS ../settings/dolphin_generalsettings.kcfgc ../settings/dolphin_directoryviewpropertysettings.kcfgc ) -kde4_add_unit_test(viewpropertiestest TEST ${viewpropertiestest_SRCS}) -target_link_libraries(viewpropertiestest dolphinprivate ${KDE4_KIO_LIBS} ${QT_QTTEST_LIBRARY}) + +add_executable(viewpropertiestest ${viewpropertiestest_SRCS}) +add_test(viewpropertiestest viewpropertiestest) +ecm_mark_as_test(viewpropertiestest) +target_link_libraries(viewpropertiestest dolphinprivate Qt5::Test) diff --git a/src/views/dolphinfileitemlistwidget.cpp b/src/views/dolphinfileitemlistwidget.cpp index 33ee6a277..f4efa5233 100644 --- a/src/views/dolphinfileitemlistwidget.cpp +++ b/src/views/dolphinfileitemlistwidget.cpp @@ -126,4 +126,3 @@ QPixmap DolphinFileItemListWidget::overlayForState(KVersionControlPlugin2::ItemV return KIcon(iconName).pixmap(QSize(overlayHeight, overlayHeight)); } -#include "dolphinfileitemlistwidget.moc" diff --git a/src/views/dolphinitemlistview.cpp b/src/views/dolphinitemlistview.cpp index db4dadf2f..eeef45d92 100644 --- a/src/views/dolphinitemlistview.cpp +++ b/src/views/dolphinitemlistview.cpp @@ -31,6 +31,7 @@ #include #include +#include #include @@ -262,4 +263,3 @@ ViewModeSettings::ViewMode DolphinItemListView::viewMode() const return mode; } -#include "dolphinitemlistview.moc" diff --git a/src/views/dolphinnewfilemenuobserver.cpp b/src/views/dolphinnewfilemenuobserver.cpp index 7669f1561..855f2675a 100644 --- a/src/views/dolphinnewfilemenuobserver.cpp +++ b/src/views/dolphinnewfilemenuobserver.cpp @@ -36,22 +36,22 @@ DolphinNewFileMenuObserver& DolphinNewFileMenuObserver::instance() void DolphinNewFileMenuObserver::attach(const DolphinNewFileMenu* menu) { - connect(menu, SIGNAL(fileCreated(KUrl)), - this, SIGNAL(itemCreated(KUrl))); - connect(menu, SIGNAL(directoryCreated(KUrl)), - this, SIGNAL(itemCreated(KUrl))); - connect(menu, SIGNAL(errorMessage(QString)), - this, SIGNAL(errorMessage(QString))); + connect(menu, &DolphinNewFileMenu::fileCreated, + this, &DolphinNewFileMenuObserver::itemCreated); + connect(menu, &DolphinNewFileMenu::directoryCreated, + this, &DolphinNewFileMenuObserver::itemCreated); + connect(menu, &DolphinNewFileMenu::errorMessage, + this, &DolphinNewFileMenuObserver::errorMessage); } void DolphinNewFileMenuObserver::detach(const DolphinNewFileMenu* menu) { - disconnect(menu, SIGNAL(fileCreated(KUrl)), - this, SIGNAL(itemCreated(KUrl))); - disconnect(menu, SIGNAL(directoryCreated(KUrl)), - this, SIGNAL(itemCreated(KUrl))); - disconnect(menu, SIGNAL(errorMessage(QString)), - this, SIGNAL(errorMessage(QString))); + disconnect(menu, &DolphinNewFileMenu::fileCreated, + this, &DolphinNewFileMenuObserver::itemCreated); + disconnect(menu, &DolphinNewFileMenu::directoryCreated, + this, &DolphinNewFileMenuObserver::itemCreated); + disconnect(menu, &DolphinNewFileMenu::errorMessage, + this, &DolphinNewFileMenuObserver::errorMessage); } DolphinNewFileMenuObserver::DolphinNewFileMenuObserver() : @@ -63,4 +63,3 @@ DolphinNewFileMenuObserver::~DolphinNewFileMenuObserver() { } -#include "dolphinnewfilemenuobserver.moc" diff --git a/src/views/dolphinnewfilemenuobserver.h b/src/views/dolphinnewfilemenuobserver.h index 239476eb9..3b5014ae9 100644 --- a/src/views/dolphinnewfilemenuobserver.h +++ b/src/views/dolphinnewfilemenuobserver.h @@ -44,7 +44,7 @@ public: void detach(const DolphinNewFileMenu* menu); signals: - void itemCreated(const KUrl& url); + void itemCreated(const QUrl& url); void errorMessage(const QString& error); private: diff --git a/src/views/dolphinremoteencoding.cpp b/src/views/dolphinremoteencoding.cpp index 04b350eda..ceb189494 100644 --- a/src/views/dolphinremoteencoding.cpp +++ b/src/views/dolphinremoteencoding.cpp @@ -51,8 +51,8 @@ DolphinRemoteEncoding::DolphinRemoteEncoding(QObject* parent, DolphinViewActionH { m_menu = new KActionMenu(KIcon("character-set"), i18n("Select Remote Charset"), this); m_actionHandler->actionCollection()->addAction("change_remote_encoding", m_menu); - connect(m_menu->menu(), SIGNAL(aboutToShow()), - this, SLOT(slotAboutToShow())); + connect(m_menu->menu(), &QMenu::aboutToShow, + this, &DolphinRemoteEncoding::slotAboutToShow); m_menu->setEnabled(false); m_menu->setDelayed(false); @@ -101,7 +101,7 @@ void DolphinRemoteEncoding::slotAboutToOpenUrl() void DolphinRemoteEncoding::fillMenu() { - KMenu* menu = m_menu->menu(); + QMenu* menu = m_menu->menu(); menu->clear(); @@ -117,7 +117,7 @@ void DolphinRemoteEncoding::fillMenu() menu->addAction(i18n("Default"), this, SLOT(slotDefault()), 0)->setCheckable(true); m_idDefault = m_encodingDescriptions.size() + 2; - connect(menu, SIGNAL(triggered(QAction*)), this, SLOT(slotItemSelected(QAction*))); + connect(menu, &QMenu::triggered, this, &DolphinRemoteEncoding::slotItemSelected); } void DolphinRemoteEncoding::updateMenu() @@ -235,4 +235,3 @@ void DolphinRemoteEncoding::updateView() m_actionHandler->currentView()->reload(); } -#include "dolphinremoteencoding.moc" diff --git a/src/views/dolphinview.cpp b/src/views/dolphinview.cpp index c1f585da9..ce8e08210 100644 --- a/src/views/dolphinview.cpp +++ b/src/views/dolphinview.cpp @@ -32,6 +32,8 @@ #include #include #include +#include +#include #include #include @@ -55,7 +57,9 @@ #include #include #include +#include #include +#include #include #include #include @@ -75,7 +79,7 @@ #include "zoomlevelinfo.h" #ifdef HAVE_BALOO - #include + #include #endif namespace { @@ -114,14 +118,14 @@ DolphinView::DolphinView(const KUrl& url, QWidget* parent) : // When a new item has been created by the "Create New..." menu, the item should // get selected and it must be assured that the item will get visible. As the // creation is done asynchronously, several signals must be checked: - connect(&DolphinNewFileMenuObserver::instance(), SIGNAL(itemCreated(KUrl)), - this, SLOT(observeCreatedItem(KUrl))); + connect(&DolphinNewFileMenuObserver::instance(), &DolphinNewFileMenuObserver::itemCreated, + this, &DolphinView::observeCreatedItem); m_selectionChangedTimer = new QTimer(this); m_selectionChangedTimer->setSingleShot(true); m_selectionChangedTimer->setInterval(300); - connect(m_selectionChangedTimer, SIGNAL(timeout()), - this, SLOT(emitSelectionChangedSignal())); + connect(m_selectionChangedTimer, &QTimer::timeout, + this, &DolphinView::emitSelectionChangedSignal); m_model = new KFileItemModel(this); m_view = new DolphinItemListView(); @@ -140,60 +144,60 @@ DolphinView::DolphinView(const KUrl& url, QWidget* parent) : m_container = new KItemListContainer(controller, this); m_container->installEventFilter(this); setFocusProxy(m_container); - connect(m_container->horizontalScrollBar(), SIGNAL(valueChanged(int)), this, SLOT(hideToolTip())); - connect(m_container->verticalScrollBar(), SIGNAL(valueChanged(int)), this, SLOT(hideToolTip())); + connect(m_container->horizontalScrollBar(), &QScrollBar::valueChanged, this, &DolphinView::hideToolTip); + connect(m_container->verticalScrollBar(), &QScrollBar::valueChanged, this, &DolphinView::hideToolTip); controller->setSelectionBehavior(KItemListController::MultiSelection); - connect(controller, SIGNAL(itemActivated(int)), this, SLOT(slotItemActivated(int))); - connect(controller, SIGNAL(itemsActivated(KItemSet)), this, SLOT(slotItemsActivated(KItemSet))); - connect(controller, SIGNAL(itemMiddleClicked(int)), this, SLOT(slotItemMiddleClicked(int))); - connect(controller, SIGNAL(itemContextMenuRequested(int,QPointF)), this, SLOT(slotItemContextMenuRequested(int,QPointF))); - connect(controller, SIGNAL(viewContextMenuRequested(QPointF)), this, SLOT(slotViewContextMenuRequested(QPointF))); - connect(controller, SIGNAL(headerContextMenuRequested(QPointF)), this, SLOT(slotHeaderContextMenuRequested(QPointF))); - connect(controller, SIGNAL(mouseButtonPressed(int,Qt::MouseButtons)), this, SLOT(slotMouseButtonPressed(int,Qt::MouseButtons))); - connect(controller, SIGNAL(itemHovered(int)), this, SLOT(slotItemHovered(int))); - connect(controller, SIGNAL(itemUnhovered(int)), this, SLOT(slotItemUnhovered(int))); - connect(controller, SIGNAL(itemDropEvent(int,QGraphicsSceneDragDropEvent*)), this, SLOT(slotItemDropEvent(int,QGraphicsSceneDragDropEvent*))); - connect(controller, SIGNAL(escapePressed()), this, SLOT(stopLoading())); - connect(controller, SIGNAL(modelChanged(KItemModelBase*,KItemModelBase*)), this, SLOT(slotModelChanged(KItemModelBase*,KItemModelBase*))); - - connect(m_model, SIGNAL(directoryLoadingStarted()), this, SLOT(slotDirectoryLoadingStarted())); - connect(m_model, SIGNAL(directoryLoadingCompleted()), this, SLOT(slotDirectoryLoadingCompleted())); - connect(m_model, SIGNAL(directoryLoadingCanceled()), this, SIGNAL(directoryLoadingCanceled())); - connect(m_model, SIGNAL(directoryLoadingProgress(int)), this, SIGNAL(directoryLoadingProgress(int))); - connect(m_model, SIGNAL(directorySortingProgress(int)), this, SIGNAL(directorySortingProgress(int))); - connect(m_model, SIGNAL(itemsChanged(KItemRangeList,QSet)), - this, SLOT(slotItemsChanged())); - connect(m_model, SIGNAL(itemsRemoved(KItemRangeList)), this, SIGNAL(itemCountChanged())); - connect(m_model, SIGNAL(itemsInserted(KItemRangeList)), this, SIGNAL(itemCountChanged())); - connect(m_model, SIGNAL(infoMessage(QString)), this, SIGNAL(infoMessage(QString))); - connect(m_model, SIGNAL(errorMessage(QString)), this, SIGNAL(errorMessage(QString))); - connect(m_model, SIGNAL(directoryRedirection(KUrl,KUrl)), this, SLOT(slotDirectoryRedirection(KUrl,KUrl))); - connect(m_model, SIGNAL(urlIsFileError(KUrl)), this, SIGNAL(urlIsFileError(KUrl))); + connect(controller, &KItemListController::itemActivated, this, &DolphinView::slotItemActivated); + connect(controller, &KItemListController::itemsActivated, this, &DolphinView::slotItemsActivated); + connect(controller, &KItemListController::itemMiddleClicked, this, &DolphinView::slotItemMiddleClicked); + connect(controller, &KItemListController::itemContextMenuRequested, this, &DolphinView::slotItemContextMenuRequested); + connect(controller, &KItemListController::viewContextMenuRequested, this, &DolphinView::slotViewContextMenuRequested); + connect(controller, &KItemListController::headerContextMenuRequested, this, &DolphinView::slotHeaderContextMenuRequested); + connect(controller, &KItemListController::mouseButtonPressed, this, &DolphinView::slotMouseButtonPressed); + connect(controller, &KItemListController::itemHovered, this, &DolphinView::slotItemHovered); + connect(controller, &KItemListController::itemUnhovered, this, &DolphinView::slotItemUnhovered); + connect(controller, &KItemListController::itemDropEvent, this, &DolphinView::slotItemDropEvent); + connect(controller, &KItemListController::escapePressed, this, &DolphinView::stopLoading); + connect(controller, &KItemListController::modelChanged, this, &DolphinView::slotModelChanged); + + connect(m_model, &KFileItemModel::directoryLoadingStarted, this, &DolphinView::slotDirectoryLoadingStarted); + connect(m_model, &KFileItemModel::directoryLoadingCompleted, this, &DolphinView::slotDirectoryLoadingCompleted); + connect(m_model, &KFileItemModel::directoryLoadingCanceled, this, &DolphinView::directoryLoadingCanceled); + connect(m_model, &KFileItemModel::directoryLoadingProgress, this, &DolphinView::directoryLoadingProgress); + connect(m_model, &KFileItemModel::directorySortingProgress, this, &DolphinView::directorySortingProgress); + connect(m_model, &KFileItemModel::itemsChanged, + this, &DolphinView::slotItemsChanged); + connect(m_model, &KFileItemModel::itemsRemoved, this, &DolphinView::itemCountChanged); + connect(m_model, &KFileItemModel::itemsInserted, this, &DolphinView::itemCountChanged); + connect(m_model, &KFileItemModel::infoMessage, this, &DolphinView::infoMessage); + connect(m_model, &KFileItemModel::errorMessage, this, &DolphinView::errorMessage); + connect(m_model, &KFileItemModel::directoryRedirection, this, &DolphinView::slotDirectoryRedirection); + connect(m_model, &KFileItemModel::urlIsFileError, this, &DolphinView::urlIsFileError); m_view->installEventFilter(this); - connect(m_view, SIGNAL(sortOrderChanged(Qt::SortOrder,Qt::SortOrder)), - this, SLOT(slotSortOrderChangedByHeader(Qt::SortOrder,Qt::SortOrder))); - connect(m_view, SIGNAL(sortRoleChanged(QByteArray,QByteArray)), - this, SLOT(slotSortRoleChangedByHeader(QByteArray,QByteArray))); - connect(m_view, SIGNAL(visibleRolesChanged(QList,QList)), - this, SLOT(slotVisibleRolesChangedByHeader(QList,QList))); - connect(m_view, SIGNAL(roleEditingCanceled(int,QByteArray,QVariant)), - this, SLOT(slotRoleEditingCanceled())); - connect(m_view->header(), SIGNAL(columnWidthChanged(QByteArray,qreal,qreal)), - this, SLOT(slotHeaderColumnWidthChanged(QByteArray,qreal,qreal))); + connect(m_view, &DolphinItemListView::sortOrderChanged, + this, &DolphinView::slotSortOrderChangedByHeader); + connect(m_view, &DolphinItemListView::sortRoleChanged, + this, &DolphinView::slotSortRoleChangedByHeader); + connect(m_view, &DolphinItemListView::visibleRolesChanged, + this, &DolphinView::slotVisibleRolesChangedByHeader); + connect(m_view, &DolphinItemListView::roleEditingCanceled, + this, &DolphinView::slotRoleEditingCanceled); + connect(m_view->header(), &KItemListHeader::columnWidthChanged, + this, &DolphinView::slotHeaderColumnWidthChanged); KItemListSelectionManager* selectionManager = controller->selectionManager(); - connect(selectionManager, SIGNAL(selectionChanged(KItemSet,KItemSet)), - this, SLOT(slotSelectionChanged(KItemSet,KItemSet))); + connect(selectionManager, &KItemListSelectionManager::selectionChanged, + this, &DolphinView::slotSelectionChanged); m_toolTipManager = new ToolTipManager(this); m_versionControlObserver = new VersionControlObserver(this); m_versionControlObserver->setModel(m_model); - connect(m_versionControlObserver, SIGNAL(infoMessage(QString)), this, SIGNAL(infoMessage(QString))); - connect(m_versionControlObserver, SIGNAL(errorMessage(QString)), this, SIGNAL(errorMessage(QString))); - connect(m_versionControlObserver, SIGNAL(operationCompletedMessage(QString)), this, SIGNAL(operationCompletedMessage(QString))); + connect(m_versionControlObserver, &VersionControlObserver::infoMessage, this, &DolphinView::infoMessage); + connect(m_versionControlObserver, &VersionControlObserver::errorMessage, this, &DolphinView::errorMessage); + connect(m_versionControlObserver, &VersionControlObserver::operationCompletedMessage, this, &DolphinView::operationCompletedMessage); applyViewProperties(); m_topLayout->addWidget(m_container); @@ -295,7 +299,7 @@ void DolphinView::setHiddenFilesShown(bool show) const KFileItemList itemList = selectedItems(); m_selectedUrls.clear(); - m_selectedUrls = itemList.urlList(); + m_selectedUrls = KUrl::List(itemList.urlList()); ViewProperties props(viewPropertiesUrl()); props.setHiddenFilesShown(show); @@ -472,7 +476,7 @@ void DolphinView::reload() const KFileItemList itemList = selectedItems(); m_selectedUrls.clear(); - m_selectedUrls = itemList.urlList(); + m_selectedUrls = KUrl::List(itemList.urlList()); setUrl(url()); loadDirectory(url(), true); @@ -606,8 +610,8 @@ void DolphinView::setUrl(const KUrl& url) hideToolTip(); - disconnect(m_view, SIGNAL(roleEditingFinished(int,QByteArray,QVariant)), - this, SLOT(slotRoleEditingFinished(int,QByteArray,QVariant))); + disconnect(m_view, &DolphinItemListView::roleEditingFinished, + this, &DolphinView::slotRoleEditingFinished); // It is important to clear the items from the model before // applying the view properties, otherwise expensive operations @@ -651,8 +655,8 @@ void DolphinView::renameSelectedItems() hideToolTip(); - connect(m_view, SIGNAL(roleEditingFinished(int,QByteArray,QVariant)), - this, SLOT(slotRoleEditingFinished(int,QByteArray,QVariant))); + connect(m_view, &DolphinItemListView::roleEditingFinished, + this, &DolphinView::slotRoleEditingFinished); } else { RenameDialog* dialog = new RenameDialog(this, items); dialog->setAttribute(Qt::WA_DeleteOnClose); @@ -684,10 +688,10 @@ void DolphinView::deleteSelectedItems() if (del) { KIO::Job* job = KIO::del(list); if (job->ui()) { - job->ui()->setWindow(this); + KJobWidgets::setWindow(job, this); } - connect(job, SIGNAL(result(KJob*)), - this, SLOT(slotDeleteFileFinished(KJob*))); + connect(job, &KIO::Job::result, + this, &DolphinView::slotDeleteFileFinished); } } @@ -1047,7 +1051,7 @@ void DolphinView::slotItemDropEvent(int index, QGraphicsSceneDragDropEvent* even // Mark the dropped urls as selected. m_clearSelectionBeforeSelectingNewItems = true; m_markFirstNewlySelectedItemAsCurrent = true; - connect(op, SIGNAL(aboutToCreate(KUrl::List)), this, SLOT(slotAboutToCreate(KUrl::List))); + connect(op, static_cast(&KonqOperations::aboutToCreate), this, &DolphinView::slotAboutToCreate); } setActive(true); @@ -1056,15 +1060,16 @@ void DolphinView::slotItemDropEvent(int index, QGraphicsSceneDragDropEvent* even void DolphinView::slotModelChanged(KItemModelBase* current, KItemModelBase* previous) { if (previous != 0) { - disconnect(previous, SIGNAL(directoryLoadingCompleted()), this, SLOT(slotDirectoryLoadingCompleted())); + Q_ASSERT(qobject_cast(previous)); + KFileItemModel* fileItemModel = static_cast(previous); + disconnect(fileItemModel, &KFileItemModel::directoryLoadingCompleted, this, &DolphinView::slotDirectoryLoadingCompleted); m_versionControlObserver->setModel(0); } if (current) { Q_ASSERT(qobject_cast(current)); - connect(current, SIGNAL(loadingCompleted()), this, SLOT(slotDirectoryLoadingCompleted())); - KFileItemModel* fileItemModel = static_cast(current); + connect(fileItemModel, &KFileItemModel::directoryLoadingCompleted, this, &DolphinView::slotDirectoryLoadingCompleted); m_versionControlObserver->setModel(fileItemModel); } } @@ -1090,7 +1095,7 @@ void DolphinView::slotAboutToCreate(const KUrl::List& urls) markUrlAsCurrent(urls.first()); m_markFirstNewlySelectedItemAsCurrent = false; } - m_selectedUrls << KDirModel::simplifiedUrlList(urls); + m_selectedUrls << KUrl::List(KDirModel::simplifiedUrlList(urls)); } } @@ -1440,14 +1445,14 @@ void DolphinView::slotVisibleRolesChangedByHeader(const QList& curre void DolphinView::slotRoleEditingCanceled() { - disconnect(m_view, SIGNAL(roleEditingFinished(int,QByteArray,QVariant)), - this, SLOT(slotRoleEditingFinished(int,QByteArray,QVariant))); + disconnect(m_view, &DolphinItemListView::roleEditingFinished, + this, &DolphinView::slotRoleEditingFinished); } void DolphinView::slotRoleEditingFinished(int index, const QByteArray& role, const QVariant& value) { - disconnect(m_view, SIGNAL(roleEditingFinished(int,QByteArray,QVariant)), - this, SLOT(slotRoleEditingFinished(int,QByteArray,QVariant))); + disconnect(m_view, &DolphinItemListView::roleEditingFinished, + this, &DolphinView::slotRoleEditingFinished); if (index < 0 || index >= m_model->count()) { return; @@ -1476,7 +1481,7 @@ void DolphinView::slotRoleEditingFinished(int index, const QByteArray& role, con if (op && !newNameExistsAlready) { // Only connect the renamingFailed signal if there is no item with the new name // in the model yet, see bug 328262. - connect(op, SIGNAL(renamingFailed(KUrl,KUrl)), SLOT(slotRenamingFailed(KUrl,KUrl))); + connect(op, &KonqOperations::renamingFailed, this, &DolphinView::slotRenamingFailed); } } } @@ -1617,7 +1622,7 @@ void DolphinView::pasteToUrl(const KUrl& url) if (op) { m_clearSelectionBeforeSelectingNewItems = true; m_markFirstNewlySelectedItemAsCurrent = true; - connect(op, SIGNAL(aboutToCreate(KUrl::List)), this, SLOT(slotAboutToCreate(KUrl::List))); + connect(op, static_cast(&KonqOperations::aboutToCreate), this, &DolphinView::slotAboutToCreate); } } @@ -1678,4 +1683,3 @@ KUrl DolphinView::viewPropertiesUrl() const return url; } -#include "dolphinview.moc" diff --git a/src/views/dolphinview.h b/src/views/dolphinview.h index 06c09edc3..4ba10293a 100644 --- a/src/views/dolphinview.h +++ b/src/views/dolphinview.h @@ -30,6 +30,7 @@ #include #include #include +#include #include #include diff --git a/src/views/dolphinviewactionhandler.cpp b/src/views/dolphinviewactionhandler.cpp index 48ec95c70..72f5be166 100644 --- a/src/views/dolphinviewactionhandler.cpp +++ b/src/views/dolphinviewactionhandler.cpp @@ -27,6 +27,8 @@ #include "views/zoomlevelinfo.h" #include +#include + #include #include #include @@ -42,7 +44,7 @@ #include #ifdef HAVE_BALOO - #include + #include #endif DolphinViewActionHandler::DolphinViewActionHandler(KActionCollection* collection, QObject* parent) : @@ -66,26 +68,26 @@ void DolphinViewActionHandler::setCurrentView(DolphinView* view) m_currentView = view; - connect(view, SIGNAL(modeChanged(DolphinView::Mode,DolphinView::Mode)), - this, SLOT(updateViewActions())); - connect(view, SIGNAL(previewsShownChanged(bool)), - this, SLOT(slotPreviewsShownChanged(bool))); - connect(view, SIGNAL(sortOrderChanged(Qt::SortOrder)), - this, SLOT(slotSortOrderChanged(Qt::SortOrder))); - connect(view, SIGNAL(sortFoldersFirstChanged(bool)), - this, SLOT(slotSortFoldersFirstChanged(bool))); - connect(view, SIGNAL(visibleRolesChanged(QList,QList)), - this, SLOT(slotVisibleRolesChanged(QList,QList))); - connect(view, SIGNAL(groupedSortingChanged(bool)), - this, SLOT(slotGroupedSortingChanged(bool))); - connect(view, SIGNAL(hiddenFilesShownChanged(bool)), - this, SLOT(slotHiddenFilesShownChanged(bool))); - connect(view, SIGNAL(sortRoleChanged(QByteArray)), - this, SLOT(slotSortRoleChanged(QByteArray))); - connect(view, SIGNAL(zoomLevelChanged(int,int)), - this, SLOT(slotZoomLevelChanged(int,int))); - connect(view, SIGNAL(writeStateChanged(bool)), - this, SLOT(slotWriteStateChanged(bool))); + connect(view, &DolphinView::modeChanged, + this, &DolphinViewActionHandler::updateViewActions); + connect(view, &DolphinView::previewsShownChanged, + this, &DolphinViewActionHandler::slotPreviewsShownChanged); + connect(view, &DolphinView::sortOrderChanged, + this, &DolphinViewActionHandler::slotSortOrderChanged); + connect(view, &DolphinView::sortFoldersFirstChanged, + this, &DolphinViewActionHandler::slotSortFoldersFirstChanged); + connect(view, &DolphinView::visibleRolesChanged, + this, &DolphinViewActionHandler::slotVisibleRolesChanged); + connect(view, &DolphinView::groupedSortingChanged, + this, &DolphinViewActionHandler::slotGroupedSortingChanged); + connect(view, &DolphinView::hiddenFilesShownChanged, + this, &DolphinViewActionHandler::slotHiddenFilesShownChanged); + connect(view, &DolphinView::sortRoleChanged, + this, &DolphinViewActionHandler::slotSortRoleChanged); + connect(view, &DolphinView::zoomLevelChanged, + this, &DolphinViewActionHandler::slotZoomLevelChanged); + connect(view, &DolphinView::writeStateChanged, + this, &DolphinViewActionHandler::slotWriteStateChanged); } DolphinView* DolphinViewActionHandler::currentView() @@ -97,51 +99,51 @@ void DolphinViewActionHandler::createActions() { // This action doesn't appear in the GUI, it's for the shortcut only. // KNewFileMenu takes care of the GUI stuff. - KAction* newDirAction = m_actionCollection->addAction("create_dir"); + QAction* newDirAction = m_actionCollection->addAction("create_dir"); newDirAction->setText(i18nc("@action", "Create Folder...")); newDirAction->setShortcut(Qt::Key_F10); newDirAction->setIcon(KIcon("folder-new")); newDirAction->setEnabled(false); // Will be enabled in slotWriteStateChanged(bool) if the current URL is writable - connect(newDirAction, SIGNAL(triggered()), this, SIGNAL(createDirectory())); + connect(newDirAction, &QAction::triggered, this, &DolphinViewActionHandler::createDirectory); // File menu - KAction* rename = m_actionCollection->addAction("rename"); + QAction* rename = m_actionCollection->addAction("rename"); rename->setText(i18nc("@action:inmenu File", "Rename...")); rename->setShortcut(Qt::Key_F2); rename->setIcon(KIcon("edit-rename")); - connect(rename, SIGNAL(triggered()), this, SLOT(slotRename())); + connect(rename, &QAction::triggered, this, &DolphinViewActionHandler::slotRename); - KAction* moveToTrash = m_actionCollection->addAction("move_to_trash"); + QAction* moveToTrash = m_actionCollection->addAction("move_to_trash"); moveToTrash->setText(i18nc("@action:inmenu File", "Move to Trash")); moveToTrash->setIcon(KIcon("user-trash")); moveToTrash->setShortcut(QKeySequence::Delete); - connect(moveToTrash, SIGNAL(triggered(Qt::MouseButtons,Qt::KeyboardModifiers)), - this, SLOT(slotTrashActivated(Qt::MouseButtons,Qt::KeyboardModifiers))); + connect(moveToTrash, &QAction::triggered, + this, &DolphinViewActionHandler::slotTrashActivated); - KAction* deleteAction = m_actionCollection->addAction("delete"); + QAction* deleteAction = m_actionCollection->addAction("delete"); deleteAction->setIcon(KIcon("edit-delete")); deleteAction->setText(i18nc("@action:inmenu File", "Delete")); deleteAction->setShortcut(Qt::SHIFT | Qt::Key_Delete); - connect(deleteAction, SIGNAL(triggered()), this, SLOT(slotDeleteItems())); + connect(deleteAction, &QAction::triggered, this, &DolphinViewActionHandler::slotDeleteItems); // This action is useful for being enabled when "move_to_trash" should be // disabled and "delete" is enabled (e.g. non-local files), so that Key_Del // can be used for deleting the file (#76016). It needs to be a separate action // so that the Edit menu isn't affected. - KAction* deleteWithTrashShortcut = m_actionCollection->addAction("delete_shortcut"); + QAction* deleteWithTrashShortcut = m_actionCollection->addAction("delete_shortcut"); // The descriptive text is just for the shortcuts editor. deleteWithTrashShortcut->setText(i18nc("@action \"Move to Trash\" for non-local files, etc.", "Delete (using shortcut for Trash)")); deleteWithTrashShortcut->setShortcut(QKeySequence::Delete); deleteWithTrashShortcut->setEnabled(false); - connect(deleteWithTrashShortcut, SIGNAL(triggered()), this, SLOT(slotDeleteItems())); + connect(deleteWithTrashShortcut, &QAction::triggered, this, &DolphinViewActionHandler::slotDeleteItems); - KAction *propertiesAction = m_actionCollection->addAction( "properties" ); + QAction *propertiesAction = m_actionCollection->addAction( "properties" ); // Well, it's the File menu in dolphinmainwindow and the Edit menu in dolphinpart... :) propertiesAction->setText( i18nc("@action:inmenu File", "Properties") ); propertiesAction->setIcon(KIcon("document-properties")); propertiesAction->setShortcuts(QList() << Qt::ALT + Qt::Key_Return << Qt::ALT + Qt::Key_Enter); - connect(propertiesAction, SIGNAL(triggered()), SLOT(slotProperties())); + connect(propertiesAction, &QAction::triggered, this, &DolphinViewActionHandler::slotProperties); // View menu KToggleAction* iconsAction = iconsModeAction(); @@ -154,7 +156,7 @@ void DolphinViewActionHandler::createActions() viewModeActions->addAction(compactAction); viewModeActions->addAction(detailsAction); viewModeActions->setToolBarMode(KSelectAction::MenuMode); - connect(viewModeActions, SIGNAL(triggered(QAction*)), this, SLOT(slotViewModeActionTriggered(QAction*))); + connect(viewModeActions, static_cast(&KSelectAction::triggered), this, &DolphinViewActionHandler::slotViewModeActionTriggered); KStandardAction::zoomIn(this, SLOT(zoomIn()), @@ -168,15 +170,15 @@ void DolphinViewActionHandler::createActions() showPreview->setText(i18nc("@action:intoolbar", "Preview")); showPreview->setToolTip(i18nc("@info", "Show preview of files and folders")); showPreview->setIcon(KIcon("view-preview")); - connect(showPreview, SIGNAL(triggered(bool)), this, SLOT(togglePreview(bool))); + connect(showPreview, &KToggleAction::triggered, this, &DolphinViewActionHandler::togglePreview); KToggleAction* sortDescending = m_actionCollection->add("descending"); sortDescending->setText(i18nc("@action:inmenu Sort", "Descending")); - connect(sortDescending, SIGNAL(triggered()), this, SLOT(toggleSortOrder())); + connect(sortDescending, &KToggleAction::triggered, this, &DolphinViewActionHandler::toggleSortOrder); KToggleAction* sortFoldersFirst = m_actionCollection->add("folders_first"); sortFoldersFirst->setText(i18nc("@action:inmenu Sort", "Folders First")); - connect(sortFoldersFirst, SIGNAL(triggered()), this, SLOT(toggleSortFoldersFirst())); + connect(sortFoldersFirst, &KToggleAction::triggered, this, &DolphinViewActionHandler::toggleSortFoldersFirst); // View -> Sort By QActionGroup* sortByActionGroup = createFileItemRolesActionGroup("sort_by_"); @@ -206,16 +208,16 @@ void DolphinViewActionHandler::createActions() KToggleAction* showInGroups = m_actionCollection->add("show_in_groups"); showInGroups->setIcon(KIcon("view-group")); showInGroups->setText(i18nc("@action:inmenu View", "Show in Groups")); - connect(showInGroups, SIGNAL(triggered(bool)), this, SLOT(toggleGroupedSorting(bool))); + connect(showInGroups, &KToggleAction::triggered, this, &DolphinViewActionHandler::toggleGroupedSorting); KToggleAction* showHiddenFiles = m_actionCollection->add("show_hidden_files"); showHiddenFiles->setText(i18nc("@action:inmenu View", "Show Hidden Files")); showHiddenFiles->setShortcuts(QList() << Qt::ALT + Qt::Key_Period << Qt::Key_F8); - connect(showHiddenFiles, SIGNAL(triggered(bool)), this, SLOT(toggleShowHiddenFiles(bool))); + connect(showHiddenFiles, &KToggleAction::triggered, this, &DolphinViewActionHandler::toggleShowHiddenFiles); - KAction* adjustViewProps = m_actionCollection->addAction("view_properties"); + QAction* adjustViewProps = m_actionCollection->addAction("view_properties"); adjustViewProps->setText(i18nc("@action:inmenu View", "Adjust View Properties...")); - connect(adjustViewProps, SIGNAL(triggered()), this, SLOT(slotAdjustViewProperties())); + connect(adjustViewProps, &QAction::triggered, this, &DolphinViewActionHandler::slotAdjustViewProperties); } QActionGroup* DolphinViewActionHandler::createFileItemRolesActionGroup(const QString& groupPrefix) @@ -226,11 +228,11 @@ QActionGroup* DolphinViewActionHandler::createFileItemRolesActionGroup(const QSt QActionGroup* rolesActionGroup = new QActionGroup(m_actionCollection); rolesActionGroup->setExclusive(isSortGroup); if (isSortGroup) { - connect(rolesActionGroup, SIGNAL(triggered(QAction*)), - this, SLOT(slotSortTriggered(QAction*))); + connect(rolesActionGroup, &QActionGroup::triggered, + this, &DolphinViewActionHandler::slotSortTriggered); } else { - connect(rolesActionGroup, SIGNAL(triggered(QAction*)), - this, SLOT(toggleVisibleRole(QAction*))); + connect(rolesActionGroup, &QActionGroup::triggered, + this, &DolphinViewActionHandler::toggleVisibleRole); } QString groupName; @@ -265,11 +267,11 @@ QActionGroup* DolphinViewActionHandler::createFileItemRolesActionGroup(const QSt groupMenuGroup = new QActionGroup(groupMenu); groupMenuGroup->setExclusive(isSortGroup); if (isSortGroup) { - connect(groupMenuGroup, SIGNAL(triggered(QAction*)), - this, SLOT(slotSortTriggered(QAction*))); + connect(groupMenuGroup, &QActionGroup::triggered, + this, &DolphinViewActionHandler::slotSortTriggered); } else { - connect(groupMenuGroup, SIGNAL(triggered(QAction*)), - this, SLOT(toggleVisibleRole(QAction*))); + connect(groupMenuGroup, &QActionGroup::triggered, + this, &DolphinViewActionHandler::toggleVisibleRole); } } @@ -310,7 +312,7 @@ void DolphinViewActionHandler::slotRename() m_currentView->renameSelectedItems(); } -void DolphinViewActionHandler::slotTrashActivated(Qt::MouseButtons, Qt::KeyboardModifiers modifiers) +void DolphinViewActionHandler::slotTrashActivated() { emit actionBeingHandled(); m_currentView->trashSelectedItems(); diff --git a/src/views/dolphinviewactionhandler.h b/src/views/dolphinviewactionhandler.h index e80ffc0df..58cdb5416 100644 --- a/src/views/dolphinviewactionhandler.h +++ b/src/views/dolphinviewactionhandler.h @@ -112,7 +112,7 @@ private Q_SLOTS: * Moves the selected items of the active view to the trash. * This methods adds "shift means del" handling. */ - void slotTrashActivated(Qt::MouseButtons, Qt::KeyboardModifiers); + void slotTrashActivated(); /** * Deletes the selected items of the active view. diff --git a/src/views/renamedialog.cpp b/src/views/renamedialog.cpp index 5c0ae6126..bd0a31d11 100644 --- a/src/views/renamedialog.cpp +++ b/src/views/renamedialog.cpp @@ -23,6 +23,7 @@ #include #include #include +#include //TODO port to QCollator #include #include @@ -74,11 +75,11 @@ RenameDialog::RenameDialog(QWidget *parent, const KFileItemList& items) : } m_lineEdit = new KLineEdit(page); - connect(m_lineEdit, SIGNAL(textChanged(QString)), this, SLOT(slotTextChanged(QString))); + connect(m_lineEdit, &KLineEdit::textChanged, this, &RenameDialog::slotTextChanged); int selectionLength = m_newName.length(); if (m_renameOneItem) { - const QString fileName = items.first().url().prettyUrl(); + const QString fileName = items.first().url().toDisplayString(); const QString extension = KMimeType::extractKnownExtension(fileName.toLower()); // If the current item is a directory, select the whole file name. @@ -101,7 +102,7 @@ RenameDialog::RenameDialog(QWidget *parent, const KFileItemList& items) : if (!m_renameOneItem) { QSet extensions; foreach (const KFileItem& item, m_items) { - const QString extension = KMimeType::extractKnownExtension(item.url().prettyUrl().toLower()); + const QString extension = KMimeType::extractKnownExtension(item.url().toDisplayString().toLower()); if (extensions.contains(extension)) { m_allExtensionsDifferent = false; @@ -218,4 +219,3 @@ QString RenameDialog::indexedName(const QString& name, int index, const QChar& i return newName; } -#include "renamedialog.moc" diff --git a/src/views/tooltips/filemetadatatooltip.cpp b/src/views/tooltips/filemetadatatooltip.cpp index b72699664..afb1a32d3 100644 --- a/src/views/tooltips/filemetadatatooltip.cpp +++ b/src/views/tooltips/filemetadatatooltip.cpp @@ -24,6 +24,8 @@ #include #include #include +// For the blurred tooltip background +#include #include #include @@ -37,12 +39,9 @@ #ifndef HAVE_BALOO #include #else -#include +#include #endif -// For the blurred tooltip background -#include - FileMetaDataToolTip::FileMetaDataToolTip(QWidget* parent) : QWidget(parent), m_preview(0), @@ -72,13 +71,15 @@ FileMetaDataToolTip::FileMetaDataToolTip(QWidget* parent) : // Create widget for the meta data #ifndef HAVE_BALOO m_fileMetaDataWidget = new KFileMetaDataWidget(this); + connect(m_fileMetaDataWidget, &KFileMetaDataWidget::metaDataRequestFinished, + this, &FileMetaDataToolTip::metaDataRequestFinished); #else m_fileMetaDataWidget = new Baloo::FileMetaDataWidget(this); + connect(m_fileMetaDataWidget, &Baloo::FileMetaDataWidget::metaDataRequestFinished, + this, &FileMetaDataToolTip::metaDataRequestFinished); #endif m_fileMetaDataWidget->setForegroundRole(QPalette::ToolTipText); m_fileMetaDataWidget->setReadOnly(true); - connect(m_fileMetaDataWidget, SIGNAL(metaDataRequestFinished(KFileItemList)), - this, SIGNAL(metaDataRequestFinished(KFileItemList))); QVBoxLayout* textLayout = new QVBoxLayout(); textLayout->addWidget(m_name); @@ -174,8 +175,8 @@ void FileMetaDataToolTip::paintEvent(QPaintEvent* event) void FileMetaDataToolTip::showEvent(QShowEvent *) { - Plasma::WindowEffects::overrideShadow(winId(), true); - Plasma::WindowEffects::enableBlurBehind(winId(), true, mask()); +#pragma message("TODO: port Plasma::WindowEffects::overrideShadow") + //Plasma::WindowEffects::overrideShadow(winId(), true); + KWindowEffects::enableBlurBehind(winId(), true, mask()); } -#include "filemetadatatooltip.moc" diff --git a/src/views/tooltips/tooltipmanager.cpp b/src/views/tooltips/tooltipmanager.cpp index bd6948363..c005979d5 100644 --- a/src/views/tooltips/tooltipmanager.cpp +++ b/src/views/tooltips/tooltipmanager.cpp @@ -23,6 +23,7 @@ #include #include #include +#include #include #include @@ -51,12 +52,12 @@ ToolTipManager::ToolTipManager(QWidget* parent) : m_showToolTipTimer = new QTimer(this); m_showToolTipTimer->setSingleShot(true); m_showToolTipTimer->setInterval(500); - connect(m_showToolTipTimer, SIGNAL(timeout()), this, SLOT(showToolTip())); + connect(m_showToolTipTimer, &QTimer::timeout, this, static_cast(&ToolTipManager::showToolTip)); m_contentRetrievalTimer = new QTimer(this); m_contentRetrievalTimer->setSingleShot(true); m_contentRetrievalTimer->setInterval(200); - connect(m_contentRetrievalTimer, SIGNAL(timeout()), this, SLOT(startContentRetrieval())); + connect(m_contentRetrievalTimer, &QTimer::timeout, this, &ToolTipManager::startContentRetrieval); Q_ASSERT(m_contentRetrievalTimer->interval() < m_showToolTipTimer->interval()); } @@ -81,8 +82,8 @@ void ToolTipManager::showToolTip(const KFileItem& item, const QRectF& itemRect) // meta data retrieval, when passing rapidly over a lot of items. Q_ASSERT(!m_fileMetaDataToolTip); m_fileMetaDataToolTip = new FileMetaDataToolTip(); - connect(m_fileMetaDataToolTip, SIGNAL(metaDataRequestFinished(KFileItemList)), - this, SLOT(slotMetaDataRequestFinished())); + connect(m_fileMetaDataToolTip, &FileMetaDataToolTip::metaDataRequestFinished, + this, &ToolTipManager::slotMetaDataRequestFinished); m_contentRetrievalTimer->start(); m_showToolTipTimer->start(); @@ -132,13 +133,13 @@ void ToolTipManager::startContentRetrieval() KIO::PreviewJob* job = new KIO::PreviewJob(KFileItemList() << m_item, QSize(256, 256)); job->setIgnoreMaximumSize(m_item.isLocalFile()); if (job->ui()) { - job->ui()->setWindow(qApp->activeWindow()); + KJobWidgets::setWindow(job, qApp->activeWindow()); } - connect(job, SIGNAL(gotPreview(KFileItem,QPixmap)), - this, SLOT(setPreviewPix(KFileItem,QPixmap))); - connect(job, SIGNAL(failed(KFileItem)), - this, SLOT(previewFailed())); + connect(job, &KIO::PreviewJob::gotPreview, + this, &ToolTipManager::setPreviewPix); + connect(job, &KIO::PreviewJob::failed, + this, &ToolTipManager::previewFailed); } @@ -266,4 +267,3 @@ void ToolTipManager::showToolTip() m_toolTipRequested = false; } -#include "tooltipmanager.moc" diff --git a/src/views/versioncontrol/updateitemstatesthread.cpp b/src/views/versioncontrol/updateitemstatesthread.cpp index 62fcd09aa..7b806a592 100644 --- a/src/views/versioncontrol/updateitemstatesthread.cpp +++ b/src/views/versioncontrol/updateitemstatesthread.cpp @@ -20,6 +20,7 @@ #include "updateitemstatesthread.h" #include +#include #include @@ -75,4 +76,3 @@ QMap > UpdateItemStatesThrea return m_itemStates; } -#include "updateitemstatesthread.moc" diff --git a/src/views/versioncontrol/versioncontrolobserver.cpp b/src/views/versioncontrol/versioncontrolobserver.cpp index 6affe80d3..c41803c16 100644 --- a/src/views/versioncontrol/versioncontrolobserver.cpp +++ b/src/views/versioncontrol/versioncontrolobserver.cpp @@ -23,6 +23,7 @@ #include #include +#include #include #include #include @@ -51,8 +52,8 @@ VersionControlObserver::VersionControlObserver(QObject* parent) : m_dirVerificationTimer = new QTimer(this); m_dirVerificationTimer->setSingleShot(true); m_dirVerificationTimer->setInterval(500); - connect(m_dirVerificationTimer, SIGNAL(timeout()), - this, SLOT(verifyDirectory())); + connect(m_dirVerificationTimer, &QTimer::timeout, + this, &VersionControlObserver::verifyDirectory); } VersionControlObserver::~VersionControlObserver() @@ -66,19 +67,19 @@ VersionControlObserver::~VersionControlObserver() void VersionControlObserver::setModel(KFileItemModel* model) { if (m_model) { - disconnect(m_model, SIGNAL(itemsInserted(KItemRangeList)), - this, SLOT(delayedDirectoryVerification())); - disconnect(m_model, SIGNAL(itemsChanged(KItemRangeList,QSet)), - this, SLOT(delayedDirectoryVerification())); + disconnect(m_model, &KFileItemModel::itemsInserted, + this, &VersionControlObserver::delayedDirectoryVerification); + disconnect(m_model, &KFileItemModel::itemsChanged, + this, &VersionControlObserver::delayedDirectoryVerification); } m_model = model; if (model) { - connect(m_model, SIGNAL(itemsInserted(KItemRangeList)), - this, SLOT(delayedDirectoryVerification())); - connect(m_model, SIGNAL(itemsChanged(KItemRangeList,QSet)), - this, SLOT(delayedDirectoryVerification())); + connect(m_model, &KFileItemModel::itemsInserted, + this, &VersionControlObserver::delayedDirectoryVerification); + connect(m_model, &KFileItemModel::itemsChanged, + this, &VersionControlObserver::delayedDirectoryVerification); } } @@ -116,7 +117,7 @@ QList VersionControlObserver::actions(const KFileItemList& items) cons if (items.count() == 1) { const KFileItem rootItem = m_model->rootItem(); if (!rootItem.isNull() && items.first().url() == rootItem.url()) { - directory = rootItem.url().path(KUrl::AddTrailingSlash); + directory = rootItem.url().path(); } } @@ -158,18 +159,18 @@ void VersionControlObserver::verifyDirectory() if (m_plugin) { KVersionControlPlugin2* pluginV2 = qobject_cast(m_plugin); if (pluginV2) { - connect(pluginV2, SIGNAL(itemVersionsChanged()), - this, SLOT(silentDirectoryVerification())); + connect(pluginV2, &KVersionControlPlugin2::itemVersionsChanged, + this, &VersionControlObserver::silentDirectoryVerification); } else { - connect(m_plugin, SIGNAL(versionStatesChanged()), - this, SLOT(silentDirectoryVerification())); + connect(m_plugin, &KVersionControlPlugin::versionStatesChanged, + this, &VersionControlObserver::silentDirectoryVerification); } - connect(m_plugin, SIGNAL(infoMessage(QString)), - this, SIGNAL(infoMessage(QString))); - connect(m_plugin, SIGNAL(errorMessage(QString)), - this, SIGNAL(errorMessage(QString))); - connect(m_plugin, SIGNAL(operationCompletedMessage(QString)), - this, SIGNAL(operationCompletedMessage(QString))); + connect(m_plugin, &KVersionControlPlugin::infoMessage, + this, &VersionControlObserver::infoMessage); + connect(m_plugin, &KVersionControlPlugin::errorMessage, + this, &VersionControlObserver::errorMessage); + connect(m_plugin, &KVersionControlPlugin::operationCompletedMessage, + this, &VersionControlObserver::operationCompletedMessage); if (!m_versionedDirectory) { m_versionedDirectory = true; @@ -241,10 +242,10 @@ void VersionControlObserver::updateItemStates() emit infoMessage(i18nc("@info:status", "Updating version information...")); } m_updateItemStatesThread = new UpdateItemStatesThread(m_plugin, itemStates); - connect(m_updateItemStatesThread, SIGNAL(finished()), - this, SLOT(slotThreadFinished())); - connect(m_updateItemStatesThread, SIGNAL(finished()), - m_updateItemStatesThread, SLOT(deleteLater())); + connect(m_updateItemStatesThread, &UpdateItemStatesThread::finished, + this, &VersionControlObserver::slotThreadFinished); + connect(m_updateItemStatesThread, &UpdateItemStatesThread::finished, + m_updateItemStatesThread, &UpdateItemStatesThread::deleteLater); m_updateItemStatesThread->start(); // slotThreadFinished() is called when finished } @@ -365,4 +366,3 @@ bool VersionControlObserver::isVersioned() const return m_versionedDirectory && m_plugin; } -#include "versioncontrolobserver.moc" diff --git a/src/views/versioncontrol/versioncontrolobserver.h b/src/views/versioncontrol/versioncontrolobserver.h index d12d2cfe0..2c07b0614 100644 --- a/src/views/versioncontrol/versioncontrolobserver.h +++ b/src/views/versioncontrol/versioncontrolobserver.h @@ -23,6 +23,7 @@ #include #include +#include #include #include #include diff --git a/src/views/viewmodecontroller.cpp b/src/views/viewmodecontroller.cpp index 26e181888..da6066887 100644 --- a/src/views/viewmodecontroller.cpp +++ b/src/views/viewmodecontroller.cpp @@ -85,4 +85,3 @@ void ViewModeController::setUrl(const KUrl& url) } } -#include "viewmodecontroller.moc" diff --git a/src/views/viewproperties.cpp b/src/views/viewproperties.cpp index d4ecfafa0..bcea06253 100644 --- a/src/views/viewproperties.cpp +++ b/src/views/viewproperties.cpp @@ -27,6 +27,8 @@ #include #include #include +#include +#include #include #include