aboutsummaryrefslogtreecommitdiffstats
path: root/src/modules/filetransferwindow/FileTransferWindow.cpp
diff options
context:
space:
mode:
authorGravatar Fabio Bas2012-02-26 14:57:49 +0000
committerGravatar Fabio Bas2012-02-26 14:57:49 +0000
commitb2891fe17c395b885b4fac8634fa8cca1a45fbb6 (patch)
treee9fcfdebc14137188b3cf02376fe90145d52943d /src/modules/filetransferwindow/FileTransferWindow.cpp
parentSome mixed changes, mostly related to osx development: (diff)
downloadKVIrc-b2891fe17c395b885b4fac8634fa8cca1a45fbb6.tar.gz
KVIrc-b2891fe17c395b885b4fac8634fa8cca1a45fbb6.tar.bz2
KVIrc-b2891fe17c395b885b4fac8634fa8cca1a45fbb6.zip
Dropped the KviTalPopupMenu layer, ported the involved code to QAction.
This fixes most of the random crashes on osx, and is the base for a next change in the menubar. Addiotional fix: "disconnect" menu entry was broken since the 3.x era git-svn-id: https://svn.kvirc.de/svn/trunk/kvirc@6072 17fca916-40b9-46aa-a4ea-0a15b648b75c
Diffstat (limited to 'src/modules/filetransferwindow/FileTransferWindow.cpp')
-rw-r--r--src/modules/filetransferwindow/FileTransferWindow.cpp65
1 files changed, 32 insertions, 33 deletions
diff --git a/src/modules/filetransferwindow/FileTransferWindow.cpp b/src/modules/filetransferwindow/FileTransferWindow.cpp
index 00a9c2aa5..2693e39f7 100644
--- a/src/modules/filetransferwindow/FileTransferWindow.cpp
+++ b/src/modules/filetransferwindow/FileTransferWindow.cpp
@@ -48,7 +48,7 @@
#include <QFontMetrics>
#include <QEvent>
#include <QKeyEvent>
-
+#include <QWidgetAction>
#include <QHeaderView>
#ifdef COMPILE_KDE_SUPPORT
@@ -386,17 +386,17 @@ void FileTransferWindow::doubleClicked(FileTransferItem *it,const QPoint &)
void FileTransferWindow::rightButtonPressed(FileTransferItem *it,const QPoint &pnt)
{
- if(!m_pContextPopup)m_pContextPopup = new KviTalPopupMenu(this);
- if(!m_pLocalFilePopup)m_pLocalFilePopup = new KviTalPopupMenu(this);
+ if(!m_pContextPopup)m_pContextPopup = new QMenu(this);
+ if(!m_pLocalFilePopup)m_pLocalFilePopup = new QMenu(this);
if(!m_pOpenFilePopup)
{
- m_pOpenFilePopup= new KviTalPopupMenu(this);
+ m_pOpenFilePopup= new QMenu(this);
connect(m_pOpenFilePopup,SIGNAL(activated(int)),this,SLOT(openFilePopupActivated(int)));
}
m_pContextPopup->clear();
- int id;
+ QAction *pAction;
if(it)
{
@@ -430,13 +430,13 @@ void FileTransferWindow::rightButtonPressed(FileTransferItem *it,const QPoint &p
QLabel * l = new QLabel(tmp,m_pLocalFilePopup);
QPalette p;
l->setStyleSheet("background-color: " + p.color(QPalette::Normal, QPalette::Mid).name());
- m_pLocalFilePopup->insertItem(l);
+ m_pLocalFilePopup->addAction(new QWidgetAction(l));
#ifdef COMPILE_KDE_SUPPORT
QString mimetype = KMimeType::findByPath(szFile)->name();
KService::List offers = KMimeTypeTrader::self()->query(mimetype,"Application");
- id = m_pLocalFilePopup->insertItem(__tr2qs_ctx("&Open","filetransferwindow"),this,SLOT(openLocalFile()));
+ id = m_pLocalFilePopup->addAction(__tr2qs_ctx("&Open","filetransferwindow"),this,SLOT(openLocalFile()));
m_pLocalFilePopup->setItemParameter(id,-1);
m_pOpenFilePopup->clear();
@@ -447,7 +447,7 @@ void FileTransferWindow::rightButtonPressed(FileTransferItem *it,const QPoint &p
for(KService::List::Iterator itOffers = offers.begin();
itOffers != offers.end(); ++itOffers)
{
- id = m_pOpenFilePopup->insertItem(
+ id = m_pOpenFilePopup->addAction(
SmallIcon((*itOffers).data()->icon()),
(*itOffers).data()->name()
);
@@ -455,42 +455,41 @@ void FileTransferWindow::rightButtonPressed(FileTransferItem *it,const QPoint &p
idx++;
}
- m_pOpenFilePopup->insertSeparator();
+ m_pOpenFilePopup->addSeparator();
- id = m_pOpenFilePopup->insertItem(__tr2qs_ctx("&Other...","filetransferwindow"),this,SLOT(openLocalFileWith()));
+ id = m_pOpenFilePopup->addAction(__tr2qs_ctx("&Other...","filetransferwindow"),this,SLOT(openLocalFileWith()));
m_pOpenFilePopup->setItemParameter(id,-1);
- m_pLocalFilePopup->insertItem(__tr2qs_ctx("Open &With","filetransferwindow"),m_pOpenFilePopup);
- m_pLocalFilePopup->insertSeparator();
- m_pLocalFilePopup->insertItem(__tr2qs_ctx("Open &Location","filetransferwindow"),this,SLOT(openLocalFileFolder()));
- m_pLocalFilePopup->insertItem(__tr2qs_ctx("Terminal at Location","filetransferwindow"),this,SLOT(openLocalFileTerminal()));
- m_pLocalFilePopup->insertSeparator();
+ m_pLocalFilePopup->addAction(__tr2qs_ctx("Open &With","filetransferwindow"),m_pOpenFilePopup);
+ m_pLocalFilePopup->addSeparator();
+ m_pLocalFilePopup->addAction(__tr2qs_ctx("Open &Location","filetransferwindow"),this,SLOT(openLocalFileFolder()));
+ m_pLocalFilePopup->addAction(__tr2qs_ctx("Terminal at Location","filetransferwindow"),this,SLOT(openLocalFileTerminal()));
+ m_pLocalFilePopup->addSeparator();
#endif //COMPILE_KDE_SUPPORT
//-| Grifisx & Noldor |-
#if defined(COMPILE_ON_WINDOWS) || defined(COMPILE_ON_MINGW)
- id = m_pLocalFilePopup->insertItem(__tr2qs_ctx("&Open","filetransferwindow"),this,SLOT(openLocalFile()));
+ id = m_pLocalFilePopup->addAction(__tr2qs_ctx("&Open","filetransferwindow"),this,SLOT(openLocalFile()));
m_pLocalFilePopup->setItemParameter(id,-1);
- m_pOpenFilePopup->insertSeparator();
- m_pLocalFilePopup->insertItem(__tr2qs_ctx("Open &With","filetransferwindow"),this,SLOT(openLocalFileWith()));
- m_pLocalFilePopup->insertSeparator();
- m_pLocalFilePopup->insertItem(__tr2qs_ctx("Open &Location","filetransferwindow"),this,SLOT(openLocalFileFolder()));
- m_pLocalFilePopup->insertItem(__tr2qs_ctx("MS-DOS Prompt at Location","filetransferwindow"),this,SLOT(openLocalFileTerminal()));
- m_pLocalFilePopup->insertSeparator();
+ m_pOpenFilePopup->addSeparator();
+ m_pLocalFilePopup->addAction(__tr2qs_ctx("Open &With","filetransferwindow"),this,SLOT(openLocalFileWith()));
+ m_pLocalFilePopup->addSeparator();
+ m_pLocalFilePopup->addAction(__tr2qs_ctx("Open &Location","filetransferwindow"),this,SLOT(openLocalFileFolder()));
+ m_pLocalFilePopup->addAction(__tr2qs_ctx("MS-DOS Prompt at Location","filetransferwindow"),this,SLOT(openLocalFileTerminal()));
+ m_pLocalFilePopup->addSeparator();
#endif
// G&N end
- m_pLocalFilePopup->insertItem(__tr2qs_ctx("&Copy Path to Clipboard","filetransferwindow"),this,SLOT(copyLocalFileToClipboard()));
-
- id = m_pLocalFilePopup->insertItem(__tr2qs_ctx("&Delete file","filetransferwindow"),this,SLOT(deleteLocalFile()));
- m_pLocalFilePopup->setItemEnabled(id,i->transfer()->terminated());
- m_pContextPopup->insertItem(__tr2qs_ctx("Local &File","filetransferwindow"),m_pLocalFilePopup);
-
+ m_pLocalFilePopup->addAction(__tr2qs_ctx("&Copy Path to Clipboard","filetransferwindow"),this,SLOT(copyLocalFileToClipboard()));
+ pAction = m_pLocalFilePopup->addAction(__tr2qs_ctx("&Delete file","filetransferwindow"),this,SLOT(deleteLocalFile()));
+ pAction->setEnabled(i->transfer()->terminated());
+ pAction = m_pContextPopup->addAction(__tr2qs_ctx("Local &File","filetransferwindow"));
+ pAction->setMenu(m_pLocalFilePopup);
}
i->transfer()->fillContextPopup(m_pContextPopup);
- m_pContextPopup->insertSeparator();
+ m_pContextPopup->addSeparator();
}
}
@@ -512,15 +511,15 @@ void FileTransferWindow::rightButtonPressed(FileTransferItem *it,const QPoint &p
}
}
- id = m_pContextPopup->insertItem(__tr2qs_ctx("&Clear Terminated","filetransferwindow"),this,SLOT(clearTerminated()));
- m_pContextPopup->setItemEnabled(id,bHaveTerminated);
+ pAction = m_pContextPopup->addAction(__tr2qs_ctx("&Clear Terminated","filetransferwindow"),this,SLOT(clearTerminated()));
+ pAction->setEnabled(bHaveTerminated);
bool bAreTransfersActive = false;
if(m_pTableWidget->rowCount() >= 1)
bAreTransfersActive = true;
- id = m_pContextPopup->insertItem(__tr2qs_ctx("Clear &All","filetransferwindow"),this,SLOT(clearAll()));
- m_pContextPopup->setItemEnabled(id,bAreTransfersActive);
+ pAction = m_pContextPopup->addAction(__tr2qs_ctx("Clear &All","filetransferwindow"),this,SLOT(clearAll()));
+ pAction->setEnabled(bAreTransfersActive);
m_pContextPopup->popup(pnt);
}