mirror of
https://invent.kde.org/system/dolphin
synced 2024-09-17 15:31:20 +00:00
Merge branch 'Applications/19.08'
This commit is contained in:
commit
3df68fb667
|
@ -2159,7 +2159,7 @@ void DolphinMainWindow::UndoUiInterface::jobError(KIO::Job* job)
|
||||||
|
|
||||||
bool DolphinMainWindow::isUrlOpen(const QString& url)
|
bool DolphinMainWindow::isUrlOpen(const QString& url)
|
||||||
{
|
{
|
||||||
if (m_tabWidget->getIndexByUrl(QUrl::fromUserInput((url))) >= 0) {
|
if (m_tabWidget->getIndexByUrl(QUrl::fromUserInput((url))).first >= 0) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -187,9 +187,15 @@ void DolphinTabWidget::openDirectories(const QList<QUrl>& dirs, bool splitView)
|
||||||
QList<QUrl>::const_iterator it = dirs.constBegin();
|
QList<QUrl>::const_iterator it = dirs.constBegin();
|
||||||
while (it != dirs.constEnd()) {
|
while (it != dirs.constEnd()) {
|
||||||
const QUrl& primaryUrl = *(it++);
|
const QUrl& primaryUrl = *(it++);
|
||||||
const int index = getIndexByUrl(primaryUrl);
|
const QPair<int, bool> viewLocation = getIndexByUrl(primaryUrl);
|
||||||
if (index >= 0) {
|
if (viewLocation.first >= 0) {
|
||||||
setCurrentIndex(index);
|
setCurrentIndex(viewLocation.first);
|
||||||
|
const auto tabPage = tabPageAt(viewLocation.first);
|
||||||
|
if (viewLocation.second) {
|
||||||
|
tabPage->primaryViewContainer()->setActive(true);
|
||||||
|
} else {
|
||||||
|
tabPage->secondaryViewContainer()->setActive(true);
|
||||||
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (splitView && (it != dirs.constEnd())) {
|
if (splitView && (it != dirs.constEnd())) {
|
||||||
|
@ -394,16 +400,17 @@ QString DolphinTabWidget::tabName(DolphinTabPage* tabPage) const
|
||||||
return name.replace('&', QLatin1String("&&"));
|
return name.replace('&', QLatin1String("&&"));
|
||||||
}
|
}
|
||||||
|
|
||||||
int DolphinTabWidget::getIndexByUrl(const QUrl& url) const
|
QPair<int, bool> DolphinTabWidget::getIndexByUrl(const QUrl& url) const
|
||||||
{
|
{
|
||||||
for (int i = 0; i < count(); i++) {
|
for (int i = 0; i < count(); i++) {
|
||||||
// Conversion to display string is necessary to deal with the '~' alias.
|
const auto tabPage = tabPageAt(i);
|
||||||
// i.e. to acknowledge that ~/ is equivalent to /home/user/
|
if (url == tabPage->primaryViewContainer()->url()) {
|
||||||
const QUrl tabUrl = tabPageAt(i)->activeViewContainer()->url();
|
return qMakePair(i, true);
|
||||||
if (url == tabUrl ||
|
}
|
||||||
url.toDisplayString(QUrl::StripTrailingSlash) == tabUrl.toDisplayString(QUrl::StripTrailingSlash)) {
|
|
||||||
return i;
|
if (tabPage->splitViewEnabled() && url == tabPage->secondaryViewContainer()->url()) {
|
||||||
|
return qMakePair(i, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return -1;
|
return qMakePair(-1, false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,9 +80,13 @@ public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param url The URL that we would like
|
* @param url The URL that we would like
|
||||||
* @return index of the tab with the desired URL. returns -1 if not found
|
* @return a QPair with first containing the index of the tab with the
|
||||||
|
* desired URL or -1 if not found. Second says true if URL is in primary
|
||||||
|
* view container, false otherwise. False means the URL is in the secondary
|
||||||
|
* view container, unless first == -1. In that case the value of second
|
||||||
|
* is meaningless.
|
||||||
*/
|
*/
|
||||||
int getIndexByUrl(const QUrl& url) const;
|
QPair<int, bool> getIndexByUrl(const QUrl& url) const;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -428,7 +428,7 @@ QString DolphinViewContainer::placesText() const
|
||||||
if (isSearchModeEnabled()) {
|
if (isSearchModeEnabled()) {
|
||||||
text = i18n("Search for %1 in %2", m_searchBox->text(), m_searchBox->searchPath().fileName());
|
text = i18n("Search for %1 in %2", m_searchBox->text(), m_searchBox->searchPath().fileName());
|
||||||
} else {
|
} else {
|
||||||
text = url().fileName();
|
text = url().adjusted(QUrl::StripTrailingSlash).fileName();
|
||||||
if (text.isEmpty()) {
|
if (text.isEmpty()) {
|
||||||
text = url().host();
|
text = url().host();
|
||||||
}
|
}
|
||||||
|
|
|
@ -116,9 +116,6 @@ extern "C" Q_DECL_EXPORT int kdemain(int argc, char **argv)
|
||||||
|
|
||||||
KAboutData::setApplicationData(aboutData);
|
KAboutData::setApplicationData(aboutData);
|
||||||
|
|
||||||
KDBusService dolphinDBusService;
|
|
||||||
DBusInterface interface;
|
|
||||||
|
|
||||||
QCommandLineParser parser;
|
QCommandLineParser parser;
|
||||||
aboutData.setupCommandLine(&parser);
|
aboutData.setupCommandLine(&parser);
|
||||||
|
|
||||||
|
@ -139,6 +136,8 @@ extern "C" Q_DECL_EXPORT int kdemain(int argc, char **argv)
|
||||||
QList<QUrl> urls = Dolphin::validateUris(args);
|
QList<QUrl> urls = Dolphin::validateUris(args);
|
||||||
|
|
||||||
if (parser.isSet(QStringLiteral("daemon"))) {
|
if (parser.isSet(QStringLiteral("daemon"))) {
|
||||||
|
KDBusService dolphinDBusService;
|
||||||
|
DBusInterface interface;
|
||||||
return app.exec();
|
return app.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -178,5 +177,8 @@ extern "C" Q_DECL_EXPORT int kdemain(int argc, char **argv)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
KDBusService dolphinDBusService;
|
||||||
|
DBusInterface interface;
|
||||||
|
|
||||||
return app.exec(); // krazy:exclude=crash;
|
return app.exec(); // krazy:exclude=crash;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue