-
+add_definitions(-Wno-deprecated-declarations)
add_subdirectory(src)
-macro_optional_find_package(Baloo)
+find_package(Baloo 4.97)
set_package_properties(Baloo PROPERTIES DESCRIPTION "Baloo Core libraries"
URL "http://www.kde.org"
TYPE OPTIONAL
PURPOSE "For adding desktop-wide search and tagging support to dolphin"
)
-macro_optional_find_package(BalooWidgets)
+find_package(BalooWidgets 4.97)
set_package_properties(BalooWidgets PROPERTIES DESCRIPTION "Baloos Widgets"
URL "http://www.kde.org"
TYPE OPTIONAL
)
-macro_optional_find_package(KFileMetaData)
+find_package(KFileMetaData 4.97)
set_package_properties(KFileMetaData PROPERTIES
URL "https://projects.kde.org/kfilemetadata"
TYPE OPTIONAL
set(HAVE_BALOO TRUE)
endif()
+find_package(KF5NewStuff CONFIG REQUIRED)
+find_package(KF5KCMUtils CONFIG REQUIRED)
+find_package(Phonon4Qt5 CONFIG REQUIRED)
+
configure_file(config-baloo.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-baloo.h )
macro_bool_to_01(X11_Xrender_FOUND HAVE_XRENDER)
kitemviews/kitemlistselectionmanager.cpp
kitemviews/kitemliststyleoption.cpp
kitemviews/kitemlistview.cpp
- kitemviews/kitemlistviewaccessible.cpp
+# kitemviews/kitemlistviewaccessible.cpp
kitemviews/kitemlistwidget.cpp
kitemviews/kitemmodelbase.cpp
kitemviews/kitemset.cpp
kde4_add_library(dolphinprivate SHARED ${dolphinprivate_LIB_SRCS})
target_link_libraries(
- dolphinprivate
- ${KDE4_KFILE_LIBS}
+ dolphinprivate PUBLIC
konq
- ${KDE4_KNEWSTUFF3_LIBS}
+ KF5::NewStuff
+ KF5::KDELibs4Support
)
if(HAVE_BALOO)
target_link_libraries(
- dolphinprivate
- ${BALOO_LIBRARIES}
+ dolphinprivate PUBLIC
+ KF5::FileMetaData
+ ${BALOO_CORE_LIBRARY}
+ ${BALOO_FILE_LIBRARY}
${BALOO_WIDGETS_LIBRARY}
- ${KFILEMETADATA_LIBRARY}
)
endif()
target_link_libraries(dolphinprivate ${X11_Xrender_LIB})
endif(X11_Xrender_FOUND)
-target_link_libraries(dolphinprivate ${KDE4_PLASMA_LIBS})
-
set_target_properties(dolphinprivate PROPERTIES VERSION ${GENERIC_LIB_VERSION} SOVERSION ${GENERIC_LIB_SOVERSION} )
install(TARGETS dolphinprivate ${INSTALL_TARGETS_DEFAULT_ARGS})
set(dolphinpart_SRCS
dolphinpart.cpp
+ dolphinpart_ext.cpp
)
-# Add dolphinpart_ext.cpp conditionally, only with KDE > 4.9.1.
-if (${KDE_VERSION} VERSION_GREATER "4.9.1")
-set(dolphinpart_SRCS
- ${dolphinpart_SRCS}
- dolphinpart_ext.cpp)
-endif (${KDE_VERSION} VERSION_GREATER "4.9.1")
-
kde4_add_plugin(dolphinpart ${dolphinpart_SRCS})
target_link_libraries(dolphinpart dolphinprivate konq ${KDE4_KPARTS_LIBS} ${KDE4_KFILE_LIBS})
kde4_add_kdeinit_executable(dolphin ${dolphin_SRCS})
+target_include_directories(kdeinit_dolphin PRIVATE ${PHONON_INCLUDES})
+
target_link_libraries(kdeinit_dolphin
- ${KDE4_KDEPRINT_LIBS}
- ${KDE4_KFILE_LIBS}
- ${KDE4_KPARTS_LIBS}
- ${KDE4_KCMUTILS_LIBRARY}
konq
dolphinprivate
- knewstuff3
- ${KDE4_SOLID_LIBS}
- ${KDE4_PHONON_LIBS}
+ KF5::NewStuff
+ KF5::Parts
+ KF5::KCMUtils
+ KF5::Solid
+ Phonon::phonon4qt5
+ KF5::KDELibs4Support
)
-if(HAVE_BALOO)
- target_link_libraries(kdeinit_dolphin
- ${BALOO_LIBRARIES}
- ${BALOO_WIDGETS_LIBRARY}
- )
-endif()
-
-if (KActivities_FOUND)
+if (KF5Activities_FOUND)
target_link_libraries(
kdeinit_dolphin
- ${KACTIVITIES_LIBRARY}
+ KF5::Activities
)
-endif (KActivities_FOUND)
+endif()
install(TARGETS kdeinit_dolphin ${INSTALL_TARGETS_DEFAULT_ARGS})
install(TARGETS dolphin ${INSTALL_TARGETS_DEFAULT_ARGS})
#include <KDebug>
#include <KRun>
#include <KUrl>
+#include <KGlobal>
DolphinApplication::DolphinApplication() :
m_mainWindow(0)
#include <KMenuBar>
#include <KMessageBox>
#include <KMimeTypeTrader>
+#include <KMimeType>
#include <KNewFileMenu>
#include <konqmimedata.h>
#include <konq_operations.h>
{
Q_ASSERT(m_context & TrashContext);
- QAction* emptyTrashAction = new QAction(KIcon("trash-empty"), i18nc("@action:inmenu", "Empty Trash"), this);
+ QAction* emptyTrashAction = new QAction(QIcon::fromTheme("trash-empty"), i18nc("@action:inmenu", "Empty Trash"), this);
KConfig trashConfig("trashrc", KConfig::SimpleConfig);
emptyTrashAction->setEnabled(!trashConfig.group("Status").readEntry("Empty", true));
addAction(emptyTrashAction);
newFileMenu->checkUpToDate();
newFileMenu->setPopupFiles(m_fileInfo.url());
newFileMenu->setEnabled(selectedItemsProps.supportsWriting());
- connect(newFileMenu, SIGNAL(fileCreated(KUrl)), newFileMenu, SLOT(deleteLater()));
- connect(newFileMenu, SIGNAL(directoryCreated(KUrl)), newFileMenu, SLOT(deleteLater()));
+ connect(newFileMenu, &DolphinNewFileMenu::fileCreated, newFileMenu, &DolphinNewFileMenu::deleteLater);
+ connect(newFileMenu, &DolphinNewFileMenu::directoryCreated, newFileMenu, &DolphinNewFileMenu::deleteLater);
- KMenu* menu = newFileMenu->menu();
+ QMenu* menu = newFileMenu->menu();
menu->setTitle(i18nc("@title:menu Create new folder, file, link, etc.", "Create New"));
- menu->setIcon(KIcon("document-new"));
+ menu->setIcon(QIcon::fromTheme("document-new"));
addMenu(menu);
addSeparator();
// insert 'Add to Places' entry
if (!placeExists(m_fileInfo.url())) {
- addToPlacesAction = addAction(KIcon("bookmark-new"),
+ addToPlacesAction = addAction(QIcon::fromTheme("bookmark-new"),
i18nc("@action:inmenu Add selected folder to places",
"Add to Places"));
}
addSeparator();
} else if (m_baseUrl.protocol().contains("search")) {
- openParentInNewWindowAction = new QAction(KIcon("window-new"),
+ openParentInNewWindowAction = new QAction(QIcon::fromTheme("window-new"),
i18nc("@action:inmenu",
"Open Path in New Window"),
this);
addAction(openParentInNewWindowAction);
- openParentInNewTabAction = new QAction(KIcon("tab-new"),
+ openParentInNewTabAction = new QAction(QIcon::fromTheme("tab-new"),
i18nc("@action:inmenu",
"Open Path in New Tab"),
this);
// Insert 'Add to Places' entry if exactly one item is selected
QAction* addToPlacesAction = 0;
if (!placeExists(m_mainWindow->activeViewContainer()->url())) {
- addToPlacesAction = addAction(KIcon("bookmark-new"),
+ addToPlacesAction = addAction(QIcon::fromTheme("bookmark-new"),
i18nc("@action:inmenu Add current folder to places", "Add to Places"));
}
QAction* action = 0;
const bool isDir = !m_fileInfo.isNull() && m_fileInfo.isDir();
if (isDir && (m_selectedItems.count() == 1)) {
- action = new QAction(KIcon("edit-paste"), i18nc("@action:inmenu", "Paste Into Folder"), this);
+ action = new QAction(QIcon::fromTheme("edit-paste"), i18nc("@action:inmenu", "Paste Into Folder"), this);
const QMimeData* mimeData = QApplication::clipboard()->mimeData();
const KUrl::List pasteData = KUrl::List::fromMimeData(mimeData);
action->setEnabled(!pasteData.isEmpty() && selectedItemsProperties().supportsWriting());
- connect(action, SIGNAL(triggered()), m_mainWindow, SLOT(pasteIntoFolder()));
+ connect(action, &QAction::triggered, m_mainWindow, &DolphinMainWindow::pasteIntoFolder);
} else {
action = m_mainWindow->actionCollection()->action(KStandardAction::name(KStandardAction::Paste));
}
const KConfig config("kservicemenurc", KConfig::NoGlobals);
const KConfigGroup showGroup = config.group("Show");
- foreach (const KSharedPtr<KService>& service, pluginServices) {
+ foreach (const KService::Ptr& service, pluginServices) {
if (!showGroup.readEntry(service->desktopEntryName(), true)) {
// The plugin has been disabled
continue;
#include <kdualaction.h>
#include <KFileDialog>
#include <KGlobal>
+#include <KDialog>
+#include <KJobWidgets>
#include <KLineEdit>
#include <KToolBar>
-#include <KIcon>
#include <KIconLoader>
#include <KIO/NetAccess>
#include <KIO/JobUiDelegate>
#include <QClipboard>
#include <QToolButton>
#include <QSplitter>
+#include <QTimer>
+#include <QPushButton>
namespace {
// Used for GeneralSettings::version() to determine whether
ViewTab& viewTab = m_viewTab[m_tabIndex];
viewTab.wasActive = true; // The first opened tab is automatically active
- connect(&DolphinNewFileMenuObserver::instance(), SIGNAL(errorMessage(QString)),
- this, SLOT(showErrorMessage(QString)));
+ connect(&DolphinNewFileMenuObserver::instance(), &DolphinNewFileMenuObserver::errorMessage,
+ this, &DolphinMainWindow::showErrorMessage);
KIO::FileUndoManager* undoManager = KIO::FileUndoManager::self();
undoManager->setUiInterface(new UndoUiInterface());
- connect(undoManager, SIGNAL(undoAvailable(bool)),
- this, SLOT(slotUndoAvailable(bool)));
- connect(undoManager, SIGNAL(undoTextChanged(QString)),
- this, SLOT(slotUndoTextChanged(QString)));
- connect(undoManager, SIGNAL(jobRecordingStarted(CommandType)),
- this, SLOT(clearStatusBar()));
- connect(undoManager, SIGNAL(jobRecordingFinished(CommandType)),
- this, SLOT(showCommand(CommandType)));
+ connect(undoManager, static_cast<void(KIO::FileUndoManager::*)(bool)>(&KIO::FileUndoManager::undoAvailable),
+ this, &DolphinMainWindow::slotUndoAvailable);
+ connect(undoManager, &KIO::FileUndoManager::undoTextChanged,
+ this, &DolphinMainWindow::slotUndoTextChanged);
+ connect(undoManager, &KIO::FileUndoManager::jobRecordingStarted,
+ this, &DolphinMainWindow::clearStatusBar);
+ connect(undoManager, &KIO::FileUndoManager::jobRecordingFinished,
+ this, &DolphinMainWindow::showCommand);
GeneralSettings* generalSettings = GeneralSettings::self();
const bool firstRun = (generalSettings->version() < 200);
const KUrl homeUrl(generalSettings->homeUrl());
setUrlAsCaption(homeUrl);
m_actionHandler = new DolphinViewActionHandler(actionCollection(), this);
- connect(m_actionHandler, SIGNAL(actionBeingHandled()), SLOT(clearStatusBar()));
- connect(m_actionHandler, SIGNAL(createDirectory()), SLOT(createDirectory()));
+ connect(m_actionHandler, &DolphinViewActionHandler::actionBeingHandled, this, &DolphinMainWindow::clearStatusBar);
+ connect(m_actionHandler, &DolphinViewActionHandler::createDirectory, this, &DolphinMainWindow::createDirectory);
viewTab.primaryView = createViewContainer(homeUrl, viewTab.splitter);
m_actionHandler->setCurrentView(view);
m_remoteEncoding = new DolphinRemoteEncoding(this, m_actionHandler);
- connect(this, SIGNAL(urlChanged(KUrl)),
- m_remoteEncoding, SLOT(slotAboutToOpenUrl()));
+ connect(this, &DolphinMainWindow::urlChanged,
+ m_remoteEncoding, &DolphinRemoteEncoding::slotAboutToOpenUrl);
m_tabBar = new KTabBar(this);
m_tabBar->setMovable(true);
m_tabBar->setTabsClosable(true);
- connect(m_tabBar, SIGNAL(currentChanged(int)),
- this, SLOT(setActiveTab(int)));
- connect(m_tabBar, SIGNAL(tabCloseRequested(int)),
- this, SLOT(closeTab(int)));
- connect(m_tabBar, SIGNAL(contextMenu(int,QPoint)),
- this, SLOT(openTabContextMenu(int,QPoint)));
- connect(m_tabBar, SIGNAL(newTabRequest()),
- this, SLOT(openNewTab()));
- connect(m_tabBar, SIGNAL(testCanDecode(const QDragMoveEvent*,bool&)),
- this, SLOT(slotTestCanDecode(const QDragMoveEvent*,bool&)));
- connect(m_tabBar, SIGNAL(mouseMiddleClick(int)),
- this, SLOT(closeTab(int)));
- connect(m_tabBar, SIGNAL(tabMoved(int,int)),
- this, SLOT(slotTabMoved(int,int)));
- connect(m_tabBar, SIGNAL(receivedDropEvent(int,QDropEvent*)),
- this, SLOT(tabDropEvent(int,QDropEvent*)));
+ connect(m_tabBar, &KTabBar::currentChanged,
+ this, &DolphinMainWindow::setActiveTab);
+ connect(m_tabBar, &KTabBar::tabCloseRequested,
+ this, static_cast<void(DolphinMainWindow::*)(int)>(&DolphinMainWindow::closeTab));
+ connect(m_tabBar, &KTabBar::contextMenu,
+ this, &DolphinMainWindow::openTabContextMenu);
+ connect(m_tabBar, &KTabBar::newTabRequest,
+ this, static_cast<void(DolphinMainWindow::*)()>(&DolphinMainWindow::openNewTab));
+ connect(m_tabBar, &KTabBar::testCanDecode,
+ this, &DolphinMainWindow::slotTestCanDecode);
+ connect(m_tabBar, &KTabBar::mouseMiddleClick,
+ this, static_cast<void(DolphinMainWindow::*)(int)>(&DolphinMainWindow::closeTab));
+ connect(m_tabBar, &KTabBar::tabMoved,
+ this, &DolphinMainWindow::slotTabMoved);
+ connect(m_tabBar, &KTabBar::receivedDropEvent,
+ this, &DolphinMainWindow::tabDropEvent);
m_tabBar->blockSignals(true); // signals get unblocked after at least 2 tabs are open
stateChanged("new_file");
QClipboard* clipboard = QApplication::clipboard();
- connect(clipboard, SIGNAL(dataChanged()),
- this, SLOT(updatePasteAction()));
+ connect(clipboard, &QClipboard::dataChanged,
+ this, &DolphinMainWindow::updatePasteAction);
if (generalSettings->splitView()) {
toggleSplitView();
if (m_viewTab.count() > 1) {
m_tabBar->setTabText(m_tabIndex, squeezedText(tabName(m_activeViewContainer->url())));
}
- const QString iconName = KMimeType::iconNameForUrl(url);
- m_tabBar->setTabIcon(m_tabIndex, KIcon(iconName));
+ const QString iconName = KIO::iconNameForUrl(url);
+ m_tabBar->setTabIcon(m_tabIndex, QIcon::fromTheme(iconName));
emit urlChanged(url);
}
}
// Only one view is open currently and hence no tab is shown at
// all. Before creating a tab for 'url', provide a tab for the current URL.
const KUrl currentUrl = m_activeViewContainer->url();
- m_tabBar->addTab(KIcon(KMimeType::iconNameForUrl(currentUrl)),
+ m_tabBar->addTab(QIcon::fromTheme(KIO::iconNameForUrl(currentUrl)),
squeezedText(tabName(currentUrl)));
m_tabBar->blockSignals(false);
}
- m_tabBar->addTab(KIcon(KMimeType::iconNameForUrl(url)),
+ m_tabBar->addTab(QIcon::fromTheme(KIO::iconNameForUrl(url)),
squeezedText(tabName(url)));
ViewTab viewTab;
}
if (!newWindowUrl.isEmpty()) {
- KRun::run("dolphin %u", KUrl::List() << newWindowUrl, this);
+ KRun::run("dolphin %u", QList<QUrl>() << newWindowUrl, this);
}
}
// KDialog::Yes -> Quit
// KDialog::No -> Close only the current tab
// KDialog::Cancel -> do nothing
- KDialog *dialog = new KDialog(this, Qt::Dialog);
- dialog->setCaption(i18nc("@title:window", "Confirmation"));
- dialog->setButtons(KDialog::Yes | KDialog::No | KDialog::Cancel);
+ QDialog *dialog = new QDialog(this, Qt::Dialog);
+ dialog->setWindowTitle(i18nc("@title:window", "Confirmation"));
dialog->setModal(true);
- dialog->setButtonGuiItem(KDialog::Yes, KStandardGuiItem::quit());
- dialog->setButtonGuiItem(KDialog::No, KGuiItem(i18n("C&lose Current Tab"), KIcon("tab-close")));
- dialog->setButtonGuiItem(KDialog::Cancel, KStandardGuiItem::cancel());
- dialog->setDefaultButton(KDialog::Yes);
+ QDialogButtonBox* buttons = new QDialogButtonBox(QDialogButtonBox::Yes | QDialogButtonBox::No | QDialogButtonBox::Cancel);
+ KGuiItem::assign(buttons->button(QDialogButtonBox::Yes), KStandardGuiItem::quit());
+ KGuiItem::assign(buttons->button(QDialogButtonBox::No), KGuiItem(i18n("C&lose Current Tab"), QIcon::fromTheme("tab-close")));
+ KGuiItem::assign(buttons->button(QDialogButtonBox::Cancel), KStandardGuiItem::cancel());
+ buttons->button(QDialogButtonBox::Yes)->setDefault(true);
bool doNotAskAgainCheckboxResult = false;
const int result = KMessageBox::createKMessageBox(dialog,
+ buttons,
QMessageBox::Warning,
i18n("You have multiple tabs open in this window, are you sure you want to quit?"),
QStringList(),
const KUrl url = container->url();
DolphinSettingsDialog* settingsDialog = new DolphinSettingsDialog(url, this);
- connect(settingsDialog, SIGNAL(settingsChanged()), this, SLOT(refreshViews()));
+ connect(settingsDialog, &DolphinSettingsDialog::settingsChanged, this, &DolphinMainWindow::refreshViews);
settingsDialog->setAttribute(Qt::WA_DeleteOnClose);
settingsDialog->show();
m_settingsDialog = settingsDialog;
{
KMenu menu(this);
- QAction* newTabAction = menu.addAction(KIcon("tab-new"), i18nc("@action:inmenu", "New Tab"));
+ QAction* newTabAction = menu.addAction(QIcon::fromTheme("tab-new"), i18nc("@action:inmenu", "New Tab"));
newTabAction->setShortcut(actionCollection()->action("new_tab")->shortcut());
- QAction* detachTabAction = menu.addAction(KIcon("tab-detach"), i18nc("@action:inmenu", "Detach Tab"));
+ QAction* detachTabAction = menu.addAction(QIcon::fromTheme("tab-detach"), i18nc("@action:inmenu", "Detach Tab"));
- QAction* closeOtherTabsAction = menu.addAction(KIcon("tab-close-other"), i18nc("@action:inmenu", "Close Other Tabs"));
+ QAction* closeOtherTabsAction = menu.addAction(QIcon::fromTheme("tab-close-other"), i18nc("@action:inmenu", "Close Other Tabs"));
- QAction* closeTabAction = menu.addAction(KIcon("tab-close"), i18nc("@action:inmenu", "Close Tab"));
+ QAction* closeTabAction = menu.addAction(QIcon::fromTheme("tab-close"), i18nc("@action:inmenu", "Close Tab"));
closeTabAction->setShortcut(actionCollection()->action("close_tab")->shortcut());
QAction* selectedAction = menu.exec(pos);
if (selectedAction == newTabAction) {
// stat the URL to see if it is a dir or not
m_lastHandleUrlStatJob = KIO::stat(url, KIO::HideProgressInfo);
if (m_lastHandleUrlStatJob->ui()) {
- m_lastHandleUrlStatJob->ui()->setWindow(this);
+ KJobWidgets::setWindow(m_lastHandleUrlStatJob, this);
}
- connect(m_lastHandleUrlStatJob, SIGNAL(result(KJob*)),
- this, SLOT(slotHandleUrlStatFinished(KJob*)));
+ connect(m_lastHandleUrlStatJob, &KIO::Job::result,
+ this, &DolphinMainWindow::slotHandleUrlStatFinished);
} else {
new KRun(url, this); // Automatically deletes itself after being finished
switch (command) {
case DolphinContextMenu::OpenParentFolderInNewWindow: {
- KRun::run("dolphin %u", KUrl::List() << item.url().upUrl(), this);
+
+ KRun::run("dolphin %u", QList<QUrl>() << KIO::upUrl(item.url()), this);
break;
}
case DolphinContextMenu::OpenParentFolderInNewTab:
- openNewTab(item.url().upUrl());
+ openNewTab(KIO::upUrl(item.url()));
break;
case DolphinContextMenu::None:
// Add "Go" menu
KMenu* goMenu = new KMenu(i18nc("@action:inmenu", "Go"), menu);
- connect(menu, SIGNAL(aboutToHide()), goMenu, SLOT(deleteLater()));
+ connect(menu, &KMenu::aboutToHide, goMenu, &KMenu::deleteLater);
goMenu->addAction(ac->action(KStandardAction::name(KStandardAction::Back)));
goMenu->addAction(ac->action(KStandardAction::name(KStandardAction::Forward)));
goMenu->addAction(ac->action(KStandardAction::name(KStandardAction::Up)));
// Add "Tool" menu
KMenu* toolsMenu = new KMenu(i18nc("@action:inmenu", "Tools"), menu);
- connect(menu, SIGNAL(aboutToHide()), toolsMenu, SLOT(deleteLater()));
+ connect(menu, &KMenu::aboutToHide, toolsMenu, &KMenu::deleteLater);
toolsMenu->addAction(ac->action("show_filter_bar"));
toolsMenu->addAction(ac->action("compare_files"));
toolsMenu->addAction(ac->action("open_terminal"));
// Add "Help" menu
KMenu* helpMenu = new KMenu(i18nc("@action:inmenu", "Help"), menu);
- connect(menu, SIGNAL(aboutToHide()), helpMenu, SLOT(deleteLater()));
+ connect(menu, &KMenu::aboutToHide, helpMenu, &KMenu::deleteLater);
helpMenu->addAction(ac->action(KStandardAction::name(KStandardAction::HelpContents)));
helpMenu->addAction(ac->action(KStandardAction::name(KStandardAction::WhatsThis)));
helpMenu->addSeparator();
// Activating the view container might trigger a recursive setActiveViewContainer() call
// inside DolphinMainWindow::toggleActiveView() when having a split view. Temporary
// disconnect the activated() signal in this case:
- disconnect(m_activeViewContainer->view(), SIGNAL(activated()), this, SLOT(toggleActiveView()));
+ disconnect(m_activeViewContainer->view(), &DolphinView::activated, this, &DolphinMainWindow::toggleActiveView);
m_activeViewContainer->setActive(true);
- connect(m_activeViewContainer->view(), SIGNAL(activated()), this, SLOT(toggleActiveView()));
+ connect(m_activeViewContainer->view(), &DolphinView::activated, this, &DolphinMainWindow::toggleActiveView);
m_actionHandler->setCurrentView(viewContainer->view());
setUrlAsCaption(url);
if (m_viewTab.count() > 1) {
m_tabBar->setTabText(m_tabIndex, tabName(url));
- m_tabBar->setTabIcon(m_tabIndex, KIcon(KMimeType::iconNameForUrl(url)));
+ m_tabBar->setTabIcon(m_tabIndex, QIcon::fromTheme(KIO::iconNameForUrl(url)));
}
emit urlChanged(url);
{
// setup 'File' menu
m_newFileMenu = new DolphinNewFileMenu(actionCollection(), this);
- KMenu* menu = m_newFileMenu->menu();
+ QMenu* menu = m_newFileMenu->menu();
menu->setTitle(i18nc("@title:menu Create new folder, file, link, etc.", "Create New"));
- menu->setIcon(KIcon("document-new"));
+ menu->setIcon(QIcon::fromTheme("document-new"));
m_newFileMenu->setDelayed(false);
- connect(menu, SIGNAL(aboutToShow()),
- this, SLOT(updateNewMenu()));
+ connect(menu, &QMenu::aboutToShow,
+ this, &DolphinMainWindow::updateNewMenu);
- KAction* newWindow = actionCollection()->addAction("new_window");
- newWindow->setIcon(KIcon("window-new"));
+ QAction* newWindow = actionCollection()->addAction("new_window");
+ newWindow->setIcon(QIcon::fromTheme("window-new"));
newWindow->setText(i18nc("@action:inmenu File", "New &Window"));
newWindow->setShortcut(Qt::CTRL | Qt::Key_N);
- connect(newWindow, SIGNAL(triggered()), this, SLOT(openNewMainWindow()));
+ connect(newWindow, &QAction::triggered, this, &DolphinMainWindow::openNewMainWindow);
- KAction* newTab = actionCollection()->addAction("new_tab");
- newTab->setIcon(KIcon("tab-new"));
+ QAction* newTab = actionCollection()->addAction("new_tab");
+ newTab->setIcon(QIcon::fromTheme("tab-new"));
newTab->setText(i18nc("@action:inmenu File", "New Tab"));
- newTab->setShortcut(KShortcut(Qt::CTRL | Qt::Key_T, Qt::CTRL | Qt::SHIFT | Qt::Key_N));
- connect(newTab, SIGNAL(triggered()), this, SLOT(openNewTab()));
+ newTab->setShortcuts(QList<QKeySequence>() << QKeySequence(Qt::CTRL | Qt::Key_T) << QKeySequence(Qt::CTRL | Qt::SHIFT | Qt::Key_N));
+ connect(newTab, &QAction::triggered, this, static_cast<void(DolphinMainWindow::*)()>(&DolphinMainWindow::openNewTab));
- KAction* closeTab = actionCollection()->addAction("close_tab");
- closeTab->setIcon(KIcon("tab-close"));
+ QAction* closeTab = actionCollection()->addAction("close_tab");
+ closeTab->setIcon(QIcon::fromTheme("tab-close"));
closeTab->setText(i18nc("@action:inmenu File", "Close Tab"));
closeTab->setShortcut(Qt::CTRL | Qt::Key_W);
closeTab->setEnabled(false);
- connect(closeTab, SIGNAL(triggered()), this, SLOT(closeTab()));
+ connect(closeTab, &QAction::triggered, this, static_cast<void(DolphinMainWindow::*)()>(&DolphinMainWindow::closeTab));
KStandardAction::quit(this, SLOT(quit()), actionCollection());
// need to remove shift+del from cut action, else the shortcut for deletejob
// doesn't work
- KAction* cut = KStandardAction::cut(this, SLOT(cut()), actionCollection());
- KShortcut cutShortcut = cut->shortcut();
- cutShortcut.remove(Qt::SHIFT | Qt::Key_Delete, KShortcut::KeepEmpty);
- cut->setShortcut(cutShortcut);
+ QAction* cut = KStandardAction::cut(this, SLOT(cut()), actionCollection());
+ auto cutShortcuts = cut->shortcuts();
+ cutShortcuts.removeAll(QKeySequence(Qt::SHIFT | Qt::Key_Delete));
+ cut->setShortcuts(cutShortcuts);
KStandardAction::copy(this, SLOT(copy()), actionCollection());
- KAction* paste = KStandardAction::paste(this, SLOT(paste()), actionCollection());
+ QAction* paste = KStandardAction::paste(this, SLOT(paste()), actionCollection());
// The text of the paste-action is modified dynamically by Dolphin
// (e. g. to "Paste One Folder"). To prevent that the size of the toolbar changes
// due to the long text, the text "Paste" is used:
KStandardAction::find(this, SLOT(find()), actionCollection());
- KAction* selectAll = actionCollection()->addAction("select_all");
+ QAction* selectAll = actionCollection()->addAction("select_all");
selectAll->setText(i18nc("@action:inmenu Edit", "Select All"));
selectAll->setShortcut(Qt::CTRL | Qt::Key_A);
- connect(selectAll, SIGNAL(triggered()), this, SLOT(selectAll()));
+ connect(selectAll, &QAction::triggered, this, &DolphinMainWindow::selectAll);
- KAction* invertSelection = actionCollection()->addAction("invert_selection");
+ QAction* invertSelection = actionCollection()->addAction("invert_selection");
invertSelection->setText(i18nc("@action:inmenu Edit", "Invert Selection"));
invertSelection->setShortcut(Qt::CTRL | Qt::SHIFT | Qt::Key_A);
- connect(invertSelection, SIGNAL(triggered()), this, SLOT(invertSelection()));
+ connect(invertSelection, &QAction::triggered, this, &DolphinMainWindow::invertSelection);
// setup 'View' menu
// (note that most of it is set up in DolphinViewActionHandler)
- KAction* split = actionCollection()->addAction("split_view");
+ QAction* split = actionCollection()->addAction("split_view");
split->setShortcut(Qt::Key_F3);
updateSplitAction();
- connect(split, SIGNAL(triggered()), this, SLOT(toggleSplitView()));
+ connect(split, &QAction::triggered, this, &DolphinMainWindow::toggleSplitView);
- KAction* reload = actionCollection()->addAction("reload");
+ QAction* reload = actionCollection()->addAction("reload");
reload->setText(i18nc("@action:inmenu View", "Reload"));
reload->setShortcut(Qt::Key_F5);
- reload->setIcon(KIcon("view-refresh"));
- connect(reload, SIGNAL(triggered()), this, SLOT(reloadView()));
+ reload->setIcon(QIcon::fromTheme("view-refresh"));
+ connect(reload, &QAction::triggered, this, &DolphinMainWindow::reloadView);
- KAction* stop = actionCollection()->addAction("stop");
+ QAction* stop = actionCollection()->addAction("stop");
stop->setText(i18nc("@action:inmenu View", "Stop"));
stop->setToolTip(i18nc("@info", "Stop loading"));
- stop->setIcon(KIcon("process-stop"));
- connect(stop, SIGNAL(triggered()), this, SLOT(stopLoading()));
+ stop->setIcon(QIcon::fromTheme("process-stop"));
+ connect(stop, &QAction::triggered, this, &DolphinMainWindow::stopLoading);
KToggleAction* editableLocation = actionCollection()->add<KToggleAction>("editable_location");
editableLocation->setText(i18nc("@action:inmenu Navigation Bar", "Editable Location"));
editableLocation->setShortcut(Qt::Key_F6);
- connect(editableLocation, SIGNAL(triggered()), this, SLOT(toggleEditLocation()));
+ connect(editableLocation, &KToggleAction::triggered, this, &DolphinMainWindow::toggleEditLocation);
- KAction* replaceLocation = actionCollection()->addAction("replace_location");
+ QAction* replaceLocation = actionCollection()->addAction("replace_location");
replaceLocation->setText(i18nc("@action:inmenu Navigation Bar", "Replace Location"));
replaceLocation->setShortcut(Qt::CTRL | Qt::Key_L);
- connect(replaceLocation, SIGNAL(triggered()), this, SLOT(replaceLocation()));
+ connect(replaceLocation, &QAction::triggered, this, &DolphinMainWindow::replaceLocation);
// setup 'Go' menu
- KAction* backAction = KStandardAction::back(this, SLOT(goBack()), actionCollection());
- connect(backAction, SIGNAL(triggered(Qt::MouseButtons,Qt::KeyboardModifiers)), this, SLOT(goBack(Qt::MouseButtons)));
- KShortcut backShortcut = backAction->shortcut();
- backShortcut.setAlternate(Qt::Key_Backspace);
- backAction->setShortcut(backShortcut);
+ QAction* backAction = KStandardAction::back(this, SLOT(goBack()), actionCollection());
+ connect(backAction, &QAction::triggered, this, static_cast<void(DolphinMainWindow::*)()>(&DolphinMainWindow::goBack));
+ auto backShortcuts = backAction->shortcuts();
+ backShortcuts.append(QKeySequence(Qt::Key_Backspace));
+ backAction->setShortcuts(backShortcuts);
m_recentTabsMenu = new KActionMenu(i18n("Recently Closed Tabs"), this);
- m_recentTabsMenu->setIcon(KIcon("edit-undo"));
+ m_recentTabsMenu->setIcon(QIcon::fromTheme("edit-undo"));
m_recentTabsMenu->setDelayed(false);
actionCollection()->addAction("closed_tabs", m_recentTabsMenu);
- connect(m_recentTabsMenu->menu(), SIGNAL(triggered(QAction*)),
- this, SLOT(restoreClosedTab(QAction*)));
+ connect(m_recentTabsMenu->menu(), &QMenu::triggered,
+ this, &DolphinMainWindow::restoreClosedTab);
QAction* action = new QAction(i18n("Empty Recently Closed Tabs"), m_recentTabsMenu);
- action->setIcon(KIcon("edit-clear-list"));
+ action->setIcon(QIcon::fromTheme("edit-clear-list"));
action->setData(QVariant::fromValue(true));
m_recentTabsMenu->addAction(action);
m_recentTabsMenu->addSeparator();
m_recentTabsMenu->setEnabled(false);
- KAction* forwardAction = KStandardAction::forward(this, SLOT(goForward()), actionCollection());
- connect(forwardAction, SIGNAL(triggered(Qt::MouseButtons,Qt::KeyboardModifiers)), this, SLOT(goForward(Qt::MouseButtons)));
+ QAction* forwardAction = KStandardAction::forward(this, SLOT(goForward()), actionCollection());
+ connect(forwardAction, &QAction::triggered, this, static_cast<void(DolphinMainWindow::*)()>(&DolphinMainWindow::goForward));
- KAction* upAction = KStandardAction::up(this, SLOT(goUp()), actionCollection());
- connect(upAction, SIGNAL(triggered(Qt::MouseButtons,Qt::KeyboardModifiers)), this, SLOT(goUp(Qt::MouseButtons)));
+ QAction* upAction = KStandardAction::up(this, SLOT(goUp()), actionCollection());
+ connect(upAction, &QAction::triggered, this, static_cast<void(DolphinMainWindow::*)()>(&DolphinMainWindow::goUp));
- KAction* homeAction = KStandardAction::home(this, SLOT(goHome()), actionCollection());
- connect(homeAction, SIGNAL(triggered(Qt::MouseButtons,Qt::KeyboardModifiers)), this, SLOT(goHome(Qt::MouseButtons)));
+ QAction* homeAction = KStandardAction::home(this, SLOT(goHome()), actionCollection());
+ connect(homeAction, &QAction::triggered, this, static_cast<void(DolphinMainWindow::*)()>(&DolphinMainWindow::goHome));
// setup 'Tools' menu
- KAction* showFilterBar = actionCollection()->addAction("show_filter_bar");
+ QAction* showFilterBar = actionCollection()->addAction("show_filter_bar");
showFilterBar->setText(i18nc("@action:inmenu Tools", "Show Filter Bar"));
- showFilterBar->setIcon(KIcon("view-filter"));
+ showFilterBar->setIcon(QIcon::fromTheme("view-filter"));
showFilterBar->setShortcut(Qt::CTRL | Qt::Key_I);
- connect(showFilterBar, SIGNAL(triggered()), this, SLOT(showFilterBar()));
+ connect(showFilterBar, &QAction::triggered, this, &DolphinMainWindow::showFilterBar);
- KAction* compareFiles = actionCollection()->addAction("compare_files");
+ QAction* compareFiles = actionCollection()->addAction("compare_files");
compareFiles->setText(i18nc("@action:inmenu Tools", "Compare Files"));
- compareFiles->setIcon(KIcon("kompare"));
+ compareFiles->setIcon(QIcon::fromTheme("kompare"));
compareFiles->setEnabled(false);
- connect(compareFiles, SIGNAL(triggered()), this, SLOT(compareFiles()));
+ connect(compareFiles, &QAction::triggered, this, &DolphinMainWindow::compareFiles);
- KAction* openTerminal = actionCollection()->addAction("open_terminal");
+ QAction* openTerminal = actionCollection()->addAction("open_terminal");
openTerminal->setText(i18nc("@action:inmenu Tools", "Open Terminal"));
- openTerminal->setIcon(KIcon("utilities-terminal"));
+ openTerminal->setIcon(QIcon::fromTheme("utilities-terminal"));
openTerminal->setShortcut(Qt::SHIFT | Qt::Key_F4);
- connect(openTerminal, SIGNAL(triggered()), this, SLOT(openTerminal()));
+ connect(openTerminal, &QAction::triggered, this, &DolphinMainWindow::openTerminal);
// setup 'Settings' menu
KToggleAction* showMenuBar = KStandardAction::showMenubar(0, 0, actionCollection());
- connect(showMenuBar, SIGNAL(triggered(bool)), // Fixes #286822
- this, SLOT(toggleShowMenuBar()), Qt::QueuedConnection);
+ connect(showMenuBar, &KToggleAction::triggered, // Fixes #286822
+ this, &DolphinMainWindow::toggleShowMenuBar, Qt::QueuedConnection);
KStandardAction::preferences(this, SLOT(editSettings()), actionCollection());
// not in menu actions
QList<QKeySequence> nextTabKeys;
- nextTabKeys.append(KStandardShortcut::tabNext().primary());
+ nextTabKeys.append(KStandardShortcut::tabNext().first()); //TODO: is this correct
nextTabKeys.append(QKeySequence(Qt::CTRL | Qt::Key_Tab));
QList<QKeySequence> prevTabKeys;
- prevTabKeys.append(KStandardShortcut::tabPrev().primary());
+ prevTabKeys.append(KStandardShortcut::tabPrev().first()); //TODO: is this correct
prevTabKeys.append(QKeySequence(Qt::CTRL | Qt::SHIFT | Qt::Key_Tab));
- KAction* activateNextTab = actionCollection()->addAction("activate_next_tab");
+ QAction* activateNextTab = actionCollection()->addAction("activate_next_tab");
activateNextTab->setIconText(i18nc("@action:inmenu", "Next Tab"));
activateNextTab->setText(i18nc("@action:inmenu", "Activate Next Tab"));
activateNextTab->setEnabled(false);
- connect(activateNextTab, SIGNAL(triggered()), SLOT(activateNextTab()));
+ connect(activateNextTab, &QAction::triggered, this, &DolphinMainWindow::activateNextTab);
activateNextTab->setShortcuts(QApplication::isRightToLeft() ? prevTabKeys : nextTabKeys);
- KAction* activatePrevTab = actionCollection()->addAction("activate_prev_tab");
+ QAction* activatePrevTab = actionCollection()->addAction("activate_prev_tab");
activatePrevTab->setIconText(i18nc("@action:inmenu", "Previous Tab"));
activatePrevTab->setText(i18nc("@action:inmenu", "Activate Previous Tab"));
activatePrevTab->setEnabled(false);
- connect(activatePrevTab, SIGNAL(triggered()), SLOT(activatePrevTab()));
+ connect(activatePrevTab, &QAction::triggered, this, &DolphinMainWindow::activatePrevTab);
activatePrevTab->setShortcuts(QApplication::isRightToLeft() ? nextTabKeys : prevTabKeys);
// for context menu
- KAction* openInNewTab = actionCollection()->addAction("open_in_new_tab");
+ QAction* openInNewTab = actionCollection()->addAction("open_in_new_tab");
openInNewTab->setText(i18nc("@action:inmenu", "Open in New Tab"));
- openInNewTab->setIcon(KIcon("tab-new"));
- connect(openInNewTab, SIGNAL(triggered()), this, SLOT(openInNewTab()));
+ openInNewTab->setIcon(QIcon::fromTheme("tab-new"));
+ connect(openInNewTab, &QAction::triggered, this, &DolphinMainWindow::openInNewTab);
- KAction* openInNewTabs = actionCollection()->addAction("open_in_new_tabs");
+ QAction* openInNewTabs = actionCollection()->addAction("open_in_new_tabs");
openInNewTabs->setText(i18nc("@action:inmenu", "Open in New Tabs"));
- openInNewTabs->setIcon(KIcon("tab-new"));
- connect(openInNewTabs, SIGNAL(triggered()), this, SLOT(openInNewTab()));
+ openInNewTabs->setIcon(QIcon::fromTheme("tab-new"));
+ connect(openInNewTabs, &QAction::triggered, this, &DolphinMainWindow::openInNewTab);
- KAction* openInNewWindow = actionCollection()->addAction("open_in_new_window");
+ QAction* openInNewWindow = actionCollection()->addAction("open_in_new_window");
openInNewWindow->setText(i18nc("@action:inmenu", "Open in New Window"));
- openInNewWindow->setIcon(KIcon("window-new"));
- connect(openInNewWindow, SIGNAL(triggered()), this, SLOT(openInNewWindow()));
+ openInNewWindow->setIcon(QIcon::fromTheme("window-new"));
+ connect(openInNewWindow, &QAction::triggered, this, &DolphinMainWindow::openInNewWindow);
}
void DolphinMainWindow::setupDockWidgets()
KDualAction* lockLayoutAction = actionCollection()->add<KDualAction>("lock_panels");
lockLayoutAction->setActiveText(i18nc("@action:inmenu Panels", "Unlock Panels"));
- lockLayoutAction->setActiveIcon(KIcon("object-unlocked"));
+ lockLayoutAction->setActiveIcon(QIcon::fromTheme("object-unlocked"));
lockLayoutAction->setInactiveText(i18nc("@action:inmenu Panels", "Lock Panels"));
- lockLayoutAction->setInactiveIcon(KIcon("object-locked"));
+ lockLayoutAction->setInactiveIcon(QIcon::fromTheme("object-locked"));
lockLayoutAction->setActive(lock);
- connect(lockLayoutAction, SIGNAL(triggered()), this, SLOT(togglePanelLockState()));
+ connect(lockLayoutAction, &KDualAction::triggered, this, &DolphinMainWindow::togglePanelLockState);
// Setup "Information"
DolphinDockWidget* infoDock = new DolphinDockWidget(i18nc("@title:window", "Information"));
infoDock->setLocked(lock);
infoDock->setObjectName("infoDock");
infoDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
- Panel* infoPanel = new InformationPanel(infoDock);
+ InformationPanel* infoPanel = new InformationPanel(infoDock);
infoPanel->setCustomContextMenuActions(QList<QAction*>() << lockLayoutAction);
- connect(infoPanel, SIGNAL(urlActivated(KUrl)), this, SLOT(handleUrl(KUrl)));
+ connect(infoPanel, &InformationPanel::urlActivated, this, &DolphinMainWindow::handleUrl);
infoDock->setWidget(infoPanel);
QAction* infoAction = infoDock->toggleViewAction();
- createPanelAction(KIcon("dialog-information"), Qt::Key_F11, infoAction, "show_information_panel");
+ createPanelAction(QIcon::fromTheme("dialog-information"), Qt::Key_F11, infoAction, "show_information_panel");
addDockWidget(Qt::RightDockWidgetArea, infoDock);
- connect(this, SIGNAL(urlChanged(KUrl)),
- infoPanel, SLOT(setUrl(KUrl)));
- connect(this, SIGNAL(selectionChanged(KFileItemList)),
- infoPanel, SLOT(setSelection(KFileItemList)));
- connect(this, SIGNAL(requestItemInfo(KFileItem)),
- infoPanel, SLOT(requestDelayedItemInfo(KFileItem)));
+ connect(this, &DolphinMainWindow::urlChanged,
+ infoPanel, &InformationPanel::setUrl);
+ connect(this, &DolphinMainWindow::selectionChanged,
+ infoPanel, &InformationPanel::setSelection);
+ connect(this, &DolphinMainWindow::requestItemInfo,
+ infoPanel, &InformationPanel::requestDelayedItemInfo);
// Setup "Folders"
DolphinDockWidget* foldersDock = new DolphinDockWidget(i18nc("@title:window", "Folders"));
foldersDock->setWidget(foldersPanel);
QAction* foldersAction = foldersDock->toggleViewAction();
- createPanelAction(KIcon("folder"), Qt::Key_F7, foldersAction, "show_folders_panel");
+ createPanelAction(QIcon::fromTheme("folder"), Qt::Key_F7, foldersAction, "show_folders_panel");
addDockWidget(Qt::LeftDockWidgetArea, foldersDock);
- connect(this, SIGNAL(urlChanged(KUrl)),
- foldersPanel, SLOT(setUrl(KUrl)));
- connect(foldersPanel, SIGNAL(folderActivated(KUrl)),
- this, SLOT(changeUrl(KUrl)));
- connect(foldersPanel, SIGNAL(folderMiddleClicked(KUrl)),
- this, SLOT(openNewTab(KUrl)));
- connect(foldersPanel, SIGNAL(errorMessage(QString)),
- this, SLOT(slotPanelErrorMessage(QString)));
+ connect(this, &DolphinMainWindow::urlChanged,
+ foldersPanel, &FoldersPanel::setUrl);
+ connect(foldersPanel, &FoldersPanel::folderActivated,
+ this, &DolphinMainWindow::changeUrl);
+ connect(foldersPanel, &FoldersPanel::folderMiddleClicked,
+ this, static_cast<void(DolphinMainWindow::*)(const KUrl&)>(&DolphinMainWindow::openNewTab));
+ connect(foldersPanel, &FoldersPanel::errorMessage,
+ this, &DolphinMainWindow::slotPanelErrorMessage);
// Setup "Terminal"
#ifndef Q_OS_WIN
terminalDock->setLocked(lock);
terminalDock->setObjectName("terminalDock");
terminalDock->setAllowedAreas(Qt::TopDockWidgetArea | Qt::BottomDockWidgetArea);
- Panel* terminalPanel = new TerminalPanel(terminalDock);
+ TerminalPanel* terminalPanel = new TerminalPanel(terminalDock);
terminalPanel->setCustomContextMenuActions(QList<QAction*>() << lockLayoutAction);
terminalDock->setWidget(terminalPanel);
- connect(terminalPanel, SIGNAL(hideTerminalPanel()), terminalDock, SLOT(hide()));
- connect(terminalPanel, SIGNAL(changeUrl(KUrl)), this, SLOT(slotTerminalDirectoryChanged(KUrl)));
- connect(terminalDock, SIGNAL(visibilityChanged(bool)),
- terminalPanel, SLOT(dockVisibilityChanged()));
+ connect(terminalPanel, &TerminalPanel::hideTerminalPanel, terminalDock, &DolphinDockWidget::hide);
+ connect(terminalPanel, &TerminalPanel::changeUrl, this, &DolphinMainWindow::slotTerminalDirectoryChanged);
+ connect(terminalDock, &DolphinDockWidget::visibilityChanged,
+ terminalPanel, &TerminalPanel::dockVisibilityChanged);
QAction* terminalAction = terminalDock->toggleViewAction();
- createPanelAction(KIcon("utilities-terminal"), Qt::Key_F4, terminalAction, "show_terminal_panel");
+ createPanelAction(QIcon::fromTheme("utilities-terminal"), Qt::Key_F4, terminalAction, "show_terminal_panel");
addDockWidget(Qt::BottomDockWidgetArea, terminalDock);
- connect(this, SIGNAL(urlChanged(KUrl)),
- terminalPanel, SLOT(setUrl(KUrl)));
+ connect(this, &DolphinMainWindow::urlChanged,
+ terminalPanel, &TerminalPanel::setUrl);
#endif
if (GeneralSettings::version() < 200) {
placesDock->setWidget(placesPanel);
QAction* placesAction = placesDock->toggleViewAction();
- createPanelAction(KIcon("bookmarks"), Qt::Key_F9, placesAction, "show_places_panel");
+ createPanelAction(QIcon::fromTheme("bookmarks"), Qt::Key_F9, placesAction, "show_places_panel");
addDockWidget(Qt::LeftDockWidgetArea, placesDock);
- connect(placesPanel, SIGNAL(placeActivated(KUrl)),
- this, SLOT(slotPlaceActivated(KUrl)));
- connect(placesPanel, SIGNAL(placeMiddleClicked(KUrl)),
- this, SLOT(openNewTab(KUrl)));
- connect(placesPanel, SIGNAL(errorMessage(QString)),
- this, SLOT(slotPanelErrorMessage(QString)));
- connect(this, SIGNAL(urlChanged(KUrl)),
- placesPanel, SLOT(setUrl(KUrl)));
- connect(placesDock, SIGNAL(visibilityChanged(bool)),
- this, SLOT(slotPlacesPanelVisibilityChanged(bool)));
- connect(this, SIGNAL(settingsChanged()),
- placesPanel, SLOT(readSettings()));
+ connect(placesPanel, &PlacesPanel::placeActivated,
+ this, &DolphinMainWindow::slotPlaceActivated);
+ connect(placesPanel, &PlacesPanel::placeMiddleClicked,
+ this, static_cast<void(DolphinMainWindow::*)(const KUrl&)>(&DolphinMainWindow::openNewTab));
+ connect(placesPanel, &PlacesPanel::errorMessage,
+ this, &DolphinMainWindow::slotPanelErrorMessage);
+ connect(this, &DolphinMainWindow::urlChanged,
+ placesPanel, &PlacesPanel::setUrl);
+ connect(placesDock, &DolphinDockWidget::visibilityChanged,
+ this, &DolphinMainWindow::slotPlacesPanelVisibilityChanged);
+ connect(this, &DolphinMainWindow::settingsChanged,
+ placesPanel, &PlacesPanel::readSettings);
// Add actions into the "Panels" menu
KActionMenu* panelsMenu = new KActionMenu(i18nc("@action:inmenu View", "Panels"), this);
Q_ASSERT(!m_controlButton);
m_controlButton = new QToolButton(this);
- m_controlButton->setIcon(KIcon("applications-system"));
+ m_controlButton->setIcon(QIcon::fromTheme("applications-system"));
m_controlButton->setText(i18nc("@action", "Control"));
m_controlButton->setPopupMode(QToolButton::InstantPopup);
m_controlButton->setToolButtonStyle(toolBar()->toolButtonStyle());
KMenu* controlMenu = new KMenu(m_controlButton);
- connect(controlMenu, SIGNAL(aboutToShow()), this, SLOT(updateControlMenu()));
+ connect(controlMenu, &KMenu::aboutToShow, this, &DolphinMainWindow::updateControlMenu);
m_controlButton->setMenu(controlMenu);
toolBar()->addWidget(m_controlButton);
- connect(toolBar(), SIGNAL(iconSizeChanged(QSize)),
- m_controlButton, SLOT(setIconSize(QSize)));
- connect(toolBar(), SIGNAL(toolButtonStyleChanged(Qt::ToolButtonStyle)),
- m_controlButton, SLOT(setToolButtonStyle(Qt::ToolButtonStyle)));
+ connect(toolBar(), &KToolBar::iconSizeChanged,
+ m_controlButton, &QToolButton::setIconSize);
+ connect(toolBar(), &KToolBar::toolButtonStyleChanged,
+ m_controlButton, &QToolButton::setToolButtonStyle);
// The added widgets are owned by the toolbar and may get deleted when e.g. the toolbar
// gets edited. In this case we must add them again. The adding is done asynchronously by
// m_updateToolBarTimer.
- connect(m_controlButton, SIGNAL(destroyed()), this, SLOT(slotControlButtonDeleted()));
+ connect(m_controlButton, &QToolButton::destroyed, this, &DolphinMainWindow::slotControlButtonDeleted);
m_updateToolBarTimer = new QTimer(this);
m_updateToolBarTimer->setInterval(500);
- connect(m_updateToolBarTimer, SIGNAL(timeout()), this, SLOT(updateToolBar()));
+ connect(m_updateToolBarTimer, &QTimer::timeout, this, &DolphinMainWindow::updateToolBar);
}
void DolphinMainWindow::deleteControlButton()
void DolphinMainWindow::rememberClosedTab(int index)
{
- KMenu* tabsMenu = m_recentTabsMenu->menu();
+ QMenu* tabsMenu = m_recentTabsMenu->menu();
const QString primaryPath = m_viewTab[index].primaryView->url().path();
- const QString iconName = KMimeType::iconNameForUrl(primaryPath);
+ const QString iconName = KIO::iconNameForUrl(primaryPath);
QAction* action = new QAction(squeezedText(primaryPath), tabsMenu);
}
action->setData(QVariant::fromValue(closedTab));
- action->setIcon(KIcon(iconName));
+ action->setIcon(QIcon::fromTheme(iconName));
// add the closed tab menu entry after the separator and
// "Empty Recently Closed Tabs" entry
void DolphinMainWindow::connectViewSignals(DolphinViewContainer* container)
{
- connect(container, SIGNAL(showFilterBarChanged(bool)),
- this, SLOT(updateFilterBarAction(bool)));
- connect(container, SIGNAL(writeStateChanged(bool)),
- this, SLOT(slotWriteStateChanged(bool)));
+ connect(container, &DolphinViewContainer::showFilterBarChanged,
+ this, &DolphinMainWindow::updateFilterBarAction);
+ connect(container, &DolphinViewContainer::writeStateChanged,
+ this, &DolphinMainWindow::slotWriteStateChanged);
DolphinView* view = container->view();
- connect(view, SIGNAL(selectionChanged(KFileItemList)),
- this, SLOT(slotSelectionChanged(KFileItemList)));
- connect(view, SIGNAL(requestItemInfo(KFileItem)),
- this, SLOT(slotRequestItemInfo(KFileItem)));
- connect(view, SIGNAL(activated()),
- this, SLOT(toggleActiveView()));
- connect(view, SIGNAL(tabRequested(KUrl)),
- this, SLOT(openNewTab(KUrl)));
- connect(view, SIGNAL(requestContextMenu(QPoint,KFileItem,KUrl,QList<QAction*>)),
- this, SLOT(openContextMenu(QPoint,KFileItem,KUrl,QList<QAction*>)));
- connect(view, SIGNAL(directoryLoadingStarted()),
- this, SLOT(enableStopAction()));
- connect(view, SIGNAL(directoryLoadingCompleted()),
- this, SLOT(disableStopAction()));
- connect(view, SIGNAL(goBackRequested()),
- this, SLOT(goBack()));
- connect(view, SIGNAL(goForwardRequested()),
- this, SLOT(goForward()));
+ connect(view, &DolphinView::selectionChanged,
+ this, &DolphinMainWindow::slotSelectionChanged);
+ connect(view, &DolphinView::requestItemInfo,
+ this, &DolphinMainWindow::slotRequestItemInfo);
+ connect(view, &DolphinView::activated,
+ this, &DolphinMainWindow::toggleActiveView);
+ connect(view, &DolphinView::tabRequested,
+ this, static_cast<void(DolphinMainWindow::*)(const KUrl&)>(&DolphinMainWindow::openNewTab));
+ connect(view, &DolphinView::requestContextMenu,
+ this, &DolphinMainWindow::openContextMenu);
+ connect(view, &DolphinView::directoryLoadingStarted,
+ this, &DolphinMainWindow::enableStopAction);
+ connect(view, &DolphinView::directoryLoadingCompleted,
+ this, &DolphinMainWindow::disableStopAction);
+ connect(view, &DolphinView::goBackRequested,
+ this, static_cast<void(DolphinMainWindow::*)()>(&DolphinMainWindow::goBack));
+ connect(view, &DolphinView::goForwardRequested,
+ this, static_cast<void(DolphinMainWindow::*)()>(&DolphinMainWindow::goForward));
const KUrlNavigator* navigator = container->urlNavigator();
- connect(navigator, SIGNAL(urlChanged(KUrl)),
- this, SLOT(changeUrl(KUrl)));
- connect(navigator, SIGNAL(historyChanged()),
- this, SLOT(updateHistory()));
- connect(navigator, SIGNAL(editableStateChanged(bool)),
- this, SLOT(slotEditableStateChanged(bool)));
- connect(navigator, SIGNAL(tabRequested(KUrl)),
- this, SLOT(openNewTab(KUrl)));
+ connect(navigator, &KUrlNavigator::urlChanged,
+ this, &DolphinMainWindow::changeUrl);
+ connect(navigator, &KUrlNavigator::historyChanged,
+ this, &DolphinMainWindow::updateHistory);
+ connect(navigator, &KUrlNavigator::editableStateChanged,
+ this, &DolphinMainWindow::slotEditableStateChanged);
+ connect(navigator, &KUrlNavigator::tabRequested,
+ this, static_cast<void(DolphinMainWindow::*)(const KUrl&)>(&DolphinMainWindow::openNewTab));
}
void DolphinMainWindow::updateSplitAction()
if (m_activeViewContainer == m_viewTab[m_tabIndex].secondaryView) {
splitAction->setText(i18nc("@action:intoolbar Close right view", "Close"));
splitAction->setToolTip(i18nc("@info", "Close right view"));
- splitAction->setIcon(KIcon("view-right-close"));
+ splitAction->setIcon(QIcon::fromTheme("view-right-close"));
} else {
splitAction->setText(i18nc("@action:intoolbar Close left view", "Close"));
splitAction->setToolTip(i18nc("@info", "Close left view"));
- splitAction->setIcon(KIcon("view-left-close"));
+ splitAction->setIcon(QIcon::fromTheme("view-left-close"));
}
} else {
splitAction->setText(i18nc("@action:intoolbar Split view", "Split"));
splitAction->setToolTip(i18nc("@info", "Split view"));
- splitAction->setIcon(KIcon("view-right-new"));
+ splitAction->setIcon(QIcon::fromTheme("view-right-new"));
}
}
return fm.elidedText(text, Qt::ElideMiddle, fm.maxWidth() * 10);
}
-void DolphinMainWindow::createPanelAction(const KIcon& icon,
+void DolphinMainWindow::createPanelAction(const QIcon& icon,
const QKeySequence& shortcut,
QAction* dockAction,
const QString& actionName)
{
- KAction* panelAction = actionCollection()->addAction(actionName);
+ QAction* panelAction = actionCollection()->addAction(actionName);
panelAction->setCheckable(true);
panelAction->setChecked(dockAction->isChecked());
panelAction->setText(dockAction->text());
panelAction->setIcon(icon);
panelAction->setShortcut(shortcut);
- connect(panelAction, SIGNAL(triggered()), dockAction, SLOT(trigger()));
- connect(dockAction, SIGNAL(toggled(bool)), panelAction, SLOT(setChecked(bool)));
+ connect(panelAction, &QAction::triggered, dockAction, &QAction::trigger);
+ connect(dockAction, &QAction::toggled, panelAction, &QAction::setChecked);
}
DolphinMainWindow::UndoUiInterface::UndoUiInterface() :
#include <ksortablelist.h>
#include <kxmlguiwindow.h>
#include <KActionMenu>
-#include <KIcon>
#include <QList>
#include <QWeakPointer>
class QSplitter;
class QToolButton;
class QVBoxLayout;
+class QIcon;
/**
* @short Main window for Dolphin.
* as the action for toggling the dock visibility is done by Qt which
* is no KAction instance.
*/
- void createPanelAction(const KIcon& icon,
+ void createPanelAction(const QIcon &icon,
const QKeySequence& shortcut,
QAction* dockAction,
const QString& actionName);
#include <KPluginFactory>
#include <KRun>
#include <KToggleAction>
+#include <KGlobal>
#include <KIO/NetAccess>
#include <KToolInvocation>
#include <kauthorized.h>
#include <KProtocolInfo>
#include <kdeversion.h>
-#if KDE_IS_VERSION(4, 9, 2)
#include "dolphinpart_ext.h"
-#endif
#include "dolphinnewfilemenu.h"
#include "views/dolphinview.h"
,m_removeAction(0)
{
Q_UNUSED(args)
- setComponentData(DolphinPartFactory::componentData(), false);
+#pragma message("TODO: port to KF5")
+ //setComponentData(DolphinPartFactory::componentData(), false);
m_extension = new DolphinPartBrowserExtension(this);
// make sure that other apps using this part find Dolphin's view-file-columns icons
m_view->setTabsForFilesEnabled(true);
setWidget(m_view);
- connect(&DolphinNewFileMenuObserver::instance(), SIGNAL(errorMessage(QString)),
- this, SLOT(slotErrorMessage(QString)));
+ connect(&DolphinNewFileMenuObserver::instance(), &DolphinNewFileMenuObserver::errorMessage,
+ this, &DolphinPart::slotErrorMessage);
- connect(m_view, SIGNAL(directoryLoadingCompleted()), this, SIGNAL(completed()));
- connect(m_view, SIGNAL(directoryLoadingProgress(int)), this, SLOT(updateProgress(int)));
- connect(m_view, SIGNAL(errorMessage(QString)), this, SLOT(slotErrorMessage(QString)));
+ connect(m_view, &DolphinView::directoryLoadingCompleted, this, static_cast<void(DolphinPart::*)()>(&DolphinPart::completed));
+ connect(m_view, &DolphinView::directoryLoadingProgress, this, &DolphinPart::updateProgress);
+ connect(m_view, &DolphinView::errorMessage, this, &DolphinPart::slotErrorMessage);
setXMLFile("dolphinpart.rc");
- connect(m_view, SIGNAL(infoMessage(QString)),
- this, SLOT(slotMessage(QString)));
- connect(m_view, SIGNAL(operationCompletedMessage(QString)),
- this, SLOT(slotMessage(QString)));
- connect(m_view, SIGNAL(errorMessage(QString)),
- this, SLOT(slotErrorMessage(QString)));
- connect(m_view, SIGNAL(itemActivated(KFileItem)),
- this, SLOT(slotItemActivated(KFileItem)));
- connect(m_view, SIGNAL(itemsActivated(KFileItemList)),
- this, SLOT(slotItemsActivated(KFileItemList)));
- connect(m_view, SIGNAL(tabRequested(KUrl)),
- this, SLOT(createNewWindow(KUrl)));
- connect(m_view, SIGNAL(requestContextMenu(QPoint,KFileItem,KUrl,QList<QAction*>)),
- this, SLOT(slotOpenContextMenu(QPoint,KFileItem,KUrl,QList<QAction*>)));
- connect(m_view, SIGNAL(selectionChanged(KFileItemList)),
- m_extension, SIGNAL(selectionInfo(KFileItemList)));
- connect(m_view, SIGNAL(selectionChanged(KFileItemList)),
- this, SLOT(slotSelectionChanged(KFileItemList)));
- connect(m_view, SIGNAL(requestItemInfo(KFileItem)),
- this, SLOT(slotRequestItemInfo(KFileItem)));
- connect(m_view, SIGNAL(modeChanged(DolphinView::Mode,DolphinView::Mode)),
- this, SIGNAL(viewModeChanged())); // relay signal
- connect(m_view, SIGNAL(redirection(KUrl,KUrl)),
- this, SLOT(slotDirectoryRedirection(KUrl,KUrl)));
+ connect(m_view, &DolphinView::infoMessage,
+ this, &DolphinPart::slotMessage);
+ connect(m_view, &DolphinView::operationCompletedMessage,
+ this, &DolphinPart::slotMessage);
+ connect(m_view, &DolphinView::errorMessage,
+ this, &DolphinPart::slotErrorMessage);
+ connect(m_view, &DolphinView::itemActivated,
+ this, &DolphinPart::slotItemActivated);
+ connect(m_view, &DolphinView::itemsActivated,
+ this, &DolphinPart::slotItemsActivated);
+ connect(m_view, &DolphinView::tabRequested,
+ this, &DolphinPart::createNewWindow);
+ connect(m_view, &DolphinView::requestContextMenu,
+ this, &DolphinPart::slotOpenContextMenu);
+ connect(m_view, &DolphinView::selectionChanged,
+ m_extension, static_cast<void(DolphinPartBrowserExtension::*)(const KFileItemList&)>(&DolphinPartBrowserExtension::selectionInfo));
+ connect(m_view, &DolphinView::selectionChanged,
+ this, &DolphinPart::slotSelectionChanged);
+ connect(m_view, &DolphinView::requestItemInfo,
+ this, &DolphinPart::slotRequestItemInfo);
+ connect(m_view, &DolphinView::modeChanged,
+ this, &DolphinPart::viewModeChanged); // relay signal
+ connect(m_view, &DolphinView::redirection,
+ this, &DolphinPart::slotDirectoryRedirection);
// Watch for changes that should result in updates to the
// status bar text.
- connect(m_view, SIGNAL(itemCountChanged()), this, SLOT(updateStatusBar()));
- connect(m_view, SIGNAL(selectionChanged(KFileItemList)), this, SLOT(updateStatusBar()));
+ connect(m_view, &DolphinView::itemCountChanged, this, &DolphinPart::updateStatusBar);
+ connect(m_view, &DolphinView::selectionChanged, this, &DolphinPart::updateStatusBar);
m_actionHandler = new DolphinViewActionHandler(actionCollection(), this);
m_actionHandler->setCurrentView(m_view);
- connect(m_actionHandler, SIGNAL(createDirectory()), SLOT(createDirectory()));
+ connect(m_actionHandler, &DolphinViewActionHandler::createDirectory, this, &DolphinPart::createDirectory);
m_remoteEncoding = new DolphinRemoteEncoding(this, m_actionHandler);
- connect(this, SIGNAL(aboutToOpenURL()),
- m_remoteEncoding, SLOT(slotAboutToOpenUrl()));
+ connect(this, &DolphinPart::aboutToOpenURL,
+ m_remoteEncoding, &DolphinRemoteEncoding::slotAboutToOpenUrl);
QClipboard* clipboard = QApplication::clipboard();
- connect(clipboard, SIGNAL(dataChanged()),
- this, SLOT(updatePasteAction()));
+ connect(clipboard, &QClipboard::dataChanged,
+ this, &DolphinPart::updatePasteAction);
// Create file info and listing filter extensions.
// NOTE: Listing filter needs to be instantiated after the creation of the view.
new DolphinPartFileInfoExtension(this);
-#if KDE_IS_VERSION(4, 9, 2)
new DolphinPartListingFilterExtension(this);
KDirLister* lister = m_view->m_model->m_dirLister;
if (lister) {
DolphinPartListingNotificationExtension* notifyExt = new DolphinPartListingNotificationExtension(this);
- connect(lister, SIGNAL(newItems(KFileItemList)), notifyExt, SLOT(slotNewItems(KFileItemList)));
- connect(lister, SIGNAL(itemsDeleted(KFileItemList)), notifyExt, SLOT(slotItemsDeleted(KFileItemList)));
+ connect(lister, &KDirLister::newItems, notifyExt, &DolphinPartListingNotificationExtension::slotNewItems);
+ connect(lister, &KDirLister::itemsDeleted, notifyExt, &DolphinPartListingNotificationExtension::slotItemsDeleted);
} else {
kWarning() << "NULL KDirLister object! KParts::ListingNotificationExtension will NOT be supported";
}
-#endif
createActions();
m_actionHandler->updateViewActions();
m_newFileMenu = new DolphinNewFileMenu(actionCollection(), this);
m_newFileMenu->setParentWidget(widget());
- connect(m_newFileMenu->menu(), SIGNAL(aboutToShow()),
- this, SLOT(updateNewMenu()));
+ connect(m_newFileMenu->menu(), &QMenu::aboutToShow,
+ this, &DolphinPart::updateNewMenu);
- KAction *editMimeTypeAction = actionCollection()->addAction( "editMimeType" );
+ QAction *editMimeTypeAction = actionCollection()->addAction( "editMimeType" );
editMimeTypeAction->setText( i18nc("@action:inmenu Edit", "&Edit File Type..." ) );
- connect(editMimeTypeAction, SIGNAL(triggered()), SLOT(slotEditMimeType()));
+ connect(editMimeTypeAction, &QAction::triggered, this, &DolphinPart::slotEditMimeType);
- KAction* selectItemsMatching = actionCollection()->addAction("select_items_matching");
+ QAction* selectItemsMatching = actionCollection()->addAction("select_items_matching");
selectItemsMatching->setText(i18nc("@action:inmenu Edit", "Select Items Matching..."));
selectItemsMatching->setShortcut(Qt::CTRL | Qt::Key_S);
- connect(selectItemsMatching, SIGNAL(triggered()), this, SLOT(slotSelectItemsMatchingPattern()));
+ connect(selectItemsMatching, &QAction::triggered, this, &DolphinPart::slotSelectItemsMatchingPattern);
- KAction* unselectItemsMatching = actionCollection()->addAction("unselect_items_matching");
+ QAction* unselectItemsMatching = actionCollection()->addAction("unselect_items_matching");
unselectItemsMatching->setText(i18nc("@action:inmenu Edit", "Unselect Items Matching..."));
- connect(unselectItemsMatching, SIGNAL(triggered()), this, SLOT(slotUnselectItemsMatchingPattern()));
+ connect(unselectItemsMatching, &QAction::triggered, this, &DolphinPart::slotUnselectItemsMatchingPattern);
actionCollection()->addAction(KStandardAction::SelectAll, "select_all", m_view, SLOT(selectAll()));
- KAction* unselectAll = actionCollection()->addAction("unselect_all");
+ QAction* unselectAll = actionCollection()->addAction("unselect_all");
unselectAll->setText(i18nc("@action:inmenu Edit", "Unselect All"));
- connect(unselectAll, SIGNAL(triggered()), m_view, SLOT(clearSelection()));
+ connect(unselectAll, &QAction::triggered, m_view, &DolphinView::clearSelection);
- KAction* invertSelection = actionCollection()->addAction("invert_selection");
+ QAction* invertSelection = actionCollection()->addAction("invert_selection");
invertSelection->setText(i18nc("@action:inmenu Edit", "Invert Selection"));
invertSelection->setShortcut(Qt::CTRL | Qt::SHIFT | Qt::Key_A);
- connect(invertSelection, SIGNAL(triggered()), m_view, SLOT(invertSelection()));
+ connect(invertSelection, &QAction::triggered, m_view, &DolphinView::invertSelection);
// View menu: all done by DolphinViewActionHandler
// Go menu
QActionGroup* goActionGroup = new QActionGroup(this);
- connect(goActionGroup, SIGNAL(triggered(QAction*)),
- this, SLOT(slotGoTriggered(QAction*)));
+ connect(goActionGroup, &QActionGroup::triggered,
+ this, &DolphinPart::slotGoTriggered);
createGoAction("go_applications", "start-here-kde",
i18nc("@action:inmenu Go", "App&lications"), QString("programs:/"),
i18nc("@action:inmenu Go", "Trash"), QString("trash:/"),
goActionGroup);
createGoAction("go_autostart", "",
- i18nc("@action:inmenu Go", "Autostart"), KGlobalSettings::autostartPath(),
+ i18nc("@action:inmenu Go", "Autostart"), QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation) + "/autostart",
goActionGroup);
// Tools menu
m_findFileAction = actionCollection()->addAction("find_file");
m_findFileAction->setText(i18nc("@action:inmenu Tools", "Find File..."));
m_findFileAction->setShortcut(Qt::CTRL | Qt::Key_F);
- m_findFileAction->setIcon(KIcon("edit-find"));
- connect(m_findFileAction, SIGNAL(triggered()), this, SLOT(slotFindFile()));
+ m_findFileAction->setIcon(QIcon::fromTheme("edit-find"));
+ connect(m_findFileAction, &QAction::triggered, this, &DolphinPart::slotFindFile);
if (KAuthorized::authorizeKAction("shell_access")) {
m_openTerminalAction = actionCollection()->addAction("open_terminal");
- m_openTerminalAction->setIcon(KIcon("utilities-terminal"));
+ m_openTerminalAction->setIcon(QIcon::fromTheme("utilities-terminal"));
m_openTerminalAction->setText(i18nc("@action:inmenu Tools", "Open &Terminal"));
- connect(m_openTerminalAction, SIGNAL(triggered()), SLOT(slotOpenTerminal()));
+ connect(m_openTerminalAction, &QAction::triggered, this, &DolphinPart::slotOpenTerminal);
m_openTerminalAction->setShortcut(Qt::Key_F4);
}
}
const QString& text, const QString& url,
QActionGroup* actionGroup)
{
- KAction* action = actionCollection()->addAction(name);
- action->setIcon(KIcon(iconName));
+ QAction* action = actionCollection()->addAction(name);
+ action->setIcon(QIcon::fromTheme(iconName));
action->setText(text);
action->setData(url);
action->setActionGroup(actionGroup);
KAboutData* DolphinPart::createAboutData()
{
- return new KAboutData("dolphinpart", "dolphin", ki18nc("@title", "Dolphin Part"), "0.1");
+ return new KAboutData("dolphinpart", i18nc("@title", "Dolphin Part"), "0.1");
}
-bool DolphinPart::openUrl(const KUrl& url)
+bool DolphinPart::openUrl(const QUrl &url)
{
bool reload = arguments().reload();
// A bit of a workaround so that changing the namefilter works: force reload.
void DolphinPart::slotFindFile()
{
- KRun::run("kfind", url(), widget());
+ KRun::run("kfind", QList<QUrl>() << url(), widget());
}
void DolphinPart::updateNewMenu()
#ifndef DOLPHINPART_H
#define DOLPHINPART_H
-#include <kparts/part.h>
+#include <KParts/ReadOnlyPart>
+#include <KUrl>
#include <QItemSelectionModel>
class DolphinNewFileMenu;
class DolphinViewActionHandler;
class QActionGroup;
-class KAction;
class KFileItemList;
class KFileItem;
class DolphinPartBrowserExtension;
* Standard KParts::ReadOnlyPart openUrl method.
* Called by Konqueror to view a directory in DolphinPart.
*/
- virtual bool openUrl(const KUrl& url);
+ virtual bool openUrl(const QUrl& url) Q_DECL_OVERRIDE;
/// see the supportsUndo property
bool supportsUndo() const { return true; }
DolphinRemoteEncoding* m_remoteEncoding;
DolphinPartBrowserExtension* m_extension;
DolphinNewFileMenu* m_newFileMenu;
- KAction* m_findFileAction;
- KAction* m_openTerminalAction;
+ QAction* m_findFileAction;
+ QAction* m_openTerminalAction;
QString m_nameFilter;
DolphinRemoveAction* m_removeAction;
Q_DISABLE_COPY(DolphinPart)
#include <kparts/browserextension.h>
#include <kparts/fileinfoextension.h>
#include <kparts/listingextension.h>
+#include <KUrl>
class DolphinPart;
m_collection(collection)
{
update();
- connect(this, SIGNAL(triggered()), this, SLOT(slotRemoveActionTriggered()));
+ connect(this, &DolphinRemoveAction::triggered, this, &DolphinRemoveAction::slotRemoveActionTriggered);
}
void DolphinRemoveAction::slotRemoveActionTriggered()
#include <QBoxLayout>
#include <QTimer>
#include <QScrollBar>
+#include <QMimeData>
#include <KDesktopFile>
#include <KFileItemDelegate>
m_topLayout->setMargin(0);
m_urlNavigator = new KUrlNavigator(new KFilePlacesModel(this), url, this);
- connect(m_urlNavigator, SIGNAL(urlsDropped(KUrl,QDropEvent*)),
- this, SLOT(dropUrls(KUrl,QDropEvent*)));
- connect(m_urlNavigator, SIGNAL(activated()),
- this, SLOT(activate()));
- connect(m_urlNavigator->editor(), SIGNAL(completionModeChanged(KGlobalSettings::Completion)),
- this, SLOT(saveUrlCompletionMode(KGlobalSettings::Completion)));
+ connect(m_urlNavigator, &KUrlNavigator::urlsDropped,
+ this, &DolphinViewContainer::dropUrls);
+ connect(m_urlNavigator, &KUrlNavigator::activated,
+ this, &DolphinViewContainer::activate);
+ connect(m_urlNavigator->editor(), &KUrlComboBox::completionModeChanged,
+ this, &DolphinViewContainer::saveUrlCompletionMode);
const GeneralSettings* settings = GeneralSettings::self();
m_urlNavigator->setUrlEditable(settings->editableUrl());
m_urlNavigator->setShowFullPath(settings->showFullPath());
m_urlNavigator->setHomeUrl(KUrl(settings->homeUrl()));
KUrlComboBox* editor = m_urlNavigator->editor();
- editor->setCompletionMode(KGlobalSettings::Completion(settings->urlCompletionMode()));
+ editor->setCompletionMode(KCompletion::CompletionMode(settings->urlCompletionMode()));
m_searchBox = new DolphinSearchBox(this);
m_searchBox->hide();
- connect(m_searchBox, SIGNAL(activated()), this, SLOT(activate()));
- connect(m_searchBox, SIGNAL(closeRequest()), this, SLOT(closeSearchBox()));
- connect(m_searchBox, SIGNAL(searchRequest()), this, SLOT(startSearching()));
- connect(m_searchBox, SIGNAL(returnPressed(QString)), this, SLOT(requestFocus()));
+ connect(m_searchBox, &DolphinSearchBox::activated, this, &DolphinViewContainer::activate);
+ connect(m_searchBox, &DolphinSearchBox::closeRequest, this, &DolphinViewContainer::closeSearchBox);
+ connect(m_searchBox, &DolphinSearchBox::searchRequest, this, &DolphinViewContainer::startSearching);
+ connect(m_searchBox, &DolphinSearchBox::returnPressed, this, &DolphinViewContainer::requestFocus);
m_messageWidget = new KMessageWidget(this);
m_messageWidget->setCloseButtonVisible(true);
m_messageWidget->hide();
m_view = new DolphinView(url, this);
- connect(m_view, SIGNAL(urlChanged(KUrl)), m_urlNavigator, SLOT(setUrl(KUrl)));
- connect(m_view, SIGNAL(urlChanged(KUrl)), m_messageWidget, SLOT(hide()));
- connect(m_view, SIGNAL(writeStateChanged(bool)), this, SIGNAL(writeStateChanged(bool)));
- connect(m_view, SIGNAL(requestItemInfo(KFileItem)), this, SLOT(showItemInfo(KFileItem)));
- connect(m_view, SIGNAL(itemActivated(KFileItem)), this, SLOT(slotItemActivated(KFileItem)));
- connect(m_view, SIGNAL(itemsActivated(KFileItemList)), this, SLOT(slotItemsActivated(KFileItemList)));
- connect(m_view, SIGNAL(redirection(KUrl,KUrl)), this, SLOT(redirect(KUrl,KUrl)));
- connect(m_view, SIGNAL(directoryLoadingStarted()), this, SLOT(slotDirectoryLoadingStarted()));
- connect(m_view, SIGNAL(directoryLoadingCompleted()), this, SLOT(slotDirectoryLoadingCompleted()));
- connect(m_view, SIGNAL(directoryLoadingCanceled()), this, SLOT(slotDirectoryLoadingCanceled()));
- connect(m_view, SIGNAL(itemCountChanged()), this, SLOT(delayedStatusBarUpdate()));
- connect(m_view, SIGNAL(directoryLoadingProgress(int)), this, SLOT(updateDirectoryLoadingProgress(int)));
- connect(m_view, SIGNAL(directorySortingProgress(int)), this, SLOT(updateDirectorySortingProgress(int)));
- connect(m_view, SIGNAL(selectionChanged(KFileItemList)), this, SLOT(delayedStatusBarUpdate()));
- connect(m_view, SIGNAL(urlAboutToBeChanged(KUrl)), this, SLOT(slotViewUrlAboutToBeChanged(KUrl)));
- connect(m_view, SIGNAL(errorMessage(QString)), this, SLOT(showErrorMessage(QString)));
- connect(m_view, SIGNAL(urlIsFileError(KUrl)), this, SLOT(slotUrlIsFileError(KUrl)));
-
- connect(m_urlNavigator, SIGNAL(urlAboutToBeChanged(KUrl)),
- this, SLOT(slotUrlNavigatorLocationAboutToBeChanged(KUrl)));
- connect(m_urlNavigator, SIGNAL(urlChanged(KUrl)),
- this, SLOT(slotUrlNavigatorLocationChanged(KUrl)));
- connect(m_urlNavigator, SIGNAL(historyChanged()),
- this, SLOT(slotHistoryChanged()));
- connect(m_urlNavigator, SIGNAL(returnPressed()),
- this, SLOT(slotReturnPressed()));
+ connect(m_view, &DolphinView::urlChanged,
+ m_urlNavigator, &KUrlNavigator::setUrl);
+ connect(m_view, &DolphinView::urlChanged,
+ m_messageWidget, &KMessageWidget::hide);
+ connect(m_view, &DolphinView::writeStateChanged,
+ this, &DolphinViewContainer::writeStateChanged);
+ connect(m_view, &DolphinView::requestItemInfo,
+ this, &DolphinViewContainer::showItemInfo);
+ connect(m_view, &DolphinView::itemActivated,
+ this, &DolphinViewContainer::slotItemActivated);
+ connect(m_view, &DolphinView::itemsActivated,
+ this, &DolphinViewContainer::slotItemsActivated);
+ connect(m_view, &DolphinView::redirection,
+ this, &DolphinViewContainer::redirect);
+ connect(m_view, &DolphinView::directoryLoadingStarted,
+ this, &DolphinViewContainer::slotDirectoryLoadingStarted);
+ connect(m_view, &DolphinView::directoryLoadingCompleted,
+ this, &DolphinViewContainer::slotDirectoryLoadingCompleted);
+ connect(m_view, &DolphinView::directoryLoadingCanceled,
+ this, &DolphinViewContainer::slotDirectoryLoadingCanceled);
+ connect(m_view, &DolphinView::itemCountChanged,
+ this, &DolphinViewContainer::delayedStatusBarUpdate);
+ connect(m_view, &DolphinView::directoryLoadingProgress,
+ this, &DolphinViewContainer::updateDirectoryLoadingProgress);
+ connect(m_view, &DolphinView::directorySortingProgress,
+ this, &DolphinViewContainer::updateDirectorySortingProgress);
+ connect(m_view, &DolphinView::selectionChanged,
+ this, &DolphinViewContainer::delayedStatusBarUpdate);
+ connect(m_view, &DolphinView::urlAboutToBeChanged,
+ this, &DolphinViewContainer::slotViewUrlAboutToBeChanged);
+ connect(m_view, &DolphinView::errorMessage,
+ this, &DolphinViewContainer::showErrorMessage);
+ connect(m_view, &DolphinView::urlIsFileError,
+ this, &DolphinViewContainer::slotUrlIsFileError);
+
+ connect(m_urlNavigator, &KUrlNavigator::urlAboutToBeChanged,
+ this, &DolphinViewContainer::slotUrlNavigatorLocationAboutToBeChanged);
+ connect(m_urlNavigator, &KUrlNavigator::urlChanged,
+ this, &DolphinViewContainer::slotUrlNavigatorLocationChanged);
+ connect(m_urlNavigator, &KUrlNavigator::historyChanged,
+ this, &DolphinViewContainer::slotHistoryChanged);
+ connect(m_urlNavigator, &KUrlNavigator::returnPressed,
+ this, &DolphinViewContainer::slotReturnPressed);
// Initialize status bar
m_statusBar = new DolphinStatusBar(this);
m_statusBar->setUrl(m_view->url());
m_statusBar->setZoomLevel(m_view->zoomLevel());
- connect(m_view, SIGNAL(urlChanged(KUrl)), m_statusBar, SLOT(setUrl(KUrl)));
- connect(m_view, SIGNAL(zoomLevelChanged(int,int)), m_statusBar, SLOT(setZoomLevel(int)));
- connect(m_view, SIGNAL(infoMessage(QString)), m_statusBar, SLOT(setText(QString)));
- connect(m_view, SIGNAL(operationCompletedMessage(QString)), m_statusBar, SLOT(setText(QString)));
- connect(m_statusBar, SIGNAL(stopPressed()), this, SLOT(stopDirectoryLoading()));
- connect(m_statusBar, SIGNAL(zoomLevelChanged(int)), this, SLOT(slotStatusBarZoomLevelChanged(int)));
+ connect(m_view, &DolphinView::urlChanged,
+ m_statusBar, &DolphinStatusBar::setUrl);
+ connect(m_view, &DolphinView::zoomLevelChanged,
+ m_statusBar, &DolphinStatusBar::setZoomLevel);
+ connect(m_view, &DolphinView::infoMessage,
+ m_statusBar, &DolphinStatusBar::setText);
+ connect(m_view, &DolphinView::operationCompletedMessage,
+ m_statusBar, &DolphinStatusBar::setText);
+ connect(m_statusBar, &DolphinStatusBar::stopPressed,
+ this, &DolphinViewContainer::stopDirectoryLoading);
+ connect(m_statusBar, &DolphinStatusBar::zoomLevelChanged,
+ this, &DolphinViewContainer::slotStatusBarZoomLevelChanged);
m_statusBarTimer = new QTimer(this);
m_statusBarTimer->setSingleShot(true);
m_statusBarTimer->setInterval(300);
- connect(m_statusBarTimer, SIGNAL(timeout()), this, SLOT(updateStatusBar()));
+ connect(m_statusBarTimer, &QTimer::timeout, this, &DolphinViewContainer::updateStatusBar);
KIO::FileUndoManager* undoManager = KIO::FileUndoManager::self();
- connect(undoManager, SIGNAL(jobRecordingFinished(CommandType)),
- this, SLOT(delayedStatusBarUpdate()));
+ connect(undoManager, &KIO::FileUndoManager::jobRecordingFinished,
+ this, &DolphinViewContainer::delayedStatusBarUpdate);
// Initialize filter bar
m_filterBar = new FilterBar(this);
m_filterBar->setVisible(settings->filterBar());
- connect(m_filterBar, SIGNAL(filterChanged(QString)),
- this, SLOT(setNameFilter(QString)));
- connect(m_filterBar, SIGNAL(closeRequest()),
- this, SLOT(closeFilterBar()));
- connect(m_filterBar, SIGNAL(focusViewRequest()),
- this, SLOT(requestFocus()));
- connect(m_view, SIGNAL(urlChanged(KUrl)),
- m_filterBar, SLOT(slotUrlChanged()));
+ connect(m_filterBar, &FilterBar::filterChanged,
+ this, &DolphinViewContainer::setNameFilter);
+ connect(m_filterBar, &FilterBar::closeRequest,
+ this, &DolphinViewContainer::closeFilterBar);
+ connect(m_filterBar, &FilterBar::focusViewRequest,
+ this, &DolphinViewContainer::requestFocus);
+ connect(m_view, &DolphinView::urlChanged,
+ m_filterBar, &FilterBar::slotUrlChanged);
m_topLayout->addWidget(m_urlNavigator);
m_topLayout->addWidget(m_searchBox);
return;
}
- item.run();
+ new KRun(item.targetUrl(), this);
}
void DolphinViewContainer::slotItemsActivated(const KFileItemList& items)
m_view->setFocus();
}
-void DolphinViewContainer::saveUrlCompletionMode(KGlobalSettings::Completion completion)
+void DolphinViewContainer::saveUrlCompletionMode(KCompletion::CompletionMode completion)
{
GeneralSettings::setUrlCompletionMode(completion);
}
#include <KFileItem>
#include <KFileItemDelegate>
-#include <KGlobalSettings>
+#include <KCompletion>
#include <KIO/Job>
#include <KUrlNavigator>
* Saves the currently used URL completion mode of
* the URL navigator.
*/
- void saveUrlCompletionMode(KGlobalSettings::Completion completion);
+ void saveUrlCompletionMode(KCompletion::CompletionMode completion);
void slotHistoryChanged();
closeButton->setAutoRaise(true);
closeButton->setIcon(KIcon("dialog-close"));
closeButton->setToolTip(i18nc("@info:tooltip", "Hide Filter Bar"));
- connect(closeButton, SIGNAL(clicked()), this, SIGNAL(closeRequest()));
+ connect(closeButton, &QToolButton::clicked, this, &FilterBar::closeRequest);
// Create button to lock text when changing folders
m_lockButton = new QToolButton(this);
m_lockButton->setCheckable(true);
m_lockButton->setIcon(KIcon("object-unlocked"));
m_lockButton->setToolTip(i18nc("@info:tooltip", "Keep Filter When Changing Folders"));
- connect(m_lockButton, SIGNAL(toggled(bool)), this, SLOT(slotToggleLockButton(bool)));
+ connect(m_lockButton, &QToolButton::toggled, this, &FilterBar::slotToggleLockButton);
// Create label
QLabel* filterLabel = new QLabel(i18nc("@label:textbox", "Filter:"), this);
m_filterInput = new KLineEdit(this);
m_filterInput->setLayoutDirection(Qt::LeftToRight);
m_filterInput->setClearButtonShown(true);
- connect(m_filterInput, SIGNAL(textChanged(QString)),
- this, SIGNAL(filterChanged(QString)));
+ connect(m_filterInput, &KLineEdit::textChanged,
+ this, &FilterBar::filterChanged);
setFocusProxy(m_filterInput);
// Apply layout
#include <KDebug>
#include <KIcon>
#include <KTextEdit>
+#include <KIconLoader>
+#include <KDateTime>
#include <QPainter>
#include <QTextLine>
m_updateVisibleIndexRangeTimer = new QTimer(this);
m_updateVisibleIndexRangeTimer->setSingleShot(true);
m_updateVisibleIndexRangeTimer->setInterval(ShortInterval);
- connect(m_updateVisibleIndexRangeTimer, SIGNAL(timeout()), this, SLOT(updateVisibleIndexRange()));
+ connect(m_updateVisibleIndexRangeTimer, &QTimer::timeout, this, &KFileItemListView::updateVisibleIndexRange);
m_updateIconSizeTimer = new QTimer(this);
m_updateIconSizeTimer->setSingleShot(true);
m_updateIconSizeTimer->setInterval(LongInterval);
- connect(m_updateIconSizeTimer, SIGNAL(timeout()), this, SLOT(updateIconSize()));
+ connect(m_updateIconSizeTimer, &QTimer::timeout, this, &KFileItemListView::updateIconSize);
setVisibleRoles(QList<QByteArray>() << "text");
}
#include <KLocale>
#include <KStringHandler>
#include <KDebug>
+#include <kstringhandler_deprecated.h> //TODO: port to QCollator
#include "private/kfileitemmodelsortalgorithm.h"
#include "private/kfileitemmodeldirlister.h"
m_dirLister->setMainWindow(parentWidget->window());
}
- connect(m_dirLister, SIGNAL(started(KUrl)), this, SIGNAL(directoryLoadingStarted()));
- connect(m_dirLister, SIGNAL(canceled()), this, SLOT(slotCanceled()));
- connect(m_dirLister, SIGNAL(completed(KUrl)), this, SLOT(slotCompleted()));
- connect(m_dirLister, SIGNAL(itemsAdded(KUrl,KFileItemList)), this, SLOT(slotItemsAdded(KUrl,KFileItemList)));
- connect(m_dirLister, SIGNAL(itemsDeleted(KFileItemList)), this, SLOT(slotItemsDeleted(KFileItemList)));
- connect(m_dirLister, SIGNAL(refreshItems(QList<QPair<KFileItem,KFileItem> >)), this, SLOT(slotRefreshItems(QList<QPair<KFileItem,KFileItem> >)));
- connect(m_dirLister, SIGNAL(clear()), this, SLOT(slotClear()));
- connect(m_dirLister, SIGNAL(infoMessage(QString)), this, SIGNAL(infoMessage(QString)));
- connect(m_dirLister, SIGNAL(errorMessage(QString)), this, SIGNAL(errorMessage(QString)));
- connect(m_dirLister, SIGNAL(redirection(KUrl,KUrl)), this, SIGNAL(directoryRedirection(KUrl,KUrl)));
- connect(m_dirLister, SIGNAL(urlIsFileError(KUrl)), this, SIGNAL(urlIsFileError(KUrl)));
+ connect(m_dirLister, &KFileItemModelDirLister::started, this, &KFileItemModel::directoryLoadingStarted);
+ connect(m_dirLister, static_cast<void(KFileItemModelDirLister::*)()>(&KFileItemModelDirLister::canceled), this, &KFileItemModel::slotCanceled);
+ connect(m_dirLister, static_cast<void(KFileItemModelDirLister::*)(const QUrl&)>(&KFileItemModelDirLister::completed), this, &KFileItemModel::slotCompleted);
+ connect(m_dirLister, &KFileItemModelDirLister::itemsAdded, this, &KFileItemModel::slotItemsAdded);
+ connect(m_dirLister, &KFileItemModelDirLister::itemsDeleted, this, &KFileItemModel::slotItemsDeleted);
+ connect(m_dirLister, &KFileItemModelDirLister::refreshItems, this, &KFileItemModel::slotRefreshItems);
+ connect(m_dirLister, static_cast<void(KFileItemModelDirLister::*)()>(&KFileItemModelDirLister::clear), this, &KFileItemModel::slotClear);
+ connect(m_dirLister, &KFileItemModelDirLister::infoMessage, this, &KFileItemModel::infoMessage);
+ connect(m_dirLister, &KFileItemModelDirLister::errorMessage, this, &KFileItemModel::errorMessage);
+ connect(m_dirLister, static_cast<void(KFileItemModelDirLister::*)(const QUrl&, const QUrl&)>(&KFileItemModelDirLister::redirection), this, &KFileItemModel::directoryRedirection);
+ connect(m_dirLister, &KFileItemModelDirLister::urlIsFileError, this, &KFileItemModel::urlIsFileError);
// Apply default roles that should be determined
resetRoles();
m_maximumUpdateIntervalTimer = new QTimer(this);
m_maximumUpdateIntervalTimer->setInterval(2000);
m_maximumUpdateIntervalTimer->setSingleShot(true);
- connect(m_maximumUpdateIntervalTimer, SIGNAL(timeout()), this, SLOT(dispatchPendingItemsToInsert()));
+ connect(m_maximumUpdateIntervalTimer, &QTimer::timeout, this, &KFileItemModel::dispatchPendingItemsToInsert);
// When changing the value of an item which represents the sort-role a resorting must be
// triggered. Especially in combination with KFileItemModelRolesUpdater this might be done
m_resortAllItemsTimer = new QTimer(this);
m_resortAllItemsTimer->setInterval(500);
m_resortAllItemsTimer->setSingleShot(true);
- connect(m_resortAllItemsTimer, SIGNAL(timeout()), this, SLOT(resortAllItems()));
+ connect(m_resortAllItemsTimer, &QTimer::timeout, this, &KFileItemModel::resortAllItems);
- connect(KGlobalSettings::self(), SIGNAL(naturalSortingChanged()), this, SLOT(slotNaturalSortingChanged()));
+ connect(KGlobalSettings::self(), &KGlobalSettings::naturalSortingChanged,
+ this, &KFileItemModel::slotNaturalSortingChanged);
}
KFileItemModel::~KFileItemModel()
int KFileItemModel::index(const KFileItem& item) const
{
- return index(item.url());
+ return index(KUrl(item.url()));
}
int KFileItemModel::index(const KUrl& url) const
// might result in emitting the same items twice due to the Keep-parameter.
// This case happens if an item gets expanded, collapsed and expanded again
// before the items could be loaded for the first expansion.
- if (index(items.first().url()) >= 0) {
+ if (index(KUrl(items.first().url())) >= 0) {
// The items are already part of the model.
return;
}
// Don't use KFileItem::timeString() as this is too expensive when
// having several thousands of items. Instead the formatting of the
// date-time will be done on-demand by the view when the date will be shown.
- const KDateTime dateTime = item.time(KFileItem::ModificationTime);
- data.insert(sharedValue("date"), dateTime.dateTime());
+ const QDateTime dateTime = item.time(KFileItem::ModificationTime);
+ data.insert(sharedValue("date"), dateTime);
}
if (m_requestRole[PermissionsRole]) {
if (m_requestRole[PathRole]) {
QString path;
- if (item.url().protocol() == QLatin1String("trash")) {
+ if (item.url().scheme() == QLatin1String("trash")) {
path = item.entry().stringValue(KIO::UDSEntry::UDS_EXTRA);
} else {
// For performance reasons cache the home-path in a static QString
}
case DateRole: {
- const KDateTime dateTimeA = itemA.time(KFileItem::ModificationTime);
- const KDateTime dateTimeB = itemB.time(KFileItem::ModificationTime);
+ const QDateTime dateTimeA = itemA.time(KFileItem::ModificationTime);
+ const QDateTime dateTimeB = itemB.time(KFileItem::ModificationTime);
if (dateTimeA < dateTimeB) {
result = -1;
} else if (dateTimeA > dateTimeB) {
const int maxIndex = count() - 1;
QList<QPair<int, QVariant> > groups;
- const QDate currentDate = KDateTime::currentLocalDateTime().date();
+ const QDate currentDate = QDate::currentDate();
QDate previousModifiedDate;
QString groupValue;
continue;
}
- const KDateTime modifiedTime = m_itemData.at(i)->item.time(KFileItem::ModificationTime);
+ const QDateTime modifiedTime = m_itemData.at(i)->item.time(KFileItem::ModificationTime);
const QDate modifiedDate = modifiedTime.date();
if (modifiedDate == previousModifiedDate) {
// The current item is in the same group as the previous item
}
permissionsString = newPermissionsString;
- const QFileInfo info(itemData->item.url().pathOrUrl());
+ const QFileInfo info(itemData->item.url().toLocalFile());
// Set user string
QString user;
#include <KDebug>
#include <KFileItem>
#include <KGlobal>
+#include <KIconLoader>
+#include <KJobWidgets>
#include <KIO/JobUiDelegate>
#include <KIO/PreviewJob>
<< "imagethumbnail"
<< "jpegthumbnail");
- connect(m_model, SIGNAL(itemsInserted(KItemRangeList)),
- this, SLOT(slotItemsInserted(KItemRangeList)));
- connect(m_model, SIGNAL(itemsRemoved(KItemRangeList)),
- this, SLOT(slotItemsRemoved(KItemRangeList)));
- connect(m_model, SIGNAL(itemsChanged(KItemRangeList,QSet<QByteArray>)),
- this, SLOT(slotItemsChanged(KItemRangeList,QSet<QByteArray>)));
- connect(m_model, SIGNAL(itemsMoved(KItemRange,QList<int>)),
- this, SLOT(slotItemsMoved(KItemRange,QList<int>)));
- connect(m_model, SIGNAL(sortRoleChanged(QByteArray,QByteArray)),
- this, SLOT(slotSortRoleChanged(QByteArray,QByteArray)));
+ connect(m_model, &KFileItemModel::itemsInserted,
+ this, &KFileItemModelRolesUpdater::slotItemsInserted);
+ connect(m_model, &KFileItemModel::itemsRemoved,
+ this, &KFileItemModelRolesUpdater::slotItemsRemoved);
+ connect(m_model, &KFileItemModel::itemsChanged,
+ this, &KFileItemModelRolesUpdater::slotItemsChanged);
+ connect(m_model, &KFileItemModel::itemsMoved,
+ this, &KFileItemModelRolesUpdater::slotItemsMoved);
+ connect(m_model, &KFileItemModel::sortRoleChanged,
+ this, &KFileItemModelRolesUpdater::slotSortRoleChanged);
// Use a timer to prevent that each call of slotItemsChanged() results in a synchronous
// resolving of the roles. Postpone the resolving until no update has been done for 1 second.
m_recentlyChangedItemsTimer = new QTimer(this);
m_recentlyChangedItemsTimer->setInterval(1000);
m_recentlyChangedItemsTimer->setSingleShot(true);
- connect(m_recentlyChangedItemsTimer, SIGNAL(timeout()), this, SLOT(resolveRecentlyChangedItems()));
+ connect(m_recentlyChangedItemsTimer, &QTimer::timeout, this, &KFileItemModelRolesUpdater::resolveRecentlyChangedItems);
m_resolvableRoles.insert("size");
m_resolvableRoles.insert("type");
#endif
m_directoryContentsCounter = new KDirectoryContentsCounter(m_model, this);
- connect(m_directoryContentsCounter, SIGNAL(result(QString,int)),
- this, SLOT(slotDirectoryContentsCountReceived(QString,int)));
+ connect(m_directoryContentsCounter, &KDirectoryContentsCounter::result,
+ this, &KFileItemModelRolesUpdater::slotDirectoryContentsCountReceived);
}
KFileItemModelRolesUpdater::~KFileItemModelRolesUpdater()
if (hasBalooRole && !m_balooFileMonitor) {
m_balooFileMonitor = new Baloo::FileMonitor(this);
- connect(m_balooFileMonitor, SIGNAL(fileMetaDataChanged(QString)),
- this, SLOT(applyChangedBalooRoles(QString)));
+ connect(m_balooFileMonitor, &Baloo::FileMonitor::fileMetaDataChanged,
+ this, &KFileItemModelRolesUpdater::applyChangedBalooRoles);
} else if (!hasBalooRole && m_balooFileMonitor) {
delete m_balooFileMonitor;
m_balooFileMonitor = 0;
data.insert("iconPixmap", scaledPixmap);
- disconnect(m_model, SIGNAL(itemsChanged(KItemRangeList,QSet<QByteArray>)),
- this, SLOT(slotItemsChanged(KItemRangeList,QSet<QByteArray>)));
+ disconnect(m_model, &KFileItemModel::itemsChanged,
+ this, &KFileItemModelRolesUpdater::slotItemsChanged);
m_model->setData(index, data);
- connect(m_model, SIGNAL(itemsChanged(KItemRangeList,QSet<QByteArray>)),
- this, SLOT(slotItemsChanged(KItemRangeList,QSet<QByteArray>)));
+ connect(m_model, &KFileItemModel::itemsChanged,
+ this, &KFileItemModelRolesUpdater::slotItemsChanged);
m_finishedItems.insert(item);
}
QHash<QByteArray, QVariant> data;
data.insert("iconPixmap", QPixmap());
- disconnect(m_model, SIGNAL(itemsChanged(KItemRangeList,QSet<QByteArray>)),
- this, SLOT(slotItemsChanged(KItemRangeList,QSet<QByteArray>)));
+ disconnect(m_model, &KFileItemModel::itemsChanged,
+ this, &KFileItemModelRolesUpdater::slotItemsChanged);
m_model->setData(index, data);
- connect(m_model, SIGNAL(itemsChanged(KItemRangeList,QSet<QByteArray>)),
- this, SLOT(slotItemsChanged(KItemRangeList,QSet<QByteArray>)));
+ connect(m_model, &KFileItemModel::itemsChanged,
+ this, &KFileItemModelRolesUpdater::slotItemsChanged);
applyResolvedRoles(index, ResolveAll);
m_finishedItems.insert(item);
m_state = Idle;
// Prevent that we try to update the items twice.
- disconnect(m_model, SIGNAL(itemsMoved(KItemRange,QList<int>)),
- this, SLOT(slotItemsMoved(KItemRange,QList<int>)));
+ disconnect(m_model, &KFileItemModel::itemsMoved,
+ this, &KFileItemModelRolesUpdater::slotItemsMoved);
applySortProgressToModel();
- connect(m_model, SIGNAL(itemsMoved(KItemRange,QList<int>)),
- this, SLOT(slotItemsMoved(KItemRange,QList<int>)));
+ connect(m_model, &KFileItemModel::itemsMoved,
+ this, &KFileItemModelRolesUpdater::slotItemsMoved);
startUpdating();
}
}
QHash<QByteArray, QVariant> data;
data.insert("iconPixmap", QPixmap());
- disconnect(m_model, SIGNAL(itemsChanged(KItemRangeList,QSet<QByteArray>)),
- this, SLOT(slotItemsChanged(KItemRangeList,QSet<QByteArray>)));
+ disconnect(m_model, &KFileItemModel::itemsChanged,
+ this, &KFileItemModelRolesUpdater::slotItemsChanged);
for (int index = 0; index <= m_model->count(); ++index) {
if (m_model->data(index).contains("iconPixmap")) {
m_model->setData(index, data);
}
}
- connect(m_model, SIGNAL(itemsChanged(KItemRangeList,QSet<QByteArray>)),
- this, SLOT(slotItemsChanged(KItemRangeList,QSet<QByteArray>)));
+ connect(m_model, &KFileItemModel::itemsChanged,
+ this, &KFileItemModelRolesUpdater::slotItemsChanged);
}
m_clearPreviews = false;
}
Baloo::FileFetchJob* job = new Baloo::FileFetchJob(item.localPath());
- connect(job, SIGNAL(finished(KJob*)), this, SLOT(applyChangedBalooRolesJobFinished(KJob*)));
+ connect(job, &Baloo::FileFetchJob::finished, this, &KFileItemModelRolesUpdater::applyChangedBalooRolesJobFinished);
job->setProperty("item", QVariant::fromValue(item));
job->start();
#else
data.insert(it.key(), it.value());
}
- disconnect(m_model, SIGNAL(itemsChanged(KItemRangeList,QSet<QByteArray>)),
- this, SLOT(slotItemsChanged(KItemRangeList,QSet<QByteArray>)));
+ disconnect(m_model, &KFileItemModel::itemsChanged,
+ this, &KFileItemModelRolesUpdater::slotItemsChanged);
const int index = m_model->index(item);
m_model->setData(index, data);
- connect(m_model, SIGNAL(itemsChanged(KItemRangeList,QSet<QByteArray>)),
- this, SLOT(slotItemsChanged(KItemRangeList,QSet<QByteArray>)));
+ connect(m_model, &KFileItemModel::itemsChanged,
+ this, &KFileItemModelRolesUpdater::slotItemsChanged);
#endif
}
data.insert("isExpandable", count > 0);
}
- disconnect(m_model, SIGNAL(itemsChanged(KItemRangeList,QSet<QByteArray>)),
- this, SLOT(slotItemsChanged(KItemRangeList,QSet<QByteArray>)));
+ disconnect(m_model, &KFileItemModel::itemsChanged,
+ this, &KFileItemModelRolesUpdater::slotItemsChanged);
m_model->setData(index, data);
- connect(m_model, SIGNAL(itemsChanged(KItemRangeList,QSet<QByteArray>)),
- this, SLOT(slotItemsChanged(KItemRangeList,QSet<QByteArray>)));
+ connect(m_model, &KFileItemModel::itemsChanged,
+ this, &KFileItemModelRolesUpdater::slotItemsChanged);
}
}
}
job->setIgnoreMaximumSize(itemSubSet.first().isLocalFile());
if (job->ui()) {
- job->ui()->setWindow(qApp->activeWindow());
+ KJobWidgets::setWindow(job, qApp->activeWindow());
}
- connect(job, SIGNAL(gotPreview(KFileItem,QPixmap)),
- this, SLOT(slotGotPreview(KFileItem,QPixmap)));
- connect(job, SIGNAL(failed(KFileItem)),
- this, SLOT(slotPreviewFailed(KFileItem)));
- connect(job, SIGNAL(finished(KJob*)),
- this, SLOT(slotPreviewJobFinished()));
+ connect(job, &KIO::PreviewJob::gotPreview,
+ this, &KFileItemModelRolesUpdater::slotGotPreview);
+ connect(job, &KIO::PreviewJob::failed,
+ this, &KFileItemModelRolesUpdater::slotPreviewFailed);
+ connect(job, &KIO::PreviewJob::finished,
+ this, &KFileItemModelRolesUpdater::slotPreviewJobFinished);
m_previewJob = job;
}
data = rolesData(item);
}
- disconnect(m_model, SIGNAL(itemsChanged(KItemRangeList,QSet<QByteArray>)),
- this, SLOT(slotItemsChanged(KItemRangeList,QSet<QByteArray>)));
+ disconnect(m_model, &KFileItemModel::itemsChanged,
+ this, &KFileItemModelRolesUpdater::slotItemsChanged);
m_model->setData(index, data);
- connect(m_model, SIGNAL(itemsChanged(KItemRangeList,QSet<QByteArray>)),
- this, SLOT(slotItemsChanged(KItemRangeList,QSet<QByteArray>)));
+ connect(m_model, &KFileItemModel::itemsChanged,
+ this, &KFileItemModelRolesUpdater::slotItemsChanged);
}
void KFileItemModelRolesUpdater::applySortProgressToModel()
data.insert("iconPixmap", QPixmap());
}
- disconnect(m_model, SIGNAL(itemsChanged(KItemRangeList,QSet<QByteArray>)),
- this, SLOT(slotItemsChanged(KItemRangeList,QSet<QByteArray>)));
+ disconnect(m_model, &KFileItemModel::itemsChanged,
+ this, &KFileItemModelRolesUpdater::slotItemsChanged);
m_model->setData(index, data);
- connect(m_model, SIGNAL(itemsChanged(KItemRangeList,QSet<QByteArray>)),
- this, SLOT(slotItemsChanged(KItemRangeList,QSet<QByteArray>)));
+ connect(m_model, &KFileItemModel::itemsChanged,
+ this, &KFileItemModelRolesUpdater::slotItemsChanged);
return true;
}
void KFileItemModelRolesUpdater::killPreviewJob()
{
if (m_previewJob) {
- disconnect(m_previewJob, SIGNAL(gotPreview(KFileItem,QPixmap)),
- this, SLOT(slotGotPreview(KFileItem,QPixmap)));
- disconnect(m_previewJob, SIGNAL(failed(KFileItem)),
- this, SLOT(slotPreviewFailed(KFileItem)));
- disconnect(m_previewJob, SIGNAL(finished(KJob*)),
- this, SLOT(slotPreviewJobFinished()));
+ disconnect(m_previewJob, &KIO::PreviewJob::gotPreview,
+ this, &KFileItemModelRolesUpdater::slotGotPreview);
+ disconnect(m_previewJob, &KIO::PreviewJob::failed,
+ this, &KFileItemModelRolesUpdater::slotPreviewFailed);
+ disconnect(m_previewJob, &KIO::PreviewJob::finished,
+ this, &KFileItemModelRolesUpdater::slotPreviewJobFinished);
m_previewJob->kill();
m_previewJob = 0;
m_pendingPreviewItems.clear();
class QPixmap;
class QTimer;
+namespace KIO {
+ class PreviewJob;
+}
+
#ifdef HAVE_BALOO
namespace Baloo
{
// A new preview job will be started from them once the first one finishes.
KFileItemList m_pendingPreviewItems;
- KJob* m_previewJob;
+ KIO::PreviewJob* m_previewJob;
// When downloading or copying large files, the slot slotItemsChanged()
// will be called periodically within a quite short delay. To prevent
slotViewChanged(controller->view(), 0);
}
- connect(controller, SIGNAL(modelChanged(KItemModelBase*,KItemModelBase*)),
- this, SLOT(slotModelChanged(KItemModelBase*,KItemModelBase*)));
- connect(controller, SIGNAL(viewChanged(KItemListView*,KItemListView*)),
- this, SLOT(slotViewChanged(KItemListView*,KItemListView*)));
+ connect(controller, &KItemListController::modelChanged,
+ this, &KItemListContainer::slotModelChanged);
+ connect(controller, &KItemListController::viewChanged,
+ this, &KItemListContainer::slotViewChanged);
}
KItemListContainer::~KItemListContainer()
QGraphicsScene* scene = static_cast<QGraphicsView*>(viewport())->scene();
if (previous) {
scene->removeItem(previous);
- disconnect(previous, SIGNAL(scrollOrientationChanged(Qt::Orientation,Qt::Orientation)), this, SLOT(slotScrollOrientationChanged(Qt::Orientation,Qt::Orientation)));
- disconnect(previous, SIGNAL(scrollOffsetChanged(qreal,qreal)), this, SLOT(updateScrollOffsetScrollBar()));
- disconnect(previous, SIGNAL(maximumScrollOffsetChanged(qreal,qreal)), this, SLOT(updateScrollOffsetScrollBar()));
- disconnect(previous, SIGNAL(itemOffsetChanged(qreal,qreal)), this, SLOT(updateItemOffsetScrollBar()));
- disconnect(previous, SIGNAL(maximumItemOffsetChanged(qreal,qreal)), this, SLOT(updateItemOffsetScrollBar()));
- disconnect(previous, SIGNAL(scrollTo(qreal)), this, SLOT(scrollTo(qreal)));
+ disconnect(previous, &KItemListView::scrollOrientationChanged,
+ this, &KItemListContainer::slotScrollOrientationChanged);
+ disconnect(previous, &KItemListView::scrollOffsetChanged,
+ this, &KItemListContainer::updateScrollOffsetScrollBar);
+ disconnect(previous, &KItemListView::maximumScrollOffsetChanged,
+ this, &KItemListContainer::updateScrollOffsetScrollBar);
+ disconnect(previous, &KItemListView::itemOffsetChanged,
+ this, &KItemListContainer::updateItemOffsetScrollBar);
+ disconnect(previous, &KItemListView::maximumItemOffsetChanged,
+ this, &KItemListContainer::updateItemOffsetScrollBar);
+ disconnect(previous, &KItemListView::scrollTo, this, &KItemListContainer::scrollTo);
m_horizontalSmoothScroller->setTargetObject(0);
m_verticalSmoothScroller->setTargetObject(0);
}
if (current) {
scene->addItem(current);
- connect(current, SIGNAL(scrollOrientationChanged(Qt::Orientation,Qt::Orientation)), this, SLOT(slotScrollOrientationChanged(Qt::Orientation,Qt::Orientation)));
- connect(current, SIGNAL(scrollOffsetChanged(qreal,qreal)), this, SLOT(updateScrollOffsetScrollBar()));
- connect(current, SIGNAL(maximumScrollOffsetChanged(qreal,qreal)), this, SLOT(updateScrollOffsetScrollBar()));
- connect(current, SIGNAL(itemOffsetChanged(qreal,qreal)), this, SLOT(updateItemOffsetScrollBar()));
- connect(current, SIGNAL(maximumItemOffsetChanged(qreal,qreal)), this, SLOT(updateItemOffsetScrollBar()));
- connect(current, SIGNAL(scrollTo(qreal)), this, SLOT(scrollTo(qreal)));
+ connect(current, &KItemListView::scrollOrientationChanged,
+ this, &KItemListContainer::slotScrollOrientationChanged);
+ connect(current, &KItemListView::scrollOffsetChanged,
+ this, &KItemListContainer::updateScrollOffsetScrollBar);
+ connect(current, &KItemListView::maximumScrollOffsetChanged,
+ this, &KItemListContainer::updateScrollOffsetScrollBar);
+ connect(current, &KItemListView::itemOffsetChanged,
+ this, &KItemListContainer::updateItemOffsetScrollBar);
+ connect(current, &KItemListView::maximumItemOffsetChanged,
+ this, &KItemListContainer::updateItemOffsetScrollBar);
+ connect(current, &KItemListView::scrollTo, this, &KItemListContainer::scrollTo);
m_horizontalSmoothScroller->setTargetObject(current);
m_verticalSmoothScroller->setTargetObject(current);
updateSmoothScrollers(current->scrollOrientation());
m_keyboardAnchorIndex(-1),
m_keyboardAnchorPos(0)
{
- connect(m_keyboardManager, SIGNAL(changeCurrentItem(QString,bool)),
- this, SLOT(slotChangeCurrentItem(QString,bool)));
- connect(m_selectionManager, SIGNAL(currentChanged(int,int)),
- m_keyboardManager, SLOT(slotCurrentChanged(int,int)));
+ connect(m_keyboardManager, &KItemListKeyboardSearchManager::changeCurrentItem,
+ this, &KItemListController::slotChangeCurrentItem);
+ connect(m_selectionManager, &KItemListSelectionManager::currentChanged,
+ m_keyboardManager, &KItemListKeyboardSearchManager::slotCurrentChanged);
m_autoActivationTimer = new QTimer(this);
m_autoActivationTimer->setSingleShot(true);
m_autoActivationTimer->setInterval(-1);
- connect(m_autoActivationTimer, SIGNAL(timeout()), this, SLOT(slotAutoActivationTimeout()));
+ connect(m_autoActivationTimer, &QTimer::timeout, this, &KItemListController::slotAutoActivationTimeout);
setModel(model);
setView(view);
KItemListView* oldView = m_view;
if (oldView) {
- disconnect(oldView, SIGNAL(scrollOffsetChanged(qreal,qreal)), this, SLOT(slotViewScrollOffsetChanged(qreal,qreal)));
+ disconnect(oldView, &KItemListView::scrollOffsetChanged, this, &KItemListController::slotViewScrollOffsetChanged);
oldView->deleteLater();
}
m_view->setParent(this);
m_view->setController(this);
m_view->setModel(m_model);
- connect(m_view, SIGNAL(scrollOffsetChanged(qreal,qreal)), this, SLOT(slotViewScrollOffsetChanged(qreal,qreal)));
+ connect(m_view, &KItemListView::scrollOffsetChanged, this, &KItemListController::slotViewScrollOffsetChanged);
updateExtendedSelectionRegion();
}
rubberBand->setStartPosition(startPos);
rubberBand->setEndPosition(startPos);
rubberBand->setActive(true);
- connect(rubberBand, SIGNAL(endPositionChanged(QPointF,QPointF)), this, SLOT(slotRubberBandChanged()));
+ connect(rubberBand, &KItemListRubberBand::endPositionChanged, this, &KItemListController::slotRubberBandChanged);
m_view->setAutoScroll(true);
}
KItemListRubberBand* rubberBand = m_view->rubberBand();
if (rubberBand->isActive()) {
- disconnect(rubberBand, SIGNAL(endPositionChanged(QPointF,QPointF)), this, SLOT(slotRubberBandChanged()));
+ disconnect(rubberBand, &KItemListRubberBand::endPositionChanged, this, &KItemListController::slotRubberBandChanged);
rubberBand->setActive(false);
m_oldSelection.clear();
m_view->setAutoScroll(false);
m_headerWidget = m_view->m_headerWidget;
Q_ASSERT(m_headerWidget);
- connect(m_headerWidget, SIGNAL(columnWidthChanged(QByteArray,qreal,qreal)),
- this, SIGNAL(columnWidthChanged(QByteArray,qreal,qreal)));
+ connect(m_headerWidget, &KItemListHeaderWidget::columnWidthChanged,
+ this, &KItemListHeader::columnWidthChanged);
}
#include "kitemlistheader.moc"
#include <algorithm>
+#if 0
#include "kitemlistviewaccessible.h"
+#else
+#define QT_NO_ACCESSIBILITY 1
+#pragma message("TODO: port accessibility to Qt5")
+#endif
namespace {
// Time in ms until reaching the autoscroll margin triggers
m_layouter = new KItemListViewLayouter(m_sizeHintResolver, this);
m_animation = new KItemListViewAnimation(this);
- connect(m_animation, SIGNAL(finished(QGraphicsWidget*,KItemListViewAnimation::AnimationType)),
- this, SLOT(slotAnimationFinished(QGraphicsWidget*,KItemListViewAnimation::AnimationType)));
+ connect(m_animation, &KItemListViewAnimation::finished,
+ this, &KItemListView::slotAnimationFinished);
m_layoutTimer = new QTimer(this);
m_layoutTimer->setInterval(300);
m_layoutTimer->setSingleShot(true);
- connect(m_layoutTimer, SIGNAL(timeout()), this, SLOT(slotLayoutTimerFinished()));
+ connect(m_layoutTimer, &QTimer::timeout, this, &KItemListView::slotLayoutTimerFinished);
m_rubberBand = new KItemListRubberBand(this);
- connect(m_rubberBand, SIGNAL(activationChanged(bool)), this, SLOT(slotRubberBandActivationChanged(bool)));
+ connect(m_rubberBand, &KItemListRubberBand::activationChanged, this, &KItemListView::slotRubberBandActivationChanged);
m_headerWidget = new KItemListHeaderWidget(this);
m_headerWidget->setVisible(false);
if (enabled && !m_autoScrollTimer) {
m_autoScrollTimer = new QTimer(this);
m_autoScrollTimer->setSingleShot(true);
- connect(m_autoScrollTimer, SIGNAL(timeout()), this, SLOT(triggerAutoScrolling()));
+ connect(m_autoScrollTimer, &QTimer::timeout, this, &KItemListView::triggerAutoScrolling);
m_autoScrollTimer->start(InitialAutoScrollDelay);
} else if (!enabled && m_autoScrollTimer) {
delete m_autoScrollTimer;
m_headerWidget->setColumns(m_visibleRoles);
m_headerWidget->setZValue(1);
- connect(m_headerWidget, SIGNAL(columnWidthChanged(QByteArray,qreal,qreal)),
- this, SLOT(slotHeaderColumnWidthChanged(QByteArray,qreal,qreal)));
- connect(m_headerWidget, SIGNAL(columnMoved(QByteArray,int,int)),
- this, SLOT(slotHeaderColumnMoved(QByteArray,int,int)));
- connect(m_headerWidget, SIGNAL(sortOrderChanged(Qt::SortOrder,Qt::SortOrder)),
- this, SIGNAL(sortOrderChanged(Qt::SortOrder,Qt::SortOrder)));
- connect(m_headerWidget, SIGNAL(sortRoleChanged(QByteArray,QByteArray)),
- this, SIGNAL(sortRoleChanged(QByteArray,QByteArray)));
+ connect(m_headerWidget, &KItemListHeaderWidget::columnWidthChanged,
+ this, &KItemListView::slotHeaderColumnWidthChanged);
+ connect(m_headerWidget, &KItemListHeaderWidget::columnMoved,
+ this, &KItemListView::slotHeaderColumnMoved);
+ connect(m_headerWidget, &KItemListHeaderWidget::sortOrderChanged,
+ this, &KItemListView::sortOrderChanged);
+ connect(m_headerWidget, &KItemListHeaderWidget::sortRoleChanged,
+ this, &KItemListView::sortRoleChanged);
m_layouter->setHeaderHeight(headerSize.height());
m_headerWidget->setVisible(true);
} else if (!visible && m_headerWidget->isVisible()) {
- disconnect(m_headerWidget, SIGNAL(columnWidthChanged(QByteArray,qreal,qreal)),
- this, SLOT(slotHeaderColumnWidthChanged(QByteArray,qreal,qreal)));
- disconnect(m_headerWidget, SIGNAL(columnMoved(QByteArray,int,int)),
- this, SLOT(slotHeaderColumnMoved(QByteArray,int,int)));
- disconnect(m_headerWidget, SIGNAL(sortOrderChanged(Qt::SortOrder,Qt::SortOrder)),
- this, SIGNAL(sortOrderChanged(Qt::SortOrder,Qt::SortOrder)));
- disconnect(m_headerWidget, SIGNAL(sortRoleChanged(QByteArray,QByteArray)),
- this, SIGNAL(sortRoleChanged(QByteArray,QByteArray)));
+ disconnect(m_headerWidget, &KItemListHeaderWidget::columnWidthChanged,
+ this, &KItemListView::slotHeaderColumnWidthChanged);
+ disconnect(m_headerWidget, &KItemListHeaderWidget::columnMoved,
+ this, &KItemListView::slotHeaderColumnMoved);
+ disconnect(m_headerWidget, &KItemListHeaderWidget::sortOrderChanged,
+ this, &KItemListView::sortOrderChanged);
+ disconnect(m_headerWidget, &KItemListHeaderWidget::sortRoleChanged,
+ this, &KItemListView::sortRoleChanged);
m_layouter->setHeaderHeight(0);
m_headerWidget->setVisible(false);
m_editingRole = true;
widget->setEditedRole(role);
- connect(widget, SIGNAL(roleEditingCanceled(int,QByteArray,QVariant)),
- this, SLOT(slotRoleEditingCanceled(int,QByteArray,QVariant)));
- connect(widget, SIGNAL(roleEditingFinished(int,QByteArray,QVariant)),
- this, SLOT(slotRoleEditingFinished(int,QByteArray,QVariant)));
+ connect(widget, &KItemListWidget::roleEditingCanceled,
+ this, &KItemListView::slotRoleEditingCanceled);
+ connect(widget, &KItemListWidget::roleEditingFinished,
+ this, &KItemListView::slotRoleEditingFinished);
}
void KItemListView::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget)
doLayout(NoAnimation);
}
}
- QAccessible::updateAccessibility(this, 0, QAccessible::TableModelChanged);
+#pragma message("TODO: port accessibility otherwise the following line asserts")
+ //QAccessible::updateAccessibility(this, 0, QAccessible::TableModelChanged);
}
void KItemListView::slotGroupsChanged()
if (currentWidget) {
currentWidget->setCurrent(true);
}
- QAccessible::updateAccessibility(this, current+1, QAccessible::Focus);
+#pragma message("TODO: port accessibility otherwise the following line asserts")
+ //QAccessible::updateAccessibility(this, current+1, QAccessible::Focus);
}
void KItemListView::slotSelectionChanged(const KItemSet& current, const KItemSet& previous)
void KItemListView::slotRubberBandActivationChanged(bool active)
{
if (active) {
- connect(m_rubberBand, SIGNAL(startPositionChanged(QPointF,QPointF)), this, SLOT(slotRubberBandPosChanged()));
- connect(m_rubberBand, SIGNAL(endPositionChanged(QPointF,QPointF)), this, SLOT(slotRubberBandPosChanged()));
+ connect(m_rubberBand, &KItemListRubberBand::startPositionChanged, this, &KItemListView::slotRubberBandPosChanged);
+ connect(m_rubberBand, &KItemListRubberBand::endPositionChanged, this, &KItemListView::slotRubberBandPosChanged);
m_skipAutoScrollForRubberBand = true;
} else {
- disconnect(m_rubberBand, SIGNAL(startPositionChanged(QPointF,QPointF)), this, SLOT(slotRubberBandPosChanged()));
- disconnect(m_rubberBand, SIGNAL(endPositionChanged(QPointF,QPointF)), this, SLOT(slotRubberBandPosChanged()));
+ disconnect(m_rubberBand, &KItemListRubberBand::startPositionChanged, this, &KItemListView::slotRubberBandPosChanged);
+ disconnect(m_rubberBand, &KItemListRubberBand::endPositionChanged, this, &KItemListView::slotRubberBandPosChanged);
m_skipAutoScrollForRubberBand = false;
}
KItemListController* previous = m_controller;
if (previous) {
KItemListSelectionManager* selectionManager = previous->selectionManager();
- disconnect(selectionManager, SIGNAL(currentChanged(int,int)), this, SLOT(slotCurrentChanged(int,int)));
- disconnect(selectionManager, SIGNAL(selectionChanged(KItemSet,KItemSet)), this, SLOT(slotSelectionChanged(KItemSet,KItemSet)));
+ disconnect(selectionManager, &KItemListSelectionManager::currentChanged, this, &KItemListView::slotCurrentChanged);
+ disconnect(selectionManager, &KItemListSelectionManager::selectionChanged, this, &KItemListView::slotSelectionChanged);
}
m_controller = controller;
if (controller) {
KItemListSelectionManager* selectionManager = controller->selectionManager();
- connect(selectionManager, SIGNAL(currentChanged(int,int)), this, SLOT(slotCurrentChanged(int,int)));
- connect(selectionManager, SIGNAL(selectionChanged(KItemSet,KItemSet)), this, SLOT(slotSelectionChanged(KItemSet,KItemSet)));
+ connect(selectionManager, &KItemListSelectionManager::currentChanged, this, &KItemListView::slotCurrentChanged);
+ connect(selectionManager, &KItemListSelectionManager::selectionChanged, this, &KItemListView::slotSelectionChanged);
}
onControllerChanged(controller, previous);
KItemModelBase* previous = m_model;
if (m_model) {
- disconnect(m_model, SIGNAL(itemsChanged(KItemRangeList,QSet<QByteArray>)),
- this, SLOT(slotItemsChanged(KItemRangeList,QSet<QByteArray>)));
- disconnect(m_model, SIGNAL(itemsInserted(KItemRangeList)),
- this, SLOT(slotItemsInserted(KItemRangeList)));
- disconnect(m_model, SIGNAL(itemsRemoved(KItemRangeList)),
- this, SLOT(slotItemsRemoved(KItemRangeList)));
- disconnect(m_model, SIGNAL(itemsMoved(KItemRange,QList<int>)),
- this, SLOT(slotItemsMoved(KItemRange,QList<int>)));
- disconnect(m_model, SIGNAL(groupsChanged()),
- this, SLOT(slotGroupsChanged()));
- disconnect(m_model, SIGNAL(groupedSortingChanged(bool)),
- this, SLOT(slotGroupedSortingChanged(bool)));
- disconnect(m_model, SIGNAL(sortOrderChanged(Qt::SortOrder,Qt::SortOrder)),
- this, SLOT(slotSortOrderChanged(Qt::SortOrder,Qt::SortOrder)));
- disconnect(m_model, SIGNAL(sortRoleChanged(QByteArray,QByteArray)),
- this, SLOT(slotSortRoleChanged(QByteArray,QByteArray)));
+ disconnect(m_model, &KItemModelBase::itemsChanged,
+ this, &KItemListView::slotItemsChanged);
+ disconnect(m_model, &KItemModelBase::itemsInserted,
+ this, &KItemListView::slotItemsInserted);
+ disconnect(m_model, &KItemModelBase::itemsRemoved,
+ this, &KItemListView::slotItemsRemoved);
+ disconnect(m_model, &KItemModelBase::itemsMoved,
+ this, &KItemListView::slotItemsMoved);
+ disconnect(m_model, &KItemModelBase::groupsChanged,
+ this, &KItemListView::slotGroupsChanged);
+ disconnect(m_model, &KItemModelBase::groupedSortingChanged,
+ this, &KItemListView::slotGroupedSortingChanged);
+ disconnect(m_model, &KItemModelBase::sortOrderChanged,
+ this, &KItemListView::slotSortOrderChanged);
+ disconnect(m_model, &KItemModelBase::sortRoleChanged,
+ this, &KItemListView::slotSortRoleChanged);
m_sizeHintResolver->itemsRemoved(KItemRangeList() << KItemRange(0, m_model->count()));
}
m_grouped = model->groupedSorting();
if (m_model) {
- connect(m_model, SIGNAL(itemsChanged(KItemRangeList,QSet<QByteArray>)),
- this, SLOT(slotItemsChanged(KItemRangeList,QSet<QByteArray>)));
- connect(m_model, SIGNAL(itemsInserted(KItemRangeList)),
- this, SLOT(slotItemsInserted(KItemRangeList)));
- connect(m_model, SIGNAL(itemsRemoved(KItemRangeList)),
- this, SLOT(slotItemsRemoved(KItemRangeList)));
- connect(m_model, SIGNAL(itemsMoved(KItemRange,QList<int>)),
- this, SLOT(slotItemsMoved(KItemRange,QList<int>)));
- connect(m_model, SIGNAL(groupsChanged()),
- this, SLOT(slotGroupsChanged()));
- connect(m_model, SIGNAL(groupedSortingChanged(bool)),
- this, SLOT(slotGroupedSortingChanged(bool)));
- connect(m_model, SIGNAL(sortOrderChanged(Qt::SortOrder,Qt::SortOrder)),
- this, SLOT(slotSortOrderChanged(Qt::SortOrder,Qt::SortOrder)));
- connect(m_model, SIGNAL(sortRoleChanged(QByteArray,QByteArray)),
- this, SLOT(slotSortRoleChanged(QByteArray,QByteArray)));
+ connect(m_model, &KItemModelBase::itemsChanged,
+ this, &KItemListView::slotItemsChanged);
+ connect(m_model, &KItemModelBase::itemsInserted,
+ this, &KItemListView::slotItemsInserted);
+ connect(m_model, &KItemModelBase::itemsRemoved,
+ this, &KItemListView::slotItemsRemoved);
+ connect(m_model, &KItemModelBase::itemsMoved,
+ this, &KItemListView::slotItemsMoved);
+ connect(m_model, &KItemModelBase::groupsChanged,
+ this, &KItemListView::slotGroupsChanged);
+ connect(m_model, &KItemModelBase::groupedSortingChanged,
+ this, &KItemListView::slotGroupedSortingChanged);
+ connect(m_model, &KItemModelBase::sortOrderChanged,
+ this, &KItemListView::slotSortOrderChanged);
+ connect(m_model, &KItemModelBase::sortRoleChanged,
+ this, &KItemListView::slotSortRoleChanged);
const int itemCount = m_model->count();
if (itemCount > 0) {
groupHeader = groupHeaderCreator()->create(this);
groupHeader->setParentItem(widget);
m_visibleGroups.insert(widget, groupHeader);
- connect(widget, SIGNAL(geometryChanged()), this, SLOT(slotGeometryOfGroupHeaderParentChanged()));
+ connect(widget, &KItemListWidget::geometryChanged, this, &KItemListView::slotGeometryOfGroupHeaderParentChanged);
}
Q_ASSERT(groupHeader->parentItem() == widget);
header->setParentItem(0);
groupHeaderCreator()->recycle(header);
m_visibleGroups.remove(widget);
- disconnect(widget, SIGNAL(geometryChanged()), this, SLOT(slotGeometryOfGroupHeaderParentChanged()));
+ disconnect(widget, &KItemListWidget::geometryChanged, this, &KItemListView::slotGeometryOfGroupHeaderParentChanged);
}
}
return;
}
- widget->disconnect(SIGNAL(roleEditingCanceled(int,QByteArray,QVariant)), this);
- widget->disconnect(SIGNAL(roleEditingFinished(int,QByteArray,QVariant)), this);
+ disconnect(widget, &KItemListWidget::roleEditingCanceled, this, nullptr);
+ disconnect(widget, &KItemListWidget::roleEditingFinished, this, nullptr);
}
int KItemListView::calculateAutoScrollingIncrement(int pos, int range, int oldInc)
m_hoverAnimation = new QPropertyAnimation(this, "hoverOpacity", this);
const int duration = (KGlobalSettings::graphicEffectsLevel() == KGlobalSettings::NoEffects) ? 1 : 200;
m_hoverAnimation->setDuration(duration);
- connect(m_hoverAnimation, SIGNAL(finished()), this, SLOT(slotHoverAnimationFinished()));
+ connect(m_hoverAnimation, &QPropertyAnimation::finished, this, &KItemListWidget::slotHoverAnimationFinished);
}
m_hoverAnimation->stop();
if (m_roleEditor) {
emit roleEditingCanceled(index(), current, data().value(current));
- disconnect(m_roleEditor, SIGNAL(roleEditingCanceled(QByteArray,QVariant)),
- this, SLOT(slotRoleEditingCanceled(QByteArray,QVariant)));
- disconnect(m_roleEditor, SIGNAL(roleEditingFinished(QByteArray,QVariant)),
- this, SLOT(slotRoleEditingFinished(QByteArray,QVariant)));
+ disconnect(m_roleEditor, &KItemListRoleEditor::roleEditingCanceled,
+ this, &KStandardItemListWidget::slotRoleEditingCanceled);
+ disconnect(m_roleEditor, &KItemListRoleEditor::roleEditingFinished,
+ this, &KStandardItemListWidget::slotRoleEditingFinished);
if (m_oldRoleEditor) {
m_oldRoleEditor->deleteLater();
m_roleEditor->setTextCursor(cursor);
}
- connect(m_roleEditor, SIGNAL(roleEditingCanceled(QByteArray,QVariant)),
- this, SLOT(slotRoleEditingCanceled(QByteArray,QVariant)));
- connect(m_roleEditor, SIGNAL(roleEditingFinished(QByteArray,QVariant)),
- this, SLOT(slotRoleEditingFinished(QByteArray,QVariant)));
+ connect(m_roleEditor, &KItemListRoleEditor::roleEditingCanceled,
+ this, &KStandardItemListWidget::slotRoleEditingCanceled);
+ connect(m_roleEditor, &KItemListRoleEditor::roleEditingFinished,
+ this, &KStandardItemListWidget::slotRoleEditingFinished);
// Adjust the geometry of the editor
QRectF rect = roleEditingRect(current);
const KUrl itemUrl = data().value("url").value<KUrl>();
m_isCut = clipboard->isCut(itemUrl);
- connect(clipboard, SIGNAL(cutItemsChanged()),
- this, SLOT(slotCutItemsChanged()));
+ connect(clipboard, &KFileItemClipboard::cutItemsChanged,
+ this, &KStandardItemListWidget::slotCutItemsChanged);
}
void KStandardItemListWidget::hideEvent(QHideEvent* event)
{
- disconnect(KFileItemClipboard::instance(), SIGNAL(cutItemsChanged()),
- this, SLOT(slotCutItemsChanged()));
+ disconnect(KFileItemClipboard::instance(), &KFileItemClipboard::cutItemsChanged,
+ this, &KStandardItemListWidget::slotCutItemsChanged);
KItemListWidget::hideEvent(event);
}
void KStandardItemListWidget::closeRoleEditor()
{
- disconnect(m_roleEditor, SIGNAL(roleEditingCanceled(QByteArray,QVariant)),
- this, SLOT(slotRoleEditingCanceled(QByteArray,QVariant)));
- disconnect(m_roleEditor, SIGNAL(roleEditingFinished(QByteArray,QVariant)),
- this, SLOT(slotRoleEditingFinished(QByteArray,QVariant)));
+ disconnect(m_roleEditor, &KItemListRoleEditor::roleEditingCanceled,
+ this, &KStandardItemListWidget::slotRoleEditingCanceled);
+ disconnect(m_roleEditor, &KItemListRoleEditor::roleEditingFinished,
+ this, &KStandardItemListWidget::slotRoleEditingFinished);
if (m_roleEditor->hasFocus()) {
// If the editing was not ended by a FocusOut event, we have
m_dirWatcher(0),
m_watchedDirs()
{
- connect(m_model, SIGNAL(itemsRemoved(KItemRangeList)),
- this, SLOT(slotItemsRemoved()));
+ connect(m_model, &KFileItemModel::itemsRemoved,
+ this, &KDirectoryContentsCounter::slotItemsRemoved);
if (!m_workerThread) {
m_workerThread = new QThread();
m_worker->moveToThread(m_workerThread);
++m_workersCount;
- connect(this, SIGNAL(requestDirectoryContentsCount(QString,KDirectoryContentsCounterWorker::Options)),
- m_worker, SLOT(countDirectoryContents(QString,KDirectoryContentsCounterWorker::Options)));
- connect(m_worker, SIGNAL(result(QString,int)),
- this, SLOT(slotResult(QString,int)));
+ connect(this, &KDirectoryContentsCounter::requestDirectoryContentsCount,
+ m_worker, &KDirectoryContentsCounterWorker::countDirectoryContents);
+ connect(m_worker, &KDirectoryContentsCounterWorker::result,
+ this, &KDirectoryContentsCounter::slotResult);
m_dirWatcher = new KDirWatch(this);
- connect(m_dirWatcher, SIGNAL(dirty(QString)), this, SLOT(slotDirWatchDirty(QString)));
+ connect(m_dirWatcher, &KDirWatch::dirty, this, &KDirectoryContentsCounter::slotDirWatchDirty);
}
KDirectoryContentsCounter::~KDirectoryContentsCounter()
{
updateCutItems();
- connect(QApplication::clipboard(), SIGNAL(dataChanged()),
- this, SLOT(updateCutItems()));
+ connect(QApplication::clipboard(), &QClipboard::dataChanged,
+ this, &KFileItemClipboard::updateCutItems);
}
#include "kfileitemclipboard.moc"
#include <libdolphin_export.h>
#include <KDirLister>
+#include <KUrl>
/**
* @brief Extends the class KDirLister by emitting a signal when an
#define KFILEITEMMODELSORTALGORITHM_H
#include <QtCore>
+#include <QtConcurrent/QtConcurrent>
#include <algorithm>
}
if (m_model) {
- disconnect(m_model, SIGNAL(sortRoleChanged(QByteArray,QByteArray)),
- this, SLOT(slotSortRoleChanged(QByteArray,QByteArray)));
- disconnect(m_model, SIGNAL(sortOrderChanged(Qt::SortOrder,Qt::SortOrder)),
- this, SLOT(slotSortOrderChanged(Qt::SortOrder,Qt::SortOrder)));
+ disconnect(m_model, &KItemModelBase::sortRoleChanged,
+ this, &KItemListHeaderWidget::slotSortRoleChanged);
+ disconnect(m_model, &KItemModelBase::sortOrderChanged,
+ this, &KItemListHeaderWidget::slotSortOrderChanged);
}
m_model = model;
if (m_model) {
- connect(m_model, SIGNAL(sortRoleChanged(QByteArray,QByteArray)),
- this, SLOT(slotSortRoleChanged(QByteArray,QByteArray)));
- connect(m_model, SIGNAL(sortOrderChanged(Qt::SortOrder,Qt::SortOrder)),
- this, SLOT(slotSortOrderChanged(Qt::SortOrder,Qt::SortOrder)));
+ connect(m_model, &KItemModelBase::sortRoleChanged,
+ this, &KItemListHeaderWidget::slotSortRoleChanged);
+ connect(m_model, &KItemModelBase::sortOrderChanged,
+ this, &KItemListHeaderWidget::slotSortOrderChanged);
}
}
parent->installEventFilter(this);
}
- connect(this, SIGNAL(textChanged()), this, SLOT(autoAdjustSize()));
+ connect(this, &KItemListRoleEditor::textChanged, this, &KItemListRoleEditor::autoAdjustSize);
}
KItemListRoleEditor::~KItemListRoleEditor()
m_animation = new QPropertyAnimation(this);
const int duration = (KGlobalSettings::graphicEffectsLevel() == KGlobalSettings::NoEffects) ? 1 : 100;
m_animation->setDuration(duration);
- connect(m_animation, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)),
- this, SLOT(slotAnimationStateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
+ connect(m_animation, &QPropertyAnimation::stateChanged,
+ this, &KItemListSmoothScroller::slotAnimationStateChanged);
m_scrollBar->installEventFilter(this);
}
}
Q_ASSERT(propertyAnim);
- connect(propertyAnim, SIGNAL(finished()), this, SLOT(slotFinished()));
+ connect(propertyAnim, &QPropertyAnimation::finished, this, &KItemListViewAnimation::slotFinished);
m_animation[type].insert(widget, propertyAnim);
propertyAnim->start();
#include "dolphinmainwindow.h"
-#include <KAboutData>
+#include <k4aboutdata.h>
#include <KCmdLineArgs>
#include <KLocale>
#include <kmainwindow.h>
+#include <kdemacros.h>
+#include <kdeversion.h>
#include <KDebug>
extern "C"
KDE_EXPORT int kdemain(int argc, char **argv)
{
- KAboutData about("dolphin", 0,
+ K4AboutData about("dolphin", 0,
ki18nc("@title", "Dolphin"),
KDE_VERSION_STRING,
ki18nc("@title", "File Manager"),
- KAboutData::License_GPL,
+ K4AboutData::License_GPL,
ki18nc("@info:credit", "(C) 2006-2014 Peter Penz and Frank Reininghaus"));
about.setHomepage("http://dolphin.kde.org");
about.addAuthor(ki18nc("@info:credit", "Frank Reininghaus"),
// opening the folders panel.
view->setOpacity(0);
- connect(view, SIGNAL(roleEditingFinished(int,QByteArray,QVariant)),
- this, SLOT(slotRoleEditingFinished(int,QByteArray,QVariant)));
+ connect(view, &KFileItemListView::roleEditingFinished,
+ this, &FoldersPanel::slotRoleEditingFinished);
m_model = new KFileItemModel(this);
m_model->setShowDirectoriesOnly(true);
m_model->setShowHiddenFiles(FoldersPanelSettings::hiddenFilesShown());
// Use a QueuedConnection to give the view the possibility to react first on the
// finished loading.
- connect(m_model, SIGNAL(directoryLoadingCompleted()), this, SLOT(slotLoadingCompleted()), Qt::QueuedConnection);
+ connect(m_model, &KFileItemModel::directoryLoadingCompleted, this, &FoldersPanel::slotLoadingCompleted, Qt::QueuedConnection);
m_controller = new KItemListController(m_model, view, this);
m_controller->setSelectionBehavior(KItemListController::SingleSelection);
m_controller->setAutoActivationDelay(750);
m_controller->setSingleClickActivationEnforced(true);
- connect(m_controller, SIGNAL(itemActivated(int)), this, SLOT(slotItemActivated(int)));
- connect(m_controller, SIGNAL(itemMiddleClicked(int)), this, SLOT(slotItemMiddleClicked(int)));
- connect(m_controller, SIGNAL(itemContextMenuRequested(int,QPointF)), this, SLOT(slotItemContextMenuRequested(int,QPointF)));
- connect(m_controller, SIGNAL(viewContextMenuRequested(QPointF)), this, SLOT(slotViewContextMenuRequested(QPointF)));
- connect(m_controller, SIGNAL(itemDropEvent(int,QGraphicsSceneDragDropEvent*)), this, SLOT(slotItemDropEvent(int,QGraphicsSceneDragDropEvent*)));
+ connect(m_controller, &KItemListController::itemActivated, this, &FoldersPanel::slotItemActivated);
+ connect(m_controller, &KItemListController::itemMiddleClicked, this, &FoldersPanel::slotItemMiddleClicked);
+ connect(m_controller, &KItemListController::itemContextMenuRequested, this, &FoldersPanel::slotItemContextMenuRequested);
+ connect(m_controller, &KItemListController::viewContextMenuRequested, this, &FoldersPanel::slotViewContextMenuRequested);
+ connect(m_controller, &KItemListController::itemDropEvent, this, &FoldersPanel::slotItemDropEvent);
KItemListContainer* container = new KItemListContainer(m_controller, this);
container->setEnabledFrame(false);
#include <KIconLoader>
#include <KIO/DeleteJob>
#include <KMenu>
+#include <KIcon>
+#include <KSharedConfig>
+#include <KConfigGroup>
#include <konqmimedata.h>
#include <KFileItemListProperties>
#include <konq_operations.h>
#include <QApplication>
#include <QClipboard>
+#include <QMimeData>
TreeViewContextMenu::TreeViewContextMenu(FoldersPanel* parent,
const KFileItem& fileInfo) :
// insert 'Cut', 'Copy' and 'Paste'
QAction* cutAction = new QAction(KIcon("edit-cut"), i18nc("@action:inmenu", "Cut"), this);
cutAction->setEnabled(capabilities.supportsMoving());
- connect(cutAction, SIGNAL(triggered()), this, SLOT(cut()));
+ connect(cutAction, &QAction::triggered, this, &TreeViewContextMenu::cut);
QAction* copyAction = new QAction(KIcon("edit-copy"), i18nc("@action:inmenu", "Copy"), this);
- connect(copyAction, SIGNAL(triggered()), this, SLOT(copy()));
+ connect(copyAction, &QAction::triggered, this, &TreeViewContextMenu::copy);
QAction* pasteAction = new QAction(KIcon("edit-paste"), i18nc("@action:inmenu", "Paste"), this);
const QMimeData* mimeData = QApplication::clipboard()->mimeData();
const KUrl::List pasteData = KUrl::List::fromMimeData(mimeData);
- connect(pasteAction, SIGNAL(triggered()), this, SLOT(paste()));
+ connect(pasteAction, &QAction::triggered, this, &TreeViewContextMenu::paste);
pasteAction->setEnabled(!pasteData.isEmpty() && capabilities.supportsWriting());
popup->addAction(cutAction);
QAction* renameAction = new QAction(i18nc("@action:inmenu", "Rename..."), this);
renameAction->setEnabled(capabilities.supportsMoving());
renameAction->setIcon(KIcon("edit-rename"));
- connect(renameAction, SIGNAL(triggered()), this, SLOT(rename()));
+ connect(renameAction, &QAction::triggered, this, &TreeViewContextMenu::rename);
popup->addAction(renameAction);
// insert 'Move to Trash' and (optionally) 'Delete'
i18nc("@action:inmenu", "Move to Trash"), this);
const bool enableMoveToTrash = capabilities.isLocal() && capabilities.supportsMoving();
moveToTrashAction->setEnabled(enableMoveToTrash);
- connect(moveToTrashAction, SIGNAL(triggered()), this, SLOT(moveToTrash()));
+ connect(moveToTrashAction, &QAction::triggered, this, &TreeViewContextMenu::moveToTrash);
popup->addAction(moveToTrashAction);
} else {
showDeleteCommand = true;
if (showDeleteCommand) {
QAction* deleteAction = new QAction(KIcon("edit-delete"), i18nc("@action:inmenu", "Delete"), this);
deleteAction->setEnabled(capabilities.supportsDeleting());
- connect(deleteAction, SIGNAL(triggered()), this, SLOT(deleteItem()));
+ connect(deleteAction, &QAction::triggered, this, &TreeViewContextMenu::deleteItem);
popup->addAction(deleteAction);
}
showHiddenFilesAction->setCheckable(true);
showHiddenFilesAction->setChecked(m_parent->showHiddenFiles());
popup->addAction(showHiddenFilesAction);
- connect(showHiddenFilesAction, SIGNAL(toggled(bool)), this, SLOT(setShowHiddenFiles(bool)));
+ connect(showHiddenFilesAction, &QAction::toggled, this, &TreeViewContextMenu::setShowHiddenFiles);
// insert 'Automatic Scrolling'
QAction* autoScrollingAction = new QAction(i18nc("@action:inmenu", "Automatic Scrolling"), this);
// TODO: Temporary disabled. Horizontal autoscrolling will be implemented later either
// in KItemViews or manually as part of the FoldersPanel
//popup->addAction(autoScrollingAction);
- connect(autoScrollingAction, SIGNAL(toggled(bool)), this, SLOT(setAutoScrolling(bool)));
+ connect(autoScrollingAction, &QAction::toggled, this, &TreeViewContextMenu::setAutoScrolling);
if (!m_fileItem.isNull()) {
// insert 'Properties' entry
QAction* propertiesAction = new QAction(i18nc("@action:inmenu", "Properties"), this);
propertiesAction->setIcon(KIcon("document-properties"));
- connect(propertiesAction, SIGNAL(triggered()), this, SLOT(showProperties()));
+ connect(propertiesAction, &QAction::triggered, this, &TreeViewContextMenu::showProperties);
popup->addAction(propertiesAction);
}
void TreeViewContextMenu::moveToTrash()
{
- KonqOperations::del(m_parent, KonqOperations::TRASH, m_fileItem.url());
+ KonqOperations::del(m_parent, KonqOperations::TRASH, KUrl::List() << m_fileItem.url());
}
void TreeViewContextMenu::deleteItem()
{
- KonqOperations::del(m_parent, KonqOperations::DEL, m_fileItem.url());
+ KonqOperations::del(m_parent, KonqOperations::DEL, KUrl::List() << m_fileItem.url());
}
void TreeViewContextMenu::showProperties()
#include <QObject>
#include <KFileItem>
+class QMimeData;
class FoldersPanel;
/**
#include "informationpanelcontent.h"
#include <KIO/Job>
#include <KIO/JobUiDelegate>
+#include <KJobWidgets>
#include <KDirNotify>
#include <QApplication>
#include <QShowEvent>
#include <QVBoxLayout>
+#include <QTimer>
InformationPanel::InformationPanel(QWidget* parent) :
Panel(parent),
// an item for the currently shown directory.
m_folderStatJob = KIO::stat(url(), KIO::HideProgressInfo);
if (m_folderStatJob->ui()) {
- m_folderStatJob->ui()->setWindow(this);
+ KJobWidgets::setWindow(m_folderStatJob, this);
}
- connect(m_folderStatJob, SIGNAL(result(KJob*)),
- this, SLOT(slotFolderStatFinished(KJob*)));
+ connect(m_folderStatJob, &KIO::Job::result,
+ this, &InformationPanel::slotFolderStatFinished);
} else {
m_content->showItem(item);
}
m_infoTimer = new QTimer(this);
m_infoTimer->setInterval(300);
m_infoTimer->setSingleShot(true);
- connect(m_infoTimer, SIGNAL(timeout()),
- this, SLOT(slotInfoTimeout()));
+ connect(m_infoTimer, &QTimer::timeout,
+ this, &InformationPanel::slotInfoTimeout);
m_urlChangedTimer = new QTimer(this);
m_urlChangedTimer->setInterval(200);
m_urlChangedTimer->setSingleShot(true);
- connect(m_urlChangedTimer, SIGNAL(timeout()),
- this, SLOT(showItemInfo()));
+ connect(m_urlChangedTimer, &QTimer::timeout,
+ this, &InformationPanel::showItemInfo);
m_resetUrlTimer = new QTimer(this);
m_resetUrlTimer->setInterval(1000);
m_resetUrlTimer->setSingleShot(true);
- connect(m_resetUrlTimer, SIGNAL(timeout()),
- this, SLOT(reset()));
+ connect(m_resetUrlTimer, &QTimer::timeout,
+ this, &InformationPanel::reset);
Q_ASSERT(m_urlChangedTimer->interval() < m_infoTimer->interval());
Q_ASSERT(m_urlChangedTimer->interval() < m_resetUrlTimer->interval());
org::kde::KDirNotify* dirNotify = new org::kde::KDirNotify(QString(), QString(),
QDBusConnection::sessionBus(), this);
- connect(dirNotify, SIGNAL(FileRenamed(QString,QString)), SLOT(slotFileRenamed(QString,QString)));
- connect(dirNotify, SIGNAL(FilesAdded(QString)), SLOT(slotFilesAdded(QString)));
- connect(dirNotify, SIGNAL(FilesChanged(QStringList)), SLOT(slotFilesChanged(QStringList)));
- connect(dirNotify, SIGNAL(FilesRemoved(QStringList)), SLOT(slotFilesRemoved(QStringList)));
- connect(dirNotify, SIGNAL(enteredDirectory(QString)), SLOT(slotEnteredDirectory(QString)));
- connect(dirNotify, SIGNAL(leftDirectory(QString)), SLOT(slotLeftDirectory(QString)));
+ connect(dirNotify, &OrgKdeKDirNotifyInterface::FileRenamed, this, &InformationPanel::slotFileRenamed);
+ connect(dirNotify, &OrgKdeKDirNotifyInterface::FilesAdded, this, &InformationPanel::slotFilesAdded);
+ connect(dirNotify, &OrgKdeKDirNotifyInterface::FilesChanged, this, &InformationPanel::slotFilesChanged);
+ connect(dirNotify, &OrgKdeKDirNotifyInterface::FilesRemoved, this, &InformationPanel::slotFilesRemoved);
+ connect(dirNotify, &OrgKdeKDirNotifyInterface::enteredDirectory, this, &InformationPanel::slotEnteredDirectory);
+ connect(dirNotify, &OrgKdeKDirNotifyInterface::leftDirectory, this, &InformationPanel::slotLeftDirectory);
m_content = new InformationPanelContent(this);
- connect(m_content, SIGNAL(urlActivated(KUrl)), this, SIGNAL(urlActivated(KUrl)));
+ connect(m_content, &InformationPanelContent::urlActivated, this, &InformationPanel::urlActivated);
QVBoxLayout* layout = new QVBoxLayout(this);
layout->setContentsMargins(0, 0, 0, 0);
#include <KGlobalSettings>
#include <KIO/JobUiDelegate>
#include <KIO/PreviewJob>
+#include <KJobWidgets>
#include <KIconEffect>
#include <KIconLoader>
+#include <KIcon>
#include <KLocale>
#include <KMenu>
#include <kseparator.h>
m_outdatedPreviewTimer = new QTimer(this);
m_outdatedPreviewTimer->setInterval(300);
m_outdatedPreviewTimer->setSingleShot(true);
- connect(m_outdatedPreviewTimer, SIGNAL(timeout()),
- this, SLOT(markOutdatedPreview()));
+ connect(m_outdatedPreviewTimer, &QTimer::timeout,
+ this, &InformationPanelContent::markOutdatedPreview);
QVBoxLayout* layout = new QVBoxLayout(this);
layout->setSpacing(KDialog::spacingHint());
m_phononWidget = new PhononWidget(parent);
m_phononWidget->hide();
m_phononWidget->setMinimumWidth(minPreviewWidth);
- connect(m_phononWidget, SIGNAL(hasVideoChanged(bool)),
- this, SLOT(slotHasVideoChanged(bool)));
+ connect(m_phononWidget, &PhononWidget::hasVideoChanged,
+ this, &InformationPanelContent::slotHasVideoChanged);
// name
m_nameLabel = new QLabel(parent);
#ifndef HAVE_BALOO
m_metaDataWidget = new KFileMetaDataWidget(parent);
+ connect(m_metaDataWidget, &KFileMetaDataWidget::urlActivated,
+ this, &InformationPanelContent::urlActivated);
#else
m_metaDataWidget = new Baloo::FileMetaDataWidget(parent);
+ connect(m_metaDataWidget, &Baloo::FileMetaDataWidget::urlActivated,
+ this, &InformationPanelContent::urlActivated);
#endif
m_metaDataWidget->setFont(KGlobalSettings::smallestReadableFont());
m_metaDataWidget->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Minimum);
- connect(m_metaDataWidget, SIGNAL(urlActivated(KUrl)), this, SIGNAL(urlActivated(KUrl)));
// Encapsulate the MetaDataWidget inside a container that has a dummy widget
// at the bottom. This prevents that the meta data widget gets vertically stretched
m_previewJob->setScaleType(KIO::PreviewJob::Unscaled);
m_previewJob->setIgnoreMaximumSize(item.isLocalFile());
if (m_previewJob->ui()) {
- m_previewJob->ui()->setWindow(this);
+ KJobWidgets::setWindow(m_previewJob, this);
}
- connect(m_previewJob, SIGNAL(gotPreview(KFileItem,QPixmap)),
- this, SLOT(showPreview(KFileItem,QPixmap)));
- connect(m_previewJob, SIGNAL(failed(KFileItem)),
- this, SLOT(showIcon(KFileItem)));
+ connect(m_previewJob.data(), &KIO::PreviewJob::gotPreview,
+ this, &InformationPanelContent::showPreview);
+ connect(m_previewJob.data(), &KIO::PreviewJob::failed,
+ this, &InformationPanelContent::showIcon);
}
}
KMenu popup(this);
QAction* previewAction = popup.addAction(i18nc("@action:inmenu", "Preview"));
- previewAction->setIcon(KIcon("view-preview"));
+ previewAction->setIcon(QIcon::fromTheme("view-preview"));
previewAction->setCheckable(true);
previewAction->setChecked(InformationPanelSettings::previewsShown());
dialog->show();
dialog->raise();
dialog->activateWindow();
- connect(dialog, SIGNAL(destroyed()), this, SLOT(refreshMetaData()));
+ connect(dialog, &FileMetaDataConfigurationDialog::destroyed, this, &InformationPanelContent::refreshMetaData);
}
}
#include <KDialog>
#include <KIcon>
+#include <KIconLoader>
#include <KUrl>
#include <KLocale>
m_playButton->setIconSize(buttonSize);
m_playButton->setIcon(KIcon("media-playback-start"));
m_playButton->setAutoRaise(true);
- connect(m_playButton, SIGNAL(clicked()), this, SLOT(play()));
+ connect(m_playButton, &QToolButton::clicked, this, &PhononWidget::play);
m_stopButton->setToolTip(i18n("stop"));
m_stopButton->setIconSize(buttonSize);
m_stopButton->setIcon(KIcon("media-playback-stop"));
m_stopButton->setAutoRaise(true);
m_stopButton->hide();
- connect(m_stopButton, SIGNAL(clicked()), this, SLOT(stop()));
+ connect(m_stopButton, &QToolButton::clicked, this, &PhononWidget::stop);
m_seekSlider->setIconVisible(false);
{
if (!m_media) {
m_media = new Phonon::MediaObject(this);
- connect(m_media, SIGNAL(stateChanged(Phonon::State,Phonon::State)),
- this, SLOT(stateChanged(Phonon::State)));
- connect(m_media, SIGNAL(hasVideoChanged(bool)),
- this, SLOT(slotHasVideoChanged(bool)));
+ connect(m_media, &Phonon::MediaObject::stateChanged,
+ this, &PhononWidget::stateChanged);
+ connect(m_media, &Phonon::MediaObject::hasVideoChanged,
+ this, &PhononWidget::slotHasVideoChanged);
m_seekSlider->setMediaObject(m_media);
}
m_animation.setCurveShape(QTimeLine::LinearCurve);
if (m_transition != NoTransition) {
- connect(&m_animation, SIGNAL(valueChanged(qreal)), this, SLOT(update()));
- connect(&m_animation, SIGNAL(finished()), this, SLOT(checkPendingPixmaps()));
+ connect(&m_animation, &QTimeLine::valueChanged, this, static_cast<void(PixmapViewer::*)()>(&PixmapViewer::update));
+ connect(&m_animation, &QTimeLine::finished, this, &PixmapViewer::checkPendingPixmaps);
}
}
m_trashDirLister = new KDirLister();
m_trashDirLister->setAutoErrorHandlingEnabled(false, 0);
m_trashDirLister->setDelayedMimeTypes(true);
- QObject::connect(m_trashDirLister, SIGNAL(completed()),
- m_signalHandler, SLOT(onTrashDirListerCompleted()));
+ QObject::connect(m_trashDirLister.data(), static_cast<void(KDirLister::*)()>(&KDirLister::completed),
+ m_signalHandler.data(), &PlacesItemSignalHandler::onTrashDirListerCompleted);
m_trashDirLister->openUrl(url);
}
if (m_access) {
setUrl(m_access->filePath());
- QObject::connect(m_access, SIGNAL(accessibilityChanged(bool,QString)),
- m_signalHandler, SLOT(onAccessibilityChanged()));
+ QObject::connect(m_access.data(), &Solid::StorageAccess::accessibilityChanged,
+ m_signalHandler.data(), &PlacesItemSignalHandler::onAccessibilityChanged);
} else if (m_disc && (m_disc->availableContent() & Solid::OpticalDisc::Audio) != 0) {
Solid::Block *block = m_device.as<Solid::Block>();
if (block) {
#include "placesitemeditdialog.h"
#include <KAboutData>
+#include <k4aboutdata.h>
#include <KComponentData>
#include <KDebug>
#include <KFile>
+#include <KGlobal>
#include <KIconButton>
#include <KLineEdit>
#include <KLocale>
formLayout->addRow(i18nc("@label", "Location:"), m_urlEdit);
// Provide room for at least 40 chars (average char width is half of height)
m_urlEdit->setMinimumWidth(m_urlEdit->fontMetrics().height() * (40 / 2));
- connect(m_urlEdit->lineEdit(), SIGNAL(textChanged(QString)), this, SLOT(slotUrlChanged(QString)));
+ connect(m_urlEdit->lineEdit(), &KLineEdit::textChanged, this, &PlacesItemEditDialog::slotUrlChanged);
m_iconButton = new KIconButton(mainWidget);
formLayout->addRow(i18nc("@label", "Choose an icon:"), m_iconButton);
#include <KLocale>
#include <KStandardDirs>
#include <KUser>
+#include <KGlobal>
#include "placesitem.h"
#include <QAction>
#include <QDate>
m_saveBookmarksTimer = new QTimer(this);
m_saveBookmarksTimer->setInterval(syncBookmarksTimeout);
m_saveBookmarksTimer->setSingleShot(true);
- connect(m_saveBookmarksTimer, SIGNAL(timeout()), this, SLOT(saveBookmarks()));
+ connect(m_saveBookmarksTimer, &QTimer::timeout, this, &PlacesItemModel::saveBookmarks);
m_updateBookmarksTimer = new QTimer(this);
m_updateBookmarksTimer->setInterval(syncBookmarksTimeout);
m_updateBookmarksTimer->setSingleShot(true);
- connect(m_updateBookmarksTimer, SIGNAL(timeout()), this, SLOT(updateBookmarks()));
+ connect(m_updateBookmarksTimer, &QTimer::timeout, this, &PlacesItemModel::updateBookmarks);
- connect(m_bookmarkManager, SIGNAL(changed(QString,QString)),
- m_updateBookmarksTimer, SLOT(start()));
- connect(m_bookmarkManager, SIGNAL(bookmarksChanged(QString)),
- m_updateBookmarksTimer, SLOT(start()));
+ connect(m_bookmarkManager, &KBookmarkManager::changed,
+ m_updateBookmarksTimer, static_cast<void(QTimer::*)()>(&QTimer::start));
+ connect(m_bookmarkManager, &KBookmarkManager::bookmarksChanged,
+ m_updateBookmarksTimer, static_cast<void(QTimer::*)()>(&QTimer::start));
}
PlacesItemModel::~PlacesItemModel()
if (item) {
Solid::OpticalDrive* drive = item->device().parent().as<Solid::OpticalDrive>();
if (drive) {
- connect(drive, SIGNAL(ejectDone(Solid::ErrorType,QVariant,QString)),
- this, SLOT(slotStorageTeardownDone(Solid::ErrorType,QVariant)));
+ connect(drive, &Solid::OpticalDrive::ejectDone,
+ this, &PlacesItemModel::slotStorageTeardownDone);
drive->eject();
} else {
const QString label = item->text();
if (item) {
Solid::StorageAccess* access = item->device().as<Solid::StorageAccess>();
if (access) {
- connect(access, SIGNAL(teardownDone(Solid::ErrorType,QVariant,QString)),
- this, SLOT(slotStorageTeardownDone(Solid::ErrorType,QVariant)));
+ connect(access, &Solid::StorageAccess::teardownDone,
+ this, &PlacesItemModel::slotStorageTeardownDone);
access->teardown();
}
}
m_storageSetupInProgress[access] = index;
- connect(access, SIGNAL(setupDone(Solid::ErrorType,QVariant,QString)),
- this, SLOT(slotStorageSetupDone(Solid::ErrorType,QVariant,QString)));
+ connect(access, &Solid::StorageAccess::setupDone,
+ this, &PlacesItemModel::slotStorageSetupDone);
access->setup();
}
Q_ASSERT(m_predicate.isValid());
Solid::DeviceNotifier* notifier = Solid::DeviceNotifier::instance();
- connect(notifier, SIGNAL(deviceAdded(QString)), this, SLOT(slotDeviceAdded(QString)));
- connect(notifier, SIGNAL(deviceRemoved(QString)), this, SLOT(slotDeviceRemoved(QString)));
+ connect(notifier, &Solid::DeviceNotifier::deviceAdded, this, &PlacesItemModel::slotDeviceAdded);
+ connect(notifier, &Solid::DeviceNotifier::deviceRemoved, this, &PlacesItemModel::slotDeviceRemoved);
const QList<Solid::Device>& deviceList = Solid::Device::listFromQuery(m_predicate);
foreach (const Solid::Device& device, deviceList) {
#include <KIcon>
#include <KIO/Job>
#include <KIO/JobUiDelegate>
+#include <KJobWidgets>
#include <KLocale>
+#include <KIconLoader>
#include <kitemviews/kitemlistcontainer.h>
#include <kitemviews/kitemlistcontroller.h>
#include <kitemviews/kitemlistselectionmanager.h>
#include <QGraphicsSceneDragDropEvent>
#include <QVBoxLayout>
#include <QShowEvent>
+#include <QMimeData>
PlacesPanel::PlacesPanel(QWidget* parent) :
Panel(parent),
// used at all and stays invisible.
m_model = new PlacesItemModel(this);
m_model->setGroupedSorting(true);
- connect(m_model, SIGNAL(errorMessage(QString)),
- this, SIGNAL(errorMessage(QString)));
+ connect(m_model, &PlacesItemModel::errorMessage,
+ this, &PlacesPanel::errorMessage);
m_view = new PlacesView();
m_view->setWidgetCreator(new KItemListWidgetCreator<PlacesItemListWidget>());
readSettings();
- connect(m_controller, SIGNAL(itemActivated(int)), this, SLOT(slotItemActivated(int)));
- connect(m_controller, SIGNAL(itemMiddleClicked(int)), this, SLOT(slotItemMiddleClicked(int)));
- connect(m_controller, SIGNAL(itemContextMenuRequested(int,QPointF)), this, SLOT(slotItemContextMenuRequested(int,QPointF)));
- connect(m_controller, SIGNAL(viewContextMenuRequested(QPointF)), this, SLOT(slotViewContextMenuRequested(QPointF)));
- connect(m_controller, SIGNAL(itemDropEvent(int,QGraphicsSceneDragDropEvent*)), this, SLOT(slotItemDropEvent(int,QGraphicsSceneDragDropEvent*)));
- connect(m_controller, SIGNAL(aboveItemDropEvent(int,QGraphicsSceneDragDropEvent*)), this, SLOT(slotAboveItemDropEvent(int,QGraphicsSceneDragDropEvent*)));
+ connect(m_controller, &KItemListController::itemActivated, this, &PlacesPanel::slotItemActivated);
+ connect(m_controller, &KItemListController::itemMiddleClicked, this, &PlacesPanel::slotItemMiddleClicked);
+ connect(m_controller, &KItemListController::itemContextMenuRequested, this, &PlacesPanel::slotItemContextMenuRequested);
+ connect(m_controller, &KItemListController::viewContextMenuRequested, this, &PlacesPanel::slotViewContextMenuRequested);
+ connect(m_controller, &KItemListController::itemDropEvent, this, &PlacesPanel::slotItemDropEvent);
+ connect(m_controller, &KItemListController::aboveItemDropEvent, this, &PlacesPanel::slotAboveItemDropEvent);
KItemListContainer* container = new KItemListContainer(m_controller, this);
container->setEnabledFrame(false);
}
if (m_model->storageSetupNeeded(index)) {
- connect(m_model, SIGNAL(storageSetupDone(int,bool)),
- this, SLOT(slotItemDropEventStorageSetupDone(int,bool)));
+ connect(m_model, &PlacesItemModel::storageSetupDone,
+ this, &PlacesPanel::slotItemDropEventStorageSetupDone);
m_itemDropEventIndex = index;
void PlacesPanel::slotItemDropEventStorageSetupDone(int index, bool success)
{
- disconnect(m_model, SIGNAL(storageSetupDone(int,bool)),
- this, SLOT(slotItemDropEventStorageSetupDone(int,bool)));
+ disconnect(m_model, &PlacesItemModel::storageSetupDone,
+ this, &PlacesPanel::slotItemDropEventStorageSetupDone);
if ((index == m_itemDropEventIndex) && m_itemDropEvent && m_itemDropEventMimeData) {
if (success) {
if (job->error()) {
emit errorMessage(job->errorString());
}
- org::kde::KDirNotify::emitFilesAdded("trash:/");
+ org::kde::KDirNotify::emitFilesAdded(QUrl("trash:/"));
}
void PlacesPanel::slotStorageSetupDone(int index, bool success)
{
- disconnect(m_model, SIGNAL(storageSetupDone(int,bool)),
- this, SLOT(slotStorageSetupDone(int,bool)));
+ disconnect(m_model, &PlacesItemModel::storageSetupDone,
+ this, &PlacesPanel::slotStorageSetupDone);
if (m_triggerStorageSetupButton == Qt::NoButton) {
return;
stream << int(1);
KIO::Job *job = KIO::special(KUrl("trash:/"), packedArgs);
KNotification::event("Trash: emptied", QString() , QPixmap() , 0, KNotification::DefaultEvent);
- job->ui()->setWindow(parentWidget());
- connect(job, SIGNAL(result(KJob*)), SLOT(slotTrashUpdated(KJob*)));
+ KJobWidgets::setWindow(job, parentWidget());
+ connect(job, &KIO::Job::result, this, &PlacesPanel::slotTrashUpdated);
}
}
m_triggerStorageSetupButton = button;
m_storageSetupFailedUrl = url();
- connect(m_model, SIGNAL(storageSetupDone(int,bool)),
- this, SLOT(slotStorageSetupDone(int,bool)));
+ connect(m_model, &PlacesItemModel::storageSetupDone,
+ this, &PlacesPanel::slotStorageSetupDone);
m_model->requestStorageSetup(index);
} else {
#include <KPluginLoader>
#include <KPluginFactory>
#include <KService>
-#include <kde_terminal_interface_v2.h>
+#include <kde_terminal_interface.h>
#include <KParts/Part>
#include <KShell>
#include <KIO/Job>
#include <KIO/JobUiDelegate>
+#include <KJobWidgets>
#include <QBoxLayout>
#include <QDir>
}
m_konsolePart = factory ? (factory->create<KParts::ReadOnlyPart>(this)) : 0;
if (m_konsolePart) {
- connect(m_konsolePart, SIGNAL(destroyed(QObject*)), this, SLOT(terminalExited()));
+ connect(m_konsolePart, &KParts::ReadOnlyPart::destroyed, this, &TerminalPanel::terminalExited);
m_terminalWidget = m_konsolePart->widget();
m_layout->addWidget(m_terminalWidget);
- m_terminal = qobject_cast<TerminalInterfaceV2 *>(m_konsolePart);
+ m_terminal = qobject_cast<TerminalInterface*>(m_konsolePart);
}
}
if (m_terminal) {
} else {
m_mostLocalUrlJob = KIO::mostLocalUrl(url, KIO::HideProgressInfo);
if (m_mostLocalUrlJob->ui()) {
- m_mostLocalUrlJob->ui()->setWindow(this);
+ KJobWidgets::setWindow(m_mostLocalUrlJob, this);
}
- connect(m_mostLocalUrlJob, SIGNAL(result(KJob*)), this, SLOT(slotMostLocalUrlResult(KJob*)));
+ connect(m_mostLocalUrlJob, &KIO::StatJob::result, this, &TerminalPanel::slotMostLocalUrlResult);
}
}
#include <panels/panel.h>
-class TerminalInterfaceV2;
+class TerminalInterface;
class QVBoxLayout;
class QWidget;
KIO::StatJob* m_mostLocalUrlJob;
QVBoxLayout* m_layout;
- TerminalInterfaceV2* m_terminal;
+ TerminalInterface* m_terminal;
QWidget* m_terminalWidget;
KParts::ReadOnlyPart* m_konsolePart;
QString m_konsolePartCurrentDirectory;
QButtonGroup* group)
{
QRadioButton* button = new QRadioButton(text);
- connect(button, SIGNAL(clicked()), this, SIGNAL(facetChanged()));
+ connect(button, &QRadioButton::clicked, this, &DolphinFacetsWidget::facetChanged);
group->addButton(button);
return button;
}
#include <KLineEdit>
#include <KLocale>
#include <KSeparator>
+#include <KGlobalSettings>
#include <QButtonGroup>
#include <QDir>
button->setAutoExclusive(true);
button->setAutoRaise(true);
button->setCheckable(true);
- connect(button, SIGNAL(clicked(bool)), this, SLOT(slotConfigurationChanged()));
+ connect(button, &QToolButton::clicked, this, &DolphinSearchBox::slotConfigurationChanged);
}
void DolphinSearchBox::loadSettings()
closeButton->setAutoRaise(true);
closeButton->setIcon(KIcon("dialog-close"));
closeButton->setToolTip(i18nc("@info:tooltip", "Quit searching"));
- connect(closeButton, SIGNAL(clicked()), this, SLOT(emitCloseRequest()));
+ connect(closeButton, &QToolButton::clicked, this, &DolphinSearchBox::emitCloseRequest);
// Create search label
m_searchLabel = new QLabel(this);
m_searchInput->setClearButtonShown(true);
m_searchInput->setFont(KGlobalSettings::generalFont());
setFocusProxy(m_searchInput);
- connect(m_searchInput, SIGNAL(returnPressed(QString)),
- this, SLOT(slotReturnPressed(QString)));
- connect(m_searchInput, SIGNAL(textChanged(QString)),
- this, SLOT(slotSearchTextChanged(QString)));
+ connect(m_searchInput, static_cast<void(KLineEdit::*)(const QString&)>(&KLineEdit::returnPressed),
+ this, &DolphinSearchBox::slotReturnPressed);
+ connect(m_searchInput, &KLineEdit::textChanged,
+ this, &DolphinSearchBox::slotSearchTextChanged);
// Apply layout for the search input
QHBoxLayout* searchInputLayout = new QHBoxLayout();
m_facetsToggleButton = new QToolButton(this);
m_facetsToggleButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
initButton(m_facetsToggleButton);
- connect(m_facetsToggleButton, SIGNAL(clicked()), this, SLOT(slotFacetsButtonToggled()));
+ connect(m_facetsToggleButton, &QToolButton::clicked, this, &DolphinSearchBox::slotFacetsButtonToggled);
m_facetsWidget = new DolphinFacetsWidget(this);
m_facetsWidget->installEventFilter(this);
m_facetsWidget->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Maximum);
- connect(m_facetsWidget, SIGNAL(facetChanged()), this, SLOT(slotFacetChanged()));
+ connect(m_facetsWidget, &DolphinFacetsWidget::facetChanged, this, &DolphinSearchBox::slotFacetChanged);
// Apply layout for the options
QHBoxLayout* optionsLayout = new QHBoxLayout();
m_startSearchTimer = new QTimer(this);
m_startSearchTimer->setSingleShot(true);
m_startSearchTimer->setInterval(1000);
- connect(m_startSearchTimer, SIGNAL(timeout()), this, SLOT(emitSearchRequest()));
+ connect(m_startSearchTimer, &QTimer::timeout, this, &DolphinSearchBox::emitSearchRequest);
updateFacetsToggleButton();
}
// while we adjust the search text and the facet widget.
blockSignals(true);
- const QVariantHash customOptions = query.customOptions();
+ const QVariantMap customOptions = query.customOptions();
if (customOptions.contains("includeFolder")) {
setSearchPath(customOptions.value("includeFolder").toString());
} else {
#include <KIO/NetAccess>
#include <KIO/Job>
#include <KUrl>
+#include <kdemacros.h>
#include <ktemporaryfile.h>
#include <QCoreApplication>
cleanup();
}
-void FileNameSearchProtocol::listDir(const KUrl& url)
+void FileNameSearchProtocol::listDir(const QUrl& url)
{
cleanup();
- const QString search = url.queryItem("search");
+ const QString search = url.queryItemValue("search");
if (!search.isEmpty()) {
m_regExp = new QRegExp(search, Qt::CaseInsensitive, QRegExp::Wildcard);
}
m_checkContent = false;
- const QString checkContent = url.queryItem("checkContent");
+ const QString checkContent = url.queryItemValue("checkContent");
if (checkContent == QLatin1String("yes")) {
m_checkContent = true;
}
- const QString urlString = url.queryItem("url");
+ const QString urlString = url.queryItemValue("url");
searchDirectory(KUrl(urlString));
cleanup();
dirLister->openUrl(directory);
QEventLoop eventLoop;
- QObject::connect(dirLister, SIGNAL(canceled()), &eventLoop, SLOT(quit()));
- QObject::connect(dirLister, SIGNAL(completed()), &eventLoop, SLOT(quit()));
+ QObject::connect(dirLister, static_cast<void(KDirLister::*)()>(&KDirLister::canceled), &eventLoop, &QEventLoop::quit);
+ QObject::connect(dirLister, static_cast<void(KDirLister::*)()>(&KDirLister::completed), &eventLoop, &QEventLoop::quit);
eventLoop.exec();
// Visualize all items that match the search pattern
bool addItem = false;
if (!m_regExp || item.name().contains(*m_regExp)) {
addItem = true;
- } else if (m_checkContent && item.determineMimeType()->is(QLatin1String("text/plain"))) {
+ } else if (m_checkContent && item.determineMimeType().inherits(QLatin1String("text/plain"))) {
addItem = contentContainsPattern(item.url());
}
FileNameSearchProtocol(const QByteArray& pool, const QByteArray& app);
virtual ~FileNameSearchProtocol();
- virtual void listDir(const KUrl& url);
+ virtual void listDir(const QUrl& url) Q_DECL_OVERRIDE;
private:
void searchDirectory(const KUrl& directory);
const KConfigGroup dialogConfig(KSharedConfig::openConfig("dolphinrc"), "AdditionalInfoDialog");
restoreDialogSize(dialogConfig);
- connect(this, SIGNAL(okClicked()), this, SLOT(slotOk()));
+ connect(this, &AdditionalInfoDialog::okClicked, this, &AdditionalInfoDialog::slotOk);
}
AdditionalInfoDialog::~AdditionalInfoDialog()
m_viewProps->setSortOrder(viewProps.sortOrder());
KIO::ListJob* listJob = KIO::listRecursive(dir, KIO::HideProgressInfo);
- connect(listJob, SIGNAL(entries(KIO::Job*,KIO::UDSEntryList)),
- SLOT(slotEntries(KIO::Job*,KIO::UDSEntryList)));
+ connect(listJob, &KIO::ListJob::entries,
+ this, &ApplyViewPropsJob::slotEntries);
addSubjob(listJob);
}
#include <KMessageBox>
#include <KIcon>
+#include <QPushButton>
+#include <QDialogButtonBox>
+
DolphinSettingsDialog::DolphinSettingsDialog(const KUrl& url, QWidget* parent) :
KPageDialog(parent),
m_pages()
setMinimumSize(QSize(512, minSize.height()));
setFaceType(List);
- setCaption(i18nc("@title:window", "Dolphin Preferences"));
- setButtons(Ok | Apply | Cancel | Default);
- enableButtonApply(false);
- setDefaultButton(Ok);
+ setWindowTitle(i18nc("@title:window", "Dolphin Preferences"));
+ QDialogButtonBox* box = new QDialogButtonBox(QDialogButtonBox::Ok
+ | QDialogButtonBox::Apply | QDialogButtonBox::Cancel | QDialogButtonBox::RestoreDefaults);
+ box->button(QDialogButtonBox::Apply)->setEnabled(false);
+ box->button(QDialogButtonBox::Ok)->setDefault(true);
+ setButtonBox(box);
// Startup
StartupSettingsPage* startupSettingsPage = new StartupSettingsPage(url, this);
KPageWidgetItem* startupSettingsFrame = addPage(startupSettingsPage,
i18nc("@title:group", "Startup"));
startupSettingsFrame->setIcon(KIcon("go-home"));
- connect(startupSettingsPage, SIGNAL(changed()), this, SLOT(enableApply()));
+ connect(startupSettingsPage, &StartupSettingsPage::changed, this, &DolphinSettingsDialog::enableApply);
// View Modes
ViewSettingsPage* viewSettingsPage = new ViewSettingsPage(this);
KPageWidgetItem* viewSettingsFrame = addPage(viewSettingsPage,
i18nc("@title:group", "View Modes"));
viewSettingsFrame->setIcon(KIcon("view-choose"));
- connect(viewSettingsPage, SIGNAL(changed()), this, SLOT(enableApply()));
+ connect(viewSettingsPage, &ViewSettingsPage::changed, this, &DolphinSettingsDialog::enableApply);
// Navigation
NavigationSettingsPage* navigationSettingsPage = new NavigationSettingsPage(this);
KPageWidgetItem* navigationSettingsFrame = addPage(navigationSettingsPage,
i18nc("@title:group", "Navigation"));
navigationSettingsFrame->setIcon(KIcon("input-mouse"));
- connect(navigationSettingsPage, SIGNAL(changed()), this, SLOT(enableApply()));
+ connect(navigationSettingsPage, &NavigationSettingsPage::changed, this, &DolphinSettingsDialog::enableApply);
// Services
ServicesSettingsPage* servicesSettingsPage = new ServicesSettingsPage(this);
KPageWidgetItem* servicesSettingsFrame = addPage(servicesSettingsPage,
i18nc("@title:group", "Services"));
servicesSettingsFrame->setIcon(KIcon("services"));
- connect(servicesSettingsPage, SIGNAL(changed()), this, SLOT(enableApply()));
+ connect(servicesSettingsPage, &ServicesSettingsPage::changed, this, &DolphinSettingsDialog::enableApply);
// Trash
TrashSettingsPage* trashSettingsPage = new TrashSettingsPage(this);
KPageWidgetItem* trashSettingsFrame = addPage(trashSettingsPage,
i18nc("@title:group", "Trash"));
trashSettingsFrame->setIcon(KIcon("user-trash"));
- connect(trashSettingsPage, SIGNAL(changed()), this, SLOT(enableApply()));
+ connect(trashSettingsPage, &TrashSettingsPage::changed, this, &DolphinSettingsDialog::enableApply);
// General
GeneralSettingsPage* generalSettingsPage = new GeneralSettingsPage(url, this);
KPageWidgetItem* generalSettingsFrame = addPage(generalSettingsPage,
i18nc("@title:group General settings", "General"));
generalSettingsFrame->setIcon(KIcon("system-run"));
- connect(generalSettingsPage, SIGNAL(changed()), this, SLOT(enableApply()));
+ connect(generalSettingsPage, &GeneralSettingsPage::changed, this, &DolphinSettingsDialog::enableApply);
const KConfigGroup dialogConfig(KSharedConfig::openConfig("dolphinrc"), "SettingsDialog");
- restoreDialogSize(dialogConfig);
+#pragma message("TODO: port")
+ //restoreDialogSize(dialogConfig);
m_pages.append(startupSettingsPage);
m_pages.append(viewSettingsPage);
DolphinSettingsDialog::~DolphinSettingsDialog()
{
KConfigGroup dialogConfig(KSharedConfig::openConfig("dolphinrc"), "SettingsDialog");
- saveDialogSize(dialogConfig);
+#pragma message("TODO: port")
+ //saveDialogSize(dialogConfig);
}
void DolphinSettingsDialog::slotButtonClicked(int button)
{
- if ((button == Ok) || (button == Apply)) {
+ if ((button == QDialogButtonBox::Ok) || (button == QDialogButtonBox::Apply)) {
applySettings();
- } else if (button == Default) {
+ } else if (button == QDialogButtonBox::RestoreDefaults) {
restoreDefaults();
}
- KPageDialog::slotButtonClicked(button);
+#pragma message("TODO: port")
+ //KPageDialog::slotButtonClicked(button);
}
void DolphinSettingsDialog::enableApply()
{
- enableButtonApply(true);
+ buttonBox()->button(QDialogButtonBox::Apply)->setEnabled(true);
}
void DolphinSettingsDialog::applySettings()
settings->setModifiedStartupSettings(false);
settings->writeConfig();
}
-
- enableButtonApply(false);
+ buttonBox()->button(QDialogButtonBox::Apply)->setEnabled(false);
}
void DolphinSettingsDialog::restoreDefaults()
loadSettings();
- connect(m_localViewProps, SIGNAL(toggled(bool)), this, SIGNAL(changed()));
- connect(m_globalViewProps, SIGNAL(toggled(bool)), this, SIGNAL(changed()));
- connect(m_showToolTips, SIGNAL(toggled(bool)), this, SIGNAL(changed()));
- connect(m_showSelectionToggle, SIGNAL(toggled(bool)), this, SIGNAL(changed()));
- connect(m_naturalSorting, SIGNAL(toggled(bool)), this, SIGNAL(changed()));
- connect(m_renameInline, SIGNAL(toggled(bool)), this, SIGNAL(changed()));
+ connect(m_localViewProps, &QRadioButton::toggled, this, &BehaviorSettingsPage::changed);
+ connect(m_globalViewProps, &QRadioButton::toggled, this, &BehaviorSettingsPage::changed);
+ connect(m_showToolTips, &QCheckBox::toggled, this, &BehaviorSettingsPage::changed);
+ connect(m_showSelectionToggle, &QCheckBox::toggled, this, &BehaviorSettingsPage::changed);
+ connect(m_naturalSorting, &QCheckBox::toggled, this, &BehaviorSettingsPage::changed);
+ connect(m_renameInline, &QCheckBox::toggled, this, &BehaviorSettingsPage::changed);
}
BehaviorSettingsPage::~BehaviorSettingsPage()
const bool naturalSorting = m_naturalSorting->isChecked();
if (KGlobalSettings::naturalSorting() != naturalSorting) {
- KConfigGroup group(KGlobal::config(), "KDE");
+ KConfigGroup group(KSharedConfig::openConfig(), "KDE");
group.writeEntry("NaturalSorting", naturalSorting, KConfig::Persistent | KConfig::Global);
KGlobalSettings::emitChange(KGlobalSettings::NaturalSortingChanged);
}
#include <QApplication>
#include <QDir>
#include <QVBoxLayout>
+#include <QUrl>
ConfigurePreviewPluginDialog::ConfigurePreviewPluginDialog(const QString& pluginName,
const QString& desktopEntryName,
setMainWidget(mainWidget);
- connect(this, SIGNAL(okClicked()), this, SLOT(slotOk()));
+ connect(this, &ConfigurePreviewPluginDialog::okClicked, this, &ConfigurePreviewPluginDialog::slotOk);
}
ConfigurePreviewPluginDialog::~ConfigurePreviewPluginDialog()
// for a specific MIME-type should be regenerated. As this is not available yet we
// delete the whole thumbnails directory.
QApplication::changeOverrideCursor(Qt::BusyCursor);
- KIO::NetAccess::del(QString(QDir::homePath() + "/.thumbnails/"), this);
+ KIO::NetAccess::del(QUrl::fromLocalFile(QDir::homePath() + "/.thumbnails/"), this);
QApplication::restoreOverrideCursor();
}
loadSettings();
- connect(m_confirmMoveToTrash, SIGNAL(toggled(bool)), this, SIGNAL(changed()));
- connect(m_confirmDelete, SIGNAL(toggled(bool)), this, SIGNAL(changed()));
- connect(m_confirmClosingMultipleTabs, SIGNAL(toggled(bool)), this, SIGNAL(changed()));
+ connect(m_confirmMoveToTrash, &QCheckBox::toggled, this, &ConfirmationsSettingsPage::changed);
+ connect(m_confirmDelete, &QCheckBox::toggled, this, &ConfirmationsSettingsPage::changed);
+ connect(m_confirmClosingMultipleTabs, &QCheckBox::toggled, this, &ConfirmationsSettingsPage::changed);
}
ConfirmationsSettingsPage::~ConfirmationsSettingsPage()
// initialize 'Behavior' tab
BehaviorSettingsPage* behaviorPage = new BehaviorSettingsPage(url, tabWidget);
tabWidget->addTab(behaviorPage, i18nc("@title:tab Behavior settings", "Behavior"));
- connect(behaviorPage, SIGNAL(changed()), this, SIGNAL(changed()));
+ connect(behaviorPage, &BehaviorSettingsPage::changed, this, &GeneralSettingsPage::changed);
// initialize 'Previews' tab
PreviewsSettingsPage* previewsPage = new PreviewsSettingsPage(tabWidget);
tabWidget->addTab(previewsPage, i18nc("@title:tab Previews settings", "Previews"));
- connect(previewsPage, SIGNAL(changed()), this, SIGNAL(changed()));
+ connect(previewsPage, &PreviewsSettingsPage::changed, this, &GeneralSettingsPage::changed);
// initialize 'Context Menu' tab
ConfirmationsSettingsPage* confirmationsPage = new ConfirmationsSettingsPage(tabWidget);
tabWidget->addTab(confirmationsPage, i18nc("@title:tab Confirmations settings", "Confirmations"));
- connect(confirmationsPage, SIGNAL(changed()), this, SIGNAL(changed()));
+ connect(confirmationsPage, &ConfirmationsSettingsPage::changed, this, &GeneralSettingsPage::changed);
// initialize 'Status Bar' tab
StatusBarSettingsPage* statusBarPage = new StatusBarSettingsPage(tabWidget);
tabWidget->addTab(statusBarPage, i18nc("@title:tab Status Bar settings", "Status Bar"));
- connect(statusBarPage, SIGNAL(changed()), this, SIGNAL(changed()));
+ connect(statusBarPage, &StatusBarSettingsPage::changed, this, &GeneralSettingsPage::changed);
m_pages.append(behaviorPage);
m_pages.append(previewsPage);
m_listView = new QListView(this);
ServiceItemDelegate* delegate = new ServiceItemDelegate(m_listView, m_listView);
- connect(delegate, SIGNAL(requestServiceConfiguration(QModelIndex)),
- this, SLOT(configureService(QModelIndex)));
+ connect(delegate, &ServiceItemDelegate::requestServiceConfiguration,
+ this, &PreviewsSettingsPage::configureService);
ServiceModel* serviceModel = new ServiceModel(this);
QSortFilterProxyModel* proxyModel = new QSortFilterProxyModel(this);
loadSettings();
- connect(m_listView, SIGNAL(clicked(QModelIndex)), this, SIGNAL(changed()));
- connect(m_remoteFileSizeBox, SIGNAL(valueChanged(int)), this, SIGNAL(changed()));
+ connect(m_listView, &QListView::clicked, this, &PreviewsSettingsPage::changed);
+ connect(m_remoteFileSizeBox, static_cast<void(KIntSpinBox::*)(int)>(&KIntSpinBox::valueChanged), this, &PreviewsSettingsPage::changed);
}
PreviewsSettingsPage::~PreviewsSettingsPage()
QAbstractItemModel* model = m_listView->model();
const KService::List plugins = KServiceTypeTrader::self()->query(QLatin1String("ThumbCreator"));
- foreach (const KSharedPtr<KService>& service, plugins) {
+ foreach (const KService::Ptr& service, plugins) {
const bool configurable = service->property("Configurable", QVariant::Bool).toBool();
const bool show = m_enabledPreviewPlugins.contains(service->desktopEntryName());
loadSettings();
- connect(m_showZoomSlider, SIGNAL(toggled(bool)), this, SIGNAL(changed()));
- connect(m_showSpaceInfo, SIGNAL(toggled(bool)), this, SIGNAL(changed()));
+ connect(m_showZoomSlider, &QCheckBox::toggled, this, &StatusBarSettingsPage::changed);
+ connect(m_showSpaceInfo, &QCheckBox::toggled, this, &StatusBarSettingsPage::changed);
}
StatusBarSettingsPage::~StatusBarSettingsPage()
#include <KLocale>
#include <KPluginFactory>
#include <KPluginLoader>
+#include <KGlobal>
#include <settings/general/behaviorsettingspage.h>
#include <settings/general/previewssettingspage.h>
K_EXPORT_PLUGIN(KCMDolphinGeneralConfigFactory("kcmdolphingeneral"))
DolphinGeneralConfigModule::DolphinGeneralConfigModule(QWidget* parent, const QVariantList& args) :
- KCModule(KCMDolphinGeneralConfigFactory::componentData(), parent),
+ KCModule(parent),
m_pages()
{
Q_UNUSED(args);
// initialize 'Behavior' tab
BehaviorSettingsPage* behaviorPage = new BehaviorSettingsPage(QDir::homePath(), tabWidget);
tabWidget->addTab(behaviorPage, i18nc("@title:tab Behavior settings", "Behavior"));
- connect(behaviorPage, SIGNAL(changed()), this, SLOT(changed()));
+ connect(behaviorPage, &BehaviorSettingsPage::changed, this, static_cast<void(DolphinGeneralConfigModule::*)()>(&DolphinGeneralConfigModule::changed));
// initialize 'Previews' tab
PreviewsSettingsPage* previewsPage = new PreviewsSettingsPage(tabWidget);
tabWidget->addTab(previewsPage, i18nc("@title:tab Previews settings", "Previews"));
- connect(previewsPage, SIGNAL(changed()), this, SLOT(changed()));
+ connect(previewsPage, &PreviewsSettingsPage::changed, this, static_cast<void(DolphinGeneralConfigModule::*)()>(&DolphinGeneralConfigModule::changed));
// initialize 'Confirmations' tab
ConfirmationsSettingsPage* confirmationsPage = new ConfirmationsSettingsPage(tabWidget);
tabWidget->addTab(confirmationsPage, i18nc("@title:tab Confirmations settings", "Confirmations"));
- connect(confirmationsPage, SIGNAL(changed()), this, SLOT(changed()));
+ connect(confirmationsPage, &ConfirmationsSettingsPage::changed, this, static_cast<void(DolphinGeneralConfigModule::*)()>(&DolphinGeneralConfigModule::changed));
m_pages.append(behaviorPage);
m_pages.append(previewsPage);
#include <KLocale>
#include <KPluginFactory>
#include <KPluginLoader>
+#include <KGlobal>
#include <settings/navigation/navigationsettingspage.h>
K_EXPORT_PLUGIN(KCMDolphinNavigationConfigFactory("kcmdolphinnavigation"))
DolphinNavigationConfigModule::DolphinNavigationConfigModule(QWidget* parent, const QVariantList& args) :
- KCModule(KCMDolphinNavigationConfigFactory::componentData(), parent),
+ KCModule(parent),
m_navigation(0)
{
Q_UNUSED(args);
topLayout->setSpacing(KDialog::spacingHint());
m_navigation = new NavigationSettingsPage(this);
- connect(m_navigation, SIGNAL(changed()), this, SLOT(changed()));
+ connect(m_navigation, &NavigationSettingsPage::changed, this, static_cast<void(DolphinNavigationConfigModule::*)()>(&DolphinNavigationConfigModule::changed));
topLayout->addWidget(m_navigation, 0, 0);
}
#include <KLocale>
#include <KPluginFactory>
#include <KPluginLoader>
+#include <KGlobal>
#include <settings/services/servicessettingspage.h>
K_EXPORT_PLUGIN(KCMDolphinServicesConfigFactory("kcmdolphinservices"))
DolphinServicesConfigModule::DolphinServicesConfigModule(QWidget* parent, const QVariantList& args) :
- KCModule(KCMDolphinServicesConfigFactory::componentData(), parent),
+ KCModule(parent),
m_services(0)
{
Q_UNUSED(args);
topLayout->setSpacing(KDialog::spacingHint());
m_services = new ServicesSettingsPage(this);
- connect(m_services, SIGNAL(changed()), this, SLOT(changed()));
+ connect(m_services, &ServicesSettingsPage::changed, this, static_cast<void(DolphinServicesConfigModule::*)()>(&DolphinServicesConfigModule::changed));
topLayout->addWidget(m_services, 0, 0);
}
#include <KPluginFactory>
#include <KPluginLoader>
#include <KIcon>
+#include <KGlobal>
#include <settings/viewmodes/viewsettingstab.h>
K_EXPORT_PLUGIN(KCMDolphinViewModesConfigFactory("kcmdolphinviewmodes"))
DolphinViewModesConfigModule::DolphinViewModesConfigModule(QWidget* parent, const QVariantList& args) :
- KCModule(KCMDolphinViewModesConfigFactory::componentData(), parent),
+ KCModule(parent),
m_tabs()
{
Q_UNUSED(args);
// Initialize 'Icons' tab
ViewSettingsTab* iconsTab = new ViewSettingsTab(ViewSettingsTab::IconsMode, tabWidget);
tabWidget->addTab(iconsTab, KIcon("view-list-icons"), i18nc("@title:tab", "Icons"));
- connect(iconsTab, SIGNAL(changed()), this, SLOT(viewModeChanged()));
+ connect(iconsTab, &ViewSettingsTab::changed, this, &DolphinViewModesConfigModule::viewModeChanged);
// Initialize 'Compact' tab
ViewSettingsTab* compactTab = new ViewSettingsTab(ViewSettingsTab::CompactMode, tabWidget);
tabWidget->addTab(compactTab, KIcon("view-list-details"), i18nc("@title:tab", "Compact"));
- connect(compactTab, SIGNAL(changed()), this, SLOT(viewModeChanged()));
+ connect(compactTab, &ViewSettingsTab::changed, this, &DolphinViewModesConfigModule::viewModeChanged);
// Initialize 'Details' tab
ViewSettingsTab* detailsTab = new ViewSettingsTab(ViewSettingsTab::DetailsMode, tabWidget);
tabWidget->addTab(detailsTab, KIcon("view-list-tree"), i18nc("@title:tab", "Details"));
- connect(detailsTab, SIGNAL(changed()), this, SLOT(viewModeChanged()));
+ connect(detailsTab, &ViewSettingsTab::changed, this, &DolphinViewModesConfigModule::viewModeChanged);
m_tabs.append(iconsTab);
m_tabs.append(compactTab);
loadSettings();
- connect(m_singleClick, SIGNAL(toggled(bool)), this, SIGNAL(changed()));
- connect(m_doubleClick, SIGNAL(toggled(bool)), this, SIGNAL(changed()));
- connect(m_openArchivesAsFolder, SIGNAL(toggled(bool)), this, SIGNAL(changed()));
- connect(m_autoExpandFolders, SIGNAL(toggled(bool)), this, SIGNAL(changed()));
+ connect(m_singleClick, &QRadioButton::toggled, this, &NavigationSettingsPage::changed);
+ connect(m_doubleClick, &QRadioButton::toggled, this, &NavigationSettingsPage::changed);
+ connect(m_openArchivesAsFolder, &QCheckBox::toggled, this, &NavigationSettingsPage::changed);
+ connect(m_autoExpandFolders, &QCheckBox::toggled, this, &NavigationSettingsPage::changed);
}
NavigationSettingsPage::~NavigationSettingsPage()
painter->restore();
}
-QList<QWidget*> ServiceItemDelegate::createItemWidgets() const
+QList<QWidget*> ServiceItemDelegate::createItemWidgets(const QModelIndex&) const
{
QCheckBox* checkBox = new QCheckBox();
QPalette palette = checkBox->palette();
palette.setColor(QPalette::WindowText, palette.color(QPalette::Text));
checkBox->setPalette(palette);
- connect(checkBox, SIGNAL(clicked(bool)), this, SLOT(slotCheckBoxClicked(bool)));
+ connect(checkBox, &QCheckBox::clicked, this, &ServiceItemDelegate::slotCheckBoxClicked);
KPushButton* configureButton = new KPushButton();
- connect(configureButton, SIGNAL(clicked()), this, SLOT(slotConfigureButtonClicked()));
+ connect(configureButton, &KPushButton::clicked, this, &ServiceItemDelegate::slotConfigureButtonClicked);
return QList<QWidget*>() << checkBox << configureButton;
}
virtual void paint(QPainter* painter, const QStyleOptionViewItem& option,
const QModelIndex& index) const;
- virtual QList<QWidget*> createItemWidgets() const;
+ virtual QList<QWidget*> createItemWidgets(const QModelIndex&) const Q_DECL_OVERRIDE;
virtual void updateItemWidgets(const QList<QWidget*> widgets,
const QStyleOptionViewItem& option,
#include <KIcon>
#include <KLocale>
#include <KMessageBox>
-#include <knewstuff3/knewstuffbutton.h>
+#include <KNS3/Button>
#include <KService>
#include <KServiceTypeTrader>
#include <KStandardDirs>
m_listView->setModel(m_sortModel);
m_listView->setItemDelegate(delegate);
m_listView->setVerticalScrollMode(QListView::ScrollPerPixel);
- connect(m_listView, SIGNAL(clicked(QModelIndex)), this, SIGNAL(changed()));
+ connect(m_listView, &QListView::clicked, this, &ServicesSettingsPage::changed);
KNS3::Button* downloadButton = new KNS3::Button(i18nc("@action:button", "Download New Services..."),
"servicemenu.knsrc",
this);
- connect(downloadButton, SIGNAL(dialogFinished(KNS3::Entry::List)), this, SLOT(loadServices()));
+ connect(downloadButton, &KNS3::Button::dialogFinished, this, &ServicesSettingsPage::loadServices);
topLayout->addWidget(label);
topLayout->addWidget(m_listView);
// Load generic services
const KService::List entries = KServiceTypeTrader::self()->query("KonqPopupMenu/Plugin");
- foreach (const KSharedPtr<KService>& service, entries) {
+ foreach (const KService::Ptr& service, entries) {
const QString file = KStandardDirs::locate("services", service->entryPath());
const QList<KServiceAction> serviceActions =
KDesktopFileActions::userDefinedServices(file, true);
// Load service plugins that implement the KFileItemActionPlugin interface
const KService::List pluginServices = KServiceTypeTrader::self()->query("KFileItemAction/Plugin");
- foreach (const KSharedPtr<KService>& service, pluginServices) {
+ foreach (const KService::Ptr& service, pluginServices) {
const QString desktopEntryName = service->desktopEntryName();
if (!isInServicesList(desktopEntryName)) {
const bool checked = showGroup.readEntry(desktopEntryName, true);
m_homeUrl = new KLineEdit(homeUrlBox);
m_homeUrl->setClearButtonShown(true);
- QPushButton* selectHomeUrlButton = new QPushButton(KIcon("folder-open"), QString(), homeUrlBox);
+ QPushButton* selectHomeUrlButton = new QPushButton(QIcon::fromTheme("folder-open"), QString(), homeUrlBox);
#ifndef QT_NO_ACCESSIBILITY
selectHomeUrlButton->setAccessibleName(i18nc("@action:button", "Select Home Location"));
#endif
- connect(selectHomeUrlButton, SIGNAL(clicked()),
- this, SLOT(selectHomeUrl()));
+ connect(selectHomeUrlButton, &QPushButton::clicked,
+ this, &StartupSettingsPage::selectHomeUrl);
KHBox* buttonBox = new KHBox(homeBox);
buttonBox->setSpacing(spacing);
QPushButton* useCurrentButton = new QPushButton(i18nc("@action:button", "Use Current Location"), buttonBox);
- connect(useCurrentButton, SIGNAL(clicked()),
- this, SLOT(useCurrentLocation()));
+ connect(useCurrentButton, &QPushButton::clicked,
+ this, &StartupSettingsPage::useCurrentLocation);
QPushButton* useDefaultButton = new QPushButton(i18nc("@action:button", "Use Default Location"), buttonBox);
- connect(useDefaultButton, SIGNAL(clicked()),
- this, SLOT(useDefaultLocation()));
+ connect(useDefaultButton, &QPushButton::clicked,
+ this, &StartupSettingsPage::useDefaultLocation);
QVBoxLayout* homeBoxLayout = new QVBoxLayout(homeBox);
homeBoxLayout->addWidget(homeUrlBox);
loadSettings();
- connect(m_homeUrl, SIGNAL(textChanged(QString)), this, SLOT(slotSettingsChanged()));
- connect(m_splitView, SIGNAL(toggled(bool)), this, SLOT(slotSettingsChanged()));
- connect(m_editableUrl, SIGNAL(toggled(bool)), this, SLOT(slotSettingsChanged()));
- connect(m_showFullPath, SIGNAL(toggled(bool)), this, SLOT(slotSettingsChanged()));
- connect(m_filterBar, SIGNAL(toggled(bool)), this, SLOT(slotSettingsChanged()));
+ connect(m_homeUrl, &KLineEdit::textChanged, this, &StartupSettingsPage::slotSettingsChanged);
+ connect(m_splitView, &QCheckBox::toggled, this, &StartupSettingsPage::slotSettingsChanged);
+ connect(m_editableUrl, &QCheckBox::toggled, this, &StartupSettingsPage::slotSettingsChanged);
+ connect(m_showFullPath, &QCheckBox::toggled, this, &StartupSettingsPage::slotSettingsChanged);
+ connect(m_filterBar, &QCheckBox::toggled, this, &StartupSettingsPage::slotSettingsChanged);
}
StartupSettingsPage::~StartupSettingsPage()
loadSettings();
- connect(m_proxy, SIGNAL(changed(bool)), this, SIGNAL(changed()));
+ connect(m_proxy, static_cast<void(KCModuleProxy::*)(bool)>(&KCModuleProxy::changed), this, &TrashSettingsPage::changed);
}
TrashSettingsPage::~TrashSettingsPage()
m_modeCombo = new KComboBox(this);
m_modeCombo->addItem(i18nc("@item:inlistbox Font", "System Font"));
m_modeCombo->addItem(i18nc("@item:inlistbox Font", "Custom Font"));
- connect(m_modeCombo, SIGNAL(activated(int)),
- this, SLOT(changeMode(int)));
+ connect(m_modeCombo, static_cast<void(KComboBox::*)(int)>(&KComboBox::activated),
+ this, &DolphinFontRequester::changeMode);
m_chooseFontButton = new QPushButton(i18nc("@action:button Choose font", "Choose..."), this);
- connect(m_chooseFontButton, SIGNAL(clicked()),
- this, SLOT(openFontDialog()));
+ connect(m_chooseFontButton, &QPushButton::clicked,
+ this, &DolphinFontRequester::openFontDialog);
changeMode(m_modeCombo->currentIndex());
// Initialize 'Icons' tab
ViewSettingsTab* iconsTab = new ViewSettingsTab(ViewSettingsTab::IconsMode, tabWidget);
- tabWidget->addTab(iconsTab, KIcon("view-list-icons"), i18nc("@title:tab", "Icons"));
- connect(iconsTab, SIGNAL(changed()), this, SIGNAL(changed()));
+ tabWidget->addTab(iconsTab, QIcon::fromTheme("view-list-icons"), i18nc("@title:tab", "Icons"));
+ connect(iconsTab, &ViewSettingsTab::changed, this, &ViewSettingsPage::changed);
// Initialize 'Compact' tab
ViewSettingsTab* compactTab = new ViewSettingsTab(ViewSettingsTab::CompactMode, tabWidget);
- tabWidget->addTab(compactTab, KIcon("view-list-details"), i18nc("@title:tab", "Compact"));
- connect(compactTab, SIGNAL(changed()), this, SIGNAL(changed()));
+ tabWidget->addTab(compactTab, QIcon::fromTheme("view-list-details"), i18nc("@title:tab", "Compact"));
+ connect(compactTab, &ViewSettingsTab::changed, this, &ViewSettingsPage::changed);
// Initialize 'Details' tab
ViewSettingsTab* detailsTab = new ViewSettingsTab(ViewSettingsTab::DetailsMode, tabWidget);
- tabWidget->addTab(detailsTab, KIcon("view-list-tree"), i18nc("@title:tab", "Details"));
- connect(detailsTab, SIGNAL(changed()), this, SIGNAL(changed()));
+ tabWidget->addTab(detailsTab, QIcon::fromTheme("view-list-tree"), i18nc("@title:tab", "Details"));
+ connect(detailsTab, &ViewSettingsTab::changed, this, &ViewSettingsPage::changed);
m_tabs.append(iconsTab);
m_tabs.append(compactTab);
m_defaultSizeSlider->setPageStep(1);
m_defaultSizeSlider->setTickPosition(QSlider::TicksBelow);
m_defaultSizeSlider->setRange(minRange, maxRange);
- connect(m_defaultSizeSlider, SIGNAL(valueChanged(int)),
- this, SLOT(slotDefaultSliderMoved(int)));
+ connect(m_defaultSizeSlider, &QSlider::valueChanged,
+ this, &ViewSettingsTab::slotDefaultSliderMoved);
QLabel* previewLabel = new QLabel(i18nc("@label:listbox", "Preview:"), this);
m_previewSizeSlider = new QSlider(Qt::Horizontal, this);
m_previewSizeSlider->setPageStep(1);
m_previewSizeSlider->setTickPosition(QSlider::TicksBelow);
m_previewSizeSlider->setRange(minRange, maxRange);
- connect(m_previewSizeSlider, SIGNAL(valueChanged(int)),
- this, SLOT(slotPreviewSliderMoved(int)));
+ connect(m_previewSizeSlider, &QSlider::valueChanged,
+ this, &ViewSettingsTab::slotPreviewSliderMoved);
QGridLayout* layout = new QGridLayout(iconSizeGroup);
layout->addWidget(defaultLabel, 0, 0, Qt::AlignRight);
loadSettings();
- connect(m_defaultSizeSlider, SIGNAL(valueChanged(int)), this, SIGNAL(changed()));
- connect(m_previewSizeSlider, SIGNAL(valueChanged(int)), this, SIGNAL(changed()));
- connect(m_fontRequester, SIGNAL(changed()), this, SIGNAL(changed()));
+ connect(m_defaultSizeSlider, &QSlider::valueChanged, this, &ViewSettingsTab::changed);
+ connect(m_previewSizeSlider, &QSlider::valueChanged, this, &ViewSettingsTab::changed);
+ connect(m_fontRequester, &DolphinFontRequester::changed, this, &ViewSettingsTab::changed);
switch (m_mode) {
case IconsMode:
- connect(m_widthBox, SIGNAL(currentIndexChanged(int)), this, SIGNAL(changed()));
- connect(m_maxLinesBox, SIGNAL(currentIndexChanged(int)), this, SIGNAL(changed()));
+ connect(m_widthBox, static_cast<void(KComboBox::*)(int)>(&KComboBox::currentIndexChanged), this, &ViewSettingsTab::changed);
+ connect(m_maxLinesBox, static_cast<void(KComboBox::*)(int)>(&KComboBox::currentIndexChanged), this, &ViewSettingsTab::changed);
break;
case CompactMode:
- connect(m_widthBox, SIGNAL(currentIndexChanged(int)), this, SIGNAL(changed()));
+ connect(m_widthBox, static_cast<void(KComboBox::*)(int)>(&KComboBox::currentIndexChanged), this, &ViewSettingsTab::changed);
break;
case DetailsMode:
- connect(m_expandableFolders, SIGNAL(toggled(bool)), this, SIGNAL(changed()));
+ connect(m_expandableFolders, &QCheckBox::toggled, this, &ViewSettingsTab::changed);
break;
default:
break;
QLabel* viewModeLabel = new QLabel(i18nc("@label:listbox", "View mode:"), propsGrid);
m_viewMode = new KComboBox(propsGrid);
- m_viewMode->addItem(KIcon("view-list-icons"), i18nc("@item:inlistbox", "Icons"), DolphinView::IconsView);
- m_viewMode->addItem(KIcon("view-list-details"), i18nc("@item:inlistbox", "Compact"), DolphinView::CompactView);
- m_viewMode->addItem(KIcon("view-list-tree"), i18nc("@item:inlistbox", "Details"), DolphinView::DetailsView);
+ m_viewMode->addItem(QIcon::fromTheme("view-list-icons"), i18nc("@item:inlistbox", "Icons"), DolphinView::IconsView);
+ m_viewMode->addItem(QIcon::fromTheme("view-list-details"), i18nc("@item:inlistbox", "Compact"), DolphinView::CompactView);
+ m_viewMode->addItem(QIcon::fromTheme("view-list-tree"), i18nc("@item:inlistbox", "Details"), DolphinView::DetailsView);
QLabel* sortingLabel = new QLabel(i18nc("@label:listbox", "Sorting:"), propsGrid);
QWidget* sortingBox = new QWidget(propsGrid);
topLayout->addWidget(propsBox);
- connect(m_viewMode, SIGNAL(currentIndexChanged(int)),
- this, SLOT(slotViewModeChanged(int)));
- connect(m_sorting, SIGNAL(currentIndexChanged(int)),
- this, SLOT(slotSortingChanged(int)));
- connect(m_sortOrder, SIGNAL(currentIndexChanged(int)),
- this, SLOT(slotSortOrderChanged(int)));
- connect(m_additionalInfo, SIGNAL(clicked()),
- this, SLOT(configureAdditionalInfo()));
- connect(m_sortFoldersFirst, SIGNAL(clicked()),
- this, SLOT(slotSortFoldersFirstChanged()));
- connect(m_previewsShown, SIGNAL(clicked()),
- this, SLOT(slotShowPreviewChanged()));
- connect(m_showInGroups, SIGNAL(clicked()),
- this, SLOT(slotGroupedSortingChanged()));
- connect(m_showHiddenFiles, SIGNAL(clicked()),
- this, SLOT(slotShowHiddenFilesChanged()));
-
- connect(this, SIGNAL(okClicked()), this, SLOT(slotOk()));
- connect(this, SIGNAL(applyClicked()), this, SLOT(slotApply()));
+ connect(m_viewMode, static_cast<void(KComboBox::*)(int)>(&KComboBox::currentIndexChanged),
+ this, &ViewPropertiesDialog::slotViewModeChanged);
+ connect(m_sorting, static_cast<void(KComboBox::*)(int)>(&KComboBox::currentIndexChanged),
+ this, &ViewPropertiesDialog::slotSortingChanged);
+ connect(m_sortOrder, static_cast<void(KComboBox::*)(int)>(&KComboBox::currentIndexChanged),
+ this, &ViewPropertiesDialog::slotSortOrderChanged);
+ connect(m_additionalInfo, &QPushButton::clicked,
+ this, &ViewPropertiesDialog::configureAdditionalInfo);
+ connect(m_sortFoldersFirst, &QCheckBox::clicked,
+ this, &ViewPropertiesDialog::slotSortFoldersFirstChanged);
+ connect(m_previewsShown, &QCheckBox::clicked,
+ this, &ViewPropertiesDialog::slotShowPreviewChanged);
+ connect(m_showInGroups, &QCheckBox::clicked,
+ this, &ViewPropertiesDialog::slotGroupedSortingChanged);
+ connect(m_showHiddenFiles, &QCheckBox::clicked,
+ this, &ViewPropertiesDialog::slotShowHiddenFilesChanged);
+
+ connect(this, &ViewPropertiesDialog::okClicked, this, &ViewPropertiesDialog::slotOk);
+ connect(this, &ViewPropertiesDialog::applyClicked, this, &ViewPropertiesDialog::slotApply);
// Only show the following settings if the view properties are remembered
// for each directory:
topLayout->addWidget(applyBox);
topLayout->addWidget(m_useAsDefault);
- connect(m_applyToCurrentFolder, SIGNAL(clicked(bool)),
- this, SLOT(markAsDirty(bool)));
- connect(m_applyToSubFolders, SIGNAL(clicked(bool)),
- this, SLOT(markAsDirty(bool)));
- connect(m_applyToAllFolders, SIGNAL(clicked(bool)),
- this, SLOT(markAsDirty(bool)));
- connect(m_useAsDefault, SIGNAL(clicked(bool)),
- this, SLOT(markAsDirty(bool)));
+ connect(m_applyToCurrentFolder, &QRadioButton::clicked,
+ this, &ViewPropertiesDialog::markAsDirty);
+ connect(m_applyToSubFolders, &QRadioButton::clicked,
+ this, &ViewPropertiesDialog::markAsDirty);
+ connect(m_applyToAllFolders, &QRadioButton::clicked,
+ this, &ViewPropertiesDialog::markAsDirty);
+ connect(m_useAsDefault, &QCheckBox::clicked,
+ this, &ViewPropertiesDialog::markAsDirty);
}
main->setLayout(topLayout);
// allows to give a progress indication for the user when applying the view
// properties later.
m_dirSizeJob = KIO::directorySize(dir);
- connect(m_dirSizeJob, SIGNAL(result(KJob*)),
- this, SLOT(applyViewProperties()));
+ connect(m_dirSizeJob, &KIO::DirectorySizeJob::result,
+ this, &ViewPropsProgressInfo::applyViewProperties);
// The directory size job cannot emit any progress signal, as it is not aware
// about the total number of directories. Therefor a timer is triggered, which
// periodically updates the current directory count.
m_timer = new QTimer(this);
- connect(m_timer, SIGNAL(timeout()),
- this, SLOT(updateProgress()));
+ connect(m_timer, &QTimer::timeout,
+ this, &ViewPropsProgressInfo::updateProgress);
m_timer->start(300);
- connect(this, SIGNAL(cancelClicked()), this, SLOT(cancelApplying()));
+ connect(this, &ViewPropsProgressInfo::cancelClicked, this, &ViewPropsProgressInfo::cancelApplying);
}
ViewPropsProgressInfo::~ViewPropsProgressInfo()
m_dirSizeJob = 0;
m_applyViewPropsJob = new ApplyViewPropsJob(m_dir, *m_viewProps);
- connect(m_applyViewPropsJob, SIGNAL(result(KJob*)),
- this, SLOT(close()));
+ connect(m_applyViewPropsJob, &ApplyViewPropsJob::result,
+ this, &ViewPropsProgressInfo::close);
}
void ViewPropsProgressInfo::cancelApplying()
m_zoomSlider->setPageStep(1);
m_zoomSlider->setRange(ZoomLevelInfo::minimumLevel(), ZoomLevelInfo::maximumLevel());
- connect(m_zoomSlider, SIGNAL(valueChanged(int)), this, SIGNAL(zoomLevelChanged(int)));
- connect(m_zoomSlider, SIGNAL(valueChanged(int)), this, SLOT(updateZoomSliderToolTip(int)));
- connect(m_zoomSlider, SIGNAL(sliderMoved(int)), this, SLOT(showZoomSliderToolTip(int)));
+ connect(m_zoomSlider, &QSlider::valueChanged, this, &DolphinStatusBar::zoomLevelChanged);
+ connect(m_zoomSlider, &QSlider::valueChanged, this, &DolphinStatusBar::updateZoomSliderToolTip);
+ connect(m_zoomSlider, &QSlider::sliderMoved, this, &DolphinStatusBar::showZoomSliderToolTip);
// Initialize space information
m_spaceInfo = new StatusBarSpaceInfo(this);
m_stopButton->setAutoRaise(true);
m_stopButton->setToolTip(i18nc("@tooltip", "Stop loading"));
m_stopButton->hide();
- connect(m_stopButton, SIGNAL(clicked()), this, SIGNAL(stopPressed()));
+ connect(m_stopButton, &QToolButton::clicked, this, &DolphinStatusBar::stopPressed);
m_progressTextLabel = new QLabel(this);
m_progressTextLabel->hide();
m_showProgressBarTimer = new QTimer(this);
m_showProgressBarTimer->setInterval(500);
m_showProgressBarTimer->setSingleShot(true);
- connect(m_showProgressBarTimer, SIGNAL(timeout()), this, SLOT(updateProgressInfo()));
+ connect(m_showProgressBarTimer, &QTimer::timeout, this, &DolphinStatusBar::updateProgressInfo);
m_resetToDefaultTextTimer = new QTimer(this);
m_resetToDefaultTextTimer->setInterval(ResetToDefaultTimeout);
m_resetToDefaultTextTimer->setSingleShot(true);
- connect(m_resetToDefaultTextTimer, SIGNAL(timeout()), this, SLOT(slotResetToDefaultText()));
+ connect(m_resetToDefaultTextTimer, &QTimer::timeout, this, &DolphinStatusBar::slotResetToDefaultText);
// Initialize top layout and size policies
const int fontHeight = QFontMetrics(m_label->font()).height();
// Use a timer to update the space information. Polling is useful
// here, as files can be deleted/added outside the scope of Dolphin.
m_timer = new QTimer(this);
- connect(m_timer, SIGNAL(timeout()), this, SLOT(calculateSpaceInfo()));
+ connect(m_timer, &QTimer::timeout, this, &StatusBarSpaceInfo::calculateSpaceInfo);
}
StatusBarSpaceInfo::~StatusBarSpaceInfo()
../kitemviews/kitemlistview.cpp
../kitemviews/kitemlistcontainer.cpp
../kitemviews/kitemlistwidget.cpp
- ../kitemviews/kitemlistviewaccessible.cpp
+# ../kitemviews/kitemlistviewaccessible.cpp # TODO: enable once accessibility is ported to Qt5
../kitemviews/kitemset.cpp
../kitemviews/kstandarditemlistview.cpp
../kitemviews/kstandarditemlistwidget.cpp
../kitemviews/kfileitemlistview.cpp
../kitemviews/kitemmodelbase.cpp
../kitemviews/kitemlistview.cpp
- ../kitemviews/kitemlistviewaccessible.cpp
+# ../kitemviews/kitemlistviewaccessible.cpp # TODO: enable once accessibility is ported to Qt5
../kitemviews/kitemlistcontainer.cpp
../kitemviews/kitemlistwidget.cpp
../kitemviews/kitemset.cpp
../search/dolphin_searchsettings.kcfgc
)
kde4_add_unit_test(dolphinsearchboxtest TEST ${dolphinsearchboxtest_SRCS})
- target_link_libraries(dolphinsearchboxtest ${KDE4_KIO_LIBS} ${BALOO_LIBRARIES} ${QT_QTTEST_LIBRARY})
+ target_link_libraries(dolphinsearchboxtest ${KDE4_KIO_LIBS} ${BALOO_FILE_LIBRARY} ${BALOO_CORE_LIBRARY} ${QT_QTTEST_LIBRARY})
endif (Baloo_FOUND)
# KStandardItemModelTest
#include <kitemviews/kitemliststyleoption.h>
#include <KGlobalSettings>
+#include <KGlobal>
#include <views/viewmodecontroller.h>
void DolphinNewFileMenuObserver::attach(const DolphinNewFileMenu* menu)
{
- connect(menu, SIGNAL(fileCreated(KUrl)),
- this, SIGNAL(itemCreated(KUrl)));
- connect(menu, SIGNAL(directoryCreated(KUrl)),
- this, SIGNAL(itemCreated(KUrl)));
- connect(menu, SIGNAL(errorMessage(QString)),
- this, SIGNAL(errorMessage(QString)));
+ connect(menu, &DolphinNewFileMenu::fileCreated,
+ this, &DolphinNewFileMenuObserver::itemCreated);
+ connect(menu, &DolphinNewFileMenu::directoryCreated,
+ this, &DolphinNewFileMenuObserver::itemCreated);
+ connect(menu, &DolphinNewFileMenu::errorMessage,
+ this, &DolphinNewFileMenuObserver::errorMessage);
}
void DolphinNewFileMenuObserver::detach(const DolphinNewFileMenu* menu)
{
- disconnect(menu, SIGNAL(fileCreated(KUrl)),
- this, SIGNAL(itemCreated(KUrl)));
- disconnect(menu, SIGNAL(directoryCreated(KUrl)),
- this, SIGNAL(itemCreated(KUrl)));
- disconnect(menu, SIGNAL(errorMessage(QString)),
- this, SIGNAL(errorMessage(QString)));
+ disconnect(menu, &DolphinNewFileMenu::fileCreated,
+ this, &DolphinNewFileMenuObserver::itemCreated);
+ disconnect(menu, &DolphinNewFileMenu::directoryCreated,
+ this, &DolphinNewFileMenuObserver::itemCreated);
+ disconnect(menu, &DolphinNewFileMenu::errorMessage,
+ this, &DolphinNewFileMenuObserver::errorMessage);
}
DolphinNewFileMenuObserver::DolphinNewFileMenuObserver() :
void detach(const DolphinNewFileMenu* menu);
signals:
- void itemCreated(const KUrl& url);
+ void itemCreated(const QUrl& url);
void errorMessage(const QString& error);
private:
{
m_menu = new KActionMenu(KIcon("character-set"), i18n("Select Remote Charset"), this);
m_actionHandler->actionCollection()->addAction("change_remote_encoding", m_menu);
- connect(m_menu->menu(), SIGNAL(aboutToShow()),
- this, SLOT(slotAboutToShow()));
+ connect(m_menu->menu(), &QMenu::aboutToShow,
+ this, &DolphinRemoteEncoding::slotAboutToShow);
m_menu->setEnabled(false);
m_menu->setDelayed(false);
void DolphinRemoteEncoding::fillMenu()
{
- KMenu* menu = m_menu->menu();
+ QMenu* menu = m_menu->menu();
menu->clear();
menu->addAction(i18n("Default"), this, SLOT(slotDefault()), 0)->setCheckable(true);
m_idDefault = m_encodingDescriptions.size() + 2;
- connect(menu, SIGNAL(triggered(QAction*)), this, SLOT(slotItemSelected(QAction*)));
+ connect(menu, &QMenu::triggered, this, &DolphinRemoteEncoding::slotItemSelected);
}
void DolphinRemoteEncoding::updateMenu()
#include <QItemSelection>
#include <QTimer>
#include <QScrollBar>
+#include <QPointer>
+#include <QMenu>
#include <KDesktopFile>
#include <KProtocolManager>
#include <KIO/PreviewJob>
#include <KJob>
#include <KMenu>
+#include <KGlobal>
#include <KMessageBox>
+#include <KJobWidgets>
#include <konq_fileitemcapabilities.h>
#include <konq_operations.h>
#include <konqmimedata.h>
// When a new item has been created by the "Create New..." menu, the item should
// get selected and it must be assured that the item will get visible. As the
// creation is done asynchronously, several signals must be checked:
- connect(&DolphinNewFileMenuObserver::instance(), SIGNAL(itemCreated(KUrl)),
- this, SLOT(observeCreatedItem(KUrl)));
+ connect(&DolphinNewFileMenuObserver::instance(), &DolphinNewFileMenuObserver::itemCreated,
+ this, &DolphinView::observeCreatedItem);
m_selectionChangedTimer = new QTimer(this);
m_selectionChangedTimer->setSingleShot(true);
m_selectionChangedTimer->setInterval(300);
- connect(m_selectionChangedTimer, SIGNAL(timeout()),
- this, SLOT(emitSelectionChangedSignal()));
+ connect(m_selectionChangedTimer, &QTimer::timeout,
+ this, &DolphinView::emitSelectionChangedSignal);
m_model = new KFileItemModel(this);
m_view = new DolphinItemListView();
m_container = new KItemListContainer(controller, this);
m_container->installEventFilter(this);
setFocusProxy(m_container);
- connect(m_container->horizontalScrollBar(), SIGNAL(valueChanged(int)), this, SLOT(hideToolTip()));
- connect(m_container->verticalScrollBar(), SIGNAL(valueChanged(int)), this, SLOT(hideToolTip()));
+ connect(m_container->horizontalScrollBar(), &QScrollBar::valueChanged, this, &DolphinView::hideToolTip);
+ connect(m_container->verticalScrollBar(), &QScrollBar::valueChanged, this, &DolphinView::hideToolTip);
controller->setSelectionBehavior(KItemListController::MultiSelection);
- connect(controller, SIGNAL(itemActivated(int)), this, SLOT(slotItemActivated(int)));
- connect(controller, SIGNAL(itemsActivated(KItemSet)), this, SLOT(slotItemsActivated(KItemSet)));
- connect(controller, SIGNAL(itemMiddleClicked(int)), this, SLOT(slotItemMiddleClicked(int)));
- connect(controller, SIGNAL(itemContextMenuRequested(int,QPointF)), this, SLOT(slotItemContextMenuRequested(int,QPointF)));
- connect(controller, SIGNAL(viewContextMenuRequested(QPointF)), this, SLOT(slotViewContextMenuRequested(QPointF)));
- connect(controller, SIGNAL(headerContextMenuRequested(QPointF)), this, SLOT(slotHeaderContextMenuRequested(QPointF)));
- connect(controller, SIGNAL(mouseButtonPressed(int,Qt::MouseButtons)), this, SLOT(slotMouseButtonPressed(int,Qt::MouseButtons)));
- connect(controller, SIGNAL(itemHovered(int)), this, SLOT(slotItemHovered(int)));
- connect(controller, SIGNAL(itemUnhovered(int)), this, SLOT(slotItemUnhovered(int)));
- connect(controller, SIGNAL(itemDropEvent(int,QGraphicsSceneDragDropEvent*)), this, SLOT(slotItemDropEvent(int,QGraphicsSceneDragDropEvent*)));
- connect(controller, SIGNAL(escapePressed()), this, SLOT(stopLoading()));
- connect(controller, SIGNAL(modelChanged(KItemModelBase*,KItemModelBase*)), this, SLOT(slotModelChanged(KItemModelBase*,KItemModelBase*)));
-
- connect(m_model, SIGNAL(directoryLoadingStarted()), this, SLOT(slotDirectoryLoadingStarted()));
- connect(m_model, SIGNAL(directoryLoadingCompleted()), this, SLOT(slotDirectoryLoadingCompleted()));
- connect(m_model, SIGNAL(directoryLoadingCanceled()), this, SIGNAL(directoryLoadingCanceled()));
- connect(m_model, SIGNAL(directoryLoadingProgress(int)), this, SIGNAL(directoryLoadingProgress(int)));
- connect(m_model, SIGNAL(directorySortingProgress(int)), this, SIGNAL(directorySortingProgress(int)));
- connect(m_model, SIGNAL(itemsChanged(KItemRangeList,QSet<QByteArray>)),
- this, SLOT(slotItemsChanged()));
- connect(m_model, SIGNAL(itemsRemoved(KItemRangeList)), this, SIGNAL(itemCountChanged()));
- connect(m_model, SIGNAL(itemsInserted(KItemRangeList)), this, SIGNAL(itemCountChanged()));
- connect(m_model, SIGNAL(infoMessage(QString)), this, SIGNAL(infoMessage(QString)));
- connect(m_model, SIGNAL(errorMessage(QString)), this, SIGNAL(errorMessage(QString)));
- connect(m_model, SIGNAL(directoryRedirection(KUrl,KUrl)), this, SLOT(slotDirectoryRedirection(KUrl,KUrl)));
- connect(m_model, SIGNAL(urlIsFileError(KUrl)), this, SIGNAL(urlIsFileError(KUrl)));
+ connect(controller, &KItemListController::itemActivated, this, &DolphinView::slotItemActivated);
+ connect(controller, &KItemListController::itemsActivated, this, &DolphinView::slotItemsActivated);
+ connect(controller, &KItemListController::itemMiddleClicked, this, &DolphinView::slotItemMiddleClicked);
+ connect(controller, &KItemListController::itemContextMenuRequested, this, &DolphinView::slotItemContextMenuRequested);
+ connect(controller, &KItemListController::viewContextMenuRequested, this, &DolphinView::slotViewContextMenuRequested);
+ connect(controller, &KItemListController::headerContextMenuRequested, this, &DolphinView::slotHeaderContextMenuRequested);
+ connect(controller, &KItemListController::mouseButtonPressed, this, &DolphinView::slotMouseButtonPressed);
+ connect(controller, &KItemListController::itemHovered, this, &DolphinView::slotItemHovered);
+ connect(controller, &KItemListController::itemUnhovered, this, &DolphinView::slotItemUnhovered);
+ connect(controller, &KItemListController::itemDropEvent, this, &DolphinView::slotItemDropEvent);
+ connect(controller, &KItemListController::escapePressed, this, &DolphinView::stopLoading);
+ connect(controller, &KItemListController::modelChanged, this, &DolphinView::slotModelChanged);
+
+ connect(m_model, &KFileItemModel::directoryLoadingStarted, this, &DolphinView::slotDirectoryLoadingStarted);
+ connect(m_model, &KFileItemModel::directoryLoadingCompleted, this, &DolphinView::slotDirectoryLoadingCompleted);
+ connect(m_model, &KFileItemModel::directoryLoadingCanceled, this, &DolphinView::directoryLoadingCanceled);
+ connect(m_model, &KFileItemModel::directoryLoadingProgress, this, &DolphinView::directoryLoadingProgress);
+ connect(m_model, &KFileItemModel::directorySortingProgress, this, &DolphinView::directorySortingProgress);
+ connect(m_model, &KFileItemModel::itemsChanged,
+ this, &DolphinView::slotItemsChanged);
+ connect(m_model, &KFileItemModel::itemsRemoved, this, &DolphinView::itemCountChanged);
+ connect(m_model, &KFileItemModel::itemsInserted, this, &DolphinView::itemCountChanged);
+ connect(m_model, &KFileItemModel::infoMessage, this, &DolphinView::infoMessage);
+ connect(m_model, &KFileItemModel::errorMessage, this, &DolphinView::errorMessage);
+ connect(m_model, &KFileItemModel::directoryRedirection, this, &DolphinView::slotDirectoryRedirection);
+ connect(m_model, &KFileItemModel::urlIsFileError, this, &DolphinView::urlIsFileError);
m_view->installEventFilter(this);
- connect(m_view, SIGNAL(sortOrderChanged(Qt::SortOrder,Qt::SortOrder)),
- this, SLOT(slotSortOrderChangedByHeader(Qt::SortOrder,Qt::SortOrder)));
- connect(m_view, SIGNAL(sortRoleChanged(QByteArray,QByteArray)),
- this, SLOT(slotSortRoleChangedByHeader(QByteArray,QByteArray)));
- connect(m_view, SIGNAL(visibleRolesChanged(QList<QByteArray>,QList<QByteArray>)),
- this, SLOT(slotVisibleRolesChangedByHeader(QList<QByteArray>,QList<QByteArray>)));
- connect(m_view, SIGNAL(roleEditingCanceled(int,QByteArray,QVariant)),
- this, SLOT(slotRoleEditingCanceled()));
- connect(m_view->header(), SIGNAL(columnWidthChanged(QByteArray,qreal,qreal)),
- this, SLOT(slotHeaderColumnWidthChanged(QByteArray,qreal,qreal)));
+ connect(m_view, &DolphinItemListView::sortOrderChanged,
+ this, &DolphinView::slotSortOrderChangedByHeader);
+ connect(m_view, &DolphinItemListView::sortRoleChanged,
+ this, &DolphinView::slotSortRoleChangedByHeader);
+ connect(m_view, &DolphinItemListView::visibleRolesChanged,
+ this, &DolphinView::slotVisibleRolesChangedByHeader);
+ connect(m_view, &DolphinItemListView::roleEditingCanceled,
+ this, &DolphinView::slotRoleEditingCanceled);
+ connect(m_view->header(), &KItemListHeader::columnWidthChanged,
+ this, &DolphinView::slotHeaderColumnWidthChanged);
KItemListSelectionManager* selectionManager = controller->selectionManager();
- connect(selectionManager, SIGNAL(selectionChanged(KItemSet,KItemSet)),
- this, SLOT(slotSelectionChanged(KItemSet,KItemSet)));
+ connect(selectionManager, &KItemListSelectionManager::selectionChanged,
+ this, &DolphinView::slotSelectionChanged);
m_toolTipManager = new ToolTipManager(this);
m_versionControlObserver = new VersionControlObserver(this);
m_versionControlObserver->setModel(m_model);
- connect(m_versionControlObserver, SIGNAL(infoMessage(QString)), this, SIGNAL(infoMessage(QString)));
- connect(m_versionControlObserver, SIGNAL(errorMessage(QString)), this, SIGNAL(errorMessage(QString)));
- connect(m_versionControlObserver, SIGNAL(operationCompletedMessage(QString)), this, SIGNAL(operationCompletedMessage(QString)));
+ connect(m_versionControlObserver, &VersionControlObserver::infoMessage, this, &DolphinView::infoMessage);
+ connect(m_versionControlObserver, &VersionControlObserver::errorMessage, this, &DolphinView::errorMessage);
+ connect(m_versionControlObserver, &VersionControlObserver::operationCompletedMessage, this, &DolphinView::operationCompletedMessage);
applyViewProperties();
m_topLayout->addWidget(m_container);
const KFileItemList itemList = selectedItems();
m_selectedUrls.clear();
- m_selectedUrls = itemList.urlList();
+ m_selectedUrls = KUrl::List(itemList.urlList());
ViewProperties props(viewPropertiesUrl());
props.setHiddenFilesShown(show);
const KFileItemList itemList = selectedItems();
m_selectedUrls.clear();
- m_selectedUrls = itemList.urlList();
+ m_selectedUrls = KUrl::List(itemList.urlList());
setUrl(url());
loadDirectory(url(), true);
hideToolTip();
- disconnect(m_view, SIGNAL(roleEditingFinished(int,QByteArray,QVariant)),
- this, SLOT(slotRoleEditingFinished(int,QByteArray,QVariant)));
+ disconnect(m_view, &DolphinItemListView::roleEditingFinished,
+ this, &DolphinView::slotRoleEditingFinished);
// It is important to clear the items from the model before
// applying the view properties, otherwise expensive operations
hideToolTip();
- connect(m_view, SIGNAL(roleEditingFinished(int,QByteArray,QVariant)),
- this, SLOT(slotRoleEditingFinished(int,QByteArray,QVariant)));
+ connect(m_view, &DolphinItemListView::roleEditingFinished,
+ this, &DolphinView::slotRoleEditingFinished);
} else {
RenameDialog* dialog = new RenameDialog(this, items);
dialog->setAttribute(Qt::WA_DeleteOnClose);
if (del) {
KIO::Job* job = KIO::del(list);
if (job->ui()) {
- job->ui()->setWindow(this);
+ KJobWidgets::setWindow(job, this);
}
- connect(job, SIGNAL(result(KJob*)),
- this, SLOT(slotDeleteFileFinished(KJob*)));
+ connect(job, &KIO::Job::result,
+ this, &DolphinView::slotDeleteFileFinished);
}
}
// Mark the dropped urls as selected.
m_clearSelectionBeforeSelectingNewItems = true;
m_markFirstNewlySelectedItemAsCurrent = true;
- connect(op, SIGNAL(aboutToCreate(KUrl::List)), this, SLOT(slotAboutToCreate(KUrl::List)));
+ connect(op, static_cast<void(KonqOperations::*)(const KUrl::List&)>(&KonqOperations::aboutToCreate), this, &DolphinView::slotAboutToCreate);
}
setActive(true);
void DolphinView::slotModelChanged(KItemModelBase* current, KItemModelBase* previous)
{
if (previous != 0) {
- disconnect(previous, SIGNAL(directoryLoadingCompleted()), this, SLOT(slotDirectoryLoadingCompleted()));
+ Q_ASSERT(qobject_cast<KFileItemModel*>(previous));
+ KFileItemModel* fileItemModel = static_cast<KFileItemModel*>(previous);
+ disconnect(fileItemModel, &KFileItemModel::directoryLoadingCompleted, this, &DolphinView::slotDirectoryLoadingCompleted);
m_versionControlObserver->setModel(0);
}
if (current) {
Q_ASSERT(qobject_cast<KFileItemModel*>(current));
- connect(current, SIGNAL(loadingCompleted()), this, SLOT(slotDirectoryLoadingCompleted()));
-
KFileItemModel* fileItemModel = static_cast<KFileItemModel*>(current);
+ connect(fileItemModel, &KFileItemModel::directoryLoadingCompleted, this, &DolphinView::slotDirectoryLoadingCompleted);
m_versionControlObserver->setModel(fileItemModel);
}
}
markUrlAsCurrent(urls.first());
m_markFirstNewlySelectedItemAsCurrent = false;
}
- m_selectedUrls << KDirModel::simplifiedUrlList(urls);
+ m_selectedUrls << KUrl::List(KDirModel::simplifiedUrlList(urls));
}
}
void DolphinView::slotRoleEditingCanceled()
{
- disconnect(m_view, SIGNAL(roleEditingFinished(int,QByteArray,QVariant)),
- this, SLOT(slotRoleEditingFinished(int,QByteArray,QVariant)));
+ disconnect(m_view, &DolphinItemListView::roleEditingFinished,
+ this, &DolphinView::slotRoleEditingFinished);
}
void DolphinView::slotRoleEditingFinished(int index, const QByteArray& role, const QVariant& value)
{
- disconnect(m_view, SIGNAL(roleEditingFinished(int,QByteArray,QVariant)),
- this, SLOT(slotRoleEditingFinished(int,QByteArray,QVariant)));
+ disconnect(m_view, &DolphinItemListView::roleEditingFinished,
+ this, &DolphinView::slotRoleEditingFinished);
if (index < 0 || index >= m_model->count()) {
return;
if (op && !newNameExistsAlready) {
// Only connect the renamingFailed signal if there is no item with the new name
// in the model yet, see bug 328262.
- connect(op, SIGNAL(renamingFailed(KUrl,KUrl)), SLOT(slotRenamingFailed(KUrl,KUrl)));
+ connect(op, &KonqOperations::renamingFailed, this, &DolphinView::slotRenamingFailed);
}
}
}
if (op) {
m_clearSelectionBeforeSelectingNewItems = true;
m_markFirstNewlySelectedItemAsCurrent = true;
- connect(op, SIGNAL(aboutToCreate(KUrl::List)), this, SLOT(slotAboutToCreate(KUrl::List)));
+ connect(op, static_cast<void(KonqOperations::*)(const KUrl::List&)>(&KonqOperations::aboutToCreate), this, &DolphinView::slotAboutToCreate);
}
}
#include <KFileItemDelegate>
#include <kio/fileundomanager.h>
#include <KIO/Job>
+#include <KUrl>
#include <QBoxLayout>
#include <QKeyEvent>
#include "views/zoomlevelinfo.h"
#include <konq_operations.h>
+#include <QPointer>
+
#include <KAction>
#include <KActionCollection>
#include <KActionMenu>
m_currentView = view;
- connect(view, SIGNAL(modeChanged(DolphinView::Mode,DolphinView::Mode)),
- this, SLOT(updateViewActions()));
- connect(view, SIGNAL(previewsShownChanged(bool)),
- this, SLOT(slotPreviewsShownChanged(bool)));
- connect(view, SIGNAL(sortOrderChanged(Qt::SortOrder)),
- this, SLOT(slotSortOrderChanged(Qt::SortOrder)));
- connect(view, SIGNAL(sortFoldersFirstChanged(bool)),
- this, SLOT(slotSortFoldersFirstChanged(bool)));
- connect(view, SIGNAL(visibleRolesChanged(QList<QByteArray>,QList<QByteArray>)),
- this, SLOT(slotVisibleRolesChanged(QList<QByteArray>,QList<QByteArray>)));
- connect(view, SIGNAL(groupedSortingChanged(bool)),
- this, SLOT(slotGroupedSortingChanged(bool)));
- connect(view, SIGNAL(hiddenFilesShownChanged(bool)),
- this, SLOT(slotHiddenFilesShownChanged(bool)));
- connect(view, SIGNAL(sortRoleChanged(QByteArray)),
- this, SLOT(slotSortRoleChanged(QByteArray)));
- connect(view, SIGNAL(zoomLevelChanged(int,int)),
- this, SLOT(slotZoomLevelChanged(int,int)));
- connect(view, SIGNAL(writeStateChanged(bool)),
- this, SLOT(slotWriteStateChanged(bool)));
+ connect(view, &DolphinView::modeChanged,
+ this, &DolphinViewActionHandler::updateViewActions);
+ connect(view, &DolphinView::previewsShownChanged,
+ this, &DolphinViewActionHandler::slotPreviewsShownChanged);
+ connect(view, &DolphinView::sortOrderChanged,
+ this, &DolphinViewActionHandler::slotSortOrderChanged);
+ connect(view, &DolphinView::sortFoldersFirstChanged,
+ this, &DolphinViewActionHandler::slotSortFoldersFirstChanged);
+ connect(view, &DolphinView::visibleRolesChanged,
+ this, &DolphinViewActionHandler::slotVisibleRolesChanged);
+ connect(view, &DolphinView::groupedSortingChanged,
+ this, &DolphinViewActionHandler::slotGroupedSortingChanged);
+ connect(view, &DolphinView::hiddenFilesShownChanged,
+ this, &DolphinViewActionHandler::slotHiddenFilesShownChanged);
+ connect(view, &DolphinView::sortRoleChanged,
+ this, &DolphinViewActionHandler::slotSortRoleChanged);
+ connect(view, &DolphinView::zoomLevelChanged,
+ this, &DolphinViewActionHandler::slotZoomLevelChanged);
+ connect(view, &DolphinView::writeStateChanged,
+ this, &DolphinViewActionHandler::slotWriteStateChanged);
}
DolphinView* DolphinViewActionHandler::currentView()
{
// This action doesn't appear in the GUI, it's for the shortcut only.
// KNewFileMenu takes care of the GUI stuff.
- KAction* newDirAction = m_actionCollection->addAction("create_dir");
+ QAction* newDirAction = m_actionCollection->addAction("create_dir");
newDirAction->setText(i18nc("@action", "Create Folder..."));
newDirAction->setShortcut(Qt::Key_F10);
newDirAction->setIcon(KIcon("folder-new"));
newDirAction->setEnabled(false); // Will be enabled in slotWriteStateChanged(bool) if the current URL is writable
- connect(newDirAction, SIGNAL(triggered()), this, SIGNAL(createDirectory()));
+ connect(newDirAction, &QAction::triggered, this, &DolphinViewActionHandler::createDirectory);
// File menu
- KAction* rename = m_actionCollection->addAction("rename");
+ QAction* rename = m_actionCollection->addAction("rename");
rename->setText(i18nc("@action:inmenu File", "Rename..."));
rename->setShortcut(Qt::Key_F2);
rename->setIcon(KIcon("edit-rename"));
- connect(rename, SIGNAL(triggered()), this, SLOT(slotRename()));
+ connect(rename, &QAction::triggered, this, &DolphinViewActionHandler::slotRename);
- KAction* moveToTrash = m_actionCollection->addAction("move_to_trash");
+ QAction* moveToTrash = m_actionCollection->addAction("move_to_trash");
moveToTrash->setText(i18nc("@action:inmenu File", "Move to Trash"));
moveToTrash->setIcon(KIcon("user-trash"));
moveToTrash->setShortcut(QKeySequence::Delete);
- connect(moveToTrash, SIGNAL(triggered(Qt::MouseButtons,Qt::KeyboardModifiers)),
- this, SLOT(slotTrashActivated(Qt::MouseButtons,Qt::KeyboardModifiers)));
+ connect(moveToTrash, &QAction::triggered,
+ this, &DolphinViewActionHandler::slotTrashActivated);
- KAction* deleteAction = m_actionCollection->addAction("delete");
+ QAction* deleteAction = m_actionCollection->addAction("delete");
deleteAction->setIcon(KIcon("edit-delete"));
deleteAction->setText(i18nc("@action:inmenu File", "Delete"));
deleteAction->setShortcut(Qt::SHIFT | Qt::Key_Delete);
- connect(deleteAction, SIGNAL(triggered()), this, SLOT(slotDeleteItems()));
+ connect(deleteAction, &QAction::triggered, this, &DolphinViewActionHandler::slotDeleteItems);
// This action is useful for being enabled when "move_to_trash" should be
// disabled and "delete" is enabled (e.g. non-local files), so that Key_Del
// can be used for deleting the file (#76016). It needs to be a separate action
// so that the Edit menu isn't affected.
- KAction* deleteWithTrashShortcut = m_actionCollection->addAction("delete_shortcut");
+ QAction* deleteWithTrashShortcut = m_actionCollection->addAction("delete_shortcut");
// The descriptive text is just for the shortcuts editor.
deleteWithTrashShortcut->setText(i18nc("@action \"Move to Trash\" for non-local files, etc.", "Delete (using shortcut for Trash)"));
deleteWithTrashShortcut->setShortcut(QKeySequence::Delete);
deleteWithTrashShortcut->setEnabled(false);
- connect(deleteWithTrashShortcut, SIGNAL(triggered()), this, SLOT(slotDeleteItems()));
+ connect(deleteWithTrashShortcut, &QAction::triggered, this, &DolphinViewActionHandler::slotDeleteItems);
- KAction *propertiesAction = m_actionCollection->addAction( "properties" );
+ QAction *propertiesAction = m_actionCollection->addAction( "properties" );
// Well, it's the File menu in dolphinmainwindow and the Edit menu in dolphinpart... :)
propertiesAction->setText( i18nc("@action:inmenu File", "Properties") );
propertiesAction->setIcon(KIcon("document-properties"));
propertiesAction->setShortcuts(QList<QKeySequence>() << Qt::ALT + Qt::Key_Return << Qt::ALT + Qt::Key_Enter);
- connect(propertiesAction, SIGNAL(triggered()), SLOT(slotProperties()));
+ connect(propertiesAction, &QAction::triggered, this, &DolphinViewActionHandler::slotProperties);
// View menu
KToggleAction* iconsAction = iconsModeAction();
viewModeActions->addAction(compactAction);
viewModeActions->addAction(detailsAction);
viewModeActions->setToolBarMode(KSelectAction::MenuMode);
- connect(viewModeActions, SIGNAL(triggered(QAction*)), this, SLOT(slotViewModeActionTriggered(QAction*)));
+ connect(viewModeActions, static_cast<void(KSelectAction::*)(QAction*)>(&KSelectAction::triggered), this, &DolphinViewActionHandler::slotViewModeActionTriggered);
KStandardAction::zoomIn(this,
SLOT(zoomIn()),
showPreview->setText(i18nc("@action:intoolbar", "Preview"));
showPreview->setToolTip(i18nc("@info", "Show preview of files and folders"));
showPreview->setIcon(KIcon("view-preview"));
- connect(showPreview, SIGNAL(triggered(bool)), this, SLOT(togglePreview(bool)));
+ connect(showPreview, &KToggleAction::triggered, this, &DolphinViewActionHandler::togglePreview);
KToggleAction* sortDescending = m_actionCollection->add<KToggleAction>("descending");
sortDescending->setText(i18nc("@action:inmenu Sort", "Descending"));
- connect(sortDescending, SIGNAL(triggered()), this, SLOT(toggleSortOrder()));
+ connect(sortDescending, &KToggleAction::triggered, this, &DolphinViewActionHandler::toggleSortOrder);
KToggleAction* sortFoldersFirst = m_actionCollection->add<KToggleAction>("folders_first");
sortFoldersFirst->setText(i18nc("@action:inmenu Sort", "Folders First"));
- connect(sortFoldersFirst, SIGNAL(triggered()), this, SLOT(toggleSortFoldersFirst()));
+ connect(sortFoldersFirst, &KToggleAction::triggered, this, &DolphinViewActionHandler::toggleSortFoldersFirst);
// View -> Sort By
QActionGroup* sortByActionGroup = createFileItemRolesActionGroup("sort_by_");
KToggleAction* showInGroups = m_actionCollection->add<KToggleAction>("show_in_groups");
showInGroups->setIcon(KIcon("view-group"));
showInGroups->setText(i18nc("@action:inmenu View", "Show in Groups"));
- connect(showInGroups, SIGNAL(triggered(bool)), this, SLOT(toggleGroupedSorting(bool)));
+ connect(showInGroups, &KToggleAction::triggered, this, &DolphinViewActionHandler::toggleGroupedSorting);
KToggleAction* showHiddenFiles = m_actionCollection->add<KToggleAction>("show_hidden_files");
showHiddenFiles->setText(i18nc("@action:inmenu View", "Show Hidden Files"));
showHiddenFiles->setShortcuts(QList<QKeySequence>() << Qt::ALT + Qt::Key_Period << Qt::Key_F8);
- connect(showHiddenFiles, SIGNAL(triggered(bool)), this, SLOT(toggleShowHiddenFiles(bool)));
+ connect(showHiddenFiles, &KToggleAction::triggered, this, &DolphinViewActionHandler::toggleShowHiddenFiles);
- KAction* adjustViewProps = m_actionCollection->addAction("view_properties");
+ QAction* adjustViewProps = m_actionCollection->addAction("view_properties");
adjustViewProps->setText(i18nc("@action:inmenu View", "Adjust View Properties..."));
- connect(adjustViewProps, SIGNAL(triggered()), this, SLOT(slotAdjustViewProperties()));
+ connect(adjustViewProps, &QAction::triggered, this, &DolphinViewActionHandler::slotAdjustViewProperties);
}
QActionGroup* DolphinViewActionHandler::createFileItemRolesActionGroup(const QString& groupPrefix)
QActionGroup* rolesActionGroup = new QActionGroup(m_actionCollection);
rolesActionGroup->setExclusive(isSortGroup);
if (isSortGroup) {
- connect(rolesActionGroup, SIGNAL(triggered(QAction*)),
- this, SLOT(slotSortTriggered(QAction*)));
+ connect(rolesActionGroup, &QActionGroup::triggered,
+ this, &DolphinViewActionHandler::slotSortTriggered);
} else {
- connect(rolesActionGroup, SIGNAL(triggered(QAction*)),
- this, SLOT(toggleVisibleRole(QAction*)));
+ connect(rolesActionGroup, &QActionGroup::triggered,
+ this, &DolphinViewActionHandler::toggleVisibleRole);
}
QString groupName;
groupMenuGroup = new QActionGroup(groupMenu);
groupMenuGroup->setExclusive(isSortGroup);
if (isSortGroup) {
- connect(groupMenuGroup, SIGNAL(triggered(QAction*)),
- this, SLOT(slotSortTriggered(QAction*)));
+ connect(groupMenuGroup, &QActionGroup::triggered,
+ this, &DolphinViewActionHandler::slotSortTriggered);
} else {
- connect(groupMenuGroup, SIGNAL(triggered(QAction*)),
- this, SLOT(toggleVisibleRole(QAction*)));
+ connect(groupMenuGroup, &QActionGroup::triggered,
+ this, &DolphinViewActionHandler::toggleVisibleRole);
}
}
m_currentView->renameSelectedItems();
}
-void DolphinViewActionHandler::slotTrashActivated(Qt::MouseButtons, Qt::KeyboardModifiers modifiers)
+void DolphinViewActionHandler::slotTrashActivated()
{
emit actionBeingHandled();
m_currentView->trashSelectedItems();
* Moves the selected items of the active view to the trash.
* This methods adds "shift means del" handling.
*/
- void slotTrashActivated(Qt::MouseButtons, Qt::KeyboardModifiers);
+ void slotTrashActivated();
/**
* Deletes the selected items of the active view.
#include <KLocale>
#include <konq_operations.h>
#include <KStringHandler>
+#include <kstringhandler_deprecated.h> //TODO port to QCollator
#include <knuminput.h>
#include <kmimetype.h>
}
m_lineEdit = new KLineEdit(page);
- connect(m_lineEdit, SIGNAL(textChanged(QString)), this, SLOT(slotTextChanged(QString)));
+ connect(m_lineEdit, &KLineEdit::textChanged, this, &RenameDialog::slotTextChanged);
int selectionLength = m_newName.length();
if (m_renameOneItem) {
- const QString fileName = items.first().url().prettyUrl();
+ const QString fileName = items.first().url().toDisplayString();
const QString extension = KMimeType::extractKnownExtension(fileName.toLower());
// If the current item is a directory, select the whole file name.
if (!m_renameOneItem) {
QSet<QString> extensions;
foreach (const KFileItem& item, m_items) {
- const QString extension = KMimeType::extractKnownExtension(item.url().prettyUrl().toLower());
+ const QString extension = KMimeType::extractKnownExtension(item.url().toDisplayString().toLower());
if (extensions.contains(extension)) {
m_allExtensionsDifferent = false;
#include <KColorScheme>
#include <KSeparator>
#include <KWindowSystem>
+// For the blurred tooltip background
+#include <KWindowEffects>
#include <KStringHandler>
#include <QLabel>
#include <baloo/filemetadatawidget.h>
#endif
-// For the blurred tooltip background
-#include <plasma/windoweffects.h>
-
FileMetaDataToolTip::FileMetaDataToolTip(QWidget* parent) :
QWidget(parent),
m_preview(0),
// Create widget for the meta data
#ifndef HAVE_BALOO
m_fileMetaDataWidget = new KFileMetaDataWidget(this);
+ connect(m_fileMetaDataWidget, &KFileMetaDataWidget::metaDataRequestFinished,
+ this, &FileMetaDataToolTip::metaDataRequestFinished);
#else
m_fileMetaDataWidget = new Baloo::FileMetaDataWidget(this);
+ connect(m_fileMetaDataWidget, &Baloo::FileMetaDataWidget::metaDataRequestFinished,
+ this, &FileMetaDataToolTip::metaDataRequestFinished);
#endif
m_fileMetaDataWidget->setForegroundRole(QPalette::ToolTipText);
m_fileMetaDataWidget->setReadOnly(true);
- connect(m_fileMetaDataWidget, SIGNAL(metaDataRequestFinished(KFileItemList)),
- this, SIGNAL(metaDataRequestFinished(KFileItemList)));
QVBoxLayout* textLayout = new QVBoxLayout();
textLayout->addWidget(m_name);
void FileMetaDataToolTip::showEvent(QShowEvent *)
{
- Plasma::WindowEffects::overrideShadow(winId(), true);
- Plasma::WindowEffects::enableBlurBehind(winId(), true, mask());
+#pragma message("TODO: port Plasma::WindowEffects::overrideShadow")
+ //Plasma::WindowEffects::overrideShadow(winId(), true);
+ KWindowEffects::enableBlurBehind(winId(), true, mask());
}
#include "filemetadatatooltip.moc"
#include <KIcon>
#include <KIO/JobUiDelegate>
#include <KIO/PreviewJob>
+#include <KJobWidgets>
#include <QApplication>
#include <QDesktopWidget>
m_showToolTipTimer = new QTimer(this);
m_showToolTipTimer->setSingleShot(true);
m_showToolTipTimer->setInterval(500);
- connect(m_showToolTipTimer, SIGNAL(timeout()), this, SLOT(showToolTip()));
+ connect(m_showToolTipTimer, &QTimer::timeout, this, static_cast<void(ToolTipManager::*)()>(&ToolTipManager::showToolTip));
m_contentRetrievalTimer = new QTimer(this);
m_contentRetrievalTimer->setSingleShot(true);
m_contentRetrievalTimer->setInterval(200);
- connect(m_contentRetrievalTimer, SIGNAL(timeout()), this, SLOT(startContentRetrieval()));
+ connect(m_contentRetrievalTimer, &QTimer::timeout, this, &ToolTipManager::startContentRetrieval);
Q_ASSERT(m_contentRetrievalTimer->interval() < m_showToolTipTimer->interval());
}
// meta data retrieval, when passing rapidly over a lot of items.
Q_ASSERT(!m_fileMetaDataToolTip);
m_fileMetaDataToolTip = new FileMetaDataToolTip();
- connect(m_fileMetaDataToolTip, SIGNAL(metaDataRequestFinished(KFileItemList)),
- this, SLOT(slotMetaDataRequestFinished()));
+ connect(m_fileMetaDataToolTip, &FileMetaDataToolTip::metaDataRequestFinished,
+ this, &ToolTipManager::slotMetaDataRequestFinished);
m_contentRetrievalTimer->start();
m_showToolTipTimer->start();
KIO::PreviewJob* job = new KIO::PreviewJob(KFileItemList() << m_item, QSize(256, 256));
job->setIgnoreMaximumSize(m_item.isLocalFile());
if (job->ui()) {
- job->ui()->setWindow(qApp->activeWindow());
+ KJobWidgets::setWindow(job, qApp->activeWindow());
}
- connect(job, SIGNAL(gotPreview(KFileItem,QPixmap)),
- this, SLOT(setPreviewPix(KFileItem,QPixmap)));
- connect(job, SIGNAL(failed(KFileItem)),
- this, SLOT(previewFailed()));
+ connect(job, &KIO::PreviewJob::gotPreview,
+ this, &ToolTipManager::setPreviewPix);
+ connect(job, &KIO::PreviewJob::failed,
+ this, &ToolTipManager::previewFailed);
}
#include "updateitemstatesthread.h"
#include <kversioncontrolplugin2.h>
+#include <QVector>
#include <QMutexLocker>
#include <KLocale>
#include <KService>
+#include <KDebug>
#include <KServiceTypeTrader>
#include <kitemviews/kfileitemmodel.h>
#include <kversioncontrolplugin2.h>
m_dirVerificationTimer = new QTimer(this);
m_dirVerificationTimer->setSingleShot(true);
m_dirVerificationTimer->setInterval(500);
- connect(m_dirVerificationTimer, SIGNAL(timeout()),
- this, SLOT(verifyDirectory()));
+ connect(m_dirVerificationTimer, &QTimer::timeout,
+ this, &VersionControlObserver::verifyDirectory);
}
VersionControlObserver::~VersionControlObserver()
void VersionControlObserver::setModel(KFileItemModel* model)
{
if (m_model) {
- disconnect(m_model, SIGNAL(itemsInserted(KItemRangeList)),
- this, SLOT(delayedDirectoryVerification()));
- disconnect(m_model, SIGNAL(itemsChanged(KItemRangeList,QSet<QByteArray>)),
- this, SLOT(delayedDirectoryVerification()));
+ disconnect(m_model, &KFileItemModel::itemsInserted,
+ this, &VersionControlObserver::delayedDirectoryVerification);
+ disconnect(m_model, &KFileItemModel::itemsChanged,
+ this, &VersionControlObserver::delayedDirectoryVerification);
}
m_model = model;
if (model) {
- connect(m_model, SIGNAL(itemsInserted(KItemRangeList)),
- this, SLOT(delayedDirectoryVerification()));
- connect(m_model, SIGNAL(itemsChanged(KItemRangeList,QSet<QByteArray>)),
- this, SLOT(delayedDirectoryVerification()));
+ connect(m_model, &KFileItemModel::itemsInserted,
+ this, &VersionControlObserver::delayedDirectoryVerification);
+ connect(m_model, &KFileItemModel::itemsChanged,
+ this, &VersionControlObserver::delayedDirectoryVerification);
}
}
if (items.count() == 1) {
const KFileItem rootItem = m_model->rootItem();
if (!rootItem.isNull() && items.first().url() == rootItem.url()) {
- directory = rootItem.url().path(KUrl::AddTrailingSlash);
+ directory = rootItem.url().path();
}
}
if (m_plugin) {
KVersionControlPlugin2* pluginV2 = qobject_cast<KVersionControlPlugin2*>(m_plugin);
if (pluginV2) {
- connect(pluginV2, SIGNAL(itemVersionsChanged()),
- this, SLOT(silentDirectoryVerification()));
+ connect(pluginV2, &KVersionControlPlugin2::itemVersionsChanged,
+ this, &VersionControlObserver::silentDirectoryVerification);
} else {
- connect(m_plugin, SIGNAL(versionStatesChanged()),
- this, SLOT(silentDirectoryVerification()));
+ connect(m_plugin, &KVersionControlPlugin::versionStatesChanged,
+ this, &VersionControlObserver::silentDirectoryVerification);
}
- connect(m_plugin, SIGNAL(infoMessage(QString)),
- this, SIGNAL(infoMessage(QString)));
- connect(m_plugin, SIGNAL(errorMessage(QString)),
- this, SIGNAL(errorMessage(QString)));
- connect(m_plugin, SIGNAL(operationCompletedMessage(QString)),
- this, SIGNAL(operationCompletedMessage(QString)));
+ connect(m_plugin, &KVersionControlPlugin::infoMessage,
+ this, &VersionControlObserver::infoMessage);
+ connect(m_plugin, &KVersionControlPlugin::errorMessage,
+ this, &VersionControlObserver::errorMessage);
+ connect(m_plugin, &KVersionControlPlugin::operationCompletedMessage,
+ this, &VersionControlObserver::operationCompletedMessage);
if (!m_versionedDirectory) {
m_versionedDirectory = true;
emit infoMessage(i18nc("@info:status", "Updating version information..."));
}
m_updateItemStatesThread = new UpdateItemStatesThread(m_plugin, itemStates);
- connect(m_updateItemStatesThread, SIGNAL(finished()),
- this, SLOT(slotThreadFinished()));
- connect(m_updateItemStatesThread, SIGNAL(finished()),
- m_updateItemStatesThread, SLOT(deleteLater()));
+ connect(m_updateItemStatesThread, &UpdateItemStatesThread::finished,
+ this, &VersionControlObserver::slotThreadFinished);
+ connect(m_updateItemStatesThread, &UpdateItemStatesThread::finished,
+ m_updateItemStatesThread, &UpdateItemStatesThread::deleteLater);
m_updateItemStatesThread->start(); // slotThreadFinished() is called when finished
}
#include <libdolphin_export.h>
#include <KFileItem>
+#include <KUrl>
#include <kversioncontrolplugin2.h>
#include <QList>
#include <QMutex>
#include <KLocale>
#include <KStandardDirs>
#include <KUrl>
+#include <KDebug>
+#include <KGlobal>
#include <QCryptographicHash>
#include <QDate>