Bugfix: Do not perform a search if mouse enters text field.
parent
fd951ed502
commit
1a99bf1ded
|
@ -283,40 +283,57 @@ void MainWindow::find()
|
|||
|
||||
bool MainWindow::eventFilter(QObject *obj, QEvent *event)
|
||||
{
|
||||
if (obj == text_find &&
|
||||
(event->type() == QEvent::KeyRelease || event->type() == QEvent::Enter))
|
||||
wstring searchfor;
|
||||
|
||||
if (obj == text_find)
|
||||
{
|
||||
vector<Database::data> filtered_entries;
|
||||
if (!_dbdata.empty())
|
||||
if (event->type() == QEvent::KeyRelease)
|
||||
{
|
||||
for (const Database::data &entry : _dbdata)
|
||||
searchfor = text_find->text().toLower().toStdWString();
|
||||
}
|
||||
else if (event->type() == QEvent::Drop)
|
||||
{
|
||||
QDropEvent *drop = static_cast<QDropEvent*>(event);
|
||||
searchfor = drop->mimeData()->text().toLower().toStdWString();
|
||||
}
|
||||
else
|
||||
{
|
||||
return QObject::eventFilter(obj, event);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return QObject::eventFilter(obj, event);
|
||||
}
|
||||
|
||||
vector<Database::data> filtered_entries;
|
||||
if (!_dbdata.empty())
|
||||
{
|
||||
for (const Database::data &entry : _dbdata)
|
||||
{
|
||||
wstring searchstring;
|
||||
|
||||
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> convert;
|
||||
|
||||
if (check_user->isChecked())
|
||||
{
|
||||
wstring searchstring;
|
||||
|
||||
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> convert;
|
||||
|
||||
if (check_user->isChecked())
|
||||
{
|
||||
searchstring += convert.from_bytes(entry.user);
|
||||
}
|
||||
if (check_reason->isChecked())
|
||||
{
|
||||
searchstring += convert.from_bytes(entry.reason);
|
||||
}
|
||||
std::transform(searchstring.begin(), searchstring.end(),
|
||||
searchstring.begin(), ::towlower);
|
||||
if (searchstring.find(
|
||||
text_find->text().toLower().toStdWString())
|
||||
!= std::string::npos)
|
||||
{
|
||||
filtered_entries.push_back(entry);
|
||||
}
|
||||
searchstring += convert.from_bytes(entry.user);
|
||||
}
|
||||
if (check_reason->isChecked())
|
||||
{
|
||||
searchstring += convert.from_bytes(entry.reason);
|
||||
}
|
||||
std::transform(searchstring.begin(), searchstring.end(),
|
||||
searchstring.begin(), ::towlower);
|
||||
if (searchstring.find(searchfor) != std::string::npos)
|
||||
{
|
||||
filtered_entries.push_back(entry);
|
||||
}
|
||||
}
|
||||
|
||||
populate_tableview(filtered_entries);
|
||||
}
|
||||
|
||||
populate_tableview(filtered_entries);
|
||||
|
||||
return QObject::eventFilter(obj, event);
|
||||
}
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="clearButtonEnabled">
|
||||
<bool>true</bool>
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
|
@ -74,7 +74,7 @@
|
|||
<translation>Du kannst URLs hier hineinziehen</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/interface_qt.cpp" line="444"/>
|
||||
<location filename="../src/interface_qt.cpp" line="461"/>
|
||||
<source>Insert receipt here.</source>
|
||||
<translation>Beleg hier einfügen.</translation>
|
||||
</message>
|
||||
|
@ -270,175 +270,19 @@
|
|||
<translation>Bitte wähle einträge aus, die gelöscht werden sollen.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/interface_qt.cpp" line="325"/>
|
||||
<location filename="../src/interface_qt.cpp" line="342"/>
|
||||
<source>About Whyblocked</source>
|
||||
<translation>Über Whyblocked</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/interface_qt.cpp" line="326"/>
|
||||
<location filename="../src/interface_qt.cpp" line="343"/>
|
||||
<source><p><b>Whyblocked</b> %1</p><p>Reminds you why you blocked someone.</p><p>Sourcecode: <a href="https://schlomp.space/tastytea/whyblocked">https://schlomp.space/tastytea/whyblocked</a></p><p><small>Copyright © 2018 <a href="mailto:tastytea@tastytea.de">tastytea</a>.<br>Licence GPLv3: <a href="https://www.gnu.org/licenses/gpl-3.0.html">GNU GPL version 3</a>.<br>This program comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to redistribute it under certain conditions.</small></p></source>
|
||||
<translation><p><b>Whyblocked</b> %1</p><p>Erinnert dich, warum du jemanden blockiertest.</p><p>Quelltext: <a href="https://schlomp.space/tastytea/whyblocked">https://schlomp.space/tastytea/whyblocked</a></p><p><small>Copyright © 2018 <a href="mailto:tastytea@tastytea.de">tastytea</a>.<br>Lizenz GPLv3: <a href="https://www.gnu.org/licenses/gpl-3.0.html">GNU GPL version 3</a>.<br>Für dieses Programm besteht KEINERLEI GARANTIE. Dies ist freie Software, die Sie unter bestimmten Bedingungen weitergeben dürfen.</small></p></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/interface_qt.cpp" line="347"/>
|
||||
<location filename="../src/interface_qt.cpp" line="364"/>
|
||||
<source>Receipts:</source>
|
||||
<translation>Belege:</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>Text</name>
|
||||
<message>
|
||||
<location filename="../src/interface_text.cpp" line="51"/>
|
||||
<source>Blocked or silenced?</source>
|
||||
<translation>Blockiert oder gedämpft?</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/interface_text.cpp" line="68"/>
|
||||
<source>Add receipt? [y/n]</source>
|
||||
<translation>Beleg hinzufügen? [j/n]</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/interface_text.cpp" line="69"/>
|
||||
<source>y</source>
|
||||
<translation>j</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/interface_text.cpp" line="69"/>
|
||||
<source>Y</source>
|
||||
<translation>J</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/interface_text.cpp" line="71"/>
|
||||
<source>Receipt</source>
|
||||
<translation>Beleg</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/interface_text.cpp" line="75"/>
|
||||
<source>Receipt added.</source>
|
||||
<translation>Beleg hinzugefügt.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/interface_text.cpp" line="78"/>
|
||||
<source>n</source>
|
||||
<translation>n</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/interface_text.cpp" line="78"/>
|
||||
<source>N</source>
|
||||
<translation>N</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/interface_text.cpp" line="91"/>
|
||||
<location filename="../src/interface_text.cpp" line="115"/>
|
||||
<location filename="../src/interface_text.cpp" line="175"/>
|
||||
<location filename="../src/interface_text.cpp" line="206"/>
|
||||
<source>User or instance</source>
|
||||
<translation>Benutzer oder Instanz</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/interface_text.cpp" line="102"/>
|
||||
<source>Reason</source>
|
||||
<translation>Begründung</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/interface_text.cpp" line="106"/>
|
||||
<source>added.</source>
|
||||
<translation>hinzugefügt.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/interface_text.cpp" line="118"/>
|
||||
<source>A blank line keeps the former value.</source>
|
||||
<translation>Leere Zeile um den alten Wert zu erhalten.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/interface_text.cpp" line="119"/>
|
||||
<source>Change user or instance to</source>
|
||||
<translation>Ändere Benutzer oder Instanz zu</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/interface_text.cpp" line="135"/>
|
||||
<source>Old reason was:</source>
|
||||
<translation>Alte Begründung war:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/interface_text.cpp" line="136"/>
|
||||
<source>Change reason to</source>
|
||||
<translation>Ändere Begründung zu</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/interface_text.cpp" line="145"/>
|
||||
<source>Old receipt was:</source>
|
||||
<translation>Alter Beleg war:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/interface_text.cpp" line="146"/>
|
||||
<source>Change receipt to</source>
|
||||
<translation>Ändere beleg zu</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/interface_text.cpp" line="168"/>
|
||||
<source>Could not remove</source>
|
||||
<translation>Konnte nicht entfernen:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/interface_text.cpp" line="179"/>
|
||||
<source>removed.</source>
|
||||
<translation>entfernt.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/interface_text.cpp" line="192"/>
|
||||
<source> Blocked:</source>
|
||||
<translation>Blockiert:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/interface_text.cpp" line="196"/>
|
||||
<source>Silenced:</source>
|
||||
<translation> Gedämpft:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/interface_text.cpp" line="198"/>
|
||||
<source>because:</source>
|
||||
<translation>weil:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/interface_text.cpp" line="211"/>
|
||||
<source>is</source>
|
||||
<translation>ist</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/interface_text.cpp" line="214"/>
|
||||
<source>blocked, because:</source>
|
||||
<translation>blockiert, weil:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/interface_text.cpp" line="218"/>
|
||||
<source>silenced, because:</source>
|
||||
<translation>gedämpft, weil:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/interface_text.cpp" line="224"/>
|
||||
<source>Receipts:</source>
|
||||
<translation>Belege:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/interface_text.cpp" line="236"/>
|
||||
<source>Type add, edit, remove, view or details. Or just the first letter.</source>
|
||||
<translation>Schreibe a für hinzufügen, e für ändern, r für entfernen, v für anschauen oder d für Details.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/interface_text.cpp" line="239"/>
|
||||
<source>Type help or h to show this help. Type quit or q to quit the program.</source>
|
||||
<translation>Schreibe hilfe oder h, um die Hilfe anzuzeigen. Schreibe q um das Programm zu beenden.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/interface_text.cpp" line="248"/>
|
||||
<source>This is Whyblocked</source>
|
||||
<translation>Dies ist Whyblocked</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/interface_text.cpp" line="299"/>
|
||||
<source>Response not understood.</source>
|
||||
<translation>Antwort nicht verstanden.</translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
||||
|
|
|
@ -74,7 +74,7 @@
|
|||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/interface_qt.cpp" line="444"/>
|
||||
<location filename="../src/interface_qt.cpp" line="461"/>
|
||||
<source>Insert receipt here.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
@ -270,175 +270,19 @@
|
|||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/interface_qt.cpp" line="325"/>
|
||||
<location filename="../src/interface_qt.cpp" line="342"/>
|
||||
<source>About Whyblocked</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/interface_qt.cpp" line="326"/>
|
||||
<location filename="../src/interface_qt.cpp" line="343"/>
|
||||
<source><p><b>Whyblocked</b> %1</p><p>Reminds you why you blocked someone.</p><p>Sourcecode: <a href="https://schlomp.space/tastytea/whyblocked">https://schlomp.space/tastytea/whyblocked</a></p><p><small>Copyright © 2018 <a href="mailto:tastytea@tastytea.de">tastytea</a>.<br>Licence GPLv3: <a href="https://www.gnu.org/licenses/gpl-3.0.html">GNU GPL version 3</a>.<br>This program comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to redistribute it under certain conditions.</small></p></source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/interface_qt.cpp" line="347"/>
|
||||
<location filename="../src/interface_qt.cpp" line="364"/>
|
||||
<source>Receipts:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>Text</name>
|
||||
<message>
|
||||
<location filename="../src/interface_text.cpp" line="51"/>
|
||||
<source>Blocked or silenced?</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/interface_text.cpp" line="68"/>
|
||||
<source>Add receipt? [y/n]</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/interface_text.cpp" line="69"/>
|
||||
<source>y</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/interface_text.cpp" line="69"/>
|
||||
<source>Y</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/interface_text.cpp" line="71"/>
|
||||
<source>Receipt</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/interface_text.cpp" line="75"/>
|
||||
<source>Receipt added.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/interface_text.cpp" line="78"/>
|
||||
<source>n</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/interface_text.cpp" line="78"/>
|
||||
<source>N</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/interface_text.cpp" line="91"/>
|
||||
<location filename="../src/interface_text.cpp" line="115"/>
|
||||
<location filename="../src/interface_text.cpp" line="175"/>
|
||||
<location filename="../src/interface_text.cpp" line="206"/>
|
||||
<source>User or instance</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/interface_text.cpp" line="102"/>
|
||||
<source>Reason</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/interface_text.cpp" line="106"/>
|
||||
<source>added.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/interface_text.cpp" line="118"/>
|
||||
<source>A blank line keeps the former value.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/interface_text.cpp" line="119"/>
|
||||
<source>Change user or instance to</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/interface_text.cpp" line="135"/>
|
||||
<source>Old reason was:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/interface_text.cpp" line="136"/>
|
||||
<source>Change reason to</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/interface_text.cpp" line="145"/>
|
||||
<source>Old receipt was:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/interface_text.cpp" line="146"/>
|
||||
<source>Change receipt to</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/interface_text.cpp" line="168"/>
|
||||
<source>Could not remove</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/interface_text.cpp" line="179"/>
|
||||
<source>removed.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/interface_text.cpp" line="192"/>
|
||||
<source> Blocked:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/interface_text.cpp" line="196"/>
|
||||
<source>Silenced:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/interface_text.cpp" line="198"/>
|
||||
<source>because:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/interface_text.cpp" line="211"/>
|
||||
<source>is</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/interface_text.cpp" line="214"/>
|
||||
<source>blocked, because:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/interface_text.cpp" line="218"/>
|
||||
<source>silenced, because:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/interface_text.cpp" line="224"/>
|
||||
<source>Receipts:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/interface_text.cpp" line="236"/>
|
||||
<source>Type add, edit, remove, view or details. Or just the first letter.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/interface_text.cpp" line="239"/>
|
||||
<source>Type help or h to show this help. Type quit or q to quit the program.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/interface_text.cpp" line="248"/>
|
||||
<source>This is Whyblocked</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/interface_text.cpp" line="299"/>
|
||||
<source>Response not understood.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
||||
|
|
Loading…
Reference in New Issue