mirror of
https://invent.kde.org/system/dolphin
synced 2024-11-05 18:47:12 +00:00
also toggle the text between "Split" and "Join" for the split action
svn path=/trunk/KDE/kdebase/apps/; revision=671018
This commit is contained in:
parent
2d8209f072
commit
19dadee2cf
2 changed files with 23 additions and 17 deletions
|
@ -986,16 +986,7 @@ void DolphinMainWindow::init()
|
|||
void DolphinMainWindow::loadSettings()
|
||||
{
|
||||
GeneralSettings* settings = DolphinSettings::instance().generalSettings();
|
||||
|
||||
KToggleAction* splitAction = static_cast<KToggleAction*>(actionCollection()->action("split_view"));
|
||||
const bool isSplit = settings->splitView();
|
||||
if (isSplit) {
|
||||
splitAction->setChecked(true);
|
||||
toggleSplitView();
|
||||
}
|
||||
const KIcon splitIcon(isSplit ? "fileview-join" : "fileview-split");
|
||||
splitAction->setIcon(splitIcon);
|
||||
|
||||
updateSplitAction(settings->splitView());
|
||||
updateViewActions();
|
||||
}
|
||||
|
||||
|
@ -1168,9 +1159,8 @@ void DolphinMainWindow::setupActions()
|
|||
connect(showHiddenFiles, SIGNAL(triggered()), this, SLOT(toggleShowHiddenFiles()));
|
||||
|
||||
KToggleAction* split = actionCollection()->add<KToggleAction>("split_view");
|
||||
split->setText(i18n("Split"));
|
||||
split->setShortcut(Qt::Key_F10);
|
||||
split->setIcon(KIcon("fileview-split"));
|
||||
updateSplitAction(false);
|
||||
connect(split, SIGNAL(triggered()), this, SLOT(toggleSplitView()));
|
||||
|
||||
QAction* reload = actionCollection()->addAction("reload");
|
||||
|
@ -1405,11 +1395,7 @@ void DolphinMainWindow::updateViewActions()
|
|||
static_cast<KToggleAction*>(actionCollection()->action("show_hidden_files"));
|
||||
showHiddenFilesAction->setChecked(m_activeView->showHiddenFiles());
|
||||
|
||||
KToggleAction* splitAction = static_cast<KToggleAction*>(actionCollection()->action("split_view"));
|
||||
const bool isSplit = (m_view[SecondaryIdx] != 0);
|
||||
splitAction->setChecked(isSplit);
|
||||
const KIcon splitIcon(isSplit ? "fileview-join" : "fileview-split");
|
||||
splitAction->setIcon(splitIcon);
|
||||
updateSplitAction(m_view[SecondaryIdx] != 0);
|
||||
|
||||
KToggleAction* editableLocactionAction =
|
||||
static_cast<KToggleAction*>(actionCollection()->action("editable_location"));
|
||||
|
@ -1479,6 +1465,18 @@ void DolphinMainWindow::connectViewSignals(int viewIndex)
|
|||
this, SLOT(slotHistoryChanged()));
|
||||
}
|
||||
|
||||
void DolphinMainWindow::updateSplitAction(bool isSplit)
|
||||
{
|
||||
KToggleAction* splitAction = static_cast<KToggleAction*>(actionCollection()->action("split_view"));
|
||||
if (isSplit) {
|
||||
splitAction->setText(i18n("Join"));
|
||||
splitAction->setIcon(KIcon("fileview-join"));
|
||||
} else {
|
||||
splitAction->setText(i18n("Split"));
|
||||
splitAction->setIcon(KIcon("fileview-split"));
|
||||
}
|
||||
}
|
||||
|
||||
DolphinMainWindow::UndoUiInterface::UndoUiInterface(DolphinMainWindow* mainWin) :
|
||||
KonqUndoManager::UiInterface(mainWin),
|
||||
m_mainWin(mainWin)
|
||||
|
|
|
@ -431,6 +431,14 @@ private:
|
|||
*/
|
||||
void connectViewSignals(int viewIndex);
|
||||
|
||||
/**
|
||||
* Updates the text of the split action:
|
||||
* If \a isSplit is true, the text is set to "Split",
|
||||
* otherwise the text is set to "Join". The icon
|
||||
* is updated to match with the text.
|
||||
*/
|
||||
void updateSplitAction(bool isSplit);
|
||||
|
||||
private:
|
||||
/**
|
||||
* DolphinMainWindowsupports only one or two views, which
|
||||
|
|
Loading…
Reference in a new issue