Download all favicons (#3169)
* Selecting one or more entries to download icons always forces the download (ie, if a new URL exists the new icon will be downloaded and set) * Instead of downloading for each entry, the web url's are scraped from the provided entries and only those urls are downloaded. The icon is set for all entries that share a URL. This is useful if a group contains many entries that point to the same url, only 1 download call will occur. * The icon download dialog displays whether you are doing one entry, many entries, or an entire group. It is also modal so you have to dismiss it to use KeePassXC again. * Moved DuckDuckGo fallback notice into the download dialog.
This commit is contained in:
committed by
Jonathan White
parent
65cec901d5
commit
6ae27fa47b
@@ -62,6 +62,10 @@
|
||||
#include "keeshare/KeeShare.h"
|
||||
#include "touchid/TouchID.h"
|
||||
|
||||
#ifdef WITH_XC_NETWORKING
|
||||
#include "gui/IconDownloaderDialog.h"
|
||||
#endif
|
||||
|
||||
#ifdef Q_OS_LINUX
|
||||
#include <sys/vfs.h>
|
||||
#endif
|
||||
@@ -650,6 +654,41 @@ void DatabaseWidget::openUrl()
|
||||
}
|
||||
}
|
||||
|
||||
void DatabaseWidget::downloadSelectedFavicons()
|
||||
{
|
||||
#ifdef WITH_XC_NETWORKING
|
||||
QList<Entry*> selectedEntries;
|
||||
for (const auto& index : m_entryView->selectionModel()->selectedRows()) {
|
||||
selectedEntries.append(m_entryView->entryFromIndex(index));
|
||||
}
|
||||
|
||||
// Force download even if icon already exists
|
||||
performIconDownloads(selectedEntries, true);
|
||||
#endif
|
||||
}
|
||||
|
||||
void DatabaseWidget::downloadAllFavicons()
|
||||
{
|
||||
#ifdef WITH_XC_NETWORKING
|
||||
auto currentGroup = m_groupView->currentGroup();
|
||||
if (currentGroup) {
|
||||
performIconDownloads(currentGroup->entries());
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void DatabaseWidget::performIconDownloads(const QList<Entry*>& entries, bool force)
|
||||
{
|
||||
#ifdef WITH_XC_NETWORKING
|
||||
auto* iconDownloaderDialog = new IconDownloaderDialog(this);
|
||||
connect(this, SIGNAL(databaseLockRequested()), iconDownloaderDialog, SLOT(close()));
|
||||
iconDownloaderDialog->downloadFavicons(m_db, entries, force);
|
||||
#else
|
||||
Q_UNUSED(entries);
|
||||
Q_UNUSED(force);
|
||||
#endif
|
||||
}
|
||||
|
||||
void DatabaseWidget::openUrlForEntry(Entry* entry)
|
||||
{
|
||||
Q_ASSERT(entry);
|
||||
@@ -1275,6 +1314,8 @@ bool DatabaseWidget::lock()
|
||||
return true;
|
||||
}
|
||||
|
||||
emit databaseLockRequested();
|
||||
|
||||
clipboard()->clearCopiedText();
|
||||
|
||||
if (isEditWidgetModified()) {
|
||||
|
||||
Reference in New Issue
Block a user