0001-Allow-highlights-to-match-identity-nicknames-case-in.patch
| src/client/clientsettings.h | ||
|---|---|---|
| 74 | 74 |
enum HighlightNickType {
|
| 75 | 75 |
NoNick = 0x00, |
| 76 | 76 |
CurrentNick= 0x01, |
| 77 |
AllNicks = 0x02 |
|
| 77 |
AllNicks = 0x02, |
|
| 78 |
CS = 0x04, |
|
| 79 |
CurrentNickCS = 0x05, |
|
| 80 |
AllNicksCS = 0x06 |
|
| 78 | 81 |
}; |
| 79 | 82 | |
| 80 | 83 |
NotificationSettings(); |
| src/qtui/qtuimessageprocessor.cpp | ||
|---|---|---|
| 108 | 108 |
const Network *net = Client::network(msg.bufferInfo().networkId()); |
| 109 | 109 |
if(net && !net->myNick().isEmpty()) {
|
| 110 | 110 |
QStringList nickList; |
| 111 |
if(notificationSettings.highlightNick() == NotificationSettings::CurrentNick) {
|
|
| 111 |
if(notificationSettings.highlightNick() & NotificationSettings::CurrentNick) {
|
|
| 112 | 112 |
nickList << net->myNick(); |
| 113 |
} else if(notificationSettings.highlightNick() == NotificationSettings::AllNicks) {
|
|
| 113 |
} else if(notificationSettings.highlightNick() & NotificationSettings::AllNicks) {
|
|
| 114 | 114 |
const Identity *myIdentity = Client::identity(net->identity()); |
| 115 | 115 |
if(myIdentity) |
| 116 | 116 |
nickList = myIdentity->nicks(); |
| 117 | 117 |
} |
| 118 | 118 |
foreach(QString nickname, nickList) {
|
| 119 | 119 |
QRegExp nickRegExp("^(.*\\W)?" + QRegExp::escape(nickname) + "(\\W.*)?$");
|
| 120 |
(notificationSettings.highlightNick() & NotificationSettings::CS) ? |
|
| 121 |
nickRegExp.setCaseSensitivity(Qt::CaseSensitive) |
|
| 122 |
: nickRegExp.setCaseSensitivity(Qt::CaseInsensitive); |
|
| 120 | 123 |
if(nickRegExp.exactMatch(msg.contents())) {
|
| 121 | 124 |
msg.setFlags(msg.flags() | Message::Highlight); |
| 122 | 125 |
return; |
| src/qtui/settingspages/highlightsettingspage.cpp | ||
|---|---|---|
| 51 | 51 |
connect(ui.highlightAllNicks, SIGNAL(clicked(bool)), this, SLOT(widgetHasChanged())); |
| 52 | 52 |
connect(ui.highlightCurrentNick, SIGNAL(clicked(bool)), this, SLOT(widgetHasChanged())); |
| 53 | 53 |
connect(ui.highlightNoNick, SIGNAL(clicked(bool)), this, SLOT(widgetHasChanged())); |
| 54 |
connect(ui.highlightNoNick, SIGNAL(toggled(bool)), ui.highlightCS, SLOT(setDisabled(bool))); |
|
| 55 |
connect(ui.highlightCS, SIGNAL(clicked(bool)), this, SLOT(widgetHasChanged())); |
|
| 56 | ||
| 54 | 57 |
connect(ui.add, SIGNAL(clicked()), this, SLOT(widgetHasChanged())); |
| 55 | 58 |
connect(ui.remove, SIGNAL(clicked()), this, SLOT(widgetHasChanged())); |
| 56 | 59 |
connect(ui.highlightTable, SIGNAL(itemChanged(QTableWidgetItem *)), this, SLOT(tableChanged(QTableWidgetItem *))); |
| ... | ... | |
| 62 | 65 | |
| 63 | 66 |
void HighlightSettingsPage::defaults() {
|
| 64 | 67 |
ui.highlightCurrentNick->setChecked(true); |
| 68 |
ui.highlightCS->setChecked(false); |
|
| 65 | 69 |
emptyTable(); |
| 66 | 70 | |
| 67 | 71 |
widgetHasChanged(); |
| ... | ... | |
| 186 | 190 |
addNewRow(name, regex, cs, enable); |
| 187 | 191 |
} |
| 188 | 192 | |
| 189 |
switch(notificationSettings.highlightNick()) |
|
| 193 |
NotificationSettings::HighlightNickType highlightNick = notificationSettings.highlightNick(); |
|
| 194 | ||
| 195 |
if (highlightNick & 0x04) {
|
|
| 196 |
ui.highlightCS->setChecked(true); |
|
| 197 |
highlightNick = NotificationSettings::HighlightNickType(highlightNick - 0x04); |
|
| 198 |
} |
|
| 199 | ||
| 200 |
switch(highlightNick) |
|
| 190 | 201 |
{
|
| 191 | 202 |
case NotificationSettings::NoNick: |
| 192 | 203 |
ui.highlightNoNick->setChecked(true); |
| ... | ... | |
| 207 | 218 |
notificationSettings.setHighlightList(highlightList); |
| 208 | 219 | |
| 209 | 220 |
NotificationSettings::HighlightNickType highlightNickType; |
| 210 |
if(ui.highlightNoNick->isChecked())
|
|
| 221 |
if(ui.highlightNoNick->isChecked()) |
|
| 211 | 222 |
highlightNickType = NotificationSettings::NoNick; |
| 212 |
if(ui.highlightCurrentNick->isChecked())
|
|
| 223 |
if(ui.highlightCurrentNick->isChecked()) |
|
| 213 | 224 |
highlightNickType = NotificationSettings::CurrentNick; |
| 214 |
if(ui.highlightAllNicks->isChecked())
|
|
| 225 |
if(ui.highlightAllNicks->isChecked()) |
|
| 215 | 226 |
highlightNickType = NotificationSettings::AllNicks; |
| 227 |
if(ui.highlightCS->isChecked()) |
|
| 228 |
highlightNickType = NotificationSettings::HighlightNickType(highlightNickType | NotificationSettings::CS); |
|
| 216 | 229 | |
| 217 | 230 |
notificationSettings.setHighlightNick(highlightNickType); |
| 218 | 231 | |
| ... | ... | |
| 229 | 242 |
NotificationSettings notificationSettings; |
| 230 | 243 | |
| 231 | 244 |
NotificationSettings::HighlightNickType highlightNickType; |
| 232 |
if(ui.highlightNoNick->isChecked())
|
|
| 245 |
if(ui.highlightNoNick->isChecked()) |
|
| 233 | 246 |
highlightNickType = NotificationSettings::NoNick; |
| 234 |
if(ui.highlightCurrentNick->isChecked())
|
|
| 247 |
if(ui.highlightCurrentNick->isChecked()) |
|
| 235 | 248 |
highlightNickType = NotificationSettings::CurrentNick; |
| 236 |
if(ui.highlightAllNicks->isChecked())
|
|
| 249 |
if(ui.highlightAllNicks->isChecked()) |
|
| 237 | 250 |
highlightNickType = NotificationSettings::AllNicks; |
| 251 |
if(ui.highlightCS->isChecked()) |
|
| 252 |
highlightNickType = NotificationSettings::HighlightNickType(highlightNickType | NotificationSettings::CS); |
|
| 238 | 253 | |
| 239 | 254 |
if(notificationSettings.highlightNick() != highlightNickType) return true; |
| 240 | 255 | |
| ... | ... | |
| 242 | 257 | |
| 243 | 258 |
return true; |
| 244 | 259 |
} |
| 245 | ||
| 246 | ||
| 247 | ||
| 248 | ||
| src/qtui/settingspages/highlightsettingspage.ui | ||
|---|---|---|
| 25 | 25 |
<string/> |
| 26 | 26 |
</property> |
| 27 | 27 |
<property name="styleSheet" > |
| 28 |
<string/> |
|
| 28 |
<string notr="true" />
|
|
| 29 | 29 |
</property> |
| 30 | 30 |
<column> |
| 31 | 31 |
<property name="text" > |
| ... | ... | |
| 68 | 68 |
<property name="orientation" > |
| 69 | 69 |
<enum>Qt::Vertical</enum> |
| 70 | 70 |
</property> |
| 71 |
<property name="sizeHint" > |
|
| 71 |
<property name="sizeHint" stdset="0" >
|
|
| 72 | 72 |
<size> |
| 73 | 73 |
<width>20</width> |
| 74 | 74 |
<height>40</height> |
| ... | ... | |
| 107 | 107 |
<property name="text" > |
| 108 | 108 |
<string>None</string> |
| 109 | 109 |
</property> |
| 110 |
<property name="checkable" > |
|
| 111 |
<bool>true</bool> |
|
| 112 |
</property> |
|
| 113 |
</widget> |
|
| 114 |
</item> |
|
| 115 |
<item> |
|
| 116 |
<widget class="QCheckBox" name="highlightCS" > |
|
| 117 |
<property name="enabled" > |
|
| 118 |
<bool>true</bool> |
|
| 119 |
</property> |
|
| 120 |
<property name="text" > |
|
| 121 |
<string>Case Sensitive</string> |
|
| 122 |
</property> |
|
| 123 |
<property name="checkable" > |
|
| 124 |
<bool>true</bool> |
|
| 125 |
</property> |
|
| 126 |
<property name="checked" > |
|
| 127 |
<bool>false</bool> |
|
| 128 |
</property> |
|
| 110 | 129 |
</widget> |
| 111 | 130 |
</item> |
| 112 | 131 |
</layout> |
| 113 |
- |
|