summaryrefslogtreecommitdiffstats
path: root/src/mainwindow.cpp
diff options
context:
space:
mode:
authorSlávek Banko <slavek.banko@axis.cz>2014-03-03 13:46:44 +0100
committerSlávek Banko <slavek.banko@axis.cz>2014-03-03 13:46:44 +0100
commit2e02da046d3e56cdf4744f644af35ad07424f48b (patch)
treef2dcf353aa2338eae1c2ff2c41af971c580c2762 /src/mainwindow.cpp
parent3c13229d98167ae4ae0710d5eeef23fef5005bf0 (diff)
downloadtellico-2e02da046d3e56cdf4744f644af35ad07424f48b.tar.gz
tellico-2e02da046d3e56cdf4744f644af35ad07424f48b.zip
Update to upstream version 1.3.6
Diffstat (limited to 'src/mainwindow.cpp')
-rw-r--r--src/mainwindow.cpp32
1 files changed, 24 insertions, 8 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 74451ac..54aac95 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -336,7 +336,7 @@ void MainWindow::initActions() {
action = new TDEAction(actionCollection(), "file_import_csv");
action->setText(i18n("Import CSV Data..."));
action->setToolTip(i18n("Import a CSV file"));
- action->setIcon(MIME_ICON("text/x-csv"));
+ action->setIcon(MIME_ICON("text/csv"));
importMenu->insert(action);
connect(action, TQT_SIGNAL(activated()), importMapper, TQT_SLOT(map()));
importMapper->setMapping(action, Import::CSV);
@@ -506,7 +506,7 @@ void MainWindow::initActions() {
action = new TDEAction(actionCollection(), "file_export_csv");
action->setText(i18n("Export to CSV..."));
action->setToolTip(i18n("Export to a comma-separated values file"));
- action->setIcon(MIME_ICON("text/x-csv"));
+ action->setIcon(MIME_ICON("text/csv"));
exportMenu->insert(action);
connect(action, TQT_SIGNAL(activated()), exportMapper, TQT_SLOT(map()));
exportMapper->setMapping(action, Export::CSV);
@@ -750,6 +750,7 @@ void MainWindow::initActions() {
// want to update every time the filter text changes
connect(m_quickFilter, TQT_SIGNAL(textChanged(const TQString&)),
TQT_TQOBJECT(this), TQT_SLOT(slotQueueFilter()));
+ m_quickFilter->installEventFilter(this); // intercept keyEvents
KWidgetAction* wAction = new KWidgetAction(m_quickFilter, i18n("Filter"), 0, 0, 0,
actionCollection(), "quick_filter");
@@ -907,12 +908,12 @@ void MainWindow::saveOptions() {
Config::setGroupViewSortAscending(m_groupView->ascendingSort());
if(m_loanView) {
- Config::setLoanViewSortAscending(m_loanView->sortStyle()); // ok to use SortColumn key, save semantics
+ Config::setLoanViewSortColumn(m_loanView->sortStyle()); // ok to use SortColumn key, save semantics
Config::setLoanViewSortAscending(m_loanView->ascendingSort());
}
if(m_filterView) {
- Config::setFilterViewSortAscending(m_filterView->sortStyle()); // ok to use SortColumn key, save semantics
+ Config::setFilterViewSortColumn(m_filterView->sortStyle()); // ok to use SortColumn key, save semantics
Config::setFilterViewSortAscending(m_filterView->ascendingSort());
}
@@ -991,7 +992,7 @@ void MainWindow::saveCollectionOptions(Data::CollPtr coll_) {
configIndex = i;
}
}
- uint limit = TQMIN(urls.count(), Config::maxCustomURLSettings());
+ size_t limit = TQMIN(urls.count(), Config::maxCustomURLSettings());
for(uint i = 0; i < limit; ++i) {
config.writeEntry(TQString::fromLatin1("URL_%1").arg(i), urls[i].url());
config.writeEntry(TQString::fromLatin1("Group By_%1").arg(i), groupBys[i]);
@@ -1531,11 +1532,11 @@ void MainWindow::slotEntryCount() {
return;
}
- int count = coll->entryCount();
+ size_t count = coll->entryCount();
TQString text = i18n("Total entries: %1").arg(count);
- int selectCount = Controller::self()->selectedEntries().count();
- int filterCount = m_detailedView->visibleItems();
+ size_t selectCount = Controller::self()->selectedEntries().count();
+ size_t filterCount = m_detailedView->visibleItems();
// if more than one book is selected, add the number of selected books
if(filterCount < count && selectCount > 1) {
text += TQChar(' ');
@@ -1848,6 +1849,10 @@ void MainWindow::setFilter(const TQString& text_) {
// if it isn't valid, hold off on applying the filter
TQRegExp tx(text);
if(!tx.isValid()) {
+ text = TQRegExp::escape(text);
+ tx.setPattern(text);
+ }
+ if(!tx.isValid()) {
myDebug() << "MainWindow::slotUpdateFilter() - invalid regexp: " << text << endl;
return;
}
@@ -2389,4 +2394,15 @@ void MainWindow::slotURLAction(const KURL& url_) {
}
}
+bool MainWindow::eventFilter(TQObject* obj_, TQEvent* ev_) {
+ if(ev_->type() == TQEvent::KeyPress && obj_ == m_quickFilter) {
+ switch(static_cast<TQKeyEvent*>(ev_)->key()) {
+ case TQt::Key_Escape:
+ m_quickFilter->clear();
+ return true;
+ }
+ }
+ return false;
+}
+
#include "mainwindow.moc"