diff options
| author | 2014-11-22 14:56:00 +0000 | |
|---|---|---|
| committer | 2014-11-22 14:56:00 +0000 | |
| commit | f9aec8943558f3fa01c6251bed1c3acd23936233 (patch) | |
| tree | 696c2f5b627a4f862843203ca41bc320418e5857 /src | |
| parent | - massive trailing whitespace cleanup (yes, one of these "you can hate me for... (diff) | |
| download | KVIrc-f9aec8943558f3fa01c6251bed1c3acd23936233.tar.gz KVIrc-f9aec8943558f3fa01c6251bed1c3acd23936233.tar.bz2 KVIrc-f9aec8943558f3fa01c6251bed1c3acd23936233.zip | |
Work around Qt4 bug to actually export a logfile to the temprary
directory
Part of https://svn.kvirc.de/kvirc/ticket/934
git-svn-id: https://svn.kvirc.de/svn/trunk/kvirc@6399 17fca916-40b9-46aa-a4ea-0a15b648b75c
Diffstat (limited to 'src')
| -rw-r--r-- | src/modules/logview/LogViewWindow.cpp | 29 | ||||
| -rw-r--r-- | src/modules/logview/LogViewWindow.h | 7 |
2 files changed, 27 insertions, 9 deletions
diff --git a/src/modules/logview/LogViewWindow.cpp b/src/modules/logview/LogViewWindow.cpp index a6759c774..7eec8b577 100644 --- a/src/modules/logview/LogViewWindow.cpp +++ b/src/modules/logview/LogViewWindow.cpp @@ -186,12 +186,18 @@ LogViewWindow::LogViewWindow() li.append(width()-110); m_pSplitter->setSizes(li); - m_pExportLogPopup = new QMenu("exportlog", this); - m_pExportLogPopup->addAction(__tr2qs_ctx("plain text file","log")); - m_pExportLogPopup->addAction(__tr2qs_ctx("HTML archive","log")); + // Using setData to track the option ordinal that used to be passed as id + m_pExportLogPopup = new QMenu("exportlog", this); + QAction* pAction = m_pExportLogPopup->addAction(__tr2qs_ctx("Plain text file","log")); + pAction->setData(LogFile::PlainText); + pAction = m_pExportLogPopup->addAction(__tr2qs_ctx("HTML archive","log")); + pAction->setData(LogFile::HTML); //m_pExportLogPopup->addAction(__tr2qs_ctx("XML file","log")); //m_pExportLogPopup->addAction(__tr2qs_ctx("database file","log")); - connect(m_pExportLogPopup,SIGNAL(activated(int)),this,SLOT(exportLog(int))); + + // 18.11.14: Originally this hooked activated, but Qt4 kept sending bullshit IDs here + // https://svn.kvirc.de/kvirc/ticket/934#comment:9 + connect(m_pExportLogPopup,SIGNAL(triggered(QAction*)),this,SLOT(exportLog(QAction*))); m_pTimer = new QTimer(this); m_pTimer->setSingleShot(true); @@ -507,6 +513,17 @@ void LogViewWindow::deleteCurrent() delete pItem; } +void LogViewWindow::exportLog(QAction* pAction) +{ + /* This slot is required as Qt4 has started to screw up the menu ordinal + * sent with the old activated signal - the ordinal is now stored as + * QAction user data */ + if (pAction) + exportLog(pAction->data().toInt()); + else + qDebug("LogViewWindow::exportLog called with invalid pAction"); +} + void LogViewWindow::exportLog(int iId) { LogListViewItem * pItem = (LogListViewItem *)(m_pListView->currentItem()); @@ -516,7 +533,7 @@ void LogViewWindow::exportLog(int iId) if(!pItem->childCount()) { // Export the log - createLog(pItem->log(),iId); + createLog(pItem->log(), iId); return; } @@ -551,7 +568,7 @@ void LogViewWindow::exportLog(int iId) for(unsigned int u = 0; u < logList.count(); u++) { LogListViewItem * pCurItem = logList.at(u); - createLog(pCurItem->log(),iId); + createLog(pCurItem->log(), iId); } } diff --git a/src/modules/logview/LogViewWindow.h b/src/modules/logview/LogViewWindow.h index 58c485654..ed2d82ade 100644 --- a/src/modules/logview/LogViewWindow.h +++ b/src/modules/logview/LogViewWindow.h @@ -104,13 +104,14 @@ protected: public: /** * \brief Exports the log and creates the file in the selected format - * \param pLog The log file associated to the item selected in the popup + * \param pLog The log file associated with the item selected in the popup * \param iId The id of the item in the popup - * \param pszFile The buffer where to store the exported log name + * \param pszFile The buffer to store the exported log name * \return void */ void createLog(LogFile * pLog, int iId, QString * pszFile = 0); protected: + void exportLog(int iId); void recurseDirectory(const QString & szDir); void setupItemList(); @@ -128,7 +129,7 @@ protected slots: void abortFilter(); void cacheFileList(); void filterNext(); - void exportLog(int iId); + void exportLog(QAction * pAction); }; #endif //_LOGVIEWWINDOW_H_ |
