Skip to content
API Documentation
BastionGuard™
PasswordSearchRow Class Reference

#include <PasswordSearchRow.hpp>

Inheritance diagram for PasswordSearchRow:

Public Member Functions

 PasswordSearchRow (const PasswordEntry &entry)
sigc::signal< void(const PasswordEntry &)> signal_reveal ()
sigc::signal< void(const PasswordEntry &)> signal_edit ()
sigc::signal< void(const PasswordEntry &)> signal_delete ()

Private Member Functions

void buildUi ()
void connectSignals ()
void toggleExpanded ()

Private Attributes

PasswordEntry entry_
Gtk::Box rootBox
Gtk::Box headerBox
Gtk::Box bodyBox
Gtk::Revealer revealer
Gtk::Label titleLabel
Gtk::Label expandIconLabel
Gtk::Label usernameLabel
Gtk::Label urlLabel
Gtk::Label updatedLabel
Gtk::Box actionsBox
Gtk::Button revealButton
Gtk::Button editButton
Gtk::Button deleteButton
sigc::signal< void(const PasswordEntry &)> signalReveal_
sigc::signal< void(const PasswordEntry &)> signalEdit_
sigc::signal< void(const PasswordEntry &)> signalDelete_

Detailed Description

Definition at line 26 of file PasswordSearchRow.hpp.

Constructor & Destructor Documentation

◆ PasswordSearchRow()

PasswordSearchRow::PasswordSearchRow ( const PasswordEntry & entry)
explicit

Definition at line 25 of file PasswordSearchRow.cpp.

26: entry_(entry),
27 rootBox(Gtk::Orientation::VERTICAL, 0),
28 headerBox(Gtk::Orientation::HORIZONTAL, 8),
29 bodyBox(Gtk::Orientation::VERTICAL, 6),
30 titleLabel("🔐 " + entry.name),
31 expandIconLabel("▼"),
32 usernameLabel(_("Utente: ") + entry.username),
33 urlLabel(_("URL: ") + entry.url),
34 updatedLabel(_("Aggiornato: ") + entry.updated_at),
35 actionsBox(Gtk::Orientation::HORIZONTAL, 6),
36 revealButton(_("Mostra password")),
37 editButton(_("Modifica")),
38 deleteButton(_("Elimina"))
39{
40 buildUi();
42}
#define _(s)
std::string url
std::string username
std::string updated_at
std::string name

References _, actionsBox, bodyBox, buildUi(), connectSignals(), deleteButton, editButton, entry_, expandIconLabel, headerBox, revealButton, rootBox, titleLabel, updatedLabel, urlLabel, and usernameLabel.

Member Function Documentation

◆ buildUi()

void PasswordSearchRow::buildUi ( )
private

Definition at line 44 of file PasswordSearchRow.cpp.

44 {
45 set_hexpand(true);
46 set_margin_top(4);
47 set_margin_bottom(4);
48 set_margin_start(4);
49 set_margin_end(4);
50
51 titleLabel.set_xalign(0.0f);
52 titleLabel.set_hexpand(true);
53
54 expandIconLabel.set_xalign(1.0f);
55 expandIconLabel.set_margin_start(6);
56
57 headerBox.set_margin_top(6);
58 headerBox.set_margin_bottom(6);
59 headerBox.set_margin_start(6);
60 headerBox.set_margin_end(6);
61 headerBox.append(titleLabel);
63
64 usernameLabel.set_xalign(0.0f);
65 urlLabel.set_xalign(0.0f);
66 updatedLabel.set_xalign(0.0f);
67
68 deleteButton.add_css_class("btn-danger");
69
71 actionsBox.append(editButton);
73
74 bodyBox.set_margin_top(6);
75 bodyBox.set_margin_bottom(6);
76 bodyBox.set_margin_start(6);
77 bodyBox.set_margin_end(6);
78 bodyBox.append(usernameLabel);
79 bodyBox.append(urlLabel);
80 bodyBox.append(updatedLabel);
81 bodyBox.append(actionsBox);
82
83 revealer.set_transition_type(Gtk::RevealerTransitionType::SLIDE_DOWN);
84 revealer.set_transition_duration(180);
85 revealer.set_reveal_child(false);
86 revealer.set_child(bodyBox);
87
88 rootBox.append(headerBox);
89 rootBox.append(revealer);
90
91 set_child(rootBox);
92}

References actionsBox, bodyBox, deleteButton, editButton, expandIconLabel, headerBox, revealButton, revealer, rootBox, titleLabel, updatedLabel, urlLabel, and usernameLabel.

Referenced by PasswordSearchRow().

◆ connectSignals()

void PasswordSearchRow::connectSignals ( )
private

Definition at line 94 of file PasswordSearchRow.cpp.

94 {
95 auto click = Gtk::GestureClick::create();
96 click->signal_pressed().connect([this](int n_press, double, double) {
97 if (n_press == 1) {
99 }
100 });
101 headerBox.add_controller(click);
102
103 revealButton.signal_clicked().connect([this]() {
104 signalReveal_.emit(entry_);
105 });
106
107 editButton.signal_clicked().connect([this]() {
108 signalEdit_.emit(entry_);
109 });
110
111 deleteButton.signal_clicked().connect([this]() {
112 signalDelete_.emit(entry_);
113 });
114}
sigc::signal< void(const PasswordEntry &)> signalDelete_
sigc::signal< void(const PasswordEntry &)> signalReveal_
sigc::signal< void(const PasswordEntry &)> signalEdit_

References deleteButton, editButton, entry_, headerBox, revealButton, signalDelete_, signalEdit_, signalReveal_, and toggleExpanded().

Referenced by PasswordSearchRow().

◆ signal_delete()

sigc::signal< void(const PasswordEntry &)> PasswordSearchRow::signal_delete ( )

Definition at line 130 of file PasswordSearchRow.cpp.

130 {
131 return signalDelete_;
132}

References signalDelete_.

◆ signal_edit()

sigc::signal< void(const PasswordEntry &)> PasswordSearchRow::signal_edit ( )

Definition at line 126 of file PasswordSearchRow.cpp.

126 {
127 return signalEdit_;
128}

References signalEdit_.

◆ signal_reveal()

sigc::signal< void(const PasswordEntry &)> PasswordSearchRow::signal_reveal ( )

Definition at line 122 of file PasswordSearchRow.cpp.

122 {
123 return signalReveal_;
124}

References signalReveal_.

◆ toggleExpanded()

void PasswordSearchRow::toggleExpanded ( )
private

Definition at line 116 of file PasswordSearchRow.cpp.

116 {
117 const bool expanded = revealer.get_reveal_child();
118 revealer.set_reveal_child(!expanded);
119 expandIconLabel.set_text(expanded ? "▼" : "▲");
120}

References expandIconLabel, and revealer.

Referenced by connectSignals().

Member Data Documentation

◆ actionsBox

Gtk::Box PasswordSearchRow::actionsBox
private

Definition at line 48 of file PasswordSearchRow.hpp.

Referenced by buildUi(), and PasswordSearchRow().

◆ bodyBox

Gtk::Box PasswordSearchRow::bodyBox
private

Definition at line 39 of file PasswordSearchRow.hpp.

Referenced by buildUi(), and PasswordSearchRow().

◆ deleteButton

Gtk::Button PasswordSearchRow::deleteButton
private

Definition at line 51 of file PasswordSearchRow.hpp.

Referenced by buildUi(), connectSignals(), and PasswordSearchRow().

◆ editButton

Gtk::Button PasswordSearchRow::editButton
private

Definition at line 50 of file PasswordSearchRow.hpp.

Referenced by buildUi(), connectSignals(), and PasswordSearchRow().

◆ entry_

PasswordEntry PasswordSearchRow::entry_
private

Definition at line 35 of file PasswordSearchRow.hpp.

Referenced by connectSignals(), and PasswordSearchRow().

◆ expandIconLabel

Gtk::Label PasswordSearchRow::expandIconLabel
private

Definition at line 43 of file PasswordSearchRow.hpp.

Referenced by buildUi(), PasswordSearchRow(), and toggleExpanded().

◆ headerBox

Gtk::Box PasswordSearchRow::headerBox
private

Definition at line 38 of file PasswordSearchRow.hpp.

Referenced by buildUi(), connectSignals(), and PasswordSearchRow().

◆ revealButton

Gtk::Button PasswordSearchRow::revealButton
private

Definition at line 49 of file PasswordSearchRow.hpp.

Referenced by buildUi(), connectSignals(), and PasswordSearchRow().

◆ revealer

Gtk::Revealer PasswordSearchRow::revealer
private

Definition at line 40 of file PasswordSearchRow.hpp.

Referenced by buildUi(), and toggleExpanded().

◆ rootBox

Gtk::Box PasswordSearchRow::rootBox
private

Definition at line 37 of file PasswordSearchRow.hpp.

Referenced by buildUi(), and PasswordSearchRow().

◆ signalDelete_

sigc::signal<void(const PasswordEntry&)> PasswordSearchRow::signalDelete_
private

Definition at line 55 of file PasswordSearchRow.hpp.

Referenced by connectSignals(), and signal_delete().

◆ signalEdit_

sigc::signal<void(const PasswordEntry&)> PasswordSearchRow::signalEdit_
private

Definition at line 54 of file PasswordSearchRow.hpp.

Referenced by connectSignals(), and signal_edit().

◆ signalReveal_

sigc::signal<void(const PasswordEntry&)> PasswordSearchRow::signalReveal_
private

Definition at line 53 of file PasswordSearchRow.hpp.

Referenced by connectSignals(), and signal_reveal().

◆ titleLabel

Gtk::Label PasswordSearchRow::titleLabel
private

Definition at line 42 of file PasswordSearchRow.hpp.

Referenced by buildUi(), and PasswordSearchRow().

◆ updatedLabel

Gtk::Label PasswordSearchRow::updatedLabel
private

Definition at line 46 of file PasswordSearchRow.hpp.

Referenced by buildUi(), and PasswordSearchRow().

◆ urlLabel

Gtk::Label PasswordSearchRow::urlLabel
private

Definition at line 45 of file PasswordSearchRow.hpp.

Referenced by buildUi(), and PasswordSearchRow().

◆ usernameLabel

Gtk::Label PasswordSearchRow::usernameLabel
private

Definition at line 44 of file PasswordSearchRow.hpp.

Referenced by buildUi(), and PasswordSearchRow().


The documentation for this class was generated from the following files: