Changeset View
Changeset View
Standalone View
Standalone View
krusader/Panel/listpanel.cpp
Show First 20 Lines • Show All 134 Lines • ▼ Show 20 Line(s) | 127 | { | |||
---|---|---|---|---|---|
135 | setAcceptDrops(true); | 135 | setAcceptDrops(true); | ||
136 | 136 | | |||
137 | QHash<QString, QWidget*> widgets; | 137 | QHash<QString, QWidget*> widgets; | ||
138 | 138 | | |||
139 | #define ADD_WIDGET(widget) widgets.insert(#widget, widget); | 139 | #define ADD_WIDGET(widget) widgets.insert(#widget, widget); | ||
140 | 140 | | |||
141 | // media button | 141 | // media button | ||
142 | mediaButton = new MediaButton(this); | 142 | mediaButton = new MediaButton(this); | ||
143 | connect(mediaButton, SIGNAL(aboutToShow()), this, SLOT(slotFocusOnMe())); | 143 | connect(mediaButton, &MediaButton::aboutToShow, this, [=]() { slotFocusOnMe(); }); | ||
144 | connect(mediaButton, SIGNAL(openUrl(QUrl)), func, SLOT(openUrl(QUrl))); | 144 | connect(mediaButton, &MediaButton::openUrl, [=](const QUrl & _t1) { func->openUrl(_t1); }); | ||
145 | connect(mediaButton, SIGNAL(newTab(QUrl)), SLOT(newTab(QUrl))); | 145 | connect(mediaButton, &MediaButton::newTab, this, [=](const QUrl &url) { newTab(url); }); | ||
146 | ADD_WIDGET(mediaButton); | 146 | ADD_WIDGET(mediaButton); | ||
147 | 147 | | |||
148 | // status bar | 148 | // status bar | ||
149 | status = new KrSqueezedTextLabel(this); | 149 | status = new KrSqueezedTextLabel(this); | ||
150 | KConfigGroup group(krConfig, "Look&Feel"); | 150 | KConfigGroup group(krConfig, "Look&Feel"); | ||
151 | status->setFont(group.readEntry("Filelist Font", _FilelistFont)); | 151 | status->setFont(group.readEntry("Filelist Font", _FilelistFont)); | ||
152 | status->setAutoFillBackground(false); | 152 | status->setAutoFillBackground(false); | ||
153 | status->setText(""); // needed for initialization code! | 153 | status->setText(""); // needed for initialization code! | ||
154 | status->setWhatsThis(i18n("The statusbar displays information about the filesystem " | 154 | status->setWhatsThis(i18n("The statusbar displays information about the filesystem " | ||
155 | "which holds your current folder: total size, free space, " | 155 | "which holds your current folder: total size, free space, " | ||
156 | "type of filesystem, etc.")); | 156 | "type of filesystem, etc.")); | ||
157 | ADD_WIDGET(status); | 157 | ADD_WIDGET(status); | ||
158 | 158 | | |||
159 | // back button | 159 | // back button | ||
160 | backButton = new ActionButton(this, this, _actions->actHistoryBackward); | 160 | backButton = new ActionButton(this, this, _actions->actHistoryBackward); | ||
161 | ADD_WIDGET(backButton); | 161 | ADD_WIDGET(backButton); | ||
162 | 162 | | |||
163 | // forward button | 163 | // forward button | ||
164 | forwardButton = new ActionButton(this, this, _actions->actHistoryForward); | 164 | forwardButton = new ActionButton(this, this, _actions->actHistoryForward); | ||
165 | ADD_WIDGET(forwardButton); | 165 | ADD_WIDGET(forwardButton); | ||
166 | 166 | | |||
167 | 167 | | |||
168 | // ... create the history button | 168 | // ... create the history button | ||
169 | historyButton = new DirHistoryButton(func->history, this); | 169 | historyButton = new DirHistoryButton(func->history, this); | ||
170 | connect(historyButton, SIGNAL(aboutToShow()), this, SLOT(slotFocusOnMe())); | 170 | connect(historyButton, &DirHistoryButton::aboutToShow, this, [=]() { slotFocusOnMe(); }); | ||
171 | connect(historyButton, SIGNAL(gotoPos(int)), func, SLOT(historyGotoPos(int))); | 171 | connect(historyButton, &DirHistoryButton::gotoPos, func, &ListPanelFunc::historyGotoPos); | ||
172 | ADD_WIDGET(historyButton); | 172 | ADD_WIDGET(historyButton); | ||
173 | 173 | | |||
174 | // bookmarks button | 174 | // bookmarks button | ||
175 | bookmarksButton = new KrBookmarkButton(this); | 175 | bookmarksButton = new KrBookmarkButton(this); | ||
176 | connect(bookmarksButton, SIGNAL(aboutToShow()), this, SLOT(slotFocusOnMe())); | 176 | connect(bookmarksButton, &KrBookmarkButton::aboutToShow, this, [=]() { slotFocusOnMe(); }); | ||
177 | connect(bookmarksButton, SIGNAL(openUrl(QUrl)), func, SLOT(openUrl(QUrl))); | 177 | connect(bookmarksButton, &KrBookmarkButton::openUrl, [=](const QUrl & _t1) { func->openUrl(_t1); }); | ||
178 | bookmarksButton->setWhatsThis(i18n("Open menu with bookmarks. You can also add " | 178 | bookmarksButton->setWhatsThis(i18n("Open menu with bookmarks. You can also add " | ||
179 | "current location to the list, edit bookmarks " | 179 | "current location to the list, edit bookmarks " | ||
180 | "or add subfolder to the list.")); | 180 | "or add subfolder to the list.")); | ||
181 | ADD_WIDGET(bookmarksButton); | 181 | ADD_WIDGET(bookmarksButton); | ||
182 | 182 | | |||
183 | // url input field | 183 | // url input field | ||
184 | urlNavigator = new KUrlNavigator(new KFilePlacesModel(this), QUrl(), this); | 184 | urlNavigator = new KUrlNavigator(new KFilePlacesModel(this), QUrl(), this); | ||
185 | urlNavigator->setWhatsThis(i18n("Name of folder where you are. You can also " | 185 | urlNavigator->setWhatsThis(i18n("Name of folder where you are. You can also " | ||
186 | "enter name of desired location to move there. " | 186 | "enter name of desired location to move there. " | ||
187 | "Use of Net protocols like ftp or fish is possible.")); | 187 | "Use of Net protocols like ftp or fish is possible.")); | ||
188 | // handle certain key events here in event filter | 188 | // handle certain key events here in event filter | ||
189 | urlNavigator->editor()->installEventFilter(this); | 189 | urlNavigator->editor()->installEventFilter(this); | ||
190 | urlNavigator->setUrlEditable(isNavigatorEditModeSet()); | 190 | urlNavigator->setUrlEditable(isNavigatorEditModeSet()); | ||
191 | urlNavigator->setShowFullPath(group.readEntry("Navigator Full Path", false)); | 191 | urlNavigator->setShowFullPath(group.readEntry("Navigator Full Path", false)); | ||
192 | connect(urlNavigator, SIGNAL(returnPressed()), this, SLOT(slotFocusOnMe())); | 192 | connect(urlNavigator, &KUrlNavigator::returnPressed, this, [=]() { slotFocusOnMe(); }); | ||
193 | connect(urlNavigator, &KUrlNavigator::urlChanged, this, &ListPanel::slotNavigatorUrlChanged); | 193 | connect(urlNavigator, &KUrlNavigator::urlChanged, this, &ListPanel::slotNavigatorUrlChanged); | ||
194 | connect(urlNavigator->editor()->lineEdit(), &QLineEdit::editingFinished, this, &ListPanel::resetNavigatorMode); | 194 | connect(urlNavigator->editor()->lineEdit(), &QLineEdit::editingFinished, this, &ListPanel::resetNavigatorMode); | ||
195 | connect(urlNavigator, SIGNAL(tabRequested(QUrl)), this, SLOT(newTab(QUrl))); | 195 | connect(urlNavigator, &KUrlNavigator::tabRequested, this, [=](const QUrl &url) { ListPanel::newTab(url); }); | ||
196 | connect(urlNavigator, SIGNAL(urlsDropped(QUrl,QDropEvent*)), this, SLOT(handleDrop(QUrl,QDropEvent*))); | 196 | connect(urlNavigator, &KUrlNavigator::urlsDropped, this, QOverload<const QUrl &, QDropEvent *>::of(&ListPanel::handleDrop)); | ||
197 | ADD_WIDGET(urlNavigator); | 197 | ADD_WIDGET(urlNavigator); | ||
198 | 198 | | |||
199 | // toolbar | 199 | // toolbar | ||
200 | QWidget * toolbar = new QWidget(this); | 200 | QWidget * toolbar = new QWidget(this); | ||
201 | QHBoxLayout * toolbarLayout = new QHBoxLayout(toolbar); | 201 | QHBoxLayout * toolbarLayout = new QHBoxLayout(toolbar); | ||
202 | toolbarLayout->setContentsMargins(0, 0, 0, 0); | 202 | toolbarLayout->setContentsMargins(0, 0, 0, 0); | ||
203 | toolbarLayout->setSpacing(0); | 203 | toolbarLayout->setSpacing(0); | ||
204 | ADD_WIDGET(toolbar); | 204 | ADD_WIDGET(toolbar); | ||
Show All 40 Lines | |||||
245 | previewProgress = new QProgressBar(this); | 245 | previewProgress = new QProgressBar(this); | ||
246 | previewProgress->hide(); | 246 | previewProgress->hide(); | ||
247 | ADD_WIDGET(previewProgress); | 247 | ADD_WIDGET(previewProgress); | ||
248 | 248 | | |||
249 | // a cancel button for the filesystem refresh and preview job | 249 | // a cancel button for the filesystem refresh and preview job | ||
250 | cancelProgressButton = new QToolButton(this); | 250 | cancelProgressButton = new QToolButton(this); | ||
251 | cancelProgressButton->hide(); | 251 | cancelProgressButton->hide(); | ||
252 | cancelProgressButton->setIcon(Icon("dialog-cancel")); | 252 | cancelProgressButton->setIcon(Icon("dialog-cancel")); | ||
253 | connect(cancelProgressButton, SIGNAL(clicked()), this, SLOT(cancelProgress())); | 253 | connect(cancelProgressButton, &QToolButton::clicked, this, &ListPanel::cancelProgress); | ||
254 | ADD_WIDGET(cancelProgressButton); | 254 | ADD_WIDGET(cancelProgressButton); | ||
255 | 255 | | |||
256 | // button for changing the panel sidebar position in the panel | 256 | // button for changing the panel sidebar position in the panel | ||
257 | sidebarPositionButton = new QToolButton(this); | 257 | sidebarPositionButton = new QToolButton(this); | ||
258 | sidebarPositionButton->hide(); | 258 | sidebarPositionButton->hide(); | ||
259 | sidebarPositionButton->setAutoRaise(true); | 259 | sidebarPositionButton->setAutoRaise(true); | ||
260 | sidebarPositionButton->setIcon(Icon("exchange-positions")); | 260 | sidebarPositionButton->setIcon(Icon("exchange-positions")); | ||
261 | sidebarPositionButton->setToolTip(i18n("Move Sidebar clockwise")); | 261 | sidebarPositionButton->setToolTip(i18n("Move Sidebar clockwise")); | ||
▲ Show 20 Lines • Show All 106 Lines • ▼ Show 20 Line(s) | 332 | if(!layout) { // fallback: create a layout by ourself | |||
368 | h->addWidget(sidebarButton); | 368 | h->addWidget(sidebarButton); | ||
369 | v->addLayout(h); | 369 | v->addLayout(h); | ||
370 | 370 | | |||
371 | layout = v; | 371 | layout = v; | ||
372 | } | 372 | } | ||
373 | 373 | | |||
374 | setLayout(layout); | 374 | setLayout(layout); | ||
375 | 375 | | |||
376 | connect(&KrColorCache::getColorCache(), SIGNAL(colorsRefreshed()), this, SLOT(refreshColors())); | 376 | connect(&KrColorCache::getColorCache(), &KrColorCache::colorsRefreshed, this, QOverload<>::of(&ListPanel::refreshColors)); | ||
377 | connect(krApp, SIGNAL(shutdown()), SLOT(cancelProgress())); | 377 | connect(krApp, &Krusader::shutdown, this, &ListPanel::cancelProgress); | ||
378 | } | 378 | } | ||
379 | 379 | | |||
380 | ListPanel::~ListPanel() | 380 | ListPanel::~ListPanel() | ||
381 | { | 381 | { | ||
382 | cancelProgress(); | 382 | cancelProgress(); | ||
383 | delete view; | 383 | delete view; | ||
384 | view = 0; | 384 | view = 0; | ||
385 | delete func; | 385 | delete func; | ||
▲ Show 20 Lines • Show All 42 Lines • ▼ Show 20 Line(s) | 427 | else | |||
428 | view->prepareForPassive(); | 428 | view->prepareForPassive(); | ||
429 | view->refreshColors(); | 429 | view->refreshColors(); | ||
430 | 430 | | |||
431 | sidebarSplitter->insertWidget(sidebarPosition() < 2 ? 1 : 0, view->widget()); | 431 | sidebarSplitter->insertWidget(sidebarPosition() < 2 ? 1 : 0, view->widget()); | ||
432 | 432 | | |||
433 | view->widget()->installEventFilter(this); | 433 | view->widget()->installEventFilter(this); | ||
434 | 434 | | |||
435 | connect(view->op(), &KrViewOperator::quickCalcSpace, func, &ListPanelFunc::quickCalcSpace); | 435 | connect(view->op(), &KrViewOperator::quickCalcSpace, func, &ListPanelFunc::quickCalcSpace); | ||
436 | connect(view->op(), SIGNAL(goHome()), func, SLOT(home())); | 436 | connect(view->op(), &KrViewOperator::goHome, func, &ListPanelFunc::home); | ||
437 | connect(view->op(), SIGNAL(dirUp()), func, SLOT(dirUp())); | 437 | connect(view->op(), &KrViewOperator::dirUp, func, &ListPanelFunc::dirUp); | ||
438 | connect(view->op(), &KrViewOperator::defaultDeleteFiles, func, &ListPanelFunc::defaultDeleteFiles); | 438 | connect(view->op(), &KrViewOperator::defaultDeleteFiles, func, &ListPanelFunc::defaultDeleteFiles); | ||
439 | connect(view->op(), SIGNAL(middleButtonClicked(KrViewItem*)), SLOT(newTab(KrViewItem*))); | 439 | connect(view->op(), &KrViewOperator::middleButtonClicked, this, QOverload<KrViewItem *>::of(&ListPanel::newTab)); | ||
440 | connect(view->op(), SIGNAL(currentChanged(KrViewItem*)), SLOT(slotCurrentChanged(KrViewItem*))); | 440 | connect(view->op(), &KrViewOperator::currentChanged, this, &ListPanel::slotCurrentChanged); | ||
441 | connect(view->op(), SIGNAL(renameItem(QString,QString)), | 441 | connect(view->op(), &KrViewOperator::renameItem, func, QOverload<const QString &, const QString &>::of(&ListPanelFunc::rename)); | ||
442 | func, SLOT(rename(QString,QString))); | 442 | connect(view->op(), &KrViewOperator::executed, func, &ListPanelFunc::execute); | ||
443 | connect(view->op(), SIGNAL(executed(QString)), func, SLOT(execute(QString))); | 443 | connect(view->op(), &KrViewOperator::goInside, func, &ListPanelFunc::goInside); | ||
444 | connect(view->op(), SIGNAL(goInside(QString)), func, SLOT(goInside(QString))); | 444 | connect(view->op(), &KrViewOperator::needFocus, this, [=]() { slotFocusOnMe(); }); | ||
445 | connect(view->op(), SIGNAL(needFocus()), this, SLOT(slotFocusOnMe())); | 445 | connect(view->op(), &KrViewOperator::selectionChanged, this, &ListPanel::slotUpdateTotals); | ||
446 | connect(view->op(), SIGNAL(selectionChanged()), this, SLOT(slotUpdateTotals())); | 446 | connect(view->op(), &KrViewOperator::itemDescription, krApp, &Krusader::statusBarUpdate); | ||
447 | connect(view->op(), SIGNAL(itemDescription(QString)), krApp, SLOT(statusBarUpdate(QString))); | 447 | connect(view->op(), &KrViewOperator::contextMenu, this, &ListPanel::popRightClickMenu); | ||
448 | connect(view->op(), SIGNAL(contextMenu(QPoint)), this, SLOT(popRightClickMenu(QPoint))); | 448 | connect(view->op(), &KrViewOperator::emptyContextMenu, this, &ListPanel::popEmptyRightClickMenu); | ||
449 | connect(view->op(), SIGNAL(emptyContextMenu(QPoint)), | 449 | connect(view->op(), &KrViewOperator::letsDrag, this, &ListPanel::startDragging); | ||
450 | this, SLOT(popEmptyRightClickMenu(QPoint))); | 450 | connect(view->op(), &KrViewOperator::gotDrop, this, [this](QDropEvent *event) {handleDrop(event, true); }); | ||
451 | connect(view->op(), SIGNAL(letsDrag(QStringList,QPixmap)), this, SLOT(startDragging(QStringList,QPixmap))); | 451 | connect(view->op(), &KrViewOperator::previewJobStarted, this, &ListPanel::slotPreviewJobStarted); | ||
452 | connect(view->op(), &KrViewOperator::gotDrop, | 452 | connect(view->op(), &KrViewOperator::refreshActions, krApp->viewActions(), &ViewActions::refreshActions); | ||
453 | this, [this](QDropEvent *event) {handleDrop(event, true); }); | 453 | connect(view->op(), &KrViewOperator::currentChanged, func->history, &DirHistoryQueue::saveCurrentItem); | ||
454 | connect(view->op(), SIGNAL(previewJobStarted(KJob*)), this, SLOT(slotPreviewJobStarted(KJob*))); | | |||
455 | connect(view->op(), SIGNAL(refreshActions()), krApp->viewActions(), SLOT(refreshActions())); | | |||
456 | connect(view->op(), SIGNAL(currentChanged(KrViewItem*)), func->history, SLOT(saveCurrentItem())); | | |||
457 | connect(view->op(), &KrViewOperator::goBack, func, &ListPanelFunc::historyBackward); | 454 | connect(view->op(), &KrViewOperator::goBack, func, &ListPanelFunc::historyBackward); | ||
458 | connect(view->op(), &KrViewOperator::goForward, func, &ListPanelFunc::historyForward); | 455 | connect(view->op(), &KrViewOperator::goForward, func, &ListPanelFunc::historyForward); | ||
459 | 456 | | |||
460 | view->setFiles(func->files()); | 457 | view->setFiles(func->files()); | ||
461 | 458 | | |||
462 | func->refreshActions(); | 459 | func->refreshActions(); | ||
463 | } | 460 | } | ||
464 | 461 | | |||
▲ Show 20 Lines • Show All 584 Lines • ▼ Show 20 Line(s) | 1038 | { | |||
1049 | sidebarButton->setEnabled(false); | 1046 | sidebarButton->setEnabled(false); | ||
1050 | if(sidebar) | 1047 | if(sidebar) | ||
1051 | sidebar->setEnabled(false); | 1048 | sidebar->setEnabled(false); | ||
1052 | bookmarksButton->setEnabled(false); | 1049 | bookmarksButton->setEnabled(false); | ||
1053 | historyButton->setEnabled(false); | 1050 | historyButton->setEnabled(false); | ||
1054 | syncBrowseButton->setEnabled(false); | 1051 | syncBrowseButton->setEnabled(false); | ||
1055 | 1052 | | |||
1056 | // connect to the job interface to provide in-panel refresh notification | 1053 | // connect to the job interface to provide in-panel refresh notification | ||
1057 | connect(job, SIGNAL(infoMessage(KJob*,QString)), | 1054 | connect(job, &KIO::Job::infoMessage, this, &ListPanel::inlineRefreshInfoMessage); | ||
1058 | SLOT(inlineRefreshInfoMessage(KJob*,QString))); | | |||
1059 | connect(job, SIGNAL(percent(KJob*,ulong)), | 1055 | connect(job, SIGNAL(percent(KJob*,ulong)), | ||
1060 | SLOT(inlineRefreshPercent(KJob*,ulong))); | 1056 | SLOT(inlineRefreshPercent(KJob*,ulong))); | ||
1061 | connect(job, SIGNAL(result(KJob*)), | 1057 | connect(job, &KIO::Job::result, this, &ListPanel::inlineRefreshListResult); | ||
1062 | this, SLOT(inlineRefreshListResult(KJob*))); | | |||
1063 | 1058 | | |||
1064 | inlineRefreshJob = job; | 1059 | inlineRefreshJob = job; | ||
1065 | 1060 | | |||
1066 | totals->setText(i18n(">> Reading...")); | 1061 | totals->setText(i18n(">> Reading...")); | ||
1067 | cancelProgressButton->show(); | 1062 | cancelProgressButton->show(); | ||
1068 | } | 1063 | } | ||
1069 | 1064 | | |||
1070 | void ListPanel::cancelProgress() | 1065 | void ListPanel::cancelProgress() | ||
▲ Show 20 Lines • Show All 313 Lines • Show Last 20 Lines |