diff --git a/doc/bookmarks.docbook b/doc/bookmarks.docbook index 8f23fc4c..4d62f633 100644 --- a/doc/bookmarks.docbook +++ b/doc/bookmarks.docbook @@ -1,302 +1,291 @@ BookMan: Organize your Bookmarks Bookmarks BookMan is &krusader;'s Bookmark tool for bookmarking folders, local and remote URLs, and later returning to them in a click of a button. The Bookman menu is divided into four sections: Your personal bookmarks Popular &URL;s Permanent bookmarks Manage bookmarks You can bookmark inside a remote file system (&FTP; or SAMBA) and later use the bookmark to quickly connect to the remote machine, but you cannot bookmark inside an archive. -
Bookmark menu Bookmark menu
Using Bookmarks Usually, you click on the - BookMan II button when you are in the target + BookMan II button (the rightmost button to the right of + the address bar at the top of the active panel) when you are in the target folder. For example, to bookmark /usr/tmp, navigate &krusader; there and click the BookMan II button and select Bookmark Current. When the Add Bookmark dialog box appears, the &URL; line will say /usr/tmp. Name is for the name you would like to give to the bookmark (⪚: temporary folder). Hotkeys are supported by adding & to the bookmark name ⪚ &sourceforge, &home, down&loads &etc;, so you can quickly call the bookmark name with &Alt; foo. If you add the bookmark without entering a name, the bookmarks name will be the same as its target. URL is where the bookmark points to. Create in creates bookmark folders for organizing your bookmarks. To use your bookmarks, click the BookMan II button and choose a bookmark. You may also use the Key-Bindings: &Ctrl; B to bookmark the current item, &Alt; right/left arrow to open right/left panel bookmarks list and &Ctrl; D to open the bookmarks of the active panel. From the context menu of the bookmark (&RMB; click) you can open it in a new Folder tab. Navigation in bookmarks: Start typing letters ⪚ when you type 'h' and only one bookmark starts with 'h', it is executed immediately - no enter needed If more than one bookmarks begins with 'h', you will have to continue adding letters, until you have specified enough and again, the bookmark is executed. + + + The search bar will always be visible in the bookmarks menu if you check the + corresponding item on the Panel Konfigurator's page. + + Password handling One of the benefits of the bookmark manager is that the passwords are saved using &plasma;'s services - where ⪚ your &konqueror;/&kmail; password are saved. If you have a wallet, &plasma; will save the passwords there. By clicking the bookmarks, a dialog will open and ask for your username and password. Supply them and click Save password. The passwords and usernames will be saved securely by &plasma;'s wallet (make sure it is enabled by your distro). The downside here is that if the system was reinstalled and you do not backup your passwords from the wallet as well as &krusader;'s bookmark file, something will be lost. Popular URLs Popular URLs The submenu Popular URLs - holds persistent the most popular visited &URL;s (local or remote). This submenu displays the top 15 popular URLs, sorted by ranking, so that the top &URL; is the most popular. This is easy for when you need to visit &URL;s often, but do not want to create Bookmarks, it serves as a temporary bookmark list for the most visited links. Quicksearch in Popular URLs is a fast way to browse/select the popular &URL;s: Open the Popular URLs - or use &Ctrl; Z Type a few letters to narrow the search Press &Enter; (you will go to the &URL; from list) Permanent bookmarks These are hardcoded bookmarks to the top bookmark menu; there is no need for them to be saved to the file. With the Context Menu you can enable/disable these permanent bookmarks. The following permanent bookmarks are available: Trash bin uses &plasma;'s trash:/ protocol. Local Network uses &plasma;'s remote:/ protocol. Virtual Filesystem Virtual file systems (VFS) virt:/ is not a virtual folder, but a container for &URL;s from different file systems. It is used for ⪚ the Feed to Listbox feature of the search module and the synchronizer (disabled at the compilation time by default). The location toolbar will display ⪚ virt:/Search results 1 or virt:/Synchronise results 1. Jump back or &Ctrl; J brings you back to your starting position when you did create a new tab in the panel window. This feature is very handy if you go deep into a directory tree, then you can return with one action to the starting point. With Set jump back point here or &Ctrl;&Shift; J sets the current directory as a jump back point. Manage bookmarks To edit and organize your bookmarks, by clicking the BookMan II button and selecting the Manage Bookmarks, KeditBookmarks will be displayed. This is where you can edit/remove and rearrange the bookmarks. KeditBookmarks is a bookmark editor for &konqueror;, &krusader; and other applications, which use the XBEL standard for the bookmark format. The bookmarks are stored in ~/.local/share/krusader/krbookmarks.xml. The default folder for the bookmarks file krusader/krbookmarks.xml is ~/.local/share. You can determine the needed folder in your system using the qtpaths --paths GenericDataLocation command in terminal. This local file exists only if you have edited &krusader; bookmarks. It will be created after the first run of KeditBookmarks from &krusader;. The default system bookmarks are stored in the kfileplaces/bookmarks.xml file in the directory which can be determined using the qtpaths --paths GenericDataLocation command. - You can import bookmarks from - IE, - Opera, - Galeon, &kde;, - Mozilla, &Netscape;. + KeditBookmarks is easy to use, however, if you need more information, please read the - KeditBookmarks or the &konqueror; - handbook. + KeditBookmarks handbook.
<application>KeditBookmarks</application> Bookmark Manager KeditBookmarks Bookmark Manager
Bookmarks as action buttons on the Toolbar Bookmarks can be placed as buttons on the Main Toolbar or the Actions Toolbar. You can even make a key-binding for them: Create your Bookmarks. If you want, create keybindings for the bookmarks in the Configure Shortcuts window (Settings Configure Shortcuts...). Add your bookmarks as action buttons on the Main Toolbar or the Actions Toolbar with the Configure Toolbars window (Settings Configure Toolbars...).
diff --git a/doc/konfigurator.docbook b/doc/konfigurator.docbook index 12cb88f5..34b155d7 100644 --- a/doc/konfigurator.docbook +++ b/doc/konfigurator.docbook @@ -1,2040 +1,2055 @@ Konfigurator: &krusader;'s Configuration Center Configure Krusader Konfigurator is &krusader;s configuration center. When running &krusader;, use Settings Configure &krusader; , and it will start Konfigurator. There you can modify the way &krusader; works and customize it to your own needs. At any time, pressing the Apply button applies the changes, pressing Close closes Konfigurator, and pressing Defaults re-applies &krusader;'s "factory" settings. Konfigurator is divided into pages, each containing items related to that page. For some changes to the &GUI;, you have to close and restart &krusader;. Since &krusader;-1.80.0 the Key-Bindings and Main Toolbar-Actions Toolbar have received their own configuration windows and so they are not a part anymore of Konfigurator, you can configure them now via the Settings menu. Startup
Startup configuration Startup configuration
The startup page determines the way that &krusader; looks (and works) when it is launched. It is divided into two main parts: General Startup Profile: Starts the selected Panel profile at startup. <Last session> is a special Panel Profile, it is saved automatically when closing &krusader;. Show splashscreen: Displays a splash screen when starting &krusader;. Single Instance Mode: Allows only one &krusader; instance to run. User Interface Determines which parts of the user interface are visible after start-up. Save last position, size and panel settings: When launched, &krusader; resizes itself to the size it was when last shut-down. &krusader; also appears in the same location on the screen, having panels sorted and aligned as they were. If this option is unchecked, you can use the menu Window Save Position option to manually set &krusader; size and position at start-up. Update default panel settings: If checked, the default panel settings will be updated after start-up. Start to tray: if checked, &krusader; starts to tray (if minimize to tray is set), without showing the main window. Save component settings on exit: If checked, restores the user interface components to their condition when last shut-down. Show function keys: If checked, the FN Keys Bar is visible after start-up. Show statusbar: If checked, the Statusbar is visible after start-up. Available only if the Save component settings on exit item is unchecked. Show command line: If checked, the Command Line is visible after start-up. Available only if the Save component settings on exit item is unchecked. Show embedded terminal: If checked, the Terminal emulator is visible after start-up. Available only if the Save component settings on exit item is unchecked.
Panel Here you can determine the look and feel of panel - which means finetuning the application to your needs. The page is divided into six tabs: General, View, Buttons, Selection Mode, Media Menu, and Layout: General <guilabel>Navigator bar</guilabel> Edit Mode by default: If checked, show editable path in Navigator bar by default. Show full path by default: If checked, always show full path in Navigator bar by default. <guilabel>Operation</guilabel> Autoselect Directories: When you select a group of files (either by using Select Group or by using Select All), &krusader; checks this option. If checked, the directories matching the select criteria are also selected. Otherwise, only files are selected. Rename selects extension: When you rename a file, the whole text is selected. If you want total commanderlike renaming of just the name, without extension, deselect this item. Unselect files before copy/move: If checked, &krusader; remove the selection marks from files or folders before copying or moving them to the new location. Filter dialog remembers settings: If checked, the filter dialog will be opened with the last filter settings that where applied to the panel. <guilabel>Tabs</guilabel> Use fullpath tab names: If checked, display the full path in the Folder tabs; otherwise only the last part of the path is displayed. Show new/close tab buttons: If checked, &krusader; displays new and close buttons on tabs. Tab Bar position: Lets you choose Tab bar position (Bottom or Top). Show Tab Bar on single tab: If checked, &krusader; displays the Tab Bar even if there is only one tab on the panel. <guilabel>Search bar</guilabel> Start by typing: allows to select if quick search feature is used. When checked, you can open search bar and start searching by typing something while viewing folder contents in the active panel. Case sensitive: When you use the search or filter feature: If checked (the &UNIX; default), all files beginning with capital letters appear before files beginning with lower case letters; otherwise, all files beginning with a specified letter (capital or otherwise) will be displayed together. Up/Down cancels search: Pressing Arrow Up or Arrow Down cancels search bar. Directory navigation with Right Arrow: If checked, pressing the Right arrow key enters directory if no search text editing intention is captured. Position: Lets you choose search and filter bar position (Bottom or Top). Default mode: Lets you choose the search bar default mode between Search, Select and Filter. You can change the mode later using the search bar itself. + + + <guilabel>Bookmark Search</guilabel> + + + + Always show search bar: If checked, + make bookmark search bar always visible. + + + + Search in special items: If checked, + bookmark search is also applied to special items in bookmark menu like Trash, Popular URLs, Jump Back, &etc; + + <guilabel>Status/Totalsbar</guilabel> Show size in bytes too: If checked, &krusader; displays size in bytes on statusbar or totalsbar. Show space information: If checked, &krusader; displays free/total disk space in the Status-/Totalsbar. View <guilabel>General</guilabel> View font: Allows you to change the font used inside the file lists. Tooltip delay (msec): Allows you to configure the delay in milliseconds between the moment you have stopped mouse pointer above an item in a file list and the moment when the tooltip will be shown. Use human readable file size: If checked, the file size appears in kB, Mb &etc;, and not in bytes (default). Numeric permissions: Permission column (Panel View tab) shows octal numbers '0755' instead of 'rwxr-xr-x'. Show hidden files: If checked, &krusader; displays the "dot-files" which are otherwise hidden. Load the user defined folder icons: If checked, &krusader; loads the user defined folder icons. Always show current item: If checked, &krusader; shows current item border decoration in inactive panel. Sort method Krusader (default): the comparison used so far. Uses comparison using locale rules (even context rules). Alphabetical: strings are compared character by character (no context rules from locale applied). Alphabet characters are compared using locale rules, special characters are compared by the character code. Alphabetical and numbers: the same as above, but if the names contains numbers, the numbers are compared numerically instead of alphabetically. Character code: comparison by character code (quick). Character code and numbers: the same as above, but with numerical comparison of numbers. Case sensitive sorting: If checked (the &UNIX; default), all files beginning with capital letters appear before files beginning with non-capital letters; otherwise, all files beginning with a specified letter (capital or otherwise) appear together. Always sort dirs by name: Sorts directories by name, regardless of the sort column. Show directories first: If checked directories have precedence in folder lists. Locale aware sorting: Sorts files and directories according to the current locale settings. <guilabel>View modes</guilabel> Default view mode: Allows you to change the default view mode. You can choose Detailed View or Brief View. On tabs of both view modes you can define the following options. Default icon size: Allows you to change the size of the icons in the file lists. The available sizes are 16x16, 22x22, 32x32 and 48x48 pixels. Use icons in the filenames: If checked, show the icons in file names and folders. Show previews by default: If checked, show the previews of file contents. To configure the columns use the right click menu in the panel when viewing files. The left and right panel use their own columns independently. The following columns are available: Name: Shows the filename without the part after the last dot, this latter part is displayed in the Ext column. When the Ext column is made hidden, the complete filename is shown in the Name column like ⪚ &konqueror; does. Ext: Shows the last part of the filename (the part after the last dot) in the Ext column, and not as a complete filename in the Name column like ⪚ &konqueror; does. Type: Shows the MIME type field. Size: Shows the size field. Modified: Shows the modified date and time field. Perms: Shows the full permissions ⪚ "rwxr-xr-x" or as octal numbers '0755' instead with enable/disable Numeric Permissions in Panel View Tab. rwx: Shows only the rights of the current user ⪚ "-rw". Owner: Shows the owner field. Group: Shows the group field. Uncheck the columns not in use. This allows more space for columns in use. Buttons Toolbar buttons have icons: If checked, &krusader; displays icons on toolbar buttons. Show Media Button: If checked, &krusader; displays media button. Show Back Button: If checked, &krusader; displays back button. Show Forward Button: If checked, &krusader; displays forward button. Show History Button: If checked, &krusader; displays history button. Show Bookmarks Button: If checked, &krusader; displays bookmarks button. Show Panel Toolbar: If checked, &krusader; displays the Panel Toolbar. You can make the buttons on the Panel Toolbar visible or hidden: <guilabel>Visible Panel Toolbar buttons</guilabel> Equal button (=) Up button (..) Home button (~) Root button (/) Toggle-button for sync-browsing: If checked, shows the Sync-browsing button. Selection Mode Here you can configure the selection modes. <guilabel>General</guilabel> &krusader; Mode: The way &krusader; has worked from day one. Both mouse keys allow selecting files. To select more than one file, hold the &Ctrl; key and click the &LMB;. Right-click menu appears with a short click on the &RMB;. Konqueror Mode: pressing the &LMB; selects files -- you can click and select multiple files. Right-click menu appears with a short click on the &RMB;. Total commander Mode: Pressing the &RMB; selects multiple files and the right-click menu appears with pressing and holding the &RMB;. The Left Mouse Button does not select, but sets the current file without affecting the current selection. Ergonomic Mode: The &LMB; does not select, but sets the current file without affecting the current selection. The &RMB; invokes the context-menu. You can select with &Ctrl; key and the left button. Custom Selection Mode: Create your own selection style! <guilabel>Details</guilabel> Double-click selects (classic): A single click on a file will select and focus, a double click opens the file or steps into the directory. Obey global selection policy: Pressing the &LMB; selects files -- Use global setting: &plasma; System Settings -> Input Devices -> Mouse. Custom Selection Mode items: Based on &plasma;'s selection mode Left mouse button selects Left mouse button preserves selection &Shift;/&Ctrl;-Left mouse button selects Right mouse button selects Right mouse button preserves selection &Shift;/&Ctrl;-Right mouse button selects Spacebar moves down Insert moves down Right-clicking pops context menu immediately Media Menu Using this tab you can select the Media button menu contents: Show Mount Path: show the mount path of partition if checked. Show File System Type: show the file system type of partition if checked. Show Size: allows selection of the size representation in media menu. Can be Always (default, always show the size of partition), When Device has no Label (show the size for partitions with no label only) or Never (never show the size in media menu). Layout You can choose the layout and frame settings: Layout: allows to define layout. The default options are Default, Compact, and Classic. Frame Color: defines frame color. Can be Defined by Layout, None, or Statusbar. Frame Shape: defines frame color. Can be Defined by Layout, None, or Statusbar. Frame Shadow: defines frame color. Can be Defined by Layout, None, or Statusbar. Colors This page configures the colors of the List Panel and the Synchronizer (disabled at the compilation time by default). The KDE default colors is the default color configuration. General Use the default KDE colors: this is the default, it uses &plasma; color defined in the &systemsettings;. Use Alternate Background color: If checked, the Background color and the Alternate background color alternates line by line. When you do not use the &plasma; default colors, you can configure the alternate colors in the Colors box. Show current item even if not focused: If checked, shows the last cursor position in the non active list panel. This option is only available when you do not use the &plasma; default colors. Dim the colors of the inactive panel: If checked, the colors of the inactive panel are dimmed. These settings can be configured in the Inactive tab of the Colors box. This option is only available when you do not use the &plasma; default colors. Colors Configure the colors the way you like, you can see the result in the Preview section. The following items of the active and inactive panel can be configured: Foreground Directory foreground Executable foreground Symbolic link foreground Invalid symlink foreground Background Alternate background Selected foreground Selected background Alternate selected background Current foreground Selected current foreground Current background The following items of the Synchronizer (disabled at the compilation time by default) can be configured: Equals foreground Equals background Differing foreground Differing background Copy to left foreground Copy to left background Copy to right foreground Copy to left background Delete foreground Delete background Preview Here you see a preview of the configured colors. Color schemes With the Import Color Scheme and Export Color Scheme buttons you can load and save a Color Scheme profile. This allows &krusader; to use Total Commander, Midnight Commander, foo-commander or your own custom color profile. The Color Schemes are stored in /usr/share/krusader, the foo.color is a binary file that holds the color scheme. Midnight Commander and Total Commander Color scheme files are provided. Please upload your favorite Color schemes so that they become available for the &krusader; community. Thanks! General Here you configure the basic operations. The page is divided into three tabs: General, Viewer/Editor, and Atomic extensions. General The following options determine basic aspects of operation: Warn on exit: if checked, &krusader; warns you every time when exit action is triggered. Minimize to tray: If checked, the &krusader; icon will appear in the system tray. When you minimize &krusader;, it will not appear in the taskbar. It also will not exit if you close the main window. Instead you can quit &krusader; by selecting Quit from the File menu or the context menu of the tray icon. Use MIME type magic: MIME type magic is a mechanism which allows &krusader; to inspect the files in the panels and determine their type even if the file has no identifying extension. For example, if you take an image file - image1.jpg - and rename it to image1, &krusader; will still know it is an image file and work with it accordingly. However, this mode of operation is slower (while refreshing the panel, or changing directories), so try &krusader; with and without MIME type magic and decide what is best for you. Temp Directory: this option selects the base directory for &krusader;'s temporary files. The actual files will be created in separate directories under the 'Temp directory', so that each user running &krusader; will have their own temporary subdirectories under the chosen directory. You must choose a temporary directory to which all users running &krusader; have full permissions! Delete mode (Delete files/Move to trash): when &krusader; deletes files it can either really delete them or move them to the trash folder, thereby making them available via &plasma;'s trash. External Terminal: choose which terminal emulator will be used when &krusader; opens a console window (via F9, or Tools Start Terminal menu option). Embedded Terminal sends Chdir on panel change: if unchecked, there will be no cd command sent to the Terminal Emulator if the panel folder changes. Toggle Fullscreen Embedded Terminal: if checked, &krusader; shows fullscreen terminal in Midnight Commander style (Terminal is shown instead of &krusader; window). Viewer/Editor Here you can change the viewer and editor settings: Internal editor and viewer opens each file in separate window: check this item if you want each file to be opened in separate window. Default viewer mode: Generic mode: use the systems default viewer. Text mode: view the file in text-only mode. Hex mode: view the file in hex-only mode. Lister mode: Fast text/hexadecimal viewer for huge filesizes. &krusader; lister never loads the whole file into memory, just a little part of it, and uses caching for faster scrolling. Remote files are downloaded, but during the download, viewing the downloaded part is possible. If a file constantly changes, then it can also be viewed, lister will always see its current state. Use lister if the text file is bigger than: 10 MB (default value): checks whether a text file is bigger than 10 MB (configurable), and if yes, then &krusader; Lister is used instead of &plasma;'s default viewer. Use Okteta as Hex viewer: if checked (default option), use &plasma; hex editor Okteta to view raw data. To use this option you should install Okteta package first. Editor: choose what editor will be used when editing a file (via F4). Default the internal viewer is used, this is the &plasma;'s default viewer. Atomic extensions Atomic extensions: predefined atomic extensions like .tar.gz are shown as one part in the Ext Column of the List Panel. Advanced This page handles more advanced issues, so you should double-check your actions here: modifying settings here makes &krusader; a more powerful and dangerous tool. The page is divided into three parts: General Automount filesystems: this makes &krusader; try to mount a file system before entering it. For example, if you click on /mnt/cdrom (and /mnt/cdrom appears in /etc/fstab as a mount point), &krusader; will check if it is mounted. If not, it will try and mount it for you and then enter, so that you would see the contents of your cdrom. Note, however, that &krusader; will NOT unmount when exiting /mnt/cdrom. MountMan will not (un)mount the following mount points: If you have file systems that you do not want to accidentally unmount (or mount) then enter a list of mount points separated by commas (⪚ /, /boot, /tmp) and MountMan will not try to (un)mount them. Confirmations By checking the options in this section, &krusader; will ask for confirmation before doing a specific action; otherwise, the following actions will be done without warning: deleting non empty directories deleting file(s) copying file(s) moving file(s) Fine-Tuning Icon Cache Size: &krusader; uses an icon cache, so it will not have to reload icons that have been used before. Of course, as the cache grows bigger, it can store more icons and further speed operations, but the memory footprint of &krusader; will become bigger. Arguments of updatedb: sets additional arguments for updatedb, please read the manpages for more information. Archives This page configures some aspects of archive handling in &krusader;. krarc ioslave Enable Write Support: this option allows you to enable writing files into an archive. The down side is that if a power failure occurs during the process, the files that were moved might already be deleted, but not yet packed into the archive. Moving archives into themselves will delete them. Archive handling Browse Archives As Directories: if checked, &krusader; will handle the archives transparently and let you open them as folders; otherwise, &krusader; will attempt to invoke an application which opens archives of that type. Fine-Tuning Test archives after packing: this option automatically runs a test on a newly packed archive. It is safer, but takes longer. Test archives before unpacking: this option automatically runs a test before unpacking. Some corrupted archives might cause a crash; therefore, it is better to test archives before unpacking. Dependencies page This page configures the full path of the external applications. It is even possible to configure the full path of &krusader;! General tab Here you can configure the full path of the following external applications: application configurable full path kdesu /usr/bin/kdesu kget /usr/bin/kget mailer /usr/bin/kmail diff utility /usr/bin/kompare krename /usr/bin/krename krusader /usr/bin/krusader locate /usr/bin/locate mount /bin/mount umount /bin/umount updatedb /usr/bin/updatedb By default &kompare; (part of the kdesdk package) is used as external diff utility but you can also use your favorite diff utility ⪚ xxdiff or KDiff3, just fill in the full path and enjoy. Packers tab In the Packers tab you will see a list of archive formats. Some are filled and some are empty. The ones that are available (filled) are supported by &krusader;. For them, &krusader; will handle the archives transparently and let you open them as folders (provided you have checked the Browse Archives As Directories item in the Archives section); otherwise, &krusader; will attempt to invoke an application which opens archives of that type. If a certain archive item is empty, it means that &krusader; could not find the appropriate executables in the configured path. The next archives are supported: ace, arj, bzip2, deb, gzip, iso, lha, lzma, rar, rpm, tar, xz, zip and 7z. packer configurable full path 7z usr/bin/7z arj usr/bin/arj bzip2 usr/bin/bzip2 cpio /bin/cpio dpkg /bin/dpkg gzip /usr/bin/gzip lha /usr/bin/lha lzma /usr/bin/lzma rar /usr/bin/rar tar /bin/tar unace /usr/bin/unace unarj /usr/bin/unarj unrar /usr/bin/unrar unzip /usr/bin/unzip zip /usr/bin/zip xz /usr/bin/xz &krusader; may not be compatible with ACE despite our best efforts. Unace uses closed source and contains additional lines that make Unace get into infinite loop if the stdin is redirected to somewhere else. It works in the same manner as 'su', where you cannot enter the password only from the stdin. &krusader; >= 1-51 emulates the command line environment to enable co-operation with Unace, but we have noticed that Unace always changes its output format from release to release, making co-operation almost impossible. Checksum Utilities tab Here you can configure the full path of the following external Checksum Utilities: Checksum Utilities configurable full path supported checksums md5sum /usr/bin/md5sum md5 sha1sum /usr/bin/sha1sum sha1 md5deep /usr/bin/md5deep md5 sha1deep /usr/bin/sha1deep sha1 sha224sum /usr/bin/sha224sum sha224 sha256sum /usr/bin/sha256sum sha256 sha256deep /usr/bin/sha256deep sha256 sha384sum /usr/bin/sha384sum sha384 sha512sum /usr/bin/sha512sum sha512 tigerdeep /usr/bin/tigerdeep tiger whirlpooldeep /usr/bin/whirlpooldeep whirlpool cfv /usr/bin/cfv md5, sha1, sfv, crc UserActions Here you can configure the terminal for UserActions and the font for the output-collection. The default terminal is konsole --noclose -e. To set up, configure and manage your UserActions use ActionMan (UserActions &URL;). Protocols This page links the MIMEs to protocols. ⪚ protocol "tar" is linked to MIME "application/x-tar". In the Links you will see ⪚ Iso application/x-iso krarc application/x-ace application/x-arj application/x-bzip2 application/x-cpio application/x-deb application/x-debian-package application/x-gzip application/x-jar application/x-lha application/x-rar application/x-rpm application/x-zip tar application/x-tar application/x-tarz application/x-tbz application/x-tgz
diff --git a/krusader/BookMan/krbookmark.cpp b/krusader/BookMan/krbookmark.cpp index 87375bd0..d9720a2a 100644 --- a/krusader/BookMan/krbookmark.cpp +++ b/krusader/BookMan/krbookmark.cpp @@ -1,124 +1,150 @@ /***************************************************************************** * Copyright (C) 2002 Shie Erlich * * Copyright (C) 2002 Rafi Yanai * * Copyright (C) 2004-2018 Krusader Krew [https://krusader.org] * * * * This file is part of Krusader [https://krusader.org]. * * * * Krusader is free software: you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation, either version 2 of the License, or * * (at your option) any later version. * * * * Krusader is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with Krusader. If not, see [http://www.gnu.org/licenses/]. * *****************************************************************************/ #include "krbookmark.h" #include "../krglobal.h" #include "../Archive/krarchandler.h" #include "../FileSystem/krtrashhandler.h" +#include "../Panel/listpanelactions.h" #include #include #include #define BM_NAME(X) (QString("Bookmark:")+X) static const char* NAME_TRASH = I18N_NOOP("Trash bin"); static const char* NAME_VIRTUAL = I18N_NOOP("Virtual Filesystem"); static const char* NAME_LAN = I18N_NOOP("Local Network"); KrBookmark::KrBookmark(QString name, QUrl url, KActionCollection *parent, QString icon, QString actionName) : QAction(parent), _url(url), _icon(icon), _folder(false), _separator(false), _autoDelete(true) { QString actName = actionName.isNull() ? BM_NAME(name) : BM_NAME(actionName); setText(name); parent->addAction(actName, this); connect(this, SIGNAL(triggered()), this, SLOT(activatedProxy())); // do we have an icon? if (!icon.isEmpty()) setIcon(QIcon::fromTheme(icon)); else { // what kind of a url is it? if (_url.isLocalFile()) { setIcon(QIcon::fromTheme("folder")); } else { // is it an archive? if (KRarcHandler::isArchive(_url)) setIcon(QIcon::fromTheme("application-x-tar")); else setIcon(QIcon::fromTheme("folder-html")); } } } KrBookmark::KrBookmark(QString name, QString icon) : QAction(QIcon::fromTheme(icon), name, 0), _icon(icon), _folder(true), _separator(false), _autoDelete(false) { setIcon(QIcon::fromTheme(icon == "" ? "folder" : icon)); } KrBookmark::~KrBookmark() { if (_autoDelete) { QListIterator it(_children); while (it.hasNext()) delete it.next(); _children.clear(); } } -KrBookmark* KrBookmark::getExistingBookmark(QString actionName, KActionCollection *collection) +KrBookmark * KrBookmark::getExistingBookmark(QString actionName, KActionCollection *collection) { return static_cast(collection->action(BM_NAME(actionName))); } -KrBookmark* KrBookmark::trash(KActionCollection *collection) +KrBookmark * KrBookmark::trash(KActionCollection *collection) { KrBookmark *bm = getExistingBookmark(i18n(NAME_TRASH), collection); if (!bm) bm = new KrBookmark(i18n(NAME_TRASH), QUrl("trash:/"), collection); bm->setIcon(krLoader->loadIcon(KrTrashHandler::trashIcon(), KIconLoader::Small)); return bm; } -KrBookmark* KrBookmark::virt(KActionCollection *collection) +KrBookmark * KrBookmark::virt(KActionCollection *collection) { KrBookmark *bm = getExistingBookmark(i18n(NAME_VIRTUAL), collection); if (!bm) { bm = new KrBookmark(i18n(NAME_VIRTUAL), QUrl("virt:/"), collection); bm->setIcon(krLoader->loadIcon("document-open-remote", KIconLoader::Small)); } return bm; } -KrBookmark* KrBookmark::lan(KActionCollection *collection) +KrBookmark * KrBookmark::lan(KActionCollection *collection) { KrBookmark *bm = getExistingBookmark(i18n(NAME_LAN), collection); if (!bm) { bm = new KrBookmark(i18n(NAME_LAN), QUrl("remote:/"), collection); bm->setIcon(krLoader->loadIcon("network-workgroup", KIconLoader::Small)); } return bm; } -KrBookmark* KrBookmark::separator() +QAction * KrBookmark::jumpBackAction(KActionCollection *collection, bool isSetter, ListPanelActions *sourceActions) +{ + auto actionName = isSetter ? QString("setJumpBack") : QString("jumpBack"); + auto action = collection->action(actionName); + if (action) { + return action; + } + + if (!sourceActions) { + return nullptr; + } + + // copy essential part of source action + auto sourceAction = isSetter ? sourceActions->actSetJumpBack : sourceActions->actJumpBack; + action = new QAction(sourceAction->icon(), sourceAction->text(), sourceAction); + action->setShortcut(sourceAction->shortcut()); + action->setShortcutContext(Qt::WidgetShortcut); + connect(action, &QAction::triggered, sourceAction, &QAction::trigger); + // ensure there are no accelerator keys coming from another menu + action->setText(KLocalizedString::removeAcceleratorMarker(action->text())); + + collection->addAction(actionName, action); + return action; +} + +KrBookmark * KrBookmark::separator() { KrBookmark *bm = new KrBookmark(""); bm->_separator = true; bm->_folder = false; return bm; } void KrBookmark::activatedProxy() { emit activated(url()); } diff --git a/krusader/BookMan/krbookmark.h b/krusader/BookMan/krbookmark.h index 8b955a02..65e6cf19 100644 --- a/krusader/BookMan/krbookmark.h +++ b/krusader/BookMan/krbookmark.h @@ -1,85 +1,88 @@ /***************************************************************************** * Copyright (C) 2002 Shie Erlich * * Copyright (C) 2002 Rafi Yanai * * Copyright (C) 2004-2018 Krusader Krew [https://krusader.org] * * * * This file is part of Krusader [https://krusader.org]. * * * * Krusader is free software: you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation, either version 2 of the License, or * * (at your option) any later version. * * * * Krusader is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with Krusader. If not, see [http://www.gnu.org/licenses/]. * *****************************************************************************/ #ifndef KRBOOKMARK_H #define KRBOOKMARK_H // QtCore #include #include // QtWidgets #include - class KActionCollection; +class ListPanelActions; + class KrBookmark: public QAction { Q_OBJECT public: KrBookmark(QString name, QUrl url, KActionCollection *parent, QString icon = "", QString actionName = QString()); explicit KrBookmark(QString name, QString icon = ""); // creates a folder ~KrBookmark(); // text() and setText() to change the name of the bookmark // icon() and setIcon() to change icons inline const QString& iconName() const { return _icon; } inline const QUrl &url() const { return _url; } inline void setURL(const QUrl &url) { _url = url; } inline bool isFolder() const { return _folder; } inline bool isSeparator() const { return _separator; } QList& children() { return _children; } - static KrBookmark* getExistingBookmark(QString actionName, KActionCollection *collection); + static KrBookmark * getExistingBookmark(QString actionName, KActionCollection *collection); + // ----- special bookmarks - static KrBookmark* trash(KActionCollection *collection); - static KrBookmark* virt(KActionCollection *collection); - static KrBookmark* lan(KActionCollection *collection); - static KrBookmark* separator(); + static KrBookmark * trash(KActionCollection *collection); + static KrBookmark * virt(KActionCollection *collection); + static KrBookmark * lan(KActionCollection *collection); + static QAction * jumpBackAction(KActionCollection *collection, bool isSetter = false, ListPanelActions *sourceActions = 0); + static KrBookmark * separator(); signals: void activated(const QUrl &url); protected slots: void activatedProxy(); private: QUrl _url; QString _icon; bool _folder; bool _separator; bool _autoDelete; QList _children; }; #endif // KRBOOKMARK_H diff --git a/krusader/BookMan/krbookmarkbutton.cpp b/krusader/BookMan/krbookmarkbutton.cpp index 6814f824..47a3ffcc 100644 --- a/krusader/BookMan/krbookmarkbutton.cpp +++ b/krusader/BookMan/krbookmarkbutton.cpp @@ -1,66 +1,62 @@ /***************************************************************************** * Copyright (C) 2002 Shie Erlich * * Copyright (C) 2002 Rafi Yanai * * Copyright (C) 2004-2018 Krusader Krew [https://krusader.org] * * * * This file is part of Krusader [https://krusader.org]. * * * * Krusader is free software: you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation, either version 2 of the License, or * * (at your option) any later version. * * * * Krusader is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with Krusader. If not, see [http://www.gnu.org/licenses/]. * *****************************************************************************/ #include "krbookmarkbutton.h" #include "krbookmarkhandler.h" #include "../krglobal.h" // QtGui #include // QtWidgets #include #include #include #include KrBookmarkButton::KrBookmarkButton(QWidget *parent): QToolButton(parent) { setAutoRaise(true); setIcon(QIcon::fromTheme("bookmarks")); setText(i18n("BookMan II")); setToolTip(i18n("BookMan II")); setPopupMode(QToolButton::InstantPopup); setAcceptDrops(false); acmBookmarks = new KActionMenu(QIcon::fromTheme("bookmarks"), i18n("Bookmarks"), this); acmBookmarks->setDelayed(false); - // TODO KF5 : explicit cast as QMenu doesn't have those methods - //(acmBookmarks->menu())->setKeyboardShortcutsEnabled(true); - //(acmBookmarks->menu())->setKeyboardShortcutsExecute(true); setMenu(acmBookmarks->menu()); connect(acmBookmarks->menu(), SIGNAL(aboutToShow()), this, SLOT(populate())); connect(acmBookmarks->menu(), SIGNAL(aboutToShow()), this, SIGNAL(aboutToShow())); - populate(); } void KrBookmarkButton::populate() { krBookMan->populate(static_cast(menu())); } void KrBookmarkButton::showMenu() { populate(); menu()->exec(mapToGlobal(QPoint(0, height()))); } diff --git a/krusader/BookMan/krbookmarkhandler.cpp b/krusader/BookMan/krbookmarkhandler.cpp index 5e66587f..b3b248a7 100644 --- a/krusader/BookMan/krbookmarkhandler.cpp +++ b/krusader/BookMan/krbookmarkhandler.cpp @@ -1,647 +1,877 @@ /***************************************************************************** * Copyright (C) 2002 Shie Erlich * * Copyright (C) 2002 Rafi Yanai * * Copyright (C) 2004-2018 Krusader Krew [https://krusader.org] * * * * This file is part of Krusader [https://krusader.org]. * * * * Krusader is free software: you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation, either version 2 of the License, or * * (at your option) any later version. * * * * Krusader is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with Krusader. If not, see [http://www.gnu.org/licenses/]. * *****************************************************************************/ #include "krbookmarkhandler.h" #include "kraddbookmarkdlg.h" #include "../krglobal.h" #include "../krslots.h" #include "../kractions.h" #include "../krmainwindow.h" #include "../Dialogs/popularurls.h" #include "../FileSystem/filesystem.h" #include "../Panel/krpanel.h" #include "../Panel/listpanelactions.h" // QtCore #include #include #include #include +#include +#include // QtGui #include #include #include #include #include #include #include #include #define SPECIAL_BOOKMARKS true // ------------------------ for internal use #define BOOKMARKS_FILE "krusader/krbookmarks.xml" #define CONNECT_BM(X) { disconnect(X, SIGNAL(activated(QUrl)), 0, 0); connect(X, SIGNAL(activated(QUrl)), this, SLOT(slotActivated(QUrl))); } -KrBookmarkHandler::KrBookmarkHandler(KrMainWindow *mainWindow) : QObject(mainWindow->widget()), - _mainWindow(mainWindow), _middleClick(false), _mainBookmarkPopup(0), _specialBookmarks() +KrBookmarkHandler::KrBookmarkHandler(KrMainWindow *mainWindow) : + QObject(mainWindow->widget()), + _mainWindow(mainWindow), + _middleClick(false), + _mainBookmarkPopup(0), + _specialBookmarks(), + _quickSearchAction(nullptr), + _quickSearchBar(nullptr), + _quickSearchMenu(nullptr) { // create our own action collection and make the shortcuts apply only to parent _privateCollection = new KActionCollection(this); _collection = _mainWindow->actions(); // create _root: father of all bookmarks. it is a dummy bookmark and never shown _root = new KrBookmark(i18n("Bookmarks")); _root->setParent(this); // load bookmarks importFromFile(); - // hack + // create bookmark manager QString filename = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QLatin1Char('/') + BOOKMARKS_FILE; manager = KBookmarkManager::managerForFile(filename, QStringLiteral("krusader")); connect(manager, SIGNAL(changed(QString,QString)), this, SLOT(bookmarksChanged(QString,QString))); + + // create the quick search bar and action + _quickSearchAction = new QWidgetAction(this); + _quickSearchBar = new QLineEdit(); + _quickSearchBar->setPlaceholderText(i18n("Type to search...")); + _quickSearchAction->setDefaultWidget(_quickSearchBar); // ownership of the bar is transferred to the action + _quickSearchAction->setEnabled(false); + _setQuickSearchText(""); + + // fill a dummy menu to properly init actions (allows toolbar bookmark buttons to work properly) + auto menu = new QMenu(mainWindow->widget()); + populate(menu); + menu->deleteLater(); } KrBookmarkHandler::~KrBookmarkHandler() { delete manager; delete _privateCollection; } void KrBookmarkHandler::bookmarkCurrent(QUrl url) { QPointer dlg = new KrAddBookmarkDlg(_mainWindow->widget(), url); if (dlg->exec() == QDialog::Accepted) { KrBookmark *bm = new KrBookmark(dlg->name(), dlg->url(), _collection); addBookmark(bm, dlg->folder()); } delete dlg; } void KrBookmarkHandler::addBookmark(KrBookmark *bm, KrBookmark *folder) { if (folder == 0) folder = _root; // add to the list (bottom) folder->children().append(bm); exportToFile(); } void KrBookmarkHandler::deleteBookmark(KrBookmark *bm) { if (bm->isFolder()) clearBookmarks(bm); // remove the child bookmarks removeReferences(_root, bm); foreach(QWidget *w, bm->associatedWidgets()) w->removeAction(bm); delete bm; exportToFile(); } void KrBookmarkHandler::removeReferences(KrBookmark *root, KrBookmark *bmToRemove) { int index = root->children().indexOf(bmToRemove); if (index >= 0) root->children().removeAt(index); QListIterator it(root->children()); while (it.hasNext()) { KrBookmark *bm = it.next(); if (bm->isFolder()) removeReferences(bm, bmToRemove); } } void KrBookmarkHandler::exportToFileBookmark(QDomDocument &doc, QDomElement &where, KrBookmark *bm) { if (bm->isSeparator()) { QDomElement bookmark = doc.createElement("separator"); where.appendChild(bookmark); } else { QDomElement bookmark = doc.createElement("bookmark"); // url bookmark.setAttribute("href", bm->url().toDisplayString()); // icon bookmark.setAttribute("icon", bm->iconName()); // title QDomElement title = doc.createElement("title"); title.appendChild(doc.createTextNode(bm->text())); bookmark.appendChild(title); where.appendChild(bookmark); } } void KrBookmarkHandler::exportToFileFolder(QDomDocument &doc, QDomElement &parent, KrBookmark *folder) { QListIterator it(folder->children()); while (it.hasNext()) { KrBookmark *bm = it.next(); if (bm->isFolder()) { QDomElement newFolder = doc.createElement("folder"); newFolder.setAttribute("icon", bm->iconName()); parent.appendChild(newFolder); QDomElement title = doc.createElement("title"); title.appendChild(doc.createTextNode(bm->text())); newFolder.appendChild(title); exportToFileFolder(doc, newFolder, bm); } else { exportToFileBookmark(doc, parent, bm); } } } // export to file using the xbel standard // // // Developer Web Site // // Title of this folder // KDE Web Site // // My own bookmarks // KOffice Web Site // // KDevelop Web Site // // // void KrBookmarkHandler::exportToFile() { QDomDocument doc("xbel"); QDomElement root = doc.createElement("xbel"); doc.appendChild(root); exportToFileFolder(doc, root, _root); if (!doc.firstChild().isProcessingInstruction()) { // adding: if not already present QDomProcessingInstruction instr = doc.createProcessingInstruction("xml", "version=\"1.0\" encoding=\"UTF-8\" "); doc.insertBefore(instr, doc.firstChild()); } QString filename = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QLatin1Char('/') + BOOKMARKS_FILE; QFile file(filename); if (file.open(QIODevice::WriteOnly)) { QTextStream stream(&file); stream.setCodec("UTF-8"); stream << doc.toString(); file.close(); } else { KMessageBox::error(_mainWindow->widget(), i18n("Unable to write to %1", filename), i18n("Error")); } } bool KrBookmarkHandler::importFromFileBookmark(QDomElement &e, KrBookmark *parent, QString path, QString *errorMsg) { QString url, name, icon; // verify tag if (e.tagName() != "bookmark") { *errorMsg = i18n("%1 instead of %2", e.tagName(), QLatin1String("bookmark")); return false; } // verify href if (!e.hasAttribute("href")) { *errorMsg = i18n("missing tag %1", QLatin1String("href")); return false; } else url = e.attribute("href"); // verify title QDomElement te = e.firstChild().toElement(); if (te.tagName() != "title") { *errorMsg = i18n("missing tag %1", QLatin1String("title")); return false; } else name = te.text(); // do we have an icon? if (e.hasAttribute("icon")) { icon = e.attribute("icon"); } // ok: got name and url, let's add a bookmark KrBookmark *bm = KrBookmark::getExistingBookmark(path + name, _collection); if (!bm) { bm = new KrBookmark(name, QUrl(url), _collection, icon, path + name); parent->children().append(bm); } return true; } bool KrBookmarkHandler::importFromFileFolder(QDomNode &first, KrBookmark *parent, QString path, QString *errorMsg) { QString name; QDomNode n = first; while (!n.isNull()) { QDomElement e = n.toElement(); if (e.tagName() == "bookmark") { if (!importFromFileBookmark(e, parent, path, errorMsg)) return false; } else if (e.tagName() == "folder") { QString iconName = ""; if (e.hasAttribute("icon")) iconName = e.attribute("icon"); // the title is the first child of the folder QDomElement tmp = e.firstChild().toElement(); if (tmp.tagName() != "title") { *errorMsg = i18n("missing tag %1", QLatin1String("title")); return false; } else name = tmp.text(); KrBookmark *folder = new KrBookmark(name, iconName); parent->children().append(folder); QDomNode nextOne = tmp.nextSibling(); if (!importFromFileFolder(nextOne, folder, path + name + '/', errorMsg)) return false; } else if (e.tagName() == "separator") { parent->children().append(KrBookmark::separator()); } n = n.nextSibling(); } return true; } void KrBookmarkHandler::importFromFile() { clearBookmarks(_root); QString filename = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QLatin1Char('/') + BOOKMARKS_FILE; QFile file(filename); if (!file.open(QIODevice::ReadOnly)) return; // no bookmarks file QString errorMsg; QDomNode n; QDomElement e; QDomDocument doc("xbel"); if (!doc.setContent(&file, &errorMsg)) { goto BM_ERROR; } // iterate through the document: first child should be "xbel" (skip all until we find it) n = doc.firstChild(); while (!n.isNull() && n.toElement().tagName() != "xbel") n = n.nextSibling(); if (n.isNull() || n.toElement().tagName() != "xbel") { errorMsg = i18n("%1 does not seem to be a valid bookmarks file", filename); goto BM_ERROR; } else n = n.firstChild(); // skip the xbel part importFromFileFolder(n, _root, "", &errorMsg); goto BM_SUCCESS; BM_ERROR: KMessageBox::error(_mainWindow->widget(), i18n("Error reading bookmarks file: %1", errorMsg), i18n("Error")); BM_SUCCESS: file.close(); } +void KrBookmarkHandler::_setQuickSearchText(const QString &text) +{ + bool isEmptyQuickSearchBarVisible = KConfigGroup(krConfig, "Look&Feel").readEntry("Always show search bar", true); + + _quickSearchBar->setText(text); + + auto length = text.length(); + bool isVisible = isEmptyQuickSearchBarVisible || length > 0; + _quickSearchAction->setVisible(isVisible); + _quickSearchBar->setVisible(isVisible); + + if (length == 0) { + qDebug() << "Bookmark search: reset"; + _resetActionTextAndHighlighting(); + } else { + qDebug() << "Bookmark search: query =" << text; + } +} + +QString KrBookmarkHandler::_quickSearchText() const +{ + return _quickSearchBar->text(); +} + +void KrBookmarkHandler::_highlightAction(QAction *action, bool isMatched) +{ + auto font = action->font(); + font.setBold(isMatched); + action->setFont(font); +} + void KrBookmarkHandler::populate(QMenu *menu) { + // removing action from previous menu is necessary + // otherwise it won't be displayed in the currently populating menu + if (_mainBookmarkPopup) { + _mainBookmarkPopup->removeAction(_quickSearchAction); + } _mainBookmarkPopup = menu; menu->clear(); _specialBookmarks.clear(); buildMenu(_root, menu); } -void KrBookmarkHandler::buildMenu(KrBookmark *parent, QMenu *menu) +void KrBookmarkHandler::buildMenu(KrBookmark *parent, QMenu *menu, int depth) { - static int inSecondaryMenu = 0; // used to know if we're on the top menu + // add search bar widget to the top of the menu + if (depth == 0) { + menu->addAction(_quickSearchAction); + } // run the loop twice, in order to put the folders on top. stupid but easy :-) // note: this code drops the separators put there by the user QListIterator it(parent->children()); while (it.hasNext()) { KrBookmark *bm = it.next(); if (!bm->isFolder()) continue; QMenu *newMenu = new QMenu(menu); newMenu->setIcon(QIcon(krLoader->loadIcon(bm->iconName(), KIconLoader::Small))); newMenu->setTitle(bm->text()); QAction *menuAction = menu->addMenu(newMenu); QVariant v; v.setValue(bm); menuAction->setData(v); - ++inSecondaryMenu; - buildMenu(bm, newMenu); - --inSecondaryMenu; + buildMenu(bm, newMenu, depth + 1); } it.toFront(); while (it.hasNext()) { KrBookmark *bm = it.next(); if (bm->isFolder()) continue; if (bm->isSeparator()) { menu->addSeparator(); continue; } menu->addAction(bm); CONNECT_BM(bm); } - if (!inSecondaryMenu) { + if (depth == 0) { KConfigGroup group(krConfig, "Private"); bool hasPopularURLs = group.readEntry("BM Popular URLs", true); bool hasTrash = group.readEntry("BM Trash", true); bool hasLan = group.readEntry("BM Lan", true); bool hasVirtualFS = group.readEntry("BM Virtual FS", true); bool hasJumpback = group.readEntry("BM Jumpback", true); if (hasPopularURLs) { menu->addSeparator(); // add the popular links submenu QMenu *newMenu = new QMenu(menu); newMenu->setTitle(i18n("Popular URLs")); newMenu->setIcon(QIcon(krLoader->loadIcon("folder-bookmark", KIconLoader::Small))); QAction *bmfAct = menu->addMenu(newMenu); _specialBookmarks.append(bmfAct); // add the top 15 urls #define MAX 15 QList list = _mainWindow->popularUrls()->getMostPopularUrls(MAX); QList::Iterator it; for (it = list.begin(); it != list.end(); ++it) { QString name; if ((*it).isLocalFile()) name = (*it).path(); else name = (*it).toDisplayString(); // note: these bookmark are put into the private collection // as to not spam the general collection KrBookmark *bm = KrBookmark::getExistingBookmark(name, _privateCollection); if (!bm) bm = new KrBookmark(name, *it, _privateCollection); newMenu->addAction(bm); CONNECT_BM(bm); } newMenu->addSeparator(); newMenu->addAction(krPopularUrls); newMenu->installEventFilter(this); } // do we need to add special bookmarks? if (SPECIAL_BOOKMARKS) { - if (hasTrash || hasLan || hasVirtualFS || hasJumpback) + if (hasTrash || hasLan || hasVirtualFS) menu->addSeparator(); KrBookmark *bm; // note: special bookmarks are not kept inside the _bookmarks list and added ad-hoc if (hasTrash) { bm = KrBookmark::trash(_collection); menu->addAction(bm); _specialBookmarks.append(bm); CONNECT_BM(bm); } if (hasLan) { bm = KrBookmark::lan(_collection); menu->addAction(bm); _specialBookmarks.append(bm); CONNECT_BM(bm); } if (hasVirtualFS) { bm = KrBookmark::virt(_collection); menu->addAction(bm); _specialBookmarks.append(bm); CONNECT_BM(bm); } if (hasJumpback) { - // add the jump-back button - ListPanelActions *actions = _mainWindow->listPanelActions(); - menu->addAction(actions->actJumpBack); - _specialBookmarks.append(actions->actJumpBack); menu->addSeparator(); - menu->addAction(actions->actSetJumpBack); - _specialBookmarks.append(actions->actSetJumpBack); + + ListPanelActions *actions = _mainWindow->listPanelActions(); + + auto slotTriggered = [=] { + if (_mainBookmarkPopup && !_mainBookmarkPopup->isHidden()) { + _mainBookmarkPopup->close(); + } + }; + auto addJumpBackAction = [=](bool isSetter) { + auto action = KrBookmark::jumpBackAction(_privateCollection, isSetter, actions); + if (action) { + menu->addAction(action); + _specialBookmarks.append(action); + + // disconnecting from this as a receiver is important: + // we don't want to break connections established by KrBookmark::jumpBackAction + disconnect(action, &QAction::triggered, this, nullptr); + connect(action, &QAction::triggered, this, slotTriggered); + } + }; + + addJumpBackAction(true); + addJumpBackAction(false); } } - if (!hasJumpback) - menu->addSeparator(); - + menu->addSeparator(); menu->addAction(KrActions::actAddBookmark); _specialBookmarks.append(KrActions::actAddBookmark); QAction *bmAct = menu->addAction(krLoader->loadIcon("bookmarks", KIconLoader::Small), i18n("Manage Bookmarks"), manager, SLOT(slotEditBookmarks())); _specialBookmarks.append(bmAct); // make sure the menu is connected to us disconnect(menu, SIGNAL(triggered(QAction*)), 0, 0); } menu->installEventFilter(this); } void KrBookmarkHandler::clearBookmarks(KrBookmark *root) { QList::iterator it = root->children().begin(); while (it != root->children().end()) { KrBookmark *bm = *it; if (bm->isFolder()) clearBookmarks(bm); else { foreach(QWidget *w, bm->associatedWidgets()) w->removeAction(bm); delete bm; } it = root->children().erase(it); } } void KrBookmarkHandler::bookmarksChanged(const QString&, const QString&) { importFromFile(); } bool KrBookmarkHandler::eventFilter(QObject *obj, QEvent *ev) { - if (ev->type() == QEvent::MouseButtonRelease) { + auto eventType = ev->type(); + QMenu *menu = dynamic_cast(obj); + + if (eventType == QEvent::Show && menu) { + _setQuickSearchText(""); + _quickSearchMenu = menu; + qDebug() << "Bookmark search: menu" << menu << "is shown"; + + return QObject::eventFilter(obj, ev); + } + + if (eventType == QEvent::Close && menu && _quickSearchMenu) { + if (_quickSearchMenu == menu) { + qDebug() << "Bookmark search: stopped on menu" << menu; + _setQuickSearchText(""); + _quickSearchMenu = nullptr; + } else { + qDebug() << "Bookmark search: active action =" << _quickSearchMenu->activeAction(); + + // fix automatic deactivation of current action due to spurious close event from submenu + auto quickSearchMenu = _quickSearchMenu; + auto activeAction = _quickSearchMenu->activeAction(); + QTimer::singleShot(0, this, [=]() { + qDebug() << "Bookmark search: active action =" << quickSearchMenu->activeAction(); + if (!quickSearchMenu->activeAction() && activeAction) { + quickSearchMenu->setActiveAction(activeAction); + qDebug() << "Bookmark search: restored active action =" << quickSearchMenu->activeAction(); + } + }); + } + + return QObject::eventFilter(obj, ev); + } + + // Having it occur on keypress is consistent with other shortcuts, + // such as Ctrl+W and accelerator keys + if (eventType == QEvent::KeyPress && menu) { + QKeyEvent *kev = static_cast(ev); + QList acts = menu->actions(); + bool quickSearchStarted = false; + bool searchInSpecialItems = KConfigGroup(krConfig, "Look&Feel").readEntry("Search in special items", false); + + if (kev->key() == Qt::Key_Left && kev->modifiers() == Qt::NoModifier) { + menu->close(); + return true; + } + + if ((kev->modifiers() != Qt::ShiftModifier && + kev->modifiers() != Qt::NoModifier) || + kev->text().isEmpty() || + kev->key() == Qt::Key_Delete || + kev->key() == Qt::Key_Return || + kev->key() == Qt::Key_Escape) { + return QObject::eventFilter(obj, ev); + } + + // update quick search text + if (kev->key() == Qt::Key_Backspace) { + auto newSearchText = _quickSearchText(); + newSearchText.chop(1); + _setQuickSearchText(newSearchText); + + if (_quickSearchText().length() == 0) { + return QObject::eventFilter(obj, ev); + } + } else { + quickSearchStarted = _quickSearchText().length() == 0; + _setQuickSearchText(_quickSearchText().append(kev->text())); + } + + if (quickSearchStarted) { + _quickSearchMenu = menu; + qDebug() << "Bookmark search: started on menu" << menu; + } + + // match actions + QAction *matchedAction = nullptr; + int nMatches = 0; + const Qt::CaseSensitivity matchCase = + _quickSearchText() == _quickSearchText().toLower() ? Qt::CaseInsensitive : Qt::CaseSensitive; + for (auto act : acts) { + if (act->isSeparator() || act->text() == "") { + continue; + } + + if (!searchInSpecialItems && _specialBookmarks.contains(act)) { + continue; + } + + if (quickSearchStarted) { + // if the first key press is an accelerator key, let the accelerator handler process this event + if (act->text().contains('&' + kev->text(), Qt::CaseInsensitive)) { + qDebug() << "Bookmark search: hit accelerator key of" << act; + _setQuickSearchText(""); + return QObject::eventFilter(obj, ev); + } + + // strip accelerator keys from actions so they don't interfere with the search key press events + auto text = act->text(); + _quickSearchOriginalActionTitles.insert(act, text); + act->setText(KLocalizedString::removeAcceleratorMarker(text)); + } + + // match prefix of the action text to the query + if (act->text().left(_quickSearchText().length()).compare(_quickSearchText(), matchCase) == 0) { + _highlightAction(act); + if (!matchedAction || matchedAction->menu()) { + // Can't highlight menus (see comment below), hopefully pick something we can + matchedAction = act; + } + nMatches++; + } else { + _highlightAction(act, false); + } + } + + if (matchedAction) { + qDebug() << "Bookmark search: primary match =" << matchedAction->text() << ", number of matches =" << nMatches; + } else { + qDebug() << "Bookmark search: no matches"; + } + + // trigger the matched menu item or set an active item accordingly + if (nMatches == 1) { + _setQuickSearchText(""); + if ((bool) matchedAction->menu()) { + menu->setActiveAction(matchedAction); + } else { + matchedAction->activate(QAction::Trigger); + } + } else if (nMatches > 1) { + // Because of a bug submenus cannot be highlighted + // https://bugreports.qt.io/browse/QTBUG-939 + if (!matchedAction->menu()) { + menu->setActiveAction(matchedAction); + } else { + menu->setActiveAction(nullptr); + } + } else { + menu->setActiveAction(nullptr); + } + return true; + } + + if (eventType == QEvent::MouseButtonRelease) { switch (static_cast(ev)->button()) { case Qt::RightButton: _middleClick = false; if (obj->inherits("QMenu")) { QMenu *menu = static_cast(obj); QAction *act = menu->actionAt(static_cast(ev)->pos()); if (obj == _mainBookmarkPopup && _specialBookmarks.contains(act)) { rightClickOnSpecialBookmark(); return true; } KrBookmark *bm = dynamic_cast(act); if (bm != 0) { rightClicked(menu, bm); return true; } else if (act && act->data().canConvert()) { KrBookmark *bm = act->data().value(); rightClicked(menu, bm); } } break; case Qt::LeftButton: _middleClick = false; break; case Qt::MidButton: _middleClick = true; break; default: break; } } return QObject::eventFilter(obj, ev); } +void KrBookmarkHandler::_resetActionTextAndHighlighting() +{ + for (QHash::const_iterator i = _quickSearchOriginalActionTitles.begin(); + i != _quickSearchOriginalActionTitles.end(); ++i) { + QAction *action = i.key(); + action->setText(i.value()); + _highlightAction(action, false); + } + + _quickSearchOriginalActionTitles.clear(); +} + #define POPULAR_URLS_ID 100100 #define TRASH_ID 100101 #define LAN_ID 100103 #define VIRTUAL_FS_ID 100102 #define JUMP_BACK_ID 100104 void KrBookmarkHandler::rightClickOnSpecialBookmark() { KConfigGroup group(krConfig, "Private"); bool hasPopularURLs = group.readEntry("BM Popular URLs", true); bool hasTrash = group.readEntry("BM Trash", true); bool hasLan = group.readEntry("BM Lan", true); bool hasVirtualFS = group.readEntry("BM Virtual FS", true); bool hasJumpback = group.readEntry("BM Jumpback", true); QMenu menu(_mainBookmarkPopup); menu.setTitle(i18n("Enable special bookmarks")); QAction *act; act = menu.addAction(i18n("Popular URLs")); act->setData(QVariant(POPULAR_URLS_ID)); act->setCheckable(true); act->setChecked(hasPopularURLs); act = menu.addAction(i18n("Trash bin")); act->setData(QVariant(TRASH_ID)); act->setCheckable(true); act->setChecked(hasTrash); act = menu.addAction(i18n("Local Network")); act->setData(QVariant(LAN_ID)); act->setCheckable(true); act->setChecked(hasLan); act = menu.addAction(i18n("Virtual Filesystem")); act->setData(QVariant(VIRTUAL_FS_ID)); act->setCheckable(true); act->setChecked(hasVirtualFS); act = menu.addAction(i18n("Jump back")); act->setData(QVariant(JUMP_BACK_ID)); act->setCheckable(true); act->setChecked(hasJumpback); connect(_mainBookmarkPopup, SIGNAL(highlighted(int)), &menu, SLOT(close())); connect(_mainBookmarkPopup, SIGNAL(activated(int)), &menu, SLOT(close())); int result = -1; QAction *res = menu.exec(QCursor::pos()); if (res && res->data().canConvert()) result = res->data().toInt(); bool doCloseMain = true; switch (result) { case POPULAR_URLS_ID: group.writeEntry("BM Popular URLs", !hasPopularURLs); break; case TRASH_ID: group.writeEntry("BM Trash", !hasTrash); break; case LAN_ID: group.writeEntry("BM Lan", !hasLan); break; case VIRTUAL_FS_ID: group.writeEntry("BM Virtual FS", !hasVirtualFS); break; case JUMP_BACK_ID: group.writeEntry("BM Jumpback", !hasJumpback); break; default: doCloseMain = false; break; } menu.close(); if (doCloseMain && _mainBookmarkPopup) _mainBookmarkPopup->close(); } #define OPEN_ID 100200 #define OPEN_NEW_TAB_ID 100201 #define DELETE_ID 100202 void KrBookmarkHandler::rightClicked(QMenu *menu, KrBookmark * bm) { QMenu popup(_mainBookmarkPopup); QAction * act; if (!bm->isFolder()) { act = popup.addAction(krLoader->loadIcon("document-open", KIconLoader::Panel), i18n("Open")); act->setData(QVariant(OPEN_ID)); act = popup.addAction(krLoader->loadIcon("tab-new", KIconLoader::Panel), i18n("Open in a new tab")); act->setData(QVariant(OPEN_NEW_TAB_ID)); popup.addSeparator(); } act = popup.addAction(krLoader->loadIcon("edit-delete", KIconLoader::Panel), i18n("Delete")); act->setData(QVariant(DELETE_ID)); connect(menu, SIGNAL(highlighted(int)), &popup, SLOT(close())); connect(menu, SIGNAL(activated(int)), &popup, SLOT(close())); int result = -1; QAction *res = popup.exec(QCursor::pos()); if (res && res->data().canConvert ()) result = res->data().toInt(); popup.close(); if (_mainBookmarkPopup && result >= OPEN_ID && result <= DELETE_ID) { _mainBookmarkPopup->close(); } switch (result) { case OPEN_ID: SLOTS->refresh(bm->url()); break; case OPEN_NEW_TAB_ID: _mainWindow->activeManager()->newTab(bm->url()); break; case DELETE_ID: deleteBookmark(bm); break; } } // used to monitor middle clicks. if mid is found, then the // bookmark is opened in a new tab. ugly, but easier than overloading // KAction and KActionCollection. void KrBookmarkHandler::slotActivated(const QUrl &url) { if (_mainBookmarkPopup && !_mainBookmarkPopup->isHidden()) _mainBookmarkPopup->close(); if (_middleClick) _mainWindow->activeManager()->newTab(url); else SLOTS->refresh(url); } diff --git a/krusader/BookMan/krbookmarkhandler.h b/krusader/BookMan/krbookmarkhandler.h index 49950ccd..2642cf4d 100644 --- a/krusader/BookMan/krbookmarkhandler.h +++ b/krusader/BookMan/krbookmarkhandler.h @@ -1,90 +1,101 @@ /***************************************************************************** * Copyright (C) 2002 Shie Erlich * * Copyright (C) 2002 Rafi Yanai * * Copyright (C) 2004-2018 Krusader Krew [https://krusader.org] * * * * This file is part of Krusader [https://krusader.org]. * * * * Krusader is free software: you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation, either version 2 of the License, or * * (at your option) any later version. * * * * Krusader is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with Krusader. If not, see [http://www.gnu.org/licenses/]. * *****************************************************************************/ #ifndef KRBOOKMARKHANDLER_H #define KRBOOKMARKHANDLER_H // QtCore #include #include #include #include #include // QtXml #include // QtWidgets #include +#include +#include #include "krbookmark.h" class KActionCollection; class KBookmarkManager; class KrMainWindow; class KrBookmarkHandler: public QObject { Q_OBJECT friend class KrAddBookmarkDlg; enum Actions { BookmarkCurrent = 0, ManageBookmarks }; public: explicit KrBookmarkHandler(KrMainWindow *mainWindow); ~KrBookmarkHandler(); void populate(QMenu *menu); void addBookmark(KrBookmark *bm, KrBookmark *parent = 0); void bookmarkCurrent(QUrl url); protected: void deleteBookmark(KrBookmark *bm); void importFromFile(); bool importFromFileBookmark(QDomElement &e, KrBookmark *parent, QString path, QString *errorMsg); bool importFromFileFolder(QDomNode &first, KrBookmark *parent, QString path, QString *errorMsg); void exportToFile(); void exportToFileFolder(QDomDocument &doc, QDomElement &parent, KrBookmark *folder); void exportToFileBookmark(QDomDocument &doc, QDomElement &where, KrBookmark *bm); void clearBookmarks(KrBookmark *root); - void buildMenu(KrBookmark *parent, QMenu *menu); + void buildMenu(KrBookmark *parent, QMenu *menu, int depth = 0); bool eventFilter(QObject *obj, QEvent *ev); - void rightClicked(QMenu *menu, KrBookmark *bm); void rightClickOnSpecialBookmark(); void removeReferences(KrBookmark *root, KrBookmark *bmToRemove); protected slots: void bookmarksChanged(const QString&, const QString&); void slotActivated(const QUrl &url); private: KrMainWindow *_mainWindow; KActionCollection *_collection, *_privateCollection; KrBookmark *_root; // the whole KBookmarkManager is an ugly hack. use it until we have our own KBookmarkManager *manager; bool _middleClick; // if true, the user clicked the middle button to open the bookmark QPointer _mainBookmarkPopup; // main bookmark popup menu QList _specialBookmarks; // the action list of the special bookmarks + + QWidgetAction *_quickSearchAction; ///< Search bar container action + QLineEdit *_quickSearchBar; ///< Search bar containing current query + QMenu *_quickSearchMenu; ///< The menu where the search is performed + QHash _quickSearchOriginalActionTitles; ///< Saved original action text values to restore after search + + void _setQuickSearchText(const QString &text); + QString _quickSearchText() const; + static void _highlightAction(QAction *action, bool isMatched = true); + void _resetActionTextAndHighlighting(); }; Q_DECLARE_METATYPE(KrBookmark *) #endif // KRBOOKMARK_HANDLER_H diff --git a/krusader/Konfigurator/kgpanel.cpp b/krusader/Konfigurator/kgpanel.cpp index e355f751..d4e225bd 100644 --- a/krusader/Konfigurator/kgpanel.cpp +++ b/krusader/Konfigurator/kgpanel.cpp @@ -1,737 +1,753 @@ /***************************************************************************** * Copyright (C) 2010 Jan Lepper * * Copyright (C) 2010-2018 Krusader Krew [https://krusader.org] * * * * This file is part of Krusader [https://krusader.org]. * * * * Krusader is free software: you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation, either version 2 of the License, or * * (at your option) any later version. * * * * Krusader is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with Krusader. If not, see [http://www.gnu.org/licenses/]. * *****************************************************************************/ #include "kgpanel.h" #include "../defaults.h" #include "../Dialogs/krdialogs.h" // QtGui #include // QtWidgets #include #include #include #include #include #include #include #include "../GUI/krtreewidget.h" #include "../Panel/krsearchbar.h" #include "../Panel/PanelView/krselectionmode.h" #include "../Panel/PanelView/krview.h" #include "../Panel/PanelView/krviewfactory.h" #include "../Panel/krlayoutfactory.h" enum { PAGE_GENERAL = 0, PAGE_VIEW, PAGE_PANELTOOLBAR, PAGE_MOUSE, PAGE_MEDIA_MENU, PAGE_LAYOUT }; KgPanel::KgPanel(bool first, QWidget* parent) : KonfiguratorPage(first, parent) { tabWidget = new QTabWidget(this); setWidget(tabWidget); setWidgetResizable(true); setupGeneralTab(); setupPanelTab(); setupButtonsTab(); setupMouseModeTab(); setupMediaMenuTab(); setupLayoutTab(); } // --------------------------------------------------------------------------------------- // ---------------------------- General TAB ---------------------------------------------- // --------------------------------------------------------------------------------------- void KgPanel::setupGeneralTab() { QScrollArea *scrollArea = new QScrollArea(tabWidget); QWidget *tab = new QWidget(scrollArea); scrollArea->setFrameStyle(QFrame::NoFrame); scrollArea->setWidget(tab); scrollArea->setWidgetResizable(true); tabWidget->addTab(scrollArea, i18n("General")); QVBoxLayout *layout = new QVBoxLayout(tab); layout->setSpacing(6); layout->setContentsMargins(11, 11, 11, 11); // --------------------------------------------------------------------------------------- // ------------------------------- Navigator bar ------------------------------------- // --------------------------------------------------------------------------------------- QGroupBox *groupBox = createFrame(i18n("Navigator bar"), tab); QGridLayout *gridLayout = createGridLayout(groupBox); KONFIGURATOR_CHECKBOX_PARAM navigatorbar_settings[] = { // cfg_class, cfg_name, default, text, restart, tooltip {"Look&Feel", "Navigator Edit Mode", false, i18n("Edit Mode by default"), true, i18n("Show editable path in Navigator bar by default") }, {"Look&Feel", "Navigator Full Path", false, i18n("Show full path by default"), true, i18n("Always show full path in Navigator bar by default.") }, }; cbs = createCheckBoxGroup(2, 0, navigatorbar_settings, 2 /*count*/, groupBox, PAGE_GENERAL); gridLayout->addWidget(cbs, 0, 0); layout->addWidget(groupBox); // --------------------------------------------------------------------------------------- // ------------------------------- Operation --------------------------------------------- // --------------------------------------------------------------------------------------- groupBox = createFrame(i18n("Operation"), tab); gridLayout = createGridLayout(groupBox); KONFIGURATOR_CHECKBOX_PARAM operation_settings[] = { // cfg_class, cfg_name, default, text, restart, tooltip {"Look&Feel", "Mark Dirs", _MarkDirs, i18n("Autoselect folders"), false, i18n("When matching the select criteria, not only files will be selected, but also folders.") }, {"Look&Feel", "Rename Selects Extension", true, i18n("Rename selects extension"), false, i18n("When renaming a file, the whole text is selected. If you want Total-Commander like renaming of just the name, without extension, uncheck this option.") }, {"Look&Feel", "UnselectBeforeOperation", _UnselectBeforeOperation, i18n("Unselect files before copy/move"), false, i18n("Unselect files, which are to be copied/moved, before the operation starts.") }, {"Look&Feel", "FilterDialogRemembersSettings", _FilterDialogRemembersSettings, i18n("Filter dialog remembers settings"), false, i18n("The filter dialog is opened with the last filter settings that where applied to the panel.") }, }; cbs = createCheckBoxGroup(2, 0, operation_settings, 4 /*count*/, groupBox, PAGE_GENERAL); gridLayout->addWidget(cbs, 0, 0); layout->addWidget(groupBox); // --------------------------------------------------------------------------------------- // ------------------------------ Tabs --------------------------------------------------- // --------------------------------------------------------------------------------------- groupBox = createFrame(i18n("Tabs"), tab); gridLayout = createGridLayout(groupBox); KONFIGURATOR_CHECKBOX_PARAM tabbar_settings[] = { // cfg_class cfg_name default text restart tooltip {"Look&Feel", "Fullpath Tab Names", _FullPathTabNames, i18n("Use full path tab names"), true , i18n("Display the full path in the folder tabs. By default only the last part of the path is displayed.") }, {"Look&Feel", "Show Tab Buttons", true, i18n("Show new/close tab buttons"), true , i18n("Show the new/close tab buttons.") }, }; KonfiguratorCheckBoxGroup *cbs = createCheckBoxGroup(2, 0, tabbar_settings, 2 /*count*/, groupBox, PAGE_GENERAL); gridLayout->addWidget(cbs, 0, 0, 1, 2); // ----------------- Tab Bar position ---------------------------------- QHBoxLayout *hbox = new QHBoxLayout(); hbox->addWidget(new QLabel(i18n("Tab Bar position:"), groupBox)); KONFIGURATOR_NAME_VALUE_PAIR positions[] = { { i18n("Top"), "top" }, { i18n("Bottom"), "bottom" } }; KonfiguratorComboBox *cmb = createComboBox("Look&Feel", "Tab Bar Position", "bottom", positions, 2, groupBox, true, false, PAGE_GENERAL); hbox->addWidget(cmb); gridLayout->addLayout(hbox, 1, 0, Qt::AlignLeft); // ----------------- Show Tab bar ---------------------------------- KonfiguratorCheckBox *checkBox = createCheckBox("Look&Feel", "Show Tab Bar On Single Tab", true, i18n("Show Tab Bar on single tab"), groupBox, true, i18n("Show the tab bar with only one tab.")); gridLayout->addWidget(checkBox, 1, 1, Qt::AlignLeft); layout->addWidget(groupBox); // --------------------------------------------------------------------------------------- // ----------------------------- Search bar -------------------------------------------- // --------------------------------------------------------------------------------------- groupBox = createFrame(i18n("Search bar"), tab); gridLayout = createGridLayout(groupBox); KONFIGURATOR_CHECKBOX_PARAM quicksearch[] = { // cfg_class cfg_name default text restart tooltip {"Look&Feel", "New Style Quicksearch", _NewStyleQuicksearch, i18n("Start by typing"), false, i18n("Open search bar and start searching by typing in panel.") }, {"Look&Feel", "Case Sensitive Quicksearch", _CaseSensitiveQuicksearch, i18n("Case sensitive"), false, i18n("Search must match case.") }, {"Look&Feel", "Up/Down Cancels Quicksearch", false, i18n("Up/Down cancels search"), false, i18n("Pressing the Up/Down buttons closes the search bar (only in search mode).") }, {"Look&Feel", "Navigation with Right Arrow Quicksearch", _NavigationWithRightArrowQuicksearch, i18n("Directory navigation with Right Arrow"), false, i18n("Pressing the Right button enters directory if no search text editing intention is captured.") }, }; quicksearchCheckboxes = createCheckBoxGroup(2, 0, quicksearch, 4 /*count*/, groupBox, PAGE_GENERAL); gridLayout->addWidget(quicksearchCheckboxes, 0, 0, 1, -1); connect(quicksearchCheckboxes->find("New Style Quicksearch"), SIGNAL(stateChanged(int)), this, SLOT(slotDisable())); slotDisable(); // -------------- Search bar position ----------------------- hbox = new QHBoxLayout(); hbox->addWidget(new QLabel(i18n("Position:"), groupBox)); cmb = createComboBox("Look&Feel", "Quicksearch Position", "bottom", positions, 2, groupBox, true, false, PAGE_GENERAL); hbox->addWidget(cmb); hbox->addWidget(createSpacer(groupBox)); gridLayout->addLayout(hbox, 1, 0); layout->addWidget(groupBox); // -------------- Default search mode ----------------------- hbox = new QHBoxLayout(); hbox->addWidget(new QLabel(i18n("Default mode:"), groupBox)); KONFIGURATOR_NAME_VALUE_PAIR modes[] = { { i18n("Search"), QString::number(KrSearchBar::MODE_SEARCH) }, { i18n("Select"), QString::number(KrSearchBar::MODE_SELECT) }, { i18n("Filter"), QString::number(KrSearchBar::MODE_FILTER) } }; cmb = createComboBox("Look&Feel", "Default Search Mode", QString::number(KrSearchBar::MODE_SEARCH), modes, 3, groupBox, true, false, PAGE_GENERAL); cmb->setToolTip(i18n("Set the default mode on first usage")); hbox->addWidget(cmb); hbox->addWidget(createSpacer(groupBox)); gridLayout->addLayout(hbox, 1, 1); layout->addWidget(groupBox); +// -------------------------------------------------------------------------------------------- +// ------------------------------- Bookmark search settings ---------------------------------- +// -------------------------------------------------------------------------------------------- + groupBox = createFrame(i18n("Bookmark Search"), tab); + gridLayout = createGridLayout(groupBox); + + KONFIGURATOR_CHECKBOX_PARAM bookmarkSearchSettings[] = + { + {"Look&Feel", "Always show search bar", true, i18n("Always show search bar"), false, i18n("Make bookmark search bar always visible") }, + {"Look&Feel", "Search in special items", false, i18n("Search in special items"), false, i18n("Bookmark search is also applied to special items in bookmark menu like Trash, Popular URLs, Jump Back, etc.") }, + }; + KonfiguratorCheckBoxGroup *bookmarkSearchSettingsGroup = createCheckBoxGroup(2, 0, bookmarkSearchSettings, + 2 /*count*/, groupBox, PAGE_GENERAL); + gridLayout->addWidget(bookmarkSearchSettingsGroup, 1, 0, 1, 2); + layout->addWidget(groupBox); + // -------------------------------------------------------------------------------------------- // ------------------------------- Status/Totalsbar settings ---------------------------------- // -------------------------------------------------------------------------------------------- groupBox = createFrame(i18n("Status/Totalsbar"), tab); gridLayout = createGridLayout(groupBox); KONFIGURATOR_CHECKBOX_PARAM barSettings[] = { {"Look&Feel", "Show Size In Bytes", false, i18n("Show size in bytes too"), true, i18n("Show size in bytes too") }, {"Look&Feel", "ShowSpaceInformation", true, i18n("Show space information"), true, i18n("Show free/total space on the device") }, }; KonfiguratorCheckBoxGroup *barSett = createCheckBoxGroup(2, 0, barSettings, 2 /*count*/, groupBox, PAGE_GENERAL); gridLayout->addWidget(barSett, 1, 0, 1, 2); layout->addWidget(groupBox); } // -------------------------------------------------------------------------------------------- // ------------------------------------ Layout Tab -------------------------------------------- // -------------------------------------------------------------------------------------------- void KgPanel::setupLayoutTab() { QScrollArea *scrollArea = new QScrollArea(tabWidget); QWidget *tab = new QWidget(scrollArea); scrollArea->setFrameStyle(QFrame::NoFrame); scrollArea->setWidget(tab); scrollArea->setWidgetResizable(true); tabWidget->addTab(scrollArea, i18n("Layout")); QGridLayout *grid = createGridLayout(tab); QStringList layoutNames = KrLayoutFactory::layoutNames(); int numLayouts = layoutNames.count(); grid->addWidget(createSpacer(tab), 0, 2); QLabel *l = new QLabel(i18n("Layout:"), tab); l->setAlignment(Qt::AlignRight | Qt::AlignVCenter); grid->addWidget(l, 0, 0); KONFIGURATOR_NAME_VALUE_PAIR *layouts = new KONFIGURATOR_NAME_VALUE_PAIR[numLayouts]; for (int i = 0; i != numLayouts; i++) { layouts[ i ].text = KrLayoutFactory::layoutDescription(layoutNames[i]); layouts[ i ].value = layoutNames[i]; } KonfiguratorComboBox *cmb = createComboBox("PanelLayout", "Layout", "default", layouts, numLayouts, tab, true, false, PAGE_LAYOUT); grid->addWidget(cmb, 0, 1); delete [] layouts; l = new QLabel(i18n("Frame Color:"), tab); l->setAlignment(Qt::AlignRight | Qt::AlignVCenter); grid->addWidget(l, 1, 0); KONFIGURATOR_NAME_VALUE_PAIR frameColor[] = { { i18nc("Frame color", "Defined by Layout"), "default" }, { i18nc("Frame color", "None"), "none" }, { i18nc("Frame color", "Statusbar"), "Statusbar" } }; cmb = createComboBox("PanelLayout", "FrameColor", "default", frameColor, 3, tab, true, false, PAGE_LAYOUT); grid->addWidget(cmb, 1, 1); l = new QLabel(i18n("Frame Shape:"), tab); l->setAlignment(Qt::AlignRight | Qt::AlignVCenter); grid->addWidget(l, 2, 0); KONFIGURATOR_NAME_VALUE_PAIR frameShape[] = { { i18nc("Frame shape", "Defined by Layout"), "default" }, { i18nc("Frame shape", "None"), "NoFrame" }, { i18nc("Frame shape", "Box"), "Box" }, { i18nc("Frame shape", "Panel"), "Panel" }, }; cmb = createComboBox("PanelLayout", "FrameShape", "default", frameShape, 4, tab, true, false, PAGE_LAYOUT); grid->addWidget(cmb, 2, 1); l = new QLabel(i18n("Frame Shadow:"), tab); l->setAlignment(Qt::AlignRight | Qt::AlignVCenter); grid->addWidget(l, 3, 0); KONFIGURATOR_NAME_VALUE_PAIR frameShadow[] = { { i18nc("Frame shadow", "Defined by Layout"), "default" }, { i18nc("Frame shadow", "None"), "Plain" }, { i18nc("Frame shadow", "Raised"), "Raised" }, { i18nc("Frame shadow", "Sunken"), "Sunken" }, }; cmb = createComboBox("PanelLayout", "FrameShadow", "default", frameShadow, 4, tab, true, false, PAGE_LAYOUT); grid->addWidget(cmb, 3, 1); } void KgPanel::setupView(KrViewInstance *instance, QWidget *parent) { QGridLayout *grid = createGridLayout(parent); // -------------------- Filelist icon size ---------------------------------- QHBoxLayout *hbox = new QHBoxLayout(); hbox->addWidget(new QLabel(i18n("Default icon size:"), parent)); KONFIGURATOR_NAME_VALUE_PAIR *iconSizes = new KONFIGURATOR_NAME_VALUE_PAIR[KrView::iconSizes.count()]; for(int i = 0; i < KrView::iconSizes.count(); i++) iconSizes[i].text = iconSizes[i].value = QString::number(KrView::iconSizes[i]); KonfiguratorComboBox *cmb = createComboBox(instance->name(), "IconSize", _FilelistIconSize, iconSizes, KrView::iconSizes.count(), parent, true, true, PAGE_VIEW); delete [] iconSizes; cmb->lineEdit()->setValidator(new QRegExpValidator(QRegExp("[1-9]\\d{0,1}"), cmb)); hbox->addWidget(cmb); hbox->addWidget(createSpacer(parent)); grid->addLayout(hbox, 1, 0); //-------------------------------------------------------------------- KONFIGURATOR_CHECKBOX_PARAM iconSettings[] = // cfg_class cfg_name default text restart tooltip { {instance->name(), "With Icons", _WithIcons, i18n("Use icons in the filenames"), true, i18n("Show the icons for filenames and folders.") }, {instance->name(), "ShowPreviews", false, i18n("Show previews by default"), false, i18n("Show previews of files and folders.") }, }; KonfiguratorCheckBoxGroup *iconSett = createCheckBoxGroup(2, 0, iconSettings, 2 /*count*/, parent, PAGE_VIEW); grid->addWidget(iconSett, 2, 0, 1, 2); } // ---------------------------------------------------------------------------------- // ---------------------------- VIEW TAB ------------------------------------------- // ---------------------------------------------------------------------------------- void KgPanel::setupPanelTab() { QScrollArea *scrollArea = new QScrollArea(tabWidget); QWidget *tab_panel = new QWidget(scrollArea); scrollArea->setFrameStyle(QFrame::NoFrame); scrollArea->setWidget(tab_panel); scrollArea->setWidgetResizable(true); tabWidget->addTab(scrollArea, i18n("View")); QGridLayout *panelLayout = new QGridLayout(tab_panel); panelLayout->setSpacing(6); panelLayout->setContentsMargins(11, 11, 11, 11); QGroupBox *panelGrp = createFrame(i18n("General"), tab_panel); panelLayout->addWidget(panelGrp, 0, 0); QGridLayout *panelGrid = createGridLayout(panelGrp); // ---------------------------------------------------------------------------------- // ---------------------------- General settings ----------------------------------- // ---------------------------------------------------------------------------------- // -------------------- Panel Font ---------------------------------- QHBoxLayout *hbox = new QHBoxLayout(); QHBoxLayout *fontLayout = new QHBoxLayout(); fontLayout->addWidget(new QLabel(i18n("View font:"), panelGrp)); KonfiguratorFontChooser *chsr = createFontChooser("Look&Feel", "Filelist Font", _FilelistFont, panelGrp, true, PAGE_VIEW); fontLayout->addWidget(chsr); fontLayout->addStretch(1); hbox->addLayout(fontLayout, 1); // -------------------- Panel Tooltip ---------------------------------- QHBoxLayout *tooltipLayout = new QHBoxLayout(); QLabel *tooltipLabel = new QLabel(i18n("Tooltip delay (msec):")); tooltipLabel->setWhatsThis(i18n("The duration after a tooltip is shown for a file item, in " "milliseconds. Set a negative value to disable tooltips.")); tooltipLayout->addWidget(tooltipLabel); KonfiguratorSpinBox *tooltipSpinBox = createSpinBox("Look&Feel", "Panel Tooltip Delay", 1000, -100, 5000, panelGrp, false, PAGE_VIEW); tooltipSpinBox->setSingleStep(100); tooltipLayout->addWidget(tooltipSpinBox); tooltipLayout->addStretch(1); hbox->addLayout(tooltipLayout, 1); panelGrid->addLayout(hbox, 1, 0); // -------------------- General options ---------------------------------- KONFIGURATOR_CHECKBOX_PARAM panelSettings[] = // cfg_class cfg_name default text restart tooltip { {"Look&Feel", "Human Readable Size", _HumanReadableSize, i18n("Use human-readable file size"), true , i18n("File sizes are displayed in B, KB, MB and GB, not just in bytes.") }, {"Look&Feel", "Show Hidden", _ShowHidden, i18n("Show hidden files"), false, i18n("Display files beginning with a dot.") }, {"Look&Feel", "Numeric permissions", _NumericPermissions, i18n("Numeric Permissions"), true, i18n("Show octal numbers (0755) instead of the standard permissions (rwxr-xr-x) in the permission column.") }, {"Look&Feel", "Load User Defined Folder Icons", _UserDefinedFolderIcons, i18n("Load the user defined folder icons"), true , i18n("Load the user defined folder icons (can cause decrease in performance).") }, {"Look&Feel", "Always Show Current Item", _AlwaysShowCurrentItem, i18n("Always show current item"), false, i18n("Show current item border decoration in inactive panel.") }, }; KonfiguratorCheckBoxGroup *panelSett = createCheckBoxGroup(2, 0, panelSettings, 5 /*count*/, panelGrp, PAGE_VIEW); panelGrid->addWidget(panelSett, 3, 0, 1, 2); // ========================================================= panelGrid->addWidget(createLine(panelGrp), 4, 0); // ------------------------ Sort Method ---------------------------------- hbox = new QHBoxLayout(); hbox->addWidget(new QLabel(i18n("Sort method:"), panelGrp)); KONFIGURATOR_NAME_VALUE_PAIR sortMethods[] = {{ i18n("Alphabetical"), QString::number(KrViewProperties::Alphabetical) }, { i18n("Alphabetical and numbers"), QString::number(KrViewProperties::AlphabeticalNumbers) }, { i18n("Character code"), QString::number(KrViewProperties::CharacterCode) }, { i18n("Character code and numbers"), QString::number(KrViewProperties::CharacterCodeNumbers) }, { i18nc("Krusader sort", "Krusader"), QString::number(KrViewProperties::Krusader) } }; KonfiguratorComboBox *cmb = createComboBox("Look&Feel", "Sort method", QString::number(_DefaultSortMethod), sortMethods, 5, panelGrp, true, false, PAGE_VIEW); hbox->addWidget(cmb); hbox->addWidget(createSpacer(panelGrp)); panelGrid->addLayout(hbox, 5, 0); // ------------------------ Sort Options ---------------------------------- KONFIGURATOR_CHECKBOX_PARAM sortSettings[] = // cfg_class, cfg_name, default, text, restart, tooltip { {"Look&Feel", "Case Sensative Sort", _CaseSensativeSort, i18n("Case sensitive sorting"), true, i18n("All files beginning with capital letters appear before files beginning with non-capital letters (UNIX default).") }, {"Look&Feel", "Show Directories First", true, i18n("Show folders first"), true, 0 }, {"Look&Feel", "Always sort dirs by name", false, i18n("Always sort dirs by name"), true, i18n("Folders are sorted by name, regardless of the sort column.") }, {"Look&Feel", "Locale Aware Sort", true, i18n("Locale aware sorting"), true, i18n("The sorting is performed in a locale- and also platform-dependent manner. Can be slow.") }, }; KonfiguratorCheckBoxGroup *sortSett = createCheckBoxGroup(2, 0, sortSettings, 4 /*count*/, panelGrp, PAGE_VIEW); sortSett->find("Show Directories First")->addDep(sortSett->find("Always sort dirs by name")); panelGrid->addWidget(sortSett, 6, 0, 1, 2); // ---------------------------------------------------------------------------------- // ---------------------------- View modes ----------------------------------------- // ---------------------------------------------------------------------------------- panelGrp = createFrame(i18n("View modes"), tab_panel); panelLayout->addWidget(panelGrp, 1, 0); panelGrid = createGridLayout(panelGrp); // -------------------- Default Panel Type ---------------------------------- hbox = new QHBoxLayout(); hbox->addWidget(new QLabel(i18n("Default view mode:"), panelGrp)); QList views = KrViewFactory::registeredViews(); const int viewsSize = views.size(); KONFIGURATOR_NAME_VALUE_PAIR *panelTypes = new KONFIGURATOR_NAME_VALUE_PAIR[ viewsSize ]; QString defType = QString('0'); for (int i = 0; i != viewsSize; i++) { KrViewInstance * inst = views[ i ]; panelTypes[ i ].text = inst->description(); panelTypes[ i ].text.remove('&'); panelTypes[ i ].value = QString("%1").arg(inst->id()); if (inst->id() == KrViewFactory::defaultViewId()) defType = QString("%1").arg(inst->id()); } cmb = createComboBox("Look&Feel", "Default Panel Type", defType, panelTypes, viewsSize, panelGrp, false, false, PAGE_VIEW); hbox->addWidget(cmb); hbox->addWidget(createSpacer(panelGrp)); delete [] panelTypes; panelGrid->addLayout(hbox, 0, 0); // ----- Individual Settings Per View Type ------------------------ QTabWidget *tabs_view = new QTabWidget(panelGrp); panelGrid->addWidget(tabs_view, 11, 0); for(int i = 0; i < views.count(); i++) { QWidget *tab = new QWidget(tabs_view); tabs_view->addTab(tab, views[i]->description()); setupView(views[i], tab); } } // ----------------------------------------------------------------------------------- // -------------------------- Panel Toolbar TAB ---------------------------------- // ----------------------------------------------------------------------------------- void KgPanel::setupButtonsTab() { QScrollArea *scrollArea = new QScrollArea(tabWidget); QWidget *tab = new QWidget(scrollArea); scrollArea->setFrameStyle(QFrame::NoFrame); scrollArea->setWidget(tab); scrollArea->setWidgetResizable(true); tabWidget->addTab(scrollArea, i18n("Buttons")); QBoxLayout * tabLayout = new QVBoxLayout(tab); tabLayout->setSpacing(6); tabLayout->setContentsMargins(11, 11, 11, 11); KONFIGURATOR_CHECKBOX_PARAM buttonsParams[] = // cfg_class cfg_name default text restart tooltip { {"ListPanelButtons", "Icons", false, i18n("Toolbar buttons have icons"), true, "" }, {"Look&Feel", "Media Button Visible", true, i18n("Show Media Button"), true , i18n("The media button will be visible.") }, {"Look&Feel", "Back Button Visible", false, i18n("Show Back Button"), true , "Goes back in history." }, {"Look&Feel", "Forward Button Visible", false, i18n("Show Forward Button"), true , "Goes forward in history." }, {"Look&Feel", "History Button Visible", true, i18n("Show History Button"), true , i18n("The history button will be visible.") }, {"Look&Feel", "Bookmarks Button Visible", true, i18n("Show Bookmarks Button"), true , i18n("The bookmarks button will be visible.") }, {"Look&Feel", "Panel Toolbar visible", _PanelToolBar, i18n("Show Panel Toolbar"), true, i18n("The panel toolbar will be visible.") }, }; buttonsCheckboxes = createCheckBoxGroup(1, 0, buttonsParams, 7/*count*/, tab, PAGE_PANELTOOLBAR); connect(buttonsCheckboxes->find("Panel Toolbar visible"), SIGNAL(stateChanged(int)), this, SLOT(slotEnablePanelToolbar())); tabLayout->addWidget(buttonsCheckboxes, 0, 0); QGroupBox * panelToolbarGrp = createFrame(i18n("Visible Panel Toolbar buttons"), tab); QGridLayout * panelToolbarGrid = createGridLayout(panelToolbarGrp); KONFIGURATOR_CHECKBOX_PARAM panelToolbarButtonsParams[] = { // cfg_class cfg_name default text restart tooltip {"Look&Feel", "Equal Button Visible", _cdOther, i18n("Equal button (=)"), true , i18n("Changes the panel folder to the other panel folder.") }, {"Look&Feel", "Up Button Visible", _cdUp, i18n("Up button (..)"), true , i18n("Changes the panel folder to the parent folder.") }, {"Look&Feel", "Home Button Visible", _cdHome, i18n("Home button (~)"), true , i18n("Changes the panel folder to the home folder.") }, {"Look&Feel", "Root Button Visible", _cdRoot, i18n("Root button (/)"), true , i18n("Changes the panel folder to the root folder.") }, {"Look&Feel", "SyncBrowse Button Visible", _syncBrowseButton, i18n("Toggle-button for sync-browsing"), true , i18n("Each folder change in the panel is also performed in the other panel.") }, }; panelToolbarButtonsCheckboxes = createCheckBoxGroup(1, 0, panelToolbarButtonsParams, sizeof(panelToolbarButtonsParams) / sizeof(*panelToolbarButtonsParams), panelToolbarGrp, PAGE_PANELTOOLBAR); panelToolbarGrid->addWidget(panelToolbarButtonsCheckboxes, 0, 0); tabLayout->addWidget(panelToolbarGrp, 1, 0); // Enable panel toolbar checkboxes slotEnablePanelToolbar(); } // --------------------------------------------------------------------------- // -------------------------- Mouse TAB ---------------------------------- // --------------------------------------------------------------------------- void KgPanel::setupMouseModeTab() { QScrollArea *scrollArea = new QScrollArea(tabWidget); QWidget *tab_mouse = new QWidget(scrollArea); scrollArea->setFrameStyle(QFrame::NoFrame); scrollArea->setWidget(tab_mouse); scrollArea->setWidgetResizable(true); tabWidget->addTab(scrollArea, i18n("Selection Mode")); QGridLayout *mouseLayout = new QGridLayout(tab_mouse); mouseLayout->setSpacing(6); mouseLayout->setContentsMargins(11, 11, 11, 11); // -------------- General ----------------- QGroupBox *mouseGeneralGroup = createFrame(i18n("General"), tab_mouse); QGridLayout *mouseGeneralGrid = createGridLayout(mouseGeneralGroup); mouseGeneralGrid->setSpacing(0); mouseGeneralGrid->setContentsMargins(5, 5, 5, 5); KONFIGURATOR_NAME_VALUE_TIP mouseSelection[] = { // name value tooltip { i18n("Krusader Mode"), "0", i18n("Both keys allow selecting files. To select more than one file, hold the Ctrl key and click the left mouse button. Right-click menu is invoked using a short click on the right mouse button.") }, { i18n("Konqueror Mode"), "1", i18n("Pressing the left mouse button selects files - you can click and select multiple files. Right-click menu is invoked using a short click on the right mouse button.") }, { i18n("Total-Commander Mode"), "2", i18n("The left mouse button does not select, but sets the current file without affecting the current selection. The right mouse button selects multiple files and the right-click menu is invoked by pressing and holding the right mouse button.") }, { i18n("Ergonomic Mode"), "4", i18n("The left mouse button does not select, but sets the current file without affecting the current selection. The right mouse button invokes the context-menu. You can select with Ctrl key and the left button.") }, { i18n("Custom Selection Mode"), "3", i18n("Design your own selection mode.") } }; mouseRadio = createRadioButtonGroup("Look&Feel", "Mouse Selection", "0", 1, 5, mouseSelection, 5, mouseGeneralGroup, true, PAGE_MOUSE); mouseRadio->layout()->setContentsMargins(0, 0, 0, 0); mouseGeneralGrid->addWidget(mouseRadio, 0, 0); for (int i = 0; i != mouseRadio->count(); i++) connect(mouseRadio->find(i), SIGNAL(clicked()), SLOT(slotSelectionModeChanged())); mouseLayout->addWidget(mouseGeneralGroup, 0, 0); // -------------- Details ----------------- QGroupBox *mouseDetailGroup = createFrame(i18n("Details"), tab_mouse); QGridLayout *mouseDetailGrid = createGridLayout(mouseDetailGroup); mouseDetailGrid->setSpacing(0); mouseDetailGrid->setContentsMargins(5, 5, 5, 5); KONFIGURATOR_NAME_VALUE_TIP singleOrDoubleClick[] = { // name value tooltip { i18n("Double-click selects (classic)"), "0", i18n("A single click on a file will select and focus, a double click opens the file or steps into the folder.") }, { i18n("Obey global selection policy"), "1", i18n("

Use global setting:

Plasma System Settings -> Input Devices -> Mouse

") } }; KonfiguratorRadioButtons *clickRadio = createRadioButtonGroup("Look&Feel", "Single Click Selects", "0", 1, 0, singleOrDoubleClick, 2, mouseDetailGroup, true, PAGE_MOUSE); clickRadio->layout()->setContentsMargins(0, 0, 0, 0); mouseDetailGrid->addWidget(clickRadio, 0, 0); KONFIGURATOR_CHECKBOX_PARAM mouseCheckboxesParam[] = { // {cfg_class, cfg_name, default // text, restart, // tooltip } {"Custom Selection Mode", "QT Selection", _QtSelection, i18n("Based on KDE's selection mode"), true, i18n("If checked, use a mode based on KDE's style.") }, {"Custom Selection Mode", "Left Selects", _LeftSelects, i18n("Left mouse button selects"), true, i18n("If checked, left clicking an item will select it.") }, {"Custom Selection Mode", "Left Preserves", _LeftPreserves, i18n("Left mouse button preserves selection"), true, i18n("If checked, left clicking an item will select it, but will not unselect other, already selected items.") }, {"Custom Selection Mode", "ShiftCtrl Left Selects", _ShiftCtrlLeft, i18n("Shift/Ctrl-Left mouse button selects"), true, i18n("If checked, Shift/Ctrl left clicking will select items.\nNote: this is meaningless if 'Left Button Selects' is checked.") }, {"Custom Selection Mode", "Right Selects", _RightSelects, i18n("Right mouse button selects"), true, i18n("If checked, right clicking an item will select it.") }, {"Custom Selection Mode", "Right Preserves", _RightPreserves, i18n("Right mouse button preserves selection"), true, i18n("If checked, right clicking an item will select it, but will not unselect other, already selected items.") }, {"Custom Selection Mode", "ShiftCtrl Right Selects", _ShiftCtrlRight, i18n("Shift/Ctrl-Right mouse button selects"), true, i18n("If checked, Shift/Ctrl right clicking will select items.\nNote: this is meaningless if 'Right Button Selects' is checked.") }, {"Custom Selection Mode", "Space Moves Down", _SpaceMovesDown, i18n("Spacebar moves down"), true, i18n("If checked, pressing the spacebar will select the current item and move down.\nOtherwise, current item is selected, but remains the current item.") }, {"Custom Selection Mode", "Space Calc Space", _SpaceCalcSpace, i18n("Spacebar calculates disk space"), true, i18n("If checked, pressing the spacebar while the current item is a folder, will (except from selecting the folder)\ncalculate space occupied of the folder (recursively).") }, {"Custom Selection Mode", "Insert Moves Down", _InsertMovesDown, i18n("Insert moves down"), true, i18n("If checked, pressing Insert will select the current item, and move down to the next item.\nOtherwise, current item is not changed.") }, {"Custom Selection Mode", "Immediate Context Menu", _ImmediateContextMenu, i18n("Right clicking pops context menu immediately"), true, i18n("If checked, right clicking will result in an immediate showing of the context menu.\nOtherwise, user needs to click and hold the right mouse button for 500ms.") }, }; mouseCheckboxes = createCheckBoxGroup(1, 0, mouseCheckboxesParam, 11 /*count*/, mouseDetailGroup, PAGE_MOUSE); mouseDetailGrid->addWidget(mouseCheckboxes, 1, 0); for (int i = 0; i < mouseCheckboxes->count(); i++) connect(mouseCheckboxes->find(i), SIGNAL(clicked()), SLOT(slotMouseCheckBoxChanged())); mouseLayout->addWidget(mouseDetailGroup, 0, 1, 2, 1); // Disable the details-button if not in custom-mode slotSelectionModeChanged(); // -------------- Preview ----------------- QGroupBox *mousePreviewGroup = createFrame(i18n("Preview"), tab_mouse); QGridLayout *mousePreviewGrid = createGridLayout(mousePreviewGroup); // TODO preview mousePreview = new KrTreeWidget(mousePreviewGroup); mousePreviewGrid->addWidget(mousePreview, 0 , 0); mousePreviewGroup->setEnabled(false); // TODO re-enable once the preview is implemented // ------------------------------------------ mouseLayout->addWidget(mousePreviewGroup, 1, 0); } // --------------------------------------------------------------------------- // -------------------------- Media Menu TAB ---------------------------------- // --------------------------------------------------------------------------- void KgPanel::setupMediaMenuTab() { QScrollArea *scrollArea = new QScrollArea(tabWidget); QWidget *tab = new QWidget(scrollArea); scrollArea->setFrameStyle(QFrame::NoFrame); scrollArea->setWidget(tab); scrollArea->setWidgetResizable(true); tabWidget->addTab(scrollArea, i18n("Media Menu")); QBoxLayout * tabLayout = new QVBoxLayout(tab); tabLayout->setSpacing(6); tabLayout->setContentsMargins(11, 11, 11, 11); KONFIGURATOR_CHECKBOX_PARAM mediaMenuParams[] = { // cfg_class cfg_name default text restart tooltip {"MediaMenu", "ShowPath", true, i18n("Show Mount Path"), false, 0 }, {"MediaMenu", "ShowFSType", true, i18n("Show File System Type"), false, 0 }, }; KonfiguratorCheckBoxGroup *mediaMenuCheckBoxes = createCheckBoxGroup(1, 0, mediaMenuParams, sizeof(mediaMenuParams) / sizeof(*mediaMenuParams), tab, PAGE_MEDIA_MENU); tabLayout->addWidget(mediaMenuCheckBoxes, 0, 0); QHBoxLayout *showSizeHBox = new QHBoxLayout(); showSizeHBox->addWidget(new QLabel(i18n("Show Size:"), tab)); KONFIGURATOR_NAME_VALUE_PAIR showSizeValues[] = { { i18nc("setting 'show size'", "Always"), "Always" }, { i18nc("setting 'show size'", "When Device has no Label"), "WhenNoLabel" }, { i18nc("setting 'show size'", "Never"), "Never" }, }; KonfiguratorComboBox *showSizeCmb = createComboBox("MediaMenu", "ShowSize", "Always", showSizeValues, sizeof(showSizeValues) / sizeof(*showSizeValues), tab, false, false, PAGE_MEDIA_MENU); showSizeHBox->addWidget(showSizeCmb); showSizeHBox->addStretch(); tabLayout->addLayout(showSizeHBox); tabLayout->addStretch(); } void KgPanel::slotDisable() { bool isNewStyleQuickSearch = quicksearchCheckboxes->find("New Style Quicksearch")->isChecked(); quicksearchCheckboxes->find("Case Sensitive Quicksearch")->setEnabled(isNewStyleQuickSearch); } void KgPanel::slotEnablePanelToolbar() { bool enableTB = buttonsCheckboxes->find("Panel Toolbar visible")->isChecked(); panelToolbarButtonsCheckboxes->find("Root Button Visible")->setEnabled(enableTB); panelToolbarButtonsCheckboxes->find("Home Button Visible")->setEnabled(enableTB); panelToolbarButtonsCheckboxes->find("Up Button Visible")->setEnabled(enableTB); panelToolbarButtonsCheckboxes->find("Equal Button Visible")->setEnabled(enableTB); panelToolbarButtonsCheckboxes->find("SyncBrowse Button Visible")->setEnabled(enableTB); } void KgPanel::slotSelectionModeChanged() { KrSelectionMode *selectionMode = KrSelectionMode::getSelectionHandlerForMode(mouseRadio->selectedValue()); if (selectionMode == NULL) //User mode return; selectionMode->init(); mouseCheckboxes->find("QT Selection")->setChecked(selectionMode->useQTSelection()); mouseCheckboxes->find("Left Selects")->setChecked(selectionMode->leftButtonSelects()); mouseCheckboxes->find("Left Preserves")->setChecked(selectionMode->leftButtonPreservesSelection()); mouseCheckboxes->find("ShiftCtrl Left Selects")->setChecked(selectionMode->shiftCtrlLeftButtonSelects()); mouseCheckboxes->find("Right Selects")->setChecked(selectionMode->rightButtonSelects()); mouseCheckboxes->find("Right Preserves")->setChecked(selectionMode->rightButtonPreservesSelection()); mouseCheckboxes->find("ShiftCtrl Right Selects")->setChecked(selectionMode->shiftCtrlRightButtonSelects()); mouseCheckboxes->find("Space Moves Down")->setChecked(selectionMode->spaceMovesDown()); mouseCheckboxes->find("Space Calc Space")->setChecked(selectionMode->spaceCalculatesDiskSpace()); mouseCheckboxes->find("Insert Moves Down")->setChecked(selectionMode->insertMovesDown()); mouseCheckboxes->find("Immediate Context Menu")->setChecked(selectionMode->showContextMenu() == -1); } void KgPanel::slotMouseCheckBoxChanged() { mouseRadio->selectButton("3"); //custom selection mode } int KgPanel::activeSubPage() { return tabWidget->currentIndex(); } diff --git a/krusader/krusader.cpp b/krusader/krusader.cpp index 07160745..a7630423 100644 --- a/krusader/krusader.cpp +++ b/krusader/krusader.cpp @@ -1,644 +1,645 @@ /***************************************************************************** * Copyright (C) 2000 Shie Erlich * * Copyright (C) 2000 Rafi Yanai * * Copyright (C) 2004-2018 Krusader Krew [https://krusader.org] * * * * This file is part of Krusader [https://krusader.org]. * * * * Krusader is free software: you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation, either version 2 of the License, or * * (at your option) any later version. * * * * Krusader is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with Krusader. If not, see [http://www.gnu.org/licenses/]. * *****************************************************************************/ #include "krusader.h" // QtCore #include #include #include #include // QtGui #include #include // QtWidgets #include #include #include // QtDBus #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "defaults.h" #include "kicons.h" #include "kractions.h" #include "krglobal.h" #include "krservices.h" #include "krslots.h" #include "krtrashhandler.h" #include "krusaderversion.h" #include "krusaderview.h" #include "panelmanager.h" #include "tabactions.h" #include "BookMan/krbookmarkhandler.h" #include "Dialogs/checksumdlg.h" #include "Dialogs/krpleasewait.h" #include "Dialogs/popularurls.h" #include "FileSystem/fileitem.h" #include "FileSystem/krpermhandler.h" #include "GUI/kcmdline.h" #include "GUI/kfnkeys.h" #include "GUI/krremoteencodingmenu.h" #include "GUI/krusaderstatus.h" #include "GUI/terminaldock.h" #include "JobMan/jobman.h" #include "KViewer/krviewer.h" #include "Konfigurator/kgprotocols.h" #include "MountMan/kmountman.h" #include "Panel/PanelView/krview.h" #include "Panel/PanelView/krviewfactory.h" #include "Panel/krcolorcache.h" #include "Panel/krpanel.h" #include "Panel/listpanelactions.h" #include "Panel/viewactions.h" #include "UserAction/expander.h" // This makes gcc-4.1 happy. Warning about possible problem with KrAction's dtor not called #include "UserAction/kraction.h" #include "UserAction/useraction.h" #ifdef __KJSEMBED__ #include "KrJS/krjs.h" #endif // define the static members Krusader *Krusader::App = 0; QString Krusader::AppName; // KrBookmarkHandler *Krusader::bookman = 0; //QTextOStream *Krusader::_krOut = QTextOStream(::stdout); #ifdef __KJSEMBED__ KrJS *Krusader::js = 0; QAction *Krusader::actShowJSConsole = 0; #endif // construct the views, statusbar and menu bars and prepare Krusader to start Krusader::Krusader(const QCommandLineParser &parser) : KParts::MainWindow(0, Qt::Window | Qt::WindowTitleHint | Qt::WindowContextHelpButtonHint), _listPanelActions(0), isStarting(true), isExiting(false), _quit(false) { // create the "krusader" App = this; krMainWindow = this; SLOTS = new KRslots(this); setXMLFile("krusaderui.rc"); // kpart-related xml file plzWait = new KRPleaseWaitHandler(this); const bool runKonfig = versionControl(); QString message; switch (krConfig->accessMode()) { case KConfigBase::NoAccess : message = "Krusader's configuration file can't be found. Default values will be used."; break; case KConfigBase::ReadOnly : message = "Krusader's configuration file is in READ ONLY mode (why is that!?) Changed values will not be saved"; break; case KConfigBase::ReadWrite : message = ""; break; } if (!message.isEmpty()) { KMessageBox::error(krApp, message); } // create an icon loader krLoader = KIconLoader::global(); // iconLoader->addExtraDesktopThemes(); // create MountMan KrGlobal::mountMan = new KMountMan(this); connect(KrGlobal::mountMan, SIGNAL(refreshPanel(QUrl)), SLOTS, SLOT(refresh(QUrl))); + // create popular URLs container + _popularUrls = new PopularUrls(this); + // create bookman krBookMan = new KrBookmarkHandler(this); // create job manager krJobMan = new JobMan(this); - _popularUrls = new PopularUrls(this); - // create the main view MAIN_VIEW = new KrusaderView(this); // setup all the krusader's actions setupActions(); // init the permmision handler class KRpermHandler::init(); // init the protocol handler KgProtocols::init(); const KConfigGroup lookFeelGroup(krConfig, "Look&Feel"); FileItem::loadUserDefinedFolderIcons(lookFeelGroup.readEntry("Load User Defined Folder Icons", _UserDefinedFolderIcons)); const KConfigGroup startupGroup(krConfig, "Startup"); QString startProfile = startupGroup.readEntry("Starter Profile Name", QString()); QList leftTabs; QList rightTabs; // get command-line arguments if (parser.isSet("left")) { leftTabs = KrServices::toUrlList(parser.value("left").split(',')); startProfile.clear(); } if (parser.isSet("right")) { rightTabs = KrServices::toUrlList(parser.value("right").split(',')); startProfile.clear(); } if (parser.isSet("profile")) startProfile = parser.value("profile"); if (!startProfile.isEmpty()) { leftTabs.clear(); rightTabs.clear(); } // starting the panels MAIN_VIEW->start(startupGroup, startProfile.isEmpty(), leftTabs, rightTabs); // create a status bar KrusaderStatus *status = new KrusaderStatus(this); setStatusBar(status); status->setWhatsThis(i18n("Statusbar will show basic information " "about file below mouse pointer.")); // create tray icon (if needed) const bool startToTray = startupGroup.readEntry("Start To Tray", _StartToTray); setTray(startToTray); setCentralWidget(MAIN_VIEW); // manage our keyboard short-cuts //KAcceleratorManager::manage(this,true); setCursor(Qt::ArrowCursor); if (! startProfile.isEmpty()) MAIN_VIEW->profiles(startProfile); // restore gui settings { // now, check if we need to create a konsole_part // call the XML GUI function to draw the UI createGUI(MAIN_VIEW->terminalDock()->part()); // this needs to be called AFTER createGUI() !!! updateUserActions(); _listPanelActions->guiUpdated(); // not using this. See savePosition() //applyMainWindowSettings(); const KConfigGroup cfgToolbar(krConfig, "Main Toolbar"); toolBar()->applySettings(cfgToolbar); const KConfigGroup cfgJobBar(krConfig, "Job Toolbar"); toolBar("jobToolBar")->applySettings(cfgJobBar); const KConfigGroup cfgActionsBar(krConfig, "Actions Toolbar"); toolBar("actionsToolBar")->applySettings(cfgActionsBar); // restore toolbars position and visibility restoreState(startupGroup.readEntry("State", QByteArray())); statusBar()->setVisible(startupGroup.readEntry("Show status bar", _ShowStatusBar)); MAIN_VIEW->updateGUI(startupGroup); // popular urls _popularUrls->load(); } if (runKonfig) SLOTS->runKonfigurator(true); KConfigGroup viewerModuleGrp(krConfig, "ViewerModule"); if (viewerModuleGrp.readEntry("FirstRun", true)) { KrViewer::configureDeps(); viewerModuleGrp.writeEntry("FirstRun", false); } if (!runKonfig) { KConfigGroup cfg(krConfig, "Private"); move(cfg.readEntry("Start Position", _StartPosition)); resize(cfg.readEntry("Start Size", _StartSize)); } // view initialized; show window or only tray if (!startToTray) { show(); } KrTrashHandler::startWatcher(); isStarting = false; //HACK - used by [ListerTextArea|KrSearchDialog|LocateDlg]:keyPressEvent() KrGlobal::copyShortcut = _listPanelActions->actCopy->shortcut(); //HACK: make sure the active view becomes focused // for some reason sometimes the active view cannot be focused immediately at this point, // so queue it for the main loop QTimer::singleShot(0, ACTIVE_PANEL->view->widget(), SLOT(setFocus())); _openUrlTimer.setSingleShot(true); connect(&_openUrlTimer, SIGNAL(timeout()), SLOT(doOpenUrl())); KStartupInfo *startupInfo = new KStartupInfo(0, this); connect(startupInfo, &KStartupInfo::gotNewStartup, this, &Krusader::slotGotNewStartup); connect(startupInfo, &KStartupInfo::gotRemoveStartup, this, &Krusader::slotGotRemoveStartup); } Krusader::~Krusader() { KrTrashHandler::stopWatcher(); if (!isExiting) // save the settings if it was not saved (SIGTERM received) saveSettings(); delete MAIN_VIEW; MAIN_VIEW = 0; App = 0; } void Krusader::setTray(bool forceCreation) { const bool trayIsNeeded = forceCreation || KConfigGroup(krConfig, "Look&Feel") .readEntry("Minimize To Tray", _ShowTrayIcon); if (!sysTray && trayIsNeeded) { sysTray = new KStatusNotifierItem(this); sysTray->setIconByName(privIcon()); // we have our own "quit" method, re-connect QAction *quitAction = sysTray->action(QStringLiteral("quit")); if (quitAction) { disconnect(quitAction, &QAction::triggered, nullptr, nullptr); connect(quitAction, &QAction::triggered, this, &Krusader::quit); } } else if (sysTray && !trayIsNeeded) { // user does not want tray anymore :( sysTray->deleteLater(); } } bool Krusader::versionControl() { // create config file krConfig = KSharedConfig::openConfig().data(); KConfigGroup nogroup(krConfig, QString()); const bool firstRun = nogroup.readEntry("First Time", true); KrGlobal::sCurrentConfigVersion = nogroup.readEntry("Config Version", -1); // first installation of krusader if (firstRun) { KMessageBox::information( krApp, i18n("Welcome to Krusader.

As this is your first run, your machine " "will now be checked for external applications. Then the Konfigurator will " "be launched where you can customize Krusader to your needs.

")); } nogroup.writeEntry("Version", VERSION); nogroup.writeEntry("First Time", false); krConfig->sync(); QDir().mkpath(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QStringLiteral("/krusader/")); return firstRun; } void Krusader::statusBarUpdate(const QString& mess) { // change the message on the statusbar for 5 seconds if (statusBar()->isVisible()) statusBar()->showMessage(mess, 5000); } bool Krusader::event(QEvent *e) { if(e->type() == QEvent::ApplicationPaletteChange) { KrColorCache::getColorCache().refreshColors(); } return KParts::MainWindow::event(e); } // Moving from Pixmap actions to generic filenames - thanks to Carsten Pfeiffer void Krusader::setupActions() { QAction *bringToTopAct = new QAction(i18n("Bring Main Window to Top"), this); actionCollection()->addAction("bring_main_window_to_top", bringToTopAct); connect(bringToTopAct, SIGNAL(triggered()), SLOT(moveToTop())); KrActions::setupActions(this); _krActions = new KrActions(this); _viewActions = new ViewActions(this, this); _listPanelActions = new ListPanelActions(this, this); _tabActions = new TabActions(this, this); } /////////////////////////////////////////////////////////////////////////// //////////////////// implementation of slots ////////////////////////////// /////////////////////////////////////////////////////////////////////////// void Krusader::savePosition() { KConfigGroup cfg(krConfig, "Private"); cfg.writeEntry("Start Position", pos()); cfg.writeEntry("Start Size", size()); cfg = krConfig->group("Startup"); MAIN_VIEW->saveSettings(cfg); // NOTE: this would save current window state/size, statusbar and settings for each toolbar. // We are not using this and saving everything manually because // - it does not save window position // - window size save/restore does sometimes not work (multi-monitor setup) // - saving the statusbar visibility should be independent from window position and restoring it // does not work properly. //KConfigGroup cfg = KConfigGroup(&cfg, "MainWindowSettings"); //saveMainWindowSettings(cfg); //statusBar()->setVisible(cfg.readEntry("StatusBar", "Enabled") != "Disabled"); krConfig->sync(); } void Krusader::saveSettings() { // workaround: revert terminal fullscreen mode before saving widget and toolbar visibility if (MAIN_VIEW->isTerminalEmulatorFullscreen()) { MAIN_VIEW->setTerminalEmulator(false, true); } KConfigGroup noGroup(krConfig, QString()); noGroup.writeEntry("Config Version", KrGlobal::sConfigVersion); // save toolbar settings KConfigGroup cfg(krConfig, "Main Toolbar"); toolBar()->saveSettings(cfg); cfg = krConfig->group("Job Toolbar"); toolBar("jobToolBar")->saveSettings(cfg); cfg = krConfig->group("Actions Toolbar"); toolBar("actionsToolBar")->saveSettings(cfg); cfg = krConfig->group("Startup"); // save toolbar visibility and position cfg.writeEntry("State", saveState()); cfg.writeEntry("Show status bar", statusBar()->isVisible()); // save panel and window settings if (cfg.readEntry("Remember Position", _RememberPos)) savePosition(); // save the gui components visibility if (cfg.readEntry("UI Save Settings", _UiSave)) { cfg.writeEntry("Show FN Keys", KrActions::actToggleFnkeys->isChecked()); cfg.writeEntry("Show Cmd Line", KrActions::actToggleCmdline->isChecked()); cfg.writeEntry("Show Terminal Emulator", KrActions::actToggleTerminal->isChecked()); } // save popular links _popularUrls->save(); krConfig->sync(); } void Krusader::closeEvent(QCloseEvent *event) { if (!sysTray || _quit) { _quit = false; // in case quit will be aborted KParts::MainWindow::closeEvent(event); // (may) quit, continues with queryClose()... } else { // close window to tray event->ignore(); hide(); } } void Krusader::showEvent(QShowEvent *event) { const KConfigGroup lookFeelGroup(krConfig, "Look&Feel"); if (sysTray && !lookFeelGroup.readEntry("Minimize To Tray", _ShowTrayIcon)) { // restoring from "start to tray", tray icon is not needed anymore sysTray->deleteLater(); } KParts::MainWindow::showEvent(event); } bool Krusader::queryClose() { if (isStarting || isExiting) return false; if (qApp->isSavingSession()) { // KDE is logging out, accept the close acceptClose(); return true; } const KConfigGroup cfg = krConfig->group("Look&Feel"); const bool confirmExit = cfg.readEntry("Warn On Exit", _WarnOnExit); // ask user and wait until all KIO::job operations are terminated. Krusader won't exit before // that anyway if (!krJobMan->waitForJobs(confirmExit)) return false; /* First try to close the child windows, because it's the safer way to avoid crashes, then close the main window. If closing a child is not successful, then we cannot let the main window close. */ for (;;) { QWidgetList list = QApplication::topLevelWidgets(); QWidget *activeModal = QApplication::activeModalWidget(); QWidget *w = list.at(0); if (activeModal && activeModal != this && activeModal != menuBar() && list.contains(activeModal) && !activeModal->isHidden()) { w = activeModal; } else { int i = 1; for (; i < list.count(); ++i) { w = list.at(i); if (!(w && (w == this || w->isHidden() || w == menuBar()))) break; } if (i == list.count()) w = 0; } if (!w) break; if (!w->close()) { if (w->inherits("QDialog")) { fprintf(stderr, "Failed to close: %s\n", w->metaObject()->className()); } return false; } } acceptClose(); return true; } void Krusader::acceptClose() { saveSettings(); emit shutdown(); // Removes the DBUS registration of the application. Single instance mode requires unique appid. // As Krusader is exiting, we release that unique appid, so new Krusader instances // can be started. QDBusConnection dbus = QDBusConnection::sessionBus(); dbus.unregisterObject("/Instances/" + Krusader::AppName); isExiting = true; } // the please wait dialog functions void Krusader::startWaiting(QString msg, int count , bool cancel) { plzWait->startWaiting(msg , count, cancel); } bool Krusader::wasWaitingCancelled() const { return plzWait->wasCancelled(); } void Krusader::stopWait() { plzWait->stopWait(); } void Krusader::updateUserActions() { KActionMenu *userActionMenu = (KActionMenu *) KrActions::actUserMenu; if (userActionMenu) { userActionMenu->menu()->clear(); userActionMenu->addAction(KrActions::actManageUseractions); userActionMenu->addSeparator(); krUserAction->populateMenu(userActionMenu, NULL); } } const char* Krusader::privIcon() { if (geteuid()) return "krusader_user"; else return "krusader_root"; } void Krusader::quit() { _quit = true; // remember that we want to quit and not close to tray close(); // continues with closeEvent()... } void Krusader::moveToTop() { if (isHidden()) show(); KWindowSystem::forceActiveWindow(winId()); } bool Krusader::isRunning() { moveToTop(); //FIXME - doesn't belong here return true; } bool Krusader::isLeftActive() { return MAIN_VIEW->isLeftActive(); } bool Krusader::openUrl(QString url) { _urlToOpen = url; _openUrlTimer.start(0); return true; } void Krusader::doOpenUrl() { QUrl url = QUrl::fromUserInput(_urlToOpen, QDir::currentPath(), QUrl::AssumeLocalFile); _urlToOpen.clear(); int tab = ACTIVE_MNG->findTab(url); if(tab >= 0) ACTIVE_MNG->setActiveTab(tab); else if((tab = OTHER_MNG->findTab(url)) >= 0) { OTHER_MNG->setActiveTab(tab); OTHER_MNG->currentPanel()->view->widget()->setFocus(); } else ACTIVE_MNG->slotNewTab(url); } void Krusader::slotGotNewStartup(const KStartupInfoId &id, const KStartupInfoData &data) { Q_UNUSED(id) Q_UNUSED(data) // This is here to show busy mouse cursor when _other_ applications are launched, not for krusader itself. qApp->setOverrideCursor(Qt::BusyCursor); } void Krusader::slotGotRemoveStartup(const KStartupInfoId &id, const KStartupInfoData &data) { Q_UNUSED(id) Q_UNUSED(data) qApp->restoreOverrideCursor(); } KrView *Krusader::activeView() { return ACTIVE_PANEL->view; } AbstractPanelManager *Krusader::activeManager() { return MAIN_VIEW->activeManager(); } AbstractPanelManager *Krusader::leftManager() { return MAIN_VIEW->leftManager(); } AbstractPanelManager *Krusader::rightManager() { return MAIN_VIEW->rightManager(); }