Correct test failures; moved gui calls into gui objects

This commit is contained in:
Jonathan White 2018-02-24 07:44:28 -05:00 committed by Janek Bevendorff
parent fd71b4a22e
commit 77e345570d
3 changed files with 15 additions and 5 deletions

View File

@ -29,7 +29,6 @@
#include "core/Global.h" #include "core/Global.h"
#include "core/Group.h" #include "core/Group.h"
#include "core/Metadata.h" #include "core/Metadata.h"
#include "core/FilePath.h"
// String being displayed when hiding content // String being displayed when hiding content
const QString EntryModel::HiddenContentDisplay(QString("\u25cf").repeated(6)); const QString EntryModel::HiddenContentDisplay(QString("\u25cf").repeated(6));
@ -42,12 +41,9 @@ EntryModel::EntryModel(QObject* parent)
, m_group(nullptr) , m_group(nullptr)
, m_hideUsernames(false) , m_hideUsernames(false)
, m_hidePasswords(true) , m_hidePasswords(true)
, m_paperClipPixmap(FilePath::instance()->icon("actions", "paperclip").pixmap(16)) , m_paperClipPixmap(16, 16)
, m_paperClipPixmapCentered(24, 16) , m_paperClipPixmapCentered(24, 16)
{ {
m_paperClipPixmapCentered.fill(Qt::transparent);
QPainter painter(&m_paperClipPixmapCentered);
painter.drawPixmap(8, 0, m_paperClipPixmap);
} }
Entry* EntryModel::entryFromIndex(const QModelIndex& index) const Entry* EntryModel::entryFromIndex(const QModelIndex& index) const
@ -504,3 +500,12 @@ void EntryModel::togglePasswordsHidden(const bool hide)
{ {
setPasswordsHidden(hide); setPasswordsHidden(hide);
} }
void EntryModel::setPaperClipPixmap(const QPixmap& paperclip)
{
m_paperClipPixmap = paperclip;
m_paperClipPixmapCentered.fill(Qt::transparent);
QPainter painter2(&m_paperClipPixmapCentered);
painter2.drawPixmap(8, 0, paperclip);
}

View File

@ -66,6 +66,8 @@ public:
bool isPasswordsHidden() const; bool isPasswordsHidden() const;
void setPasswordsHidden(const bool hide); void setPasswordsHidden(const bool hide);
void setPaperClipPixmap(const QPixmap& paperclip);
signals: signals:
void switchedToListMode(); void switchedToListMode();
void switchedToSearchMode(); void switchedToSearchMode();

View File

@ -22,6 +22,7 @@
#include <QKeyEvent> #include <QKeyEvent>
#include <QMenu> #include <QMenu>
#include "core/FilePath.h"
#include "gui/SortFilterHideProxyModel.h" #include "gui/SortFilterHideProxyModel.h"
EntryView::EntryView(QWidget* parent) EntryView::EntryView(QWidget* parent)
@ -114,6 +115,8 @@ EntryView::EntryView(QWidget* parent)
m_sortModel->sort(EntryModel::Title, Qt::AscendingOrder); m_sortModel->sort(EntryModel::Title, Qt::AscendingOrder);
sortByColumn(EntryModel::Title, Qt::AscendingOrder); sortByColumn(EntryModel::Title, Qt::AscendingOrder);
m_defaultListViewState = header()->saveState(); m_defaultListViewState = header()->saveState();
m_model->setPaperClipPixmap(filePath()->icon("actions", "paperclip").pixmap(16));
} }
void EntryView::keyPressEvent(QKeyEvent* event) void EntryView::keyPressEvent(QKeyEvent* event)