removed some timer calls

This commit is contained in:
csoler 2019-03-03 21:49:09 +01:00
parent 0570c3fa38
commit 26792a7471
No known key found for this signature in database
GPG Key ID: 7BCA522266C0804C
2 changed files with 26 additions and 62 deletions

View File

@ -321,15 +321,7 @@ MessagesDialog::MessagesDialog(QWidget *parent)
// fill quick view // fill quick view
fillQuickView(); fillQuickView();
// create timer for navigation //ui.messageTreeWidget->installEventFilter(this);
timer = new RsProtectedTimer(this);
#ifdef TODO
timer->setInterval(300);
timer->setSingleShot(true);
connect(timer, SIGNAL(timeout()), this, SLOT(updateCurrentMessage()));
#endif
ui.messageTreeWidget->installEventFilter(this);
// remove close button of the the first tab // remove close button of the the first tab
ui.tabWidget->hideCloseButton(0); ui.tabWidget->hideCloseButton(0);
@ -351,10 +343,6 @@ MessagesDialog::MessagesDialog(QWidget *parent)
MessagesDialog::~MessagesDialog() MessagesDialog::~MessagesDialog()
{ {
// stop and delete timer
timer->stop();
delete(timer);
// save settings // save settings
processSettings(false); processSettings(false);
} }
@ -418,36 +406,35 @@ void MessagesDialog::processSettings(bool load)
bool MessagesDialog::eventFilter(QObject *obj, QEvent *event) bool MessagesDialog::eventFilter(QObject *obj, QEvent *event)
{ {
#ifdef TODO if (obj == ui.messageTreeWidget && event->type() == QEvent::KeyPress)
if (obj == ui.messageTreeWidget) { {
if (event->type() == QEvent::KeyPress) { QKeyEvent *keyEvent = static_cast<QKeyEvent*>(event);
QKeyEvent *keyEvent = static_cast<QKeyEvent*>(event);
if (keyEvent && keyEvent->key() == Qt::Key_Space) { if (keyEvent && keyEvent->key() == Qt::Key_Space)
// Space pressed {
clicked(ui.messageTreeWidget->currentItem(), COLUMN_UNREAD); // Space pressed
return true; // eat event clicked(ui.messageTreeWidget->currentIndex());
} return true; // eat event
} }
} }
#endif
// pass the event on to the parent class // pass the event on to the parent class
return MainPage::eventFilter(obj, event); return MainPage::eventFilter(obj, event);
} }
void MessagesDialog::changeEvent(QEvent *e) // void MessagesDialog::changeEvent(QEvent *e)
{ // {
#ifdef TODO // QWidget::changeEvent(e);
QWidget::changeEvent(e); //
switch (e->type()) { // switch (e->type()) {
case QEvent::StyleChange: // case QEvent::StyleChange:
insertMessages(); // insertMessages();
break; // break;
default: // default:
// remove compiler warnings // // remove compiler warnings
break; // break;
} // }
#endif // }
}
void MessagesDialog::fillQuickView() void MessagesDialog::fillQuickView()
{ {
@ -1345,23 +1332,6 @@ void MessagesDialog::insertMessages()
} }
#endif #endif
// current row in messageTreeWidget has changed
void MessagesDialog::currentItemChanged(QTreeWidgetItem *item)
{
#ifdef TODO
timer->stop();
if (item) {
timerIndex = ui.messageTreeWidget->indexOfTopLevelItem(item);
timer->start();
} else {
timerIndex = -1;
}
updateInterface();
#endif
}
// click in messageTreeWidget // click in messageTreeWidget
void MessagesDialog::clicked(const QModelIndex& index) void MessagesDialog::clicked(const QModelIndex& index)
{ {
@ -1383,10 +1353,6 @@ void MessagesDialog::clicked(const QModelIndex& index)
return; return;
} }
} }
#ifdef TODO
timer->stop();
timerIndex = ui.messageTreeWidget->indexOfTopLevelItem(item);
#endif
// show current message directly // show current message directly
insertMsgTxtAndFiles(index); insertMsgTxtAndFiles(index);

View File

@ -60,7 +60,6 @@ public:
protected: protected:
bool eventFilter(QObject *obj, QEvent *ev); bool eventFilter(QObject *obj, QEvent *ev);
void changeEvent(QEvent *e);
int getSelectedMessages(QList<QString>& mid); int getSelectedMessages(QList<QString>& mid);
public slots: public slots:
@ -76,7 +75,6 @@ private slots:
void changeBox(int newrow); void changeBox(int newrow);
void changeQuickView(int newrow); void changeQuickView(int newrow);
void updateCurrentMessage(); void updateCurrentMessage();
void currentItemChanged(QTreeWidgetItem *item);
void clicked(const QModelIndex&); void clicked(const QModelIndex&);
void doubleClicked(const QModelIndex&); void doubleClicked(const QModelIndex&);