Changeset View
Changeset View
Standalone View
Standalone View
krusader/Panel/listpanel.cpp
Show First 20 Lines • Show All 41 Lines • ▼ Show 20 Line(s) | |||||
42 | #include <QHBoxLayout> | 42 | #include <QHBoxLayout> | ||
43 | #include <QFrame> | 43 | #include <QFrame> | ||
44 | #include <QMenu> | 44 | #include <QMenu> | ||
45 | #include <QSplitter> | 45 | #include <QSplitter> | ||
46 | #include <QTabBar> | 46 | #include <QTabBar> | ||
47 | 47 | | |||
48 | #include <KCoreAddons/KUrlMimeData> | 48 | #include <KCoreAddons/KUrlMimeData> | ||
49 | #include <KI18n/KLocalizedString> | 49 | #include <KI18n/KLocalizedString> | ||
50 | #include <KIconThemes/KIconLoader> | | |||
51 | #include <KIO/DropJob> | 50 | #include <KIO/DropJob> | ||
52 | #include <KWidgetsAddons/KCursor> | 51 | #include <KWidgetsAddons/KCursor> | ||
53 | #include <KWidgetsAddons/KMessageBox> | 52 | #include <KWidgetsAddons/KMessageBox> | ||
54 | #include <KIOFileWidgets/KFilePlacesModel> | 53 | #include <KIOFileWidgets/KFilePlacesModel> | ||
55 | #include <KIOWidgets/KUrlComboBox> | 54 | #include <KIOWidgets/KUrlComboBox> | ||
56 | 55 | | |||
57 | #include "dirhistoryqueue.h" | 56 | #include "dirhistoryqueue.h" | ||
58 | #include "krcolorcache.h" | 57 | #include "krcolorcache.h" | ||
59 | #include "krerrordisplay.h" | 58 | #include "krerrordisplay.h" | ||
60 | #include "krlayoutfactory.h" | 59 | #include "krlayoutfactory.h" | ||
61 | #include "krpreviewpopup.h" | 60 | #include "krpreviewpopup.h" | ||
62 | #include "krsearchbar.h" | 61 | #include "krsearchbar.h" | ||
63 | #include "listpanelactions.h" | 62 | #include "listpanelactions.h" | ||
64 | #include "panelcontextmenu.h" | 63 | #include "panelcontextmenu.h" | ||
65 | #include "panelfunc.h" | 64 | #include "panelfunc.h" | ||
66 | #include "sidebar.h" | 65 | #include "sidebar.h" | ||
67 | #include "viewactions.h" | 66 | #include "viewactions.h" | ||
68 | 67 | | |||
69 | #include "PanelView/krview.h" | 68 | #include "PanelView/krview.h" | ||
70 | #include "PanelView/krviewfactory.h" | 69 | #include "PanelView/krviewfactory.h" | ||
71 | #include "PanelView/krviewitem.h" | 70 | #include "PanelView/krviewitem.h" | ||
72 | 71 | | |||
73 | #include "../defaults.h" | 72 | #include "../defaults.h" | ||
74 | #include "../kicons.h" | 73 | #include "../icon.h" | ||
75 | #include "../krservices.h" | 74 | #include "../krservices.h" | ||
76 | #include "../krslots.h" | 75 | #include "../krslots.h" | ||
77 | #include "../krusader.h" | 76 | #include "../krusader.h" | ||
78 | #include "../krusaderview.h" | 77 | #include "../krusaderview.h" | ||
79 | 78 | | |||
80 | #include "../Archive/krarchandler.h" | 79 | #include "../Archive/krarchandler.h" | ||
81 | #include "../BookMan/krbookmarkbutton.h" | 80 | #include "../BookMan/krbookmarkbutton.h" | ||
82 | #include "../FileSystem/fileitem.h" | 81 | #include "../FileSystem/fileitem.h" | ||
▲ Show 20 Lines • Show All 150 Lines • ▼ Show 20 Line(s) | 139 | #define ADD_WIDGET(widget) widgets.insert(#widget, widget); | |||
233 | ADD_WIDGET(freeSpace); | 232 | ADD_WIDGET(freeSpace); | ||
234 | 233 | | |||
235 | // progress indicator and cancel button for the quick calc size | 234 | // progress indicator and cancel button for the quick calc size | ||
236 | quickSizeCalcProgress = new QProgressBar(this); | 235 | quickSizeCalcProgress = new QProgressBar(this); | ||
237 | quickSizeCalcProgress->hide(); | 236 | quickSizeCalcProgress->hide(); | ||
238 | ADD_WIDGET(quickSizeCalcProgress); | 237 | ADD_WIDGET(quickSizeCalcProgress); | ||
239 | cancelQuickSizeCalcButton = new QToolButton(this); | 238 | cancelQuickSizeCalcButton = new QToolButton(this); | ||
240 | cancelQuickSizeCalcButton->hide(); | 239 | cancelQuickSizeCalcButton->hide(); | ||
241 | cancelQuickSizeCalcButton->setIcon(krLoader->loadIcon("dialog-cancel", KIconLoader::Toolbar, 16)); | 240 | cancelQuickSizeCalcButton->setIcon(Icon("dialog-cancel")); | ||
242 | cancelQuickSizeCalcButton->setToolTip(i18n("Cancel directory space calculation")); | 241 | cancelQuickSizeCalcButton->setToolTip(i18n("Cancel directory space calculation")); | ||
243 | ADD_WIDGET(cancelQuickSizeCalcButton); | 242 | ADD_WIDGET(cancelQuickSizeCalcButton); | ||
244 | 243 | | |||
245 | // progress indicator for the preview job | 244 | // progress indicator for the preview job | ||
246 | previewProgress = new QProgressBar(this); | 245 | previewProgress = new QProgressBar(this); | ||
247 | previewProgress->hide(); | 246 | previewProgress->hide(); | ||
248 | ADD_WIDGET(previewProgress); | 247 | ADD_WIDGET(previewProgress); | ||
249 | 248 | | |||
250 | // a cancel button for the filesystem refresh and preview job | 249 | // a cancel button for the filesystem refresh and preview job | ||
251 | cancelProgressButton = new QToolButton(this); | 250 | cancelProgressButton = new QToolButton(this); | ||
252 | cancelProgressButton->hide(); | 251 | cancelProgressButton->hide(); | ||
253 | cancelProgressButton->setIcon(krLoader->loadIcon("dialog-cancel", KIconLoader::Toolbar, 16)); | 252 | cancelProgressButton->setIcon(Icon("dialog-cancel")); | ||
254 | connect(cancelProgressButton, SIGNAL(clicked()), this, SLOT(cancelProgress())); | 253 | connect(cancelProgressButton, SIGNAL(clicked()), this, SLOT(cancelProgress())); | ||
255 | ADD_WIDGET(cancelProgressButton); | 254 | ADD_WIDGET(cancelProgressButton); | ||
256 | 255 | | |||
257 | // button for changing the panel sidebar position in the panel | 256 | // button for changing the panel sidebar position in the panel | ||
258 | sidebarPositionButton = new QToolButton(this); | 257 | sidebarPositionButton = new QToolButton(this); | ||
259 | sidebarPositionButton->hide(); | 258 | sidebarPositionButton->hide(); | ||
260 | sidebarPositionButton->setAutoRaise(true); | 259 | sidebarPositionButton->setAutoRaise(true); | ||
261 | sidebarPositionButton->setIcon(krLoader->loadIcon("exchange-positions", KIconLoader::Toolbar, 16)); | 260 | sidebarPositionButton->setIcon(Icon("exchange-positions")); | ||
262 | sidebarPositionButton->setToolTip(i18n("Move Sidebar clockwise")); | 261 | sidebarPositionButton->setToolTip(i18n("Move Sidebar clockwise")); | ||
263 | connect(sidebarPositionButton, &QToolButton::clicked, [this]() { | 262 | connect(sidebarPositionButton, &QToolButton::clicked, [this]() { | ||
264 | // moving position clockwise | 263 | // moving position clockwise | ||
265 | setSidebarPosition((sidebarPosition() + 1) % 4); }); | 264 | setSidebarPosition((sidebarPosition() + 1) % 4); }); | ||
266 | ADD_WIDGET(sidebarPositionButton); | 265 | ADD_WIDGET(sidebarPositionButton); | ||
267 | 266 | | |||
268 | // a quick button to open the sidebar | 267 | // a quick button to open the sidebar | ||
269 | sidebarButton = new QToolButton(this); | 268 | sidebarButton = new QToolButton(this); | ||
270 | sidebarButton->setAutoRaise(true); | 269 | sidebarButton->setAutoRaise(true); | ||
271 | sidebarButton->setIcon(krLoader->loadIcon("arrow-up", KIconLoader::Toolbar, 16)); | 270 | sidebarButton->setIcon(Icon("arrow-up")); | ||
272 | connect(sidebarButton, &QToolButton::clicked, this, &ListPanel::toggleSidebar); | 271 | connect(sidebarButton, &QToolButton::clicked, this, &ListPanel::toggleSidebar); | ||
273 | sidebarButton->setToolTip(i18n("Open the Sidebar")); | 272 | sidebarButton->setToolTip(i18n("Open the Sidebar")); | ||
274 | ADD_WIDGET(sidebarButton); | 273 | ADD_WIDGET(sidebarButton); | ||
275 | 274 | | |||
276 | #undef ADD_WIDGET | 275 | #undef ADD_WIDGET | ||
277 | 276 | | |||
278 | // toolbar buttons | 277 | // toolbar buttons | ||
279 | cdOtherButton = new ActionButton(toolbar, this, _actions->actCdToOther, "="); | 278 | cdOtherButton = new ActionButton(toolbar, this, _actions->actCdToOther, "="); | ||
280 | toolbarLayout->addWidget(cdOtherButton); | 279 | toolbarLayout->addWidget(cdOtherButton); | ||
281 | 280 | | |||
282 | cdUpButton = new ActionButton(toolbar, this, _actions->actDirUp, ".."); | 281 | cdUpButton = new ActionButton(toolbar, this, _actions->actDirUp, ".."); | ||
283 | toolbarLayout->addWidget(cdUpButton); | 282 | toolbarLayout->addWidget(cdUpButton); | ||
284 | 283 | | |||
285 | cdHomeButton = new ActionButton(toolbar, this, _actions->actHome, "~"); | 284 | cdHomeButton = new ActionButton(toolbar, this, _actions->actHome, "~"); | ||
286 | toolbarLayout->addWidget(cdHomeButton); | 285 | toolbarLayout->addWidget(cdHomeButton); | ||
287 | 286 | | |||
288 | cdRootButton = new ActionButton(toolbar, this, _actions->actRoot, "/"); | 287 | cdRootButton = new ActionButton(toolbar, this, _actions->actRoot, "/"); | ||
289 | toolbarLayout->addWidget(cdRootButton); | 288 | toolbarLayout->addWidget(cdRootButton); | ||
290 | 289 | | |||
291 | // create the button for sync-browsing | 290 | // create the button for sync-browsing | ||
292 | syncBrowseButton = new QToolButton(toolbar); | 291 | syncBrowseButton = new QToolButton(toolbar); | ||
293 | syncBrowseButton->setIcon(QIcon::fromTheme("kr_syncbrowse_off")); | 292 | syncBrowseButton->setIcon(Icon("kr_syncbrowse_off")); | ||
294 | syncBrowseButton->setCheckable(true); | 293 | syncBrowseButton->setCheckable(true); | ||
295 | 294 | | |||
296 | const QString syncBrowseText = i18n("This button toggles the sync-browse mode.\n" | 295 | const QString syncBrowseText = i18n("This button toggles the sync-browse mode.\n" | ||
297 | "When active, each folder change is performed in the\n" | 296 | "When active, each folder change is performed in the\n" | ||
298 | "active and inactive panel - if possible."); | 297 | "active and inactive panel - if possible."); | ||
299 | syncBrowseButton->setText(syncBrowseText); | 298 | syncBrowseButton->setText(syncBrowseText); | ||
300 | syncBrowseButton->setToolTip(syncBrowseText); | 299 | syncBrowseButton->setToolTip(syncBrowseText); | ||
301 | connect(syncBrowseButton, &QToolButton::toggled, [=](bool checked) { | 300 | connect(syncBrowseButton, &QToolButton::toggled, [=](bool checked) { | ||
302 | syncBrowseButton->setIcon( | 301 | syncBrowseButton->setIcon( | ||
303 | QIcon::fromTheme(checked ? "kr_syncbrowse_on" : "kr_syncbrowse_off")); | 302 | Icon(checked ? "kr_syncbrowse_on" : "kr_syncbrowse_off")); | ||
304 | }); | 303 | }); | ||
305 | syncBrowseButton->setAutoRaise(true); | 304 | syncBrowseButton->setAutoRaise(true); | ||
306 | toolbarLayout->addWidget(syncBrowseButton); | 305 | toolbarLayout->addWidget(syncBrowseButton); | ||
307 | 306 | | |||
308 | setButtons(); | 307 | setButtons(); | ||
309 | 308 | | |||
310 | // create a splitter to hold the view and the sidebar | 309 | // create a splitter to hold the view and the sidebar | ||
311 | sidebarSplitter = new PercentalSplitter(clientArea); | 310 | sidebarSplitter = new PercentalSplitter(clientArea); | ||
▲ Show 20 Lines • Show All 261 Lines • ▼ Show 20 Line(s) | 571 | if (sidebarSplitterSizes.count() > 0) { | |||
573 | sidebarSplitter->setSizes(sidebarSplitterSizes); | 572 | sidebarSplitter->setSizes(sidebarSplitterSizes); | ||
574 | } else { // on the first time, resize to 50% | 573 | } else { // on the first time, resize to 50% | ||
575 | QList<int> lst; | 574 | QList<int> lst; | ||
576 | lst << height() / 2 << height() / 2; | 575 | lst << height() / 2 << height() / 2; | ||
577 | sidebarSplitter->setSizes(lst); | 576 | sidebarSplitter->setSizes(lst); | ||
578 | } | 577 | } | ||
579 | 578 | | |||
580 | sidebar->show(); | 579 | sidebar->show(); | ||
581 | sidebarButton->setIcon(krLoader->loadIcon("arrow-down", KIconLoader::Toolbar, 16)); | 580 | sidebarButton->setIcon(Icon("arrow-down")); | ||
582 | sidebarButton->setToolTip(i18n("Close the Sidebar")); | 581 | sidebarButton->setToolTip(i18n("Close the Sidebar")); | ||
583 | sidebarPositionButton->show(); | 582 | sidebarPositionButton->show(); | ||
584 | } else { | 583 | } else { | ||
585 | sidebarSplitterSizes.clear(); | 584 | sidebarSplitterSizes.clear(); | ||
586 | sidebarSplitterSizes = sidebarSplitter->sizes(); | 585 | sidebarSplitterSizes = sidebarSplitter->sizes(); | ||
587 | sidebar->hide(); | 586 | sidebar->hide(); | ||
588 | sidebarButton->setIcon(krLoader->loadIcon("arrow-up", KIconLoader::Toolbar, 16)); | 587 | sidebarButton->setIcon(Icon("arrow-up")); | ||
589 | sidebarButton->setToolTip(i18n("Open the Sidebar")); | 588 | sidebarButton->setToolTip(i18n("Open the Sidebar")); | ||
590 | sidebarPositionButton->hide(); | 589 | sidebarPositionButton->hide(); | ||
591 | 590 | | |||
592 | QList<int> lst; | 591 | QList<int> lst; | ||
593 | lst << height() << 0; | 592 | lst << height() << 0; | ||
594 | sidebarSplitter->setSizes(lst); | 593 | sidebarSplitter->setSizes(lst); | ||
595 | if (ACTIVE_PANEL) | 594 | if (ACTIVE_PANEL) | ||
596 | ACTIVE_PANEL->gui->slotFocusOnMe(); | 595 | ACTIVE_PANEL->gui->slotFocusOnMe(); | ||
▲ Show 20 Lines • Show All 783 Lines • Show Last 20 Lines |