From 45476df6bef2810712764f717cbec3a118742409 Mon Sep 17 00:00:00 2001 From: Fabio Bas Date: Tue, 23 Mar 2010 09:46:22 +0000 Subject: some fixes to the url module git-svn-id: https://svn.kvirc.de/svn/trunk/kvirc@4207 17fca916-40b9-46aa-a4ea-0a15b648b75c --- src/modules/url/libkviurl.cpp | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) (limited to 'src/modules/url/libkviurl.cpp') diff --git a/src/modules/url/libkviurl.cpp b/src/modules/url/libkviurl.cpp index 0dd9228c0..9976a11a8 100644 --- a/src/modules/url/libkviurl.cpp +++ b/src/modules/url/libkviurl.cpp @@ -99,6 +99,7 @@ void KviUrlDialogTreeWidget::mousePressEvent (QMouseEvent *e) { QTreeWidgetItem *i= itemAt(e->pos()); if (i) emit rightButtonPressed(i,QCursor::pos()); + else emit contextMenuRequested(QCursor::pos()); } QTreeWidget::mousePressEvent(e); } @@ -197,7 +198,7 @@ UrlDialog::UrlDialog(KviPointerList *) */ connect(m_pUrlList,SIGNAL(itemDoubleClicked(QTreeWidgetItem *, int)),SLOT(dblclk_url(QTreeWidgetItem *, int))); connect(m_pUrlList,SIGNAL(rightButtonPressed(QTreeWidgetItem *, const QPoint &)),SLOT(popup(QTreeWidgetItem *, const QPoint &))); - + connect(m_pUrlList,SIGNAL(contextMenuRequested(const QPoint &)),SLOT(contextMenu(const QPoint &))); // setFocusHandlerNoChildren(m_pUrlList); m_pUrlList->setFocusPolicy(Qt::StrongFocus); m_pUrlList->setFocus(); @@ -331,6 +332,13 @@ void UrlDialog::popup(QTreeWidgetItem *item, const QPoint &point) p.exec(point); } +void UrlDialog::contextMenu(const QPoint &point) +{ + KviTalPopupMenu p(0,"contextmenu"); + p.insertItem(__tr2qs("Configure"),this,SLOT(config())); + p.exec(point); +} + void UrlDialog::sayToWin(QAction * act) { KviWindow *wnd = g_pApp->findWindowByCaption(act->text()); @@ -448,10 +456,11 @@ void ConfigDialog::discardbtn() void ConfigDialog::acceptbtn() { - if (m_pBanFrame) m_pBanFrame->saveBans(); - KviConfig *cfg = new KviConfig(szConfigPath,KviConfig::Write); cfg->setGroup("ConfigDialog"); + + if (m_pBanFrame) m_pBanFrame->saveBans(cfg); + cfg->writeEntry("SaveUrlListOnUnload",cb[0]->isChecked()); cfg->writeEntry("SaveColumnWidthOnClose",cb[1]->isChecked()); delete cfg; @@ -551,13 +560,10 @@ void BanFrame::removeBan() } -void BanFrame::saveBans() +void BanFrame::saveBans(KviConfig *cfg) { - if (m_pEnable->isChecked()) saveBanList(); - KviConfig *cfg = new KviConfig(szConfigPath,KviConfig::Write); - cfg->setGroup("ConfigDialog"); cfg->writeEntry("BanEnabled",m_pEnable->isChecked()); - delete cfg; + if (m_pEnable->isChecked()) saveBanList(); } BanFrame::~BanFrame() @@ -645,7 +651,7 @@ void saveBanList() stream << g_pBanList->count() << endl; for(QString *tmp=g_pBanList->first();tmp;tmp=g_pBanList->next()) { - stream << tmp << endl; + stream << *tmp << endl; } file.flush(); file.close(); @@ -750,8 +756,7 @@ bool urllist() @description: This command opens a configuration window where it is possible to setup plugin's parameters. You can also open this window by - using popup menu in the url list window or by clicking on the "configure plugin" button - in plugins options.

+ using popup menu in the url list window

Configure dialog options:

There is also a ban list widget, which allows to have a list of words that plugin mustn't catch.

E.g.
-- cgit v1.3.1-10-gc9f91