forked from blue/squawk
some VCard polishing, missing icons and translations
This commit is contained in:
parent
2c13f0d77c
commit
dfa4d10c36
24 changed files with 727 additions and 247 deletions
|
@ -52,7 +52,7 @@ QVariant UI::VCard::EMailsModel::data(const QModelIndex& index, int role) const
|
|||
case 1:
|
||||
switch (role) {
|
||||
case Qt::DisplayRole:
|
||||
return tr(Shared::VCard::Email::roleNames[deque[index.row()].role].toStdString().c_str());
|
||||
return QCoreApplication::translate("Global", Shared::VCard::Email::roleNames[deque[index.row()].role].toStdString().c_str());
|
||||
case Qt::EditRole:
|
||||
return deque[index.row()].role;
|
||||
default:
|
||||
|
|
|
@ -52,7 +52,7 @@ QVariant UI::VCard::PhonesModel::data(const QModelIndex& index, int role) const
|
|||
case 1:
|
||||
switch (role) {
|
||||
case Qt::DisplayRole:
|
||||
return tr(Shared::VCard::Phone::roleNames[deque[index.row()].role].toStdString().c_str());
|
||||
return QCoreApplication::translate("Global", Shared::VCard::Phone::roleNames[deque[index.row()].role].toStdString().c_str());
|
||||
case Qt::EditRole:
|
||||
return deque[index.row()].role;
|
||||
default:
|
||||
|
@ -62,7 +62,7 @@ QVariant UI::VCard::PhonesModel::data(const QModelIndex& index, int role) const
|
|||
case 2:
|
||||
switch (role) {
|
||||
case Qt::DisplayRole:
|
||||
return tr(Shared::VCard::Phone::typeNames[deque[index.row()].type].toStdString().c_str());
|
||||
return QCoreApplication::translate("Global", Shared::VCard::Phone::typeNames[deque[index.row()].type].toStdString().c_str());
|
||||
case Qt::EditRole:
|
||||
return deque[index.row()].type;
|
||||
default:
|
||||
|
|
|
@ -55,17 +55,17 @@ VCard::VCard(const QString& jid, bool edit, QWidget* parent):
|
|||
setAvatar->setEnabled(true);
|
||||
clearAvatar->setEnabled(false);
|
||||
|
||||
roleDelegate->addEntry(tr(Shared::VCard::Email::roleNames[0].toStdString().c_str()));
|
||||
roleDelegate->addEntry(tr(Shared::VCard::Email::roleNames[1].toStdString().c_str()));
|
||||
roleDelegate->addEntry(tr(Shared::VCard::Email::roleNames[2].toStdString().c_str()));
|
||||
roleDelegate->addEntry(QCoreApplication::translate("Global", Shared::VCard::Email::roleNames[0].toStdString().c_str()));
|
||||
roleDelegate->addEntry(QCoreApplication::translate("Global", Shared::VCard::Email::roleNames[1].toStdString().c_str()));
|
||||
roleDelegate->addEntry(QCoreApplication::translate("Global", Shared::VCard::Email::roleNames[2].toStdString().c_str()));
|
||||
|
||||
phoneTypeDelegate->addEntry(tr(Shared::VCard::Phone::typeNames[0].toStdString().c_str()));
|
||||
phoneTypeDelegate->addEntry(tr(Shared::VCard::Phone::typeNames[1].toStdString().c_str()));
|
||||
phoneTypeDelegate->addEntry(tr(Shared::VCard::Phone::typeNames[2].toStdString().c_str()));
|
||||
phoneTypeDelegate->addEntry(tr(Shared::VCard::Phone::typeNames[3].toStdString().c_str()));
|
||||
phoneTypeDelegate->addEntry(tr(Shared::VCard::Phone::typeNames[4].toStdString().c_str()));
|
||||
phoneTypeDelegate->addEntry(tr(Shared::VCard::Phone::typeNames[5].toStdString().c_str()));
|
||||
phoneTypeDelegate->addEntry(tr(Shared::VCard::Phone::typeNames[6].toStdString().c_str()));
|
||||
phoneTypeDelegate->addEntry(QCoreApplication::translate("Global", Shared::VCard::Phone::typeNames[0].toStdString().c_str()));
|
||||
phoneTypeDelegate->addEntry(QCoreApplication::translate("Global", Shared::VCard::Phone::typeNames[1].toStdString().c_str()));
|
||||
phoneTypeDelegate->addEntry(QCoreApplication::translate("Global", Shared::VCard::Phone::typeNames[2].toStdString().c_str()));
|
||||
phoneTypeDelegate->addEntry(QCoreApplication::translate("Global", Shared::VCard::Phone::typeNames[3].toStdString().c_str()));
|
||||
phoneTypeDelegate->addEntry(QCoreApplication::translate("Global", Shared::VCard::Phone::typeNames[4].toStdString().c_str()));
|
||||
phoneTypeDelegate->addEntry(QCoreApplication::translate("Global", Shared::VCard::Phone::typeNames[5].toStdString().c_str()));
|
||||
phoneTypeDelegate->addEntry(QCoreApplication::translate("Global", Shared::VCard::Phone::typeNames[6].toStdString().c_str()));
|
||||
|
||||
m_ui->emailsView->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
m_ui->emailsView->setModel(&emails);
|
||||
|
@ -317,7 +317,7 @@ void VCard::onContextMenu(const QPoint& point)
|
|||
if (selectionSize == 1) {
|
||||
int row = sm->selectedRows().at(0).row();
|
||||
if (emails.isPreferred(row)) {
|
||||
QAction* rev = contextMenu->addAction(Shared::icon("view-media-favorite"), tr("Unset this email as preferred"));
|
||||
QAction* rev = contextMenu->addAction(Shared::icon("unfavorite"), tr("Unset this email as preferred"));
|
||||
connect(rev, &QAction::triggered, std::bind(&UI::VCard::EMailsModel::revertPreferred, &emails, row));
|
||||
} else {
|
||||
QAction* rev = contextMenu->addAction(Shared::icon("favorite"), tr("Set this email as preferred"));
|
||||
|
@ -325,12 +325,12 @@ void VCard::onContextMenu(const QPoint& point)
|
|||
}
|
||||
}
|
||||
|
||||
QAction* del = contextMenu->addAction(Shared::icon("remove"), tr("Remove selected email addresses"));
|
||||
QAction* del = contextMenu->addAction(Shared::icon("edit-delete"), tr("Remove selected email addresses"));
|
||||
connect(del, &QAction::triggered, this, &VCard::onRemoveEmail);
|
||||
}
|
||||
}
|
||||
|
||||
QAction* cp = contextMenu->addAction(Shared::icon("copy"), tr("Copy selected emails to clipboard"));
|
||||
QAction* cp = contextMenu->addAction(Shared::icon("edit-copy"), tr("Copy selected emails to clipboard"));
|
||||
connect(cp, &QAction::triggered, this, &VCard::onCopyEmail);
|
||||
} else if (snd == m_ui->phonesView) {
|
||||
hasMenu = true;
|
||||
|
@ -353,12 +353,12 @@ void VCard::onContextMenu(const QPoint& point)
|
|||
}
|
||||
}
|
||||
|
||||
QAction* del = contextMenu->addAction(Shared::icon("remove"), tr("Remove selected phone numbers"));
|
||||
QAction* del = contextMenu->addAction(Shared::icon("edit-delete"), tr("Remove selected phone numbers"));
|
||||
connect(del, &QAction::triggered, this, &VCard::onRemovePhone);
|
||||
}
|
||||
}
|
||||
|
||||
QAction* cp = contextMenu->addAction(Shared::icon("copy"), tr("Copy selected phones to clipboard"));
|
||||
QAction* cp = contextMenu->addAction(Shared::icon("edit-copy"), tr("Copy selected phones to clipboard"));
|
||||
connect(cp, &QAction::triggered, this, &VCard::onCopyPhone);
|
||||
}
|
||||
|
||||
|
@ -431,32 +431,30 @@ void VCard::onRemovePhone()
|
|||
|
||||
void VCard::onCopyEmail()
|
||||
{
|
||||
QItemSelection selection(m_ui->emailsView->selectionModel()->selection());
|
||||
QList<QModelIndex> selection(m_ui->emailsView->selectionModel()->selectedRows());
|
||||
|
||||
QList<QString> addrs;
|
||||
for (const QModelIndex& index : selection.indexes()) {
|
||||
for (const QModelIndex& index : selection) {
|
||||
addrs.push_back(emails.getEmail(index.row()));
|
||||
}
|
||||
|
||||
QString list = addrs.join("\n");
|
||||
|
||||
qDebug() << list;
|
||||
QClipboard* cb = QApplication::clipboard();
|
||||
cb->setText(list);
|
||||
}
|
||||
|
||||
void VCard::onCopyPhone()
|
||||
{
|
||||
QItemSelection selection(m_ui->phonesView->selectionModel()->selection());
|
||||
QList<QModelIndex> selection(m_ui->phonesView->selectionModel()->selectedRows());
|
||||
|
||||
QList<QString> phs;
|
||||
for (const QModelIndex& index : selection.indexes()) {
|
||||
for (const QModelIndex& index : selection) {
|
||||
phs.push_back(phones.getPhone(index.row()));
|
||||
}
|
||||
|
||||
QString list = phs.join("\n");
|
||||
|
||||
qDebug() << list;
|
||||
QClipboard* cb = QApplication::clipboard();
|
||||
cb->setText(list);
|
||||
}
|
||||
|
|
|
@ -124,10 +124,10 @@
|
|||
</sizepolicy>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true"/>
|
||||
<string notr="true">font: 600 16pt;</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string><html><head/><body><p><span style=" font-size:16pt; font-weight:600;">Organization</span></p></body></html></string>
|
||||
<string>Organization</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
|
@ -418,8 +418,11 @@
|
|||
</item>
|
||||
<item row="0" column="0" colspan="4">
|
||||
<widget class="QLabel" name="generalHeading">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">font: 600 24pt ;</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string><html><head/><body><p><span style=" font-size:24pt; font-weight:600;">General</span></p></body></html></string>
|
||||
<string>General</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -445,7 +448,7 @@
|
|||
</sizepolicy>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true"/>
|
||||
<string notr="true">font: 600 16pt;</string>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
|
@ -454,7 +457,7 @@
|
|||
<enum>QFrame::Plain</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string><html><head/><body><p><span style=" font-size:16pt; font-weight:600;">Personal information</span></p></body></html></string>
|
||||
<string>Personal information</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
|
@ -536,8 +539,11 @@
|
|||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="contactHeading">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">font: 600 24pt ;</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string><html><head/><body><p><span style=" font-size:24pt; font-weight:600;">Contact</span></p></body></html></string>
|
||||
<string>Contact</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -561,7 +567,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>566</width>
|
||||
<height>497</height>
|
||||
<height>498</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_3" columnstretch="1,3,1">
|
||||
|
@ -640,8 +646,11 @@
|
|||
</item>
|
||||
<item row="8" column="1">
|
||||
<widget class="QLabel" name="addressesHeading">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">font: 600 16pt;</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string><html><head/><body><p><span style=" font-size:16pt; font-weight:600;">Addresses</span></p></body></html></string>
|
||||
<string>Addresses</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
|
@ -666,8 +675,11 @@
|
|||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLabel" name="emailsHeading">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">font: 600 16pt;</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string><html><head/><body><p><span style=" font-size:16pt; font-weight:600;">E-Mail addresses</span></p></body></html></string>
|
||||
<string>E-Mail addresses</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
|
@ -748,8 +760,11 @@
|
|||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QLabel" name="phenesHeading">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">font: 600 16pt;</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string><html><head/><body><p><span style=" font-size:16pt; font-weight:600;">Phone numbers</span></p></body></html></string>
|
||||
<string>Phone numbers</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
|
@ -800,8 +815,11 @@
|
|||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="descriptionHeading">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">font: 600 24pt ;</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string><html><head/><body><p><span style=" font-size:24pt; font-weight:600;">Description</span></p></body></html></string>
|
||||
<string>Description</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue