mirror of
https://invent.kde.org/system/dolphin
synced 2024-07-04 17:30:55 +00:00
Compare commits
1 Commits
292f9e6f12
...
6ed3a2363f
Author | SHA1 | Date | |
---|---|---|---|
|
6ed3a2363f |
|
@ -184,7 +184,7 @@ DolphinMainWindow::DolphinMainWindow()
|
||||||
|
|
||||||
m_disabledActionNotifier = new DisabledActionNotifier(this);
|
m_disabledActionNotifier = new DisabledActionNotifier(this);
|
||||||
connect(m_disabledActionNotifier, &DisabledActionNotifier::disabledActionTriggered, this, [this](const QAction *, QString reason) {
|
connect(m_disabledActionNotifier, &DisabledActionNotifier::disabledActionTriggered, this, [this](const QAction *, QString reason) {
|
||||||
m_activeViewContainer->showMessage(reason, KMessageWidget::Warning);
|
m_activeViewContainer->showMessage(reason, DolphinViewContainer::Warning);
|
||||||
});
|
});
|
||||||
|
|
||||||
setupDockWidgets();
|
setupDockWidgets();
|
||||||
|
@ -562,7 +562,7 @@ void DolphinMainWindow::showTarget()
|
||||||
KIO::StatJob *statJob = static_cast<KIO::StatJob *>(job);
|
KIO::StatJob *statJob = static_cast<KIO::StatJob *>(job);
|
||||||
|
|
||||||
if (statJob->error()) {
|
if (statJob->error()) {
|
||||||
m_activeViewContainer->showMessage(job->errorString(), KMessageWidget::Error);
|
m_activeViewContainer->showMessage(job->errorString(), DolphinViewContainer::Error);
|
||||||
} else {
|
} else {
|
||||||
KIO::highlightInFileManager({destinationUrl});
|
KIO::highlightInFileManager({destinationUrl});
|
||||||
}
|
}
|
||||||
|
@ -801,7 +801,7 @@ void DolphinMainWindow::quit()
|
||||||
|
|
||||||
void DolphinMainWindow::showErrorMessage(const QString &message)
|
void DolphinMainWindow::showErrorMessage(const QString &message)
|
||||||
{
|
{
|
||||||
m_activeViewContainer->showMessage(message, KMessageWidget::Error);
|
m_activeViewContainer->showMessage(message, DolphinViewContainer::Error);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DolphinMainWindow::slotUndoAvailable(bool available)
|
void DolphinMainWindow::slotUndoAvailable(bool available)
|
||||||
|
@ -2898,7 +2898,7 @@ void DolphinMainWindow::UndoUiInterface::jobError(KIO::Job *job)
|
||||||
DolphinMainWindow *mainWin = qobject_cast<DolphinMainWindow *>(parentWidget());
|
DolphinMainWindow *mainWin = qobject_cast<DolphinMainWindow *>(parentWidget());
|
||||||
if (mainWin) {
|
if (mainWin) {
|
||||||
DolphinViewContainer *container = mainWin->activeViewContainer();
|
DolphinViewContainer *container = mainWin->activeViewContainer();
|
||||||
container->showMessage(job->errorString(), KMessageWidget::Error);
|
container->showMessage(job->errorString(), DolphinViewContainer::Error);
|
||||||
} else {
|
} else {
|
||||||
KIO::FileUndoManager::UiInterface::jobError(job);
|
KIO::FileUndoManager::UiInterface::jobError(job);
|
||||||
}
|
}
|
||||||
|
|
|
@ -109,7 +109,7 @@ DolphinViewContainer::DolphinViewContainer(const QUrl &url, QWidget *parent)
|
||||||
#if !defined(Q_OS_WIN) && !defined(Q_OS_HAIKU)
|
#if !defined(Q_OS_WIN) && !defined(Q_OS_HAIKU)
|
||||||
if (getuid() == 0) {
|
if (getuid() == 0) {
|
||||||
// We must be logged in as the root user; show a big scary warning
|
// We must be logged in as the root user; show a big scary warning
|
||||||
showMessage(i18n("Running Dolphin as root can be dangerous. Please be careful."), KMessageWidget::Warning);
|
showMessage(i18n("Running Dolphin as root can be dangerous. Please be careful."), Warning);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -366,7 +366,9 @@ void DolphinViewContainer::setSelectionModeEnabled(bool enabled, KActionCollecti
|
||||||
connect(m_view, &DolphinView::selectionChanged, this, [this](const KFileItemList &selection) {
|
connect(m_view, &DolphinView::selectionChanged, this, [this](const KFileItemList &selection) {
|
||||||
m_selectionModeBottomBar->slotSelectionChanged(selection, m_view->url());
|
m_selectionModeBottomBar->slotSelectionChanged(selection, m_view->url());
|
||||||
});
|
});
|
||||||
connect(m_selectionModeBottomBar, &SelectionMode::BottomBar::error, this, &DolphinViewContainer::showErrorMessage);
|
connect(m_selectionModeBottomBar, &SelectionMode::BottomBar::error, this, [this](const QString &errorMessage) {
|
||||||
|
showErrorMessage(errorMessage);
|
||||||
|
});
|
||||||
connect(m_selectionModeBottomBar, &SelectionMode::BottomBar::selectionModeLeavingRequested, this, [this]() {
|
connect(m_selectionModeBottomBar, &SelectionMode::BottomBar::selectionModeLeavingRequested, this, [this]() {
|
||||||
setSelectionModeEnabled(false);
|
setSelectionModeEnabled(false);
|
||||||
});
|
});
|
||||||
|
@ -406,18 +408,32 @@ void DolphinViewContainer::slotSplitTabDisabled()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DolphinViewContainer::showMessage(const QString &message, KMessageWidget::MessageType messageType)
|
void DolphinViewContainer::showMessage(const QString &msg, MessageType type)
|
||||||
{
|
{
|
||||||
if (message.isEmpty()) {
|
if (msg.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_messageWidget->setText(message);
|
m_messageWidget->setText(msg);
|
||||||
|
|
||||||
// TODO: wrap at arbitrary character positions once QLabel can do this
|
// TODO: wrap at arbitrary character positions once QLabel can do this
|
||||||
// https://bugreports.qt.io/browse/QTBUG-1276
|
// https://bugreports.qt.io/browse/QTBUG-1276
|
||||||
m_messageWidget->setWordWrap(true);
|
m_messageWidget->setWordWrap(true);
|
||||||
m_messageWidget->setMessageType(messageType);
|
|
||||||
|
switch (type) {
|
||||||
|
case Information:
|
||||||
|
m_messageWidget->setMessageType(KMessageWidget::Information);
|
||||||
|
break;
|
||||||
|
case Warning:
|
||||||
|
m_messageWidget->setMessageType(KMessageWidget::Warning);
|
||||||
|
break;
|
||||||
|
case Error:
|
||||||
|
m_messageWidget->setMessageType(KMessageWidget::Error);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
Q_ASSERT(false);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
m_messageWidget->setWordWrap(false);
|
m_messageWidget->setWordWrap(false);
|
||||||
const int unwrappedWidth = m_messageWidget->sizeHint().width();
|
const int unwrappedWidth = m_messageWidget->sizeHint().width();
|
||||||
|
@ -812,18 +828,18 @@ void DolphinViewContainer::slotUrlNavigatorLocationChanged(const QUrl &url)
|
||||||
if (url.scheme().startsWith(QLatin1String("http"))) {
|
if (url.scheme().startsWith(QLatin1String("http"))) {
|
||||||
showMessage(i18nc("@info:status", // krazy:exclude=qmethods
|
showMessage(i18nc("@info:status", // krazy:exclude=qmethods
|
||||||
"Dolphin does not support web pages, the web browser has been launched"),
|
"Dolphin does not support web pages, the web browser has been launched"),
|
||||||
KMessageWidget::Information);
|
Information);
|
||||||
} else {
|
} else {
|
||||||
showMessage(i18nc("@info:status", "Protocol not supported by Dolphin, default application has been launched"), KMessageWidget::Information);
|
showMessage(i18nc("@info:status", "Protocol not supported by Dolphin, default application has been launched"), Information);
|
||||||
}
|
}
|
||||||
|
|
||||||
QDesktopServices::openUrl(url);
|
QDesktopServices::openUrl(url);
|
||||||
redirect(QUrl(), m_urlNavigator->locationUrl(1));
|
redirect(QUrl(), m_urlNavigator->locationUrl(1));
|
||||||
} else {
|
} else {
|
||||||
if (!url.scheme().isEmpty()) {
|
if (!url.scheme().isEmpty()) {
|
||||||
showMessage(i18nc("@info:status", "Invalid protocol '%1'", url.scheme()), KMessageWidget::Error);
|
showMessage(i18nc("@info:status", "Invalid protocol '%1'", url.scheme()), Error);
|
||||||
} else {
|
} else {
|
||||||
showMessage(i18nc("@info:status", "Invalid protocol"), KMessageWidget::Error);
|
showMessage(i18nc("@info:status", "Invalid protocol"), Error);
|
||||||
}
|
}
|
||||||
m_urlNavigator->goBack();
|
m_urlNavigator->goBack();
|
||||||
}
|
}
|
||||||
|
@ -898,9 +914,9 @@ void DolphinViewContainer::slotStatusBarZoomLevelChanged(int zoomLevel)
|
||||||
m_view->setZoomLevel(zoomLevel);
|
m_view->setZoomLevel(zoomLevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DolphinViewContainer::showErrorMessage(const QString &message)
|
void DolphinViewContainer::showErrorMessage(const QString &msg)
|
||||||
{
|
{
|
||||||
showMessage(message, KMessageWidget::Error);
|
showMessage(msg, Error);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DolphinViewContainer::slotPlacesModelChanged()
|
void DolphinViewContainer::slotPlacesModelChanged()
|
||||||
|
@ -934,7 +950,7 @@ void DolphinViewContainer::slotCurrentDirectoryRemoved()
|
||||||
setUrl(newUrl);
|
setUrl(newUrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
showMessage(xi18n("Current location changed, <filename>%1</filename> is no longer accessible.", location), KMessageWidget::Warning);
|
showMessage(xi18n("Current location changed, <filename>%1</filename> is no longer accessible.", location), Warning);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DolphinViewContainer::slotOpenUrlFinished(KJob *job)
|
void DolphinViewContainer::slotOpenUrlFinished(KJob *job)
|
||||||
|
|
|
@ -14,7 +14,6 @@
|
||||||
|
|
||||||
#include <KFileItem>
|
#include <KFileItem>
|
||||||
#include <KIO/Job>
|
#include <KIO/Job>
|
||||||
#include <KMessageWidget>
|
|
||||||
#include <KUrlNavigator>
|
#include <KUrlNavigator>
|
||||||
|
|
||||||
#include <QElapsedTimer>
|
#include <QElapsedTimer>
|
||||||
|
@ -26,6 +25,7 @@ namespace Admin
|
||||||
class Bar;
|
class Bar;
|
||||||
}
|
}
|
||||||
class FilterBar;
|
class FilterBar;
|
||||||
|
class KMessageWidget;
|
||||||
class QAction;
|
class QAction;
|
||||||
class QGridLayout;
|
class QGridLayout;
|
||||||
class QUrl;
|
class QUrl;
|
||||||
|
@ -53,6 +53,8 @@ class DolphinViewContainer : public QWidget
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
enum MessageType { Information, Warning, Error };
|
||||||
|
|
||||||
DolphinViewContainer(const QUrl &url, QWidget *parent);
|
DolphinViewContainer(const QUrl &url, QWidget *parent);
|
||||||
~DolphinViewContainer() override;
|
~DolphinViewContainer() override;
|
||||||
|
|
||||||
|
@ -149,9 +151,10 @@ public:
|
||||||
bool isSelectionModeEnabled() const;
|
bool isSelectionModeEnabled() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shows the message \message with the given type \messageType non-modal above the view-content.
|
* Shows the message \msg with the given type non-modal above
|
||||||
|
* the view-content.
|
||||||
*/
|
*/
|
||||||
void showMessage(const QString &message, KMessageWidget::MessageType messageType);
|
void showMessage(const QString &msg, MessageType type);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Refreshes the view container to get synchronized with the (updated) Dolphin settings.
|
* Refreshes the view container to get synchronized with the (updated) Dolphin settings.
|
||||||
|
@ -390,9 +393,9 @@ private Q_SLOTS:
|
||||||
void slotStatusBarZoomLevelChanged(int zoomLevel);
|
void slotStatusBarZoomLevelChanged(int zoomLevel);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Slot that calls showMessage(message, KMessageWidget::Error).
|
* Slot that calls showMessage(msg, Error).
|
||||||
*/
|
*/
|
||||||
void showErrorMessage(const QString &message);
|
void showErrorMessage(const QString &msg);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Is invoked when a KFilePlacesModel has been changed
|
* Is invoked when a KFilePlacesModel has been changed
|
||||||
|
|
Loading…
Reference in New Issue
Block a user