summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swift/QtUI/QtHighlightEditor.cpp')
-rw-r--r--Swift/QtUI/QtHighlightEditor.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/Swift/QtUI/QtHighlightEditor.cpp b/Swift/QtUI/QtHighlightEditor.cpp
index 5aa4560..97774be 100644
--- a/Swift/QtUI/QtHighlightEditor.cpp
+++ b/Swift/QtUI/QtHighlightEditor.cpp
@@ -318,73 +318,77 @@ void QtHighlightEditor::widgetClick()
void QtHighlightEditor::disableDialog()
{
ui_.chatRadio->setEnabled(false);
ui_.roomRadio->setEnabled(false);
ui_.allMsgRadio->setEnabled(false);
ui_.nickIsKeyword->setEnabled(false);
ui_.senderRadio->setEnabled(false);
ui_.dummySenderName->setEnabled(false);
ui_.keywordRadio->setEnabled(false);
ui_.keyword->setEnabled(false);
ui_.matchPartialWords->setEnabled(false);
ui_.matchCase->setEnabled(false);
ui_.noColorRadio->setEnabled(false);
ui_.customColorRadio->setEnabled(false);
ui_.foregroundColor->setEnabled(false);
ui_.backgroundColor->setEnabled(false);
ui_.noSoundRadio->setEnabled(false);
ui_.defaultSoundRadio->setEnabled(false);
ui_.customSoundRadio->setEnabled(false);
ui_.soundFile->setEnabled(false);
ui_.soundFileButton->setEnabled(false);
}
void QtHighlightEditor::handleContactSuggestionRequested(const QString& text)
{
std::string stdText = Q2PSTRING(text);
onContactSuggestionsRequested(stdText);
}
void QtHighlightEditor::selectSoundFile()
{
QString path = QFileDialog::getOpenFileName(this, tr("Select sound file..."), QString(), "Sounds (*.wav)");
ui_.soundFile->setText(path);
}
-void QtHighlightEditor::handleOnUserSelected(const JID& jid) {
+void QtHighlightEditor::handleOnUserSelected(const Contact::ref& contact) {
/* this might seem like it should be standard behaviour for the suggesting input box, but is not desirable in all cases */
- jid_->setText(P2QSTRING(jid.toString()));
+ if (contact->jid.isValid()) {
+ jid_->setText(P2QSTRING(contact->jid.toString()));
+ } else {
+ jid_->setText(P2QSTRING(contact->name));
+ }
}
void QtHighlightEditor::populateList()
{
previousRow_ = -1;
ui_.listWidget->clear();
HighlightRulesListPtr rules = highlightManager_->getRules();
for (size_t i = 0; i < rules->getSize(); ++i) {
const HighlightRule& rule = rules->getRule(i);
QListWidgetItem *item = new QListWidgetItem();
item->setText(P2QSTRING(formatShortDescription(rule)));
ui_.listWidget->addItem(item);
}
}
void QtHighlightEditor::selectRow(int row)
{
for (int i = 0; i < ui_.listWidget->count(); ++i) {
if (i == row) {
ui_.listWidget->item(i)->setSelected(true);
onCurrentRowChanged(i);
} else {
ui_.listWidget->item(i)->setSelected(false);
}
}
ui_.listWidget->setCurrentRow(row);
}
int QtHighlightEditor::getSelectedRow() const
{
for (int i = 0; i < ui_.listWidget->count(); ++i) {
if (ui_.listWidget->item(i)->isSelected()) {
return i;
}
}