diff options
| author | 2008-04-18 21:04:11 +0000 | |
|---|---|---|
| committer | 2008-04-18 21:04:11 +0000 | |
| commit | 0a4cd04d6bbc1b97c41892a29eb02665f6d174c8 (patch) | |
| tree | bdfc28a32e7b0ab3eba45e830e3ede902816ac43 | |
| parent | probably fix for install bug reported by desowin (diff) | |
| download | KVIrc-0a4cd04d6bbc1b97c41892a29eb02665f6d174c8.tar.gz KVIrc-0a4cd04d6bbc1b97c41892a29eb02665f6d174c8.tar.bz2 KVIrc-0a4cd04d6bbc1b97c41892a29eb02665f6d174c8.zip | |
more qt4 port (renamed QT3 stuff))
git-svn-id: https://svn.kvirc.de/svn/trunk/kvirc@1507 17fca916-40b9-46aa-a4ea-0a15b648b75c
50 files changed, 511 insertions, 487 deletions
diff --git a/src/kvilib/tal/kvi_tal_mainwindow.cpp b/src/kvilib/tal/kvi_tal_mainwindow.cpp index 73288043e..decdec33e 100644 --- a/src/kvilib/tal/kvi_tal_mainwindow.cpp +++ b/src/kvilib/tal/kvi_tal_mainwindow.cpp @@ -30,7 +30,7 @@ KviTalMainWindow::KviTalMainWindow(QWidget * par,const char * nam) : KMainWindow(par) { - setCaption(nam); + setWindowTitle(nam); } bool KviTalMainWindow::usesBigPixmaps() diff --git a/src/kvilib/tal/kvi_tal_menubar.cpp b/src/kvilib/tal/kvi_tal_menubar.cpp index 87650cf9d..08d0b4c9e 100644 --- a/src/kvilib/tal/kvi_tal_menubar.cpp +++ b/src/kvilib/tal/kvi_tal_menubar.cpp @@ -30,7 +30,7 @@ KviTalMenuBar::KviTalMenuBar(QWidget * par,const char * nam) : KMenuBar(par) { - setCaption(nam); + setWindowTitle(nam); } KviTalMenuBar::~KviTalMenuBar() diff --git a/src/kvilib/tal/kvi_tal_popupmenu.cpp b/src/kvilib/tal/kvi_tal_popupmenu.cpp index 4e561dddb..41ca2d1b0 100644 --- a/src/kvilib/tal/kvi_tal_popupmenu.cpp +++ b/src/kvilib/tal/kvi_tal_popupmenu.cpp @@ -105,10 +105,10 @@ int KviTalPopupMenu::insertItem(const QString &szText,QMenu *pMenu) return identifier-1;
}
-
+// FIXME
int KviTalPopupMenu::insertItem(QWidget * pWidget)
{
- // needs Qt 4.2
+
QWidgetAction * pAct = new QWidgetAction(this);
pAct->setDefaultWidget(pWidget);
addAction(pAct);
diff --git a/src/kvirc/kernel/kvi_iconmanager.cpp b/src/kvirc/kernel/kvi_iconmanager.cpp index 5f5a49c1a..cdbb8d300 100644 --- a/src/kvirc/kernel/kvi_iconmanager.cpp +++ b/src/kvirc/kernel/kvi_iconmanager.cpp @@ -358,7 +358,7 @@ KviIconWidget::KviIconWidget(QWidget * par) void KviIconWidget::init() { - setCaption(__tr2qs("Icon Table")); + setWindowTitle(__tr2qs("Icon Table")); setIcon(*(g_pIconManager->getSmallIcon(KVI_SMALLICON_ICONMANAGER))); int rows = KVI_NUM_SMALL_ICONS / 10; diff --git a/src/kvirc/kernel/kvi_ipc.cpp b/src/kvirc/kernel/kvi_ipc.cpp index a6e99536d..28ded735b 100644 --- a/src/kvirc/kernel/kvi_ipc.cpp +++ b/src/kvirc/kernel/kvi_ipc.cpp @@ -185,7 +185,7 @@ : QWidget(0,"kvirc4_ipc_sentinel") { #ifdef COMPILE_ON_WINDOWS - setCaption("kvirc4_ipc_sentinel"); + setWindowTitle("kvirc4_ipc_sentinel"); #else //!COMPILE_ON_WINDOWS #ifdef COMPILE_X11_SUPPORT kvi_ipcLoadAtoms(); diff --git a/src/kvirc/ui/kvi_ctcppagedialog.cpp b/src/kvirc/ui/kvi_ctcppagedialog.cpp index c8c3eca23..8e77277cf 100644 --- a/src/kvirc/ui/kvi_ctcppagedialog.cpp +++ b/src/kvirc/ui/kvi_ctcppagedialog.cpp @@ -61,7 +61,7 @@ KviCtcpPageDialog::KviCtcpPageDialog() setMaximumSize(780,580); setIcon(*(g_pIconManager->getSmallIcon(KVI_SMALLICON_CTCPREQUESTREPLIED))); - setCaption(__tr2qs("CTCP Page - KVIrc")); + setWindowTitle(__tr2qs("CTCP Page - KVIrc")); } KviCtcpPageDialog::~KviCtcpPageDialog() diff --git a/src/kvirc/ui/kvi_filedialog.cpp b/src/kvirc/ui/kvi_filedialog.cpp index f028c848e..c16726b64 100644 --- a/src/kvirc/ui/kvi_filedialog.cpp +++ b/src/kvirc/ui/kvi_filedialog.cpp @@ -82,7 +82,7 @@ bool KviFileDialog::askForOpenFileName(QString &buffer,const QString &caption,co } #endif KviFileDialog * d = new KviFileDialog(initial,filter,parent,"open_file_name_dialog",true); - d->setCaption(caption); + d->setWindowTitle(caption); // i was ignorant d->setFileMode(KviTalFileDialog::Directory); //d->setShowHiddenFiles(showHidden); @@ -128,7 +128,7 @@ bool KviFileDialog::askForSaveFileName(QString &buffer,const QString & caption,c KviFileDialog * d = new KviFileDialog(initial,filter,parent,"save_file_name_dialog",true); - d->setCaption(caption); + d->setWindowTitle(caption); // 190 d->setFileMode(KviTalFileDialog::AnyFile); //d->setShowHiddenFiles(showHidden); @@ -188,7 +188,7 @@ bool KviFileDialog::askForDirectoryName(QString &buffer,const QString & caption, KviFileDialog * d = new KviFileDialog(initial, filter,parent,"directory_name_dialog",true); - d->setCaption(caption); + d->setWindowTitle(caption); // Move to tal and settle matters there? d->setFileMode(KviTalFileDialog::Directory); //d->setShowHiddenFiles(showHidden); @@ -216,7 +216,7 @@ bool KviFileDialog::askForOpenFileNames(QStringList &buffer,const QString & capt #endif KviFileDialog * d = new KviFileDialog(initial,filter ? QString(filter) : QString::null,parent,"open_file_names_dialog",true); - d->setCaption(caption); + d->setWindowTitle(caption); // See line 190 d->setFileMode(KviTalFileDialog::ExistingFiles); //d->setShowHiddenFiles(showHidden); diff --git a/src/kvirc/ui/kvi_frame.cpp b/src/kvirc/ui/kvi_frame.cpp index 7d7c3915e..768a59beb 100644 --- a/src/kvirc/ui/kvi_frame.cpp +++ b/src/kvirc/ui/kvi_frame.cpp @@ -938,11 +938,11 @@ void KviFrame::updateCaption() QString tmp = g_pActiveWindow->plainTextCaption();
tmp += QChar(' ');
tmp += KVI_DEFAULT_FRAME_CAPTION;
- setCaption(tmp);
+ setWindowTitle(tmp);
return;
}
}
- setCaption(KVI_DEFAULT_FRAME_CAPTION);
+ setWindowTitle(KVI_DEFAULT_FRAME_CAPTION);
}
diff --git a/src/kvirc/ui/kvi_htmldialog.cpp b/src/kvirc/ui/kvi_htmldialog.cpp index 34bfe6399..4a1a9cd1c 100644 --- a/src/kvirc/ui/kvi_htmldialog.cpp +++ b/src/kvirc/ui/kvi_htmldialog.cpp @@ -38,9 +38,9 @@ KviHtmlDialog::KviHtmlDialog(QWidget * pParent,KviHtmlDialogData * pData) m_pData = pData; if(pData->szCaption.isEmpty()) - setCaption("KVIrc"); + setWindowTitle("KVIrc"); else - setCaption(pData->szCaption); + setWindowTitle(pData->szCaption); if(!pData->pixIcon.isNull()) setIcon(pData->pixIcon); diff --git a/src/kvirc/ui/kvi_imagedialog.cpp b/src/kvirc/ui/kvi_imagedialog.cpp index dc621f556..085f4af56 100644 --- a/src/kvirc/ui/kvi_imagedialog.cpp +++ b/src/kvirc/ui/kvi_imagedialog.cpp @@ -101,7 +101,7 @@ KviImageDialog::KviImageDialog(QWidget * par, setModal(modal); m_iMaxPreviewFileSize = maxPreviewFileSize; - setCaption(szCaption.isEmpty() ? __tr2qs("Choose image ...") : szCaption); + setWindowTitle(szCaption.isEmpty() ? __tr2qs("Choose image ...") : szCaption); m_pTimer = new QTimer(this); connect(m_pTimer,SIGNAL(timeout()),this,SLOT(heartbeat())); diff --git a/src/kvirc/ui/kvi_maskeditor.cpp b/src/kvirc/ui/kvi_maskeditor.cpp index 66ff69dc0..ace09bb14 100644 --- a/src/kvirc/ui/kvi_maskeditor.cpp +++ b/src/kvirc/ui/kvi_maskeditor.cpp @@ -69,7 +69,7 @@ KviMaskInputDialog::KviMaskInputDialog(const QString &szMask,KviMaskEditor* pEdi setModal(1); m_szOldMask=szMask; - setCaption(__tr2qs("Mask editor - KVirc")); + setWindowTitle(__tr2qs("Mask editor - KVirc")); QGridLayout * g = new QGridLayout(this,2,3,5,5); diff --git a/src/kvirc/ui/kvi_mdichild.cpp b/src/kvirc/ui/kvi_mdichild.cpp index b146e4658..bc9148219 100644 --- a/src/kvirc/ui/kvi_mdichild.cpp +++ b/src/kvirc/ui/kvi_mdichild.cpp @@ -145,7 +145,7 @@ bool KviMdiChild::closeEnabled() return m_pCaption->closeEnabled(); } -void KviMdiChild::setCaption(const QString & plain,const QString & xmlActive,const QString & xmlInactive) +void KviMdiChild::setWindowTitle(const QString & plain,const QString & xmlActive,const QString & xmlInactive) { m_szPlainCaption = plain; m_szXmlActiveCaption = xmlActive; diff --git a/src/kvirc/ui/kvi_mdichild.h b/src/kvirc/ui/kvi_mdichild.h index 16bda7ad2..0b564dded 100644 --- a/src/kvirc/ui/kvi_mdichild.h +++ b/src/kvirc/ui/kvi_mdichild.h @@ -72,7 +72,7 @@ public: const QString & plainCaption(){ return m_szPlainCaption; }; const QString & xmlActiveCaption(){ return m_szXmlActiveCaption; }; const QString & xmlInactiveCaption(){ return m_szXmlInactiveCaption; }; - void setCaption(const QString & plain,const QString & xmlActive,const QString & xmlInactive); + void setWindowTitle(const QString & plain,const QString & xmlActive,const QString & xmlInactive); virtual QSize sizeHint(); void setIcon(const QPixmap &pix); const QPixmap * icon(); diff --git a/src/kvirc/ui/kvi_window.cpp b/src/kvirc/ui/kvi_window.cpp index 1a79be08a..a05196233 100644 --- a/src/kvirc/ui/kvi_window.cpp +++ b/src/kvirc/ui/kvi_window.cpp @@ -668,9 +668,9 @@ void KviWindow::updateCaption() { fillCaptionBuffers(); if(mdiParent()) - mdiParent()->setCaption(plainTextCaption(),htmlActiveCaption(),htmlInactiveCaption()); + mdiParent()->setWindowTitle(plainTextCaption(),htmlActiveCaption(),htmlInactiveCaption()); else - setCaption(plainTextCaption()); + setWindowTitle(plainTextCaption()); if(m_pTaskBarItem)m_pTaskBarItem->captionChanged(); if(mdiParent() && isMaximized() && (g_pActiveWindow == this)) g_pFrame->updateCaption(); diff --git a/src/modules/about/aboutdialog.cpp b/src/modules/about/aboutdialog.cpp index b1f0dc92e..3bf758e93 100644 --- a/src/modules/about/aboutdialog.cpp +++ b/src/modules/about/aboutdialog.cpp @@ -72,7 +72,7 @@ extern KviAboutDialog * g_pAboutDialog; KviAboutDialog::KviAboutDialog() : KviTalTabDialog(0) { - setCaption(__tr2qs_ctx("About KVIrc...","about")); + setWindowTitle(__tr2qs_ctx("About KVIrc...","about")); setOkButton(__tr2qs_ctx("Close","about")); // About tab diff --git a/src/modules/addon/managementdialog.cpp b/src/modules/addon/managementdialog.cpp index 3d9905eb1..b7e82a035 100644 --- a/src/modules/addon/managementdialog.cpp +++ b/src/modules/addon/managementdialog.cpp @@ -160,7 +160,7 @@ void KviScriptAddonListView::resizeEvent(QResizeEvent * e) KviScriptManagementDialog::KviScriptManagementDialog(QWidget * p)
: QDialog(p,"" /*,WType_TopLevel | WStyle_Customize | WStyle_Title | WStyle_StaysOnTop | WStyle_DialogBorder*/)
{
- setCaption(__tr2qs("Manage Script-Based Addons"));
+ setWindowTitle(__tr2qs("Manage Script-Based Addons"));
setIcon(*(g_pIconManager->getSmallIcon(KVI_SMALLICON_ADDONS)));
setModal(true);
diff --git a/src/modules/avatar/libkviavatar.cpp b/src/modules/avatar/libkviavatar.cpp index 335a526f0..e2d89190a 100644 --- a/src/modules/avatar/libkviavatar.cpp +++ b/src/modules/avatar/libkviavatar.cpp @@ -63,7 +63,7 @@ KviAsyncAvatarSelectionDialog::KviAsyncAvatarSelectionDialog(QWidget * par,const m_pConnection = c; - setCaption(__tr2qs("Choose Avatar - KVIrc")); + setWindowTitle(__tr2qs("Choose Avatar - KVIrc")); QGridLayout * g = new QGridLayout(this,3,3,4,8); diff --git a/src/modules/channelsjoin/channelsjoinwindow.cpp b/src/modules/channelsjoin/channelsjoinwindow.cpp index aa3a916f0..4813ac624 100644 --- a/src/modules/channelsjoin/channelsjoinwindow.cpp +++ b/src/modules/channelsjoin/channelsjoinwindow.cpp @@ -58,7 +58,7 @@ KviChannelsJoinWindow::KviChannelsJoinWindow(QWidget * par, const char * name) : QDialog(par,name) { m_pConsole=0; - setCaption(__tr2qs("Join Channels")); + setWindowTitle(__tr2qs("Join Channels")); setIcon(*(g_pIconManager->getSmallIcon(KVI_SMALLICON_CHANNEL))); diff --git a/src/modules/dcc/dialogs.cpp b/src/modules/dcc/dialogs.cpp index d971e65b1..ccc3236c5 100644 --- a/src/modules/dcc/dialogs.cpp +++ b/src/modules/dcc/dialogs.cpp @@ -72,7 +72,7 @@ KviDccAcceptBox::KviDccAcceptBox(KviDccBroker * br,KviDccDescriptor * dcc,const hb->addWidget(btn); setIcon(*(g_pIconManager->getSmallIcon(KVI_SMALLICON_DCCMSG))); - setCaption(capt); + setWindowTitle(capt); l->setActiveWindow(); l->setFocus(); @@ -143,7 +143,7 @@ KviDccRenameBox::KviDccRenameBox(KviDccBroker * br,KviDccDescriptor * dcc,const //btn->setFocus(); setIcon(*(g_pIconManager->getSmallIcon(KVI_SMALLICON_DCCMSG))); - setCaption(__tr2qs_ctx("File Already Exists - KVIrc","dcc")); + setWindowTitle(__tr2qs_ctx("File Already Exists - KVIrc","dcc")); } KviDccRenameBox::~KviDccRenameBox() diff --git a/src/modules/dcc/send.cpp b/src/modules/dcc/send.cpp index 1c883e24a..7b5dbb43f 100644 --- a/src/modules/dcc/send.cpp +++ b/src/modules/dcc/send.cpp @@ -1821,7 +1821,7 @@ KviDccFileTransferBandwidthDialog::KviDccFileTransferBandwidthDialog(QWidget * p int iVal = m_pTransfer->bandwidthLimit(); QString szText = __tr2qs_ctx("Configure bandwidth for DCC transfer %1","dcc").arg(t->id()); - setCaption(szText); + setWindowTitle(szText); szText = t->isFileUpload() ? __tr2qs_ctx("Limit upload bandwidth to","dcc") : __tr2qs_ctx("Limit download bandwidth to","dcc"); diff --git a/src/modules/dialog/libkvidialog.cpp b/src/modules/dialog/libkvidialog.cpp index c7c8d3f10..ef9352a4e 100644 --- a/src/modules/dialog/libkvidialog.cpp +++ b/src/modules/dialog/libkvidialog.cpp @@ -206,7 +206,7 @@ KviKvsCallbackTextInput::KviKvsCallbackTextInput( g_pDialogModuleDialogList->append(this); setIcon(*(g_pIconManager->getSmallIcon(KVI_SMALLICON_KVIRC))); setModal(modal); - setCaption(szCaption); + setWindowTitle(szCaption); QGridLayout * g = new QGridLayout(this,2,3,5,5); @@ -479,7 +479,7 @@ KviKvsCallbackFileDialog::KviKvsCallbackFileDialog( : KviFileDialog(szInitialSelection,szFilter,0,0,modal), KviKvsCallbackObject("dialog.file",pWindow,szCode,pMagicParams,0) { g_pDialogModuleDialogList->append(this); - setCaption(szCaption); + setWindowTitle(szCaption); } KviKvsCallbackFileDialog::~KviKvsCallbackFileDialog() diff --git a/src/modules/editor/scripteditor.cpp b/src/modules/editor/scripteditor.cpp index 107dc1a46..ad976c213 100644 --- a/src/modules/editor/scripteditor.cpp +++ b/src/modules/editor/scripteditor.cpp @@ -161,7 +161,7 @@ KviScriptEditorWidgetColorOptions::KviScriptEditorWidgetColorOptions(QWidget * p { m_pSelectorInterfaceList = new KviPointerList<KviSelectorInterface>; m_pSelectorInterfaceList->setAutoDelete(false); - setCaption(__tr2qs_ctx("Preferences","editor")); + setWindowTitle(__tr2qs_ctx("Preferences","editor")); QGridLayout * g = new QGridLayout(this,3,3,4,4); KviFontSelector * f = new KviFontSelector(this,__tr2qs_ctx("Font:","editor"),&g_fntNormal,true); diff --git a/src/modules/mircimport/libkvimircimport.cpp b/src/modules/mircimport/libkvimircimport.cpp index 7b72b0b1b..5a49d5e35 100644 --- a/src/modules/mircimport/libkvimircimport.cpp +++ b/src/modules/mircimport/libkvimircimport.cpp @@ -138,7 +138,7 @@ KviRemoteMircServerImportWizard::KviRemoteMircServerImportWizard(KviRemoteMircSe : KviTalWizard(0) { QString capt = __tr2qs("Remote mIRC servers.ini Import Wizard"); - setCaption(capt); + setWindowTitle(capt); m_pRequest = 0; diff --git a/src/modules/objects/class_painter.cpp b/src/modules/objects/class_painter.cpp index bc2e41182..04ea9aa0c 100644 --- a/src/modules/objects/class_painter.cpp +++ b/src/modules/objects/class_painter.cpp @@ -364,7 +364,7 @@ const char * const brushstyles_tbl[] = { }[br]
[br]
%Hello=$new(hello)[br]
- %Hello->$setcaption("Painter effects" );[br]
+ %Hello->$setWindowTitle("Painter effects" );[br]
%Hello->$setFont(28,"times",bold);[br]
%Btn=$new(button,%Hello)[br]
%Btn->$setmaximumwidth(80)[br]
diff --git a/src/modules/objects/class_popupmenu.cpp b/src/modules/objects/class_popupmenu.cpp index e15cbdbac..4745938ec 100644 --- a/src/modules/objects/class_popupmenu.cpp +++ b/src/modules/objects/class_popupmenu.cpp @@ -1,373 +1,373 @@ -//mdm : -// File : class_popupmenu.cpp -// Creation date : Mon Feb 01 21:30:48 CEST 2005 -// by Tonino Imbesi(Grifisx) and Alessandro Carbone(Noldor) -// Lucia Papini (^ashura^) English Translation. -// This file is part of the KVirc irc client distribution -// Copyright (C) 1999-2000 Szymon Stefanek (pragma at kvirc dot net) -// -// This program is FREE software. You can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your opinion) any later version. -// -// This program is distributed in the HOPE that it will be USEFUL, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -// See the GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, write to the Free Software Foundation, -// Inc. ,59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -// - - -#include "class_popupmenu.h" -#include "kvi_error.h" -#include "kvi_debug.h" -#include "kvi_locale.h" -#include "kvi_iconmanager.h" -#include "kvi_tal_popupmenu.h" - -#include <QCursor> -#include <QMenu> -#include <QAction> - - - -/* - @doc: popupmenu - @keyterms: - popupmenu object class, - @title: - popupmenu class - @type: - class - @short: - Provides a popup menu. - @inherits: - [class]object[/class] - [class]widget[/class] - @description: - This widget can be used to display a popup menu.Technically, a popup menu consists of a list of menu items.[br] - You add items with insertItem(). An item is either a string. In addition, items can have an optional icon drawn on the very left side.[br] - @functions: - !fn: $insertItem(<text:string>,[icon_id:string]) - Inserts menu items into a popup menu with optional icon and return the popup identifier. - !fn: $insertWidget(<widget:object>)[br] - Inserts widget items int a popup menu and return the popup identifier.[br] - The widget is treats as a separator; this means that the item is not selectable and you can, for example, simply insert a label if you need a popup menu with a title. - !fn: $insertHandle(<text_label:string>,<popupmenu:object>,[icon]) - Inserts a submenu with optional icon into the popup menu. - !fn: $exec([<widget:objects>,<x:uinteger>,<y:integer>]) - If called without paramaters show the popup menu at the current pointer position.[br] - With the optional parameters show the popup menu at the coordinate x,y widget parameter relative. - !fn: $removeItem(<popup_id:Uinteger>) - Removes the menu item that has the identifier id. - !fn: $removeItemAt(<index:uinteger>) - Removes the menu item at position index. - !fn: $insertSeparator(<index:uinteger>) - Inserts a separator at position index.[br] - If the index is negative the separator becomes the last menu item. - !fn: $activatedEvent(<popup_id:uinteger>) - This function is called when a menu item and return the the item id.[br] - The default implementation emits the [classfnc]$activated[/classfnc]() signal. - !fn: $highligthtedEvent(<popup_id:uinteger>) - This function is called when a menu item is highlighted and return the item id.[br] - The default implementation emits the [classfnc]$highlighted[/classfnc]() signal. - @signals: - !sg: $activated() - This signal is emitted by the default implementation of [classfnc]$activatedEvent[/classfnc](). - !sg: $highlighted() - This signal is emitted by the default implementation of [classfnc]$highlightedEvent[/classfnc](). - [br] - |-EXAMPLE POPUP MENU-|[br] - |--Start: - # First of all we create an array wich will be used to create random colors.[br] - %Hex[]=$array(0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F)[br] - [br] - class (ws,widget)[br] - {[br] - #In the constructor we create everything that belong to the single widget.[br] - constructor[br] - {[br] - #Geometry of the widget and setting-up of popupmenu [br] - $$->$setGeometry(%X,%Y,100,100)[br] - $$->%lay=$new(layout,$$)[br] - #Here we generate a cicle to create our labels inside the widget.[br] - %i=0[br] - while (%i<10)[br] - {[br] - $$->%label=$new(label,$$)[br] - $$->%label->$settext("Another class by N\&G")[br] - #We set our foreground's coulor using the hex arrey in random way.[br] - %color=%Hex[$rand(14)]%Hex[$rand(14)]%Hex[$rand(14)]%Hex[$rand(14)]%Hex[$rand(14)]%Hex[$rand(14)][br] - $$->%label->$setforegroundcolor(%color)[br] - $$->%label->$setautoresize(1)[br] - #We add the label to the widget's popupmenu.[br] - $$->%lay->$addwidget($$->%label,%i,0)[br] - %i++;[br] - }[br] - #We make the popupmenu relative to this widget: this is merely demonstrative.[br] - #because it creates 25 identical popups.[br] - $$->%Popupmenu=$new(popupmenu,$$)[br] - #we create the label widget wich will be used as popup's title[br] - $$->%Popuptitle=$new(label)[br] - $$->%Popuptitle->$settext(<B><U>"Windows Options"</B></U>)[br] - $$->%Popuptitle->$setAlignment(Center)[br] - #and we add it.[br] - %A=$$->%Popuptitle[br] - $$->%Popupmenu->$insertwidget(%A)[br] - #Here we keep the various IDs in the arrays[br] - %Tile[%I]=$$->%Popupmenu->$insertItem("Tile",118)[br] - %Cascade[%I]=$$->%Popupmenu->$insertItem("Cascade",115)[br] - $$->%Popupmenu->$insertSeparator(3)[br] - %Closeactw[%I]=$$->%Popupmenu->$insertItem("Close Active Window",08)[br] - %Closeallw[%I]=$$->%Popupmenu->$insertItem("Close All Window",58)[br] - $$->$show()[br] - privateimpl($$->%Popupmenu,activatedEvent)[br] - {[br] - %id=$0[br] - %i = 0[br] - #with this cicle we control wich of the items has been called comparing the id given back by the event with our arrays created before;[br] - while (%i<20)[br] - {[br] - if (%id == %Tile[%i]) return %Workspace->$tile()[br] - if (%id == %Cascade[%i]) return %Workspace->$cascade()[br] - if (%id == %Closeactw[%i]) return %Workspace->$closeactivewindow()[br] - if (%id == %Closeallw[%i]) return %Workspace->$closeallwindows()[br] - %i ++[br] - }[br] - }[br] - }[br] - #we activate the popup pushing the right mouse button on the widget[br] - mousepressevent[br] - {[br] - if ($0 == 1) $$->%Popupmenu->$exec()[br] - }[br] - }[br] - %Workspace=$new(workspace)[br] - %Workspace->$resize(640,480)[br] - %I=0[br] - %Cicle=1[br] - while (%I<20)[br] - {[br] - %X=$rand(500)[br] - %Y=$rand(480)[br] - %Widget=$new(ws,%Workspace)[br] - %I++[br] - }[br] - #Let's show! - %Workspace->$show[br] - |--End.[br][br] -*/ - -KVSO_BEGIN_REGISTERCLASS(KviKvsObject_popupmenu,"popupmenu","widget") - KVSO_REGISTER_HANDLER(KviKvsObject_popupmenu,"insertItem", functioninsertItem) - //KVSO_REGISTER_HANDLER(KviKvsObject_popupmenu,"insertWidget", functioninsertWidget) -// KVSO_REGISTER_HANDLER(KviKvsObject_popupmenu,"setTitle", functionsetTitle) - KVSO_REGISTER_HANDLER(KviKvsObject_popupmenu,"exec", functionexec) - KVSO_REGISTER_HANDLER(KviKvsObject_popupmenu,"insertSeparator", functioninsertSeparator) - KVSO_REGISTER_HANDLER(KviKvsObject_popupmenu,"removeItem", functionremoveItem) - - // events - KVSO_REGISTER_HANDLER(KviKvsObject_popupmenu,"highlightedEvent", functionhighlightedEvent) - KVSO_REGISTER_HANDLER(KviKvsObject_popupmenu,"activatedEvent", functionactivatedEvent) - -KVSO_END_REGISTERCLASS(KviKvsObject_popupmenu) - -KVSO_BEGIN_CONSTRUCTOR(KviKvsObject_popupmenu,KviKvsObject_widget) - -KVSO_END_CONSTRUCTOR(KviKvsObject_popupmenu) - - -KVSO_BEGIN_DESTRUCTOR(KviKvsObject_popupmenu) - -KVSO_END_CONSTRUCTOR(KviKvsObject_popupmenu) - -bool KviKvsObject_popupmenu::init(KviKvsRunTimeContext * pContext,KviKvsVariantList *pParams) -{ - identifier=0; - SET_OBJECT(QMenu) - connect(widget(),SIGNAL(triggered(QAction *)),this,SLOT(slottriggered(QAction *))); - connect(widget(),SIGNAL(highlighted(int)),this,SLOT(slothighlighted(int))); - return true; -} - -bool KviKvsObject_popupmenu::functioninsertItem(KviKvsObjectFunctionCall *c) -{ - QString szItem,szIcon; - KVSO_PARAMETERS_BEGIN(c) - KVSO_PARAMETER("text",KVS_PT_STRING,0,szItem) - KVSO_PARAMETER("icon_id",KVS_PT_STRING,KVS_PF_OPTIONAL,szIcon) - KVSO_PARAMETERS_END(c) - if(!widget())return true; - QPixmap *pix = 0; - int id=0; - QAction * action; - if(!szIcon.isEmpty()) - { - pix = g_pIconManager->getImage(szIcon); - if (pix) action=((QMenu *)widget())->addAction(*pix,szItem); - else c->warning(__tr2qs("pix '%Q' doesn't exists"),&szIcon); - - } - else - action=((QMenu *)widget())->addAction(szItem); - actionsDict[identifier]=action; - c->returnValue()->setInteger(identifier); - identifier++; - return true; -} -/* -bool KviKvsObject_popupmenu::functionsetTitle(KviKvsObjectFunctionCall *c) -{ - QString szTitle; - KVSO_PARAMETERS_BEGIN(c) - KVSO_PARAMETER("title",KVS_PT_STRING,0,szTitle) - KVSO_PARAMETERS_END(c) - if(!widget())return true; - ((QMenu *)widget())->setTitle(szTitle); - - return true; -} -/* -bool KviKvsObject_popupmenu::functioninsertWidget(KviKvsObjectFunctionCall *c) -{ - KviKvsObject *pObject; - kvs_hobject_t hObject; - KVSO_PARAMETERS_BEGIN(c) - KVSO_PARAMETER("widget",KVS_PT_HOBJECT,0,hObject) - KVSO_PARAMETERS_END(c) - pObject=KviKvsKernel::instance()->objectController()->lookupObject(hObject); - if (!pObject) - { - c->warning(__tr2qs("Widget parameter is not an object")); - return true; - } - if (!pObject->object()) - { - c->warning(__tr2qs("Widget parameter is not a valid object")); - return true; - } - if(!pObject->object()->isWidgetType()) - { - c->warning(__tr2qs("Can't add a non-widget object")); - return TRUE; - } - if (widget()) ((KviTalPopupMenu *)widget())->insertItem(((KviTalPopupMenu *)(pObject->object()))); - return true; -} - - -bool KviKvsObject_popupmenu::functioninsertHandle(KviKvsObjectFunctionCall *c) -{ - KviKvsObject *ob; - QString szLabel,szIcon; - kvs_hobject_t hObject; - KVSO_PARAMETERS_BEGIN(c) - KVSO_PARAMETER("text_label",KVS_PT_STRING,0,szLabel) - KVSO_PARAMETER("widget",KVS_PT_HOBJECT,0,hObject) - KVSO_PARAMETER("icon_id",KVS_PT_STRING,KVS_PF_OPTIONAL,szIcon) - KVSO_PARAMETERS_END(c) - ob=KviKvsKernel::instance()->objectController()->lookupObject(hObject); - if(!ob->object()->inherits("KviKvsObject_popupmenu")) - { - c->warning(__tr2qs("Can't add a non - popupmenu object")); - return TRUE; - } - if(!widget())return true; - QPixmap *pix = 0; - int id=0; - if(!szIcon.isEmpty()) - { - pix = g_pIconManager->getImage(szIcon); - if (pix) id=((KviTalPopupMenu *)widget())->insertItem(*pix,szLabel,((KviTalPopupMenu *)(ob->object()))); - else c->warning(__tr2qs("pix '%Q' doesn't exists"),&szIcon); - - } - else - id=((KviTalPopupMenu *)widget())->insertItem(szLabel,((KviTalPopupMenu *)(ob->object()))); - c->returnValue()->setInteger(id); - return true; -} -*/ -bool KviKvsObject_popupmenu::functionexec(KviKvsObjectFunctionCall *c) -{ - if(!c->params()->count()) - { - ((QMenu *)widget())->exec(QCursor::pos()); - return true; - } - - KviKvsObject *pObject; - kvs_uint_t iX,iY; - QString szLabel,szIcon; - kvs_hobject_t hObject; - KVSO_PARAMETERS_BEGIN(c) - KVSO_PARAMETER("widget",KVS_PT_HOBJECT,0,hObject) - KVSO_PARAMETER("x",KVS_PT_UNSIGNEDINTEGER,0,iX) - KVSO_PARAMETER("y",KVS_PT_UNSIGNEDINTEGER,0,iY) - KVSO_PARAMETERS_END(c) - pObject=KviKvsKernel::instance()->objectController()->lookupObject(hObject); - if (!pObject) - { - c->warning(__tr2qs("Widget parameter is not an object")); - return true; - } - if (!pObject->object()) - { - c->warning(__tr2qs("Widget parameter is not a valid object")); - return true; - } - if(!pObject->object()->isWidgetType()) - { - c->warning(__tr2qs("Doesn't a widget object")); - return true; - } - - ((QMenu *)widget())->exec(((QWidget *)(pObject->object()))->mapToGlobal(QPoint(iX,iY)) ); - - return true; -} -bool KviKvsObject_popupmenu::functionremoveItem(KviKvsObjectFunctionCall *c) -{ - kvs_uint_t uItem; - KVSO_PARAMETERS_BEGIN(c) - KVSO_PARAMETER("item_id",KVS_PT_UNSIGNEDINTEGER,0,uItem) - KVSO_PARAMETERS_END(c) - QAction * action=actionsDict.value(uItem); - if(widget() && action){ - ((QMenu *)widget())->removeAction(action); - identifier--; - } - return true; -} - - -bool KviKvsObject_popupmenu::functioninsertSeparator(KviKvsObjectFunctionCall *c) -{ - kvs_uint_t iIndex; - KVSO_PARAMETERS_BEGIN(c) - KVSO_PARAMETER("index",KVS_PT_UNSIGNEDINTEGER,0,iIndex) - KVSO_PARAMETERS_END(c) - QAction * action=actionsDict.value(iIndex); - if(widget()&& action)((QMenu *)widget())->insertSeparator(action); - return true; -} - -void KviKvsObject_popupmenu::slothighlighted(int i) -{ - KviKvsVariantList params(new KviKvsVariant((kvs_int_t)i)); - callFunction(this,"highlightedEvent",¶ms); -} -bool KviKvsObject_popupmenu::functionhighlightedEvent(KviKvsObjectFunctionCall *c) -{ - emitSignal("highlighted",c,c->params()); - return true; -} -void KviKvsObject_popupmenu::slottriggered(QAction *a) -{ +//mdm :
+// File : class_popupmenu.cpp
+// Creation date : Mon Feb 01 21:30:48 CEST 2005
+// by Tonino Imbesi(Grifisx) and Alessandro Carbone(Noldor)
+// Lucia Papini (^ashura^) English Translation.
+// This file is part of the KVirc irc client distribution
+// Copyright (C) 1999-2000 Szymon Stefanek (pragma at kvirc dot net)
+//
+// This program is FREE software. You can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your opinion) any later version.
+//
+// This program is distributed in the HOPE that it will be USEFUL,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+// See the GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, write to the Free Software Foundation,
+// Inc. ,59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+//
+
+
+#include "class_popupmenu.h"
+#include "kvi_error.h"
+#include "kvi_debug.h"
+#include "kvi_locale.h"
+#include "kvi_iconmanager.h"
+#include "kvi_tal_popupmenu.h"
+
+#include <QCursor>
+#include <QMenu>
+#include <QAction>
+
+
+
+/*
+ @doc: popupmenu
+ @keyterms:
+ popupmenu object class,
+ @title:
+ popupmenu class
+ @type:
+ class
+ @short:
+ Provides a popup menu.
+ @inherits:
+ [class]object[/class]
+ [class]widget[/class]
+ @description:
+ This widget can be used to display a popup menu.Technically, a popup menu consists of a list of menu items.[br]
+ You add items with insertItem(). An item is either a string. In addition, items can have an optional icon drawn on the very left side.[br]
+ @functions:
+ !fn: $insertItem(<text:string>,[icon_id:string])
+ Inserts menu items into a popup menu with optional icon and return the popup identifier.
+ !fn: $insertWidget(<widget:object>)[br]
+ Inserts widget items int a popup menu and return the popup identifier.[br]
+ The widget is treats as a separator; this means that the item is not selectable and you can, for example, simply insert a label if you need a popup menu with a title.
+ !fn: $insertHandle(<text_label:string>,<popupmenu:object>,[icon])
+ Inserts a submenu with optional icon into the popup menu.
+ !fn: $exec([<widget:objects>,<x:uinteger>,<y:integer>])
+ If called without paramaters show the popup menu at the current pointer position.[br]
+ With the optional parameters show the popup menu at the coordinate x,y widget parameter relative.
+ !fn: $removeItem(<popup_id:Uinteger>)
+ Removes the menu item that has the identifier id.
+ !fn: $removeItemAt(<index:uinteger>)
+ Removes the menu item at position index.
+ !fn: $insertSeparator(<index:uinteger>)
+ Inserts a separator at position index.[br]
+ If the index is negative the separator becomes the last menu item.
+ !fn: $activatedEvent(<popup_id:uinteger>)
+ This function is called when a menu item and return the the item id.[br]
+ The default implementation emits the [classfnc]$activated[/classfnc]() signal.
+ !fn: $highligthtedEvent(<popup_id:uinteger>)
+ This function is called when a menu item is highlighted and return the item id.[br]
+ The default implementation emits the [classfnc]$highlighted[/classfnc]() signal.
+ @signals:
+ !sg: $activated()
+ This signal is emitted by the default implementation of [classfnc]$activatedEvent[/classfnc]().
+ !sg: $highlighted()
+ This signal is emitted by the default implementation of [classfnc]$highlightedEvent[/classfnc]().
+ [br]
+ |-EXAMPLE POPUP MENU-|[br]
+ |--Start:
+ # First of all we create an array wich will be used to create random colors.[br]
+ %Hex[]=$array(0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F)[br]
+ [br]
+ class (ws,widget)[br]
+ {[br]
+ #In the constructor we create everything that belong to the single widget.[br]
+ constructor[br]
+ {[br]
+ #Geometry of the widget and setting-up of popupmenu [br]
+ $$->$setGeometry(%X,%Y,100,100)[br]
+ $$->%lay=$new(layout,$$)[br]
+ #Here we generate a cicle to create our labels inside the widget.[br]
+ %i=0[br]
+ while (%i<10)[br]
+ {[br]
+ $$->%label=$new(label,$$)[br]
+ $$->%label->$settext("Another class by N\&G")[br]
+ #We set our foreground's coulor using the hex arrey in random way.[br]
+ %color=%Hex[$rand(14)]%Hex[$rand(14)]%Hex[$rand(14)]%Hex[$rand(14)]%Hex[$rand(14)]%Hex[$rand(14)][br]
+ $$->%label->$setforegroundcolor(%color)[br]
+ $$->%label->$setautoresize(1)[br]
+ #We add the label to the widget's popupmenu.[br]
+ $$->%lay->$addwidget($$->%label,%i,0)[br]
+ %i++;[br]
+ }[br]
+ #We make the popupmenu relative to this widget: this is merely demonstrative.[br]
+ #because it creates 25 identical popups.[br]
+ $$->%Popupmenu=$new(popupmenu,$$)[br]
+ #we create the label widget wich will be used as popup's title[br]
+ $$->%Popuptitle=$new(label)[br]
+ $$->%Popuptitle->$settext(<B><U>"Windows Options"</B></U>)[br]
+ $$->%Popuptitle->$setAlignment(Center)[br]
+ #and we add it.[br]
+ %A=$$->%Popuptitle[br]
+ $$->%Popupmenu->$insertwidget(%A)[br]
+ #Here we keep the various IDs in the arrays[br]
+ %Tile[%I]=$$->%Popupmenu->$insertItem("Tile",118)[br]
+ %Cascade[%I]=$$->%Popupmenu->$insertItem("Cascade",115)[br]
+ $$->%Popupmenu->$insertSeparator(3)[br]
+ %Closeactw[%I]=$$->%Popupmenu->$insertItem("Close Active Window",08)[br]
+ %Closeallw[%I]=$$->%Popupmenu->$insertItem("Close All Window",58)[br]
+ $$->$show()[br]
+ privateimpl($$->%Popupmenu,activatedEvent)[br]
+ {[br]
+ %id=$0[br]
+ %i = 0[br]
+ #with this cicle we control wich of the items has been called comparing the id given back by the event with our arrays created before;[br]
+ while (%i<20)[br]
+ {[br]
+ if (%id == %Tile[%i]) return %Workspace->$tile()[br]
+ if (%id == %Cascade[%i]) return %Workspace->$cascade()[br]
+ if (%id == %Closeactw[%i]) return %Workspace->$closeactivewindow()[br]
+ if (%id == %Closeallw[%i]) return %Workspace->$closeallwindows()[br]
+ %i ++[br]
+ }[br]
+ }[br]
+ }[br]
+ #we activate the popup pushing the right mouse button on the widget[br]
+ mousepressevent[br]
+ {[br]
+ if ($0 == 1) $$->%Popupmenu->$exec()[br]
+ }[br]
+ }[br]
+ %Workspace=$new(workspace)[br]
+ %Workspace->$resize(640,480)[br]
+ %I=0[br]
+ %Cicle=1[br]
+ while (%I<20)[br]
+ {[br]
+ %X=$rand(500)[br]
+ %Y=$rand(480)[br]
+ %Widget=$new(ws,%Workspace)[br]
+ %I++[br]
+ }[br]
+ #Let's show!
+ %Workspace->$show[br]
+ |--End.[br][br]
+*/
+
+KVSO_BEGIN_REGISTERCLASS(KviKvsObject_popupmenu,"popupmenu","widget")
+ KVSO_REGISTER_HANDLER(KviKvsObject_popupmenu,"insertItem", functioninsertItem)
+ //KVSO_REGISTER_HANDLER(KviKvsObject_popupmenu,"insertWidget", functioninsertWidget)
+// KVSO_REGISTER_HANDLER(KviKvsObject_popupmenu,"setTitle", functionsetTitle)
+ KVSO_REGISTER_HANDLER(KviKvsObject_popupmenu,"exec", functionexec)
+ KVSO_REGISTER_HANDLER(KviKvsObject_popupmenu,"insertSeparator", functioninsertSeparator)
+ KVSO_REGISTER_HANDLER(KviKvsObject_popupmenu,"removeItem", functionremoveItem)
+
+ // events
+ KVSO_REGISTER_HANDLER(KviKvsObject_popupmenu,"highlightedEvent", functionhighlightedEvent)
+ KVSO_REGISTER_HANDLER(KviKvsObject_popupmenu,"activatedEvent", functionactivatedEvent)
+
+KVSO_END_REGISTERCLASS(KviKvsObject_popupmenu)
+
+KVSO_BEGIN_CONSTRUCTOR(KviKvsObject_popupmenu,KviKvsObject_widget)
+
+KVSO_END_CONSTRUCTOR(KviKvsObject_popupmenu)
+
+
+KVSO_BEGIN_DESTRUCTOR(KviKvsObject_popupmenu)
+
+KVSO_END_CONSTRUCTOR(KviKvsObject_popupmenu)
+
+bool KviKvsObject_popupmenu::init(KviKvsRunTimeContext * pContext,KviKvsVariantList *pParams)
+{
+ identifier=0;
+ SET_OBJECT(QMenu)
+ connect(widget(),SIGNAL(triggered(QAction *)),this,SLOT(slottriggered(QAction *)));
+ connect(widget(),SIGNAL(highlighted(int)),this,SLOT(slothighlighted(int)));
+ return true;
+}
+
+bool KviKvsObject_popupmenu::functioninsertItem(KviKvsObjectFunctionCall *c)
+{
+ QString szItem,szIcon;
+ KVSO_PARAMETERS_BEGIN(c)
+ KVSO_PARAMETER("text",KVS_PT_STRING,0,szItem)
+ KVSO_PARAMETER("icon_id",KVS_PT_STRING,KVS_PF_OPTIONAL,szIcon)
+ KVSO_PARAMETERS_END(c)
+ if(!widget())return true;
+ QPixmap *pix = 0;
+ int id=0;
+ QAction * action;
+ if(!szIcon.isEmpty())
+ {
+ pix = g_pIconManager->getImage(szIcon);
+ if (pix) action=((QMenu *)widget())->addAction(*pix,szItem);
+ else c->warning(__tr2qs("pix '%Q' doesn't exists"),&szIcon);
+
+ }
+ else
+ action=((QMenu *)widget())->addAction(szItem);
+ actionsDict[identifier]=action;
+ c->returnValue()->setInteger(identifier);
+ identifier++;
+ return true;
+}
+/*
+bool KviKvsObject_popupmenu::functionsetTitle(KviKvsObjectFunctionCall *c)
+{
+ QString szTitle;
+ KVSO_PARAMETERS_BEGIN(c)
+ KVSO_PARAMETER("title",KVS_PT_STRING,0,szTitle)
+ KVSO_PARAMETERS_END(c)
+ if(!widget())return true;
+ ((QMenu *)widget())->setTitle(szTitle);
+
+ return true;
+}
+/*
+bool KviKvsObject_popupmenu::functioninsertWidget(KviKvsObjectFunctionCall *c)
+{
+ KviKvsObject *pObject;
+ kvs_hobject_t hObject;
+ KVSO_PARAMETERS_BEGIN(c)
+ KVSO_PARAMETER("widget",KVS_PT_HOBJECT,0,hObject)
+ KVSO_PARAMETERS_END(c)
+ pObject=KviKvsKernel::instance()->objectController()->lookupObject(hObject);
+ if (!pObject)
+ {
+ c->warning(__tr2qs("Widget parameter is not an object"));
+ return true;
+ }
+ if (!pObject->object())
+ {
+ c->warning(__tr2qs("Widget parameter is not a valid object"));
+ return true;
+ }
+ if(!pObject->object()->isWidgetType())
+ {
+ c->warning(__tr2qs("Can't add a non-widget object"));
+ return TRUE;
+ }
+ if (widget()) ((KviTalPopupMenu *)widget())->insertItem(((KviTalPopupMenu *)(pObject->object())));
+ return true;
+}
+
+
+bool KviKvsObject_popupmenu::functioninsertHandle(KviKvsObjectFunctionCall *c)
+{
+ KviKvsObject *ob;
+ QString szLabel,szIcon;
+ kvs_hobject_t hObject;
+ KVSO_PARAMETERS_BEGIN(c)
+ KVSO_PARAMETER("text_label",KVS_PT_STRING,0,szLabel)
+ KVSO_PARAMETER("widget",KVS_PT_HOBJECT,0,hObject)
+ KVSO_PARAMETER("icon_id",KVS_PT_STRING,KVS_PF_OPTIONAL,szIcon)
+ KVSO_PARAMETERS_END(c)
+ ob=KviKvsKernel::instance()->objectController()->lookupObject(hObject);
+ if(!ob->object()->inherits("KviKvsObject_popupmenu"))
+ {
+ c->warning(__tr2qs("Can't add a non - popupmenu object"));
+ return TRUE;
+ }
+ if(!widget())return true;
+ QPixmap *pix = 0;
+ int id=0;
+ if(!szIcon.isEmpty())
+ {
+ pix = g_pIconManager->getImage(szIcon);
+ if (pix) id=((KviTalPopupMenu *)widget())->insertItem(*pix,szLabel,((KviTalPopupMenu *)(ob->object())));
+ else c->warning(__tr2qs("pix '%Q' doesn't exists"),&szIcon);
+
+ }
+ else
+ id=((KviTalPopupMenu *)widget())->insertItem(szLabel,((KviTalPopupMenu *)(ob->object())));
+ c->returnValue()->setInteger(id);
+ return true;
+}
+*/
+bool KviKvsObject_popupmenu::functionexec(KviKvsObjectFunctionCall *c)
+{
+ if(!c->params()->count())
+ {
+ ((QMenu *)widget())->exec(QCursor::pos());
+ return true;
+ }
+
+ KviKvsObject *pObject;
+ kvs_uint_t iX,iY;
+ QString szLabel,szIcon;
+ kvs_hobject_t hObject;
+ KVSO_PARAMETERS_BEGIN(c)
+ KVSO_PARAMETER("widget",KVS_PT_HOBJECT,0,hObject)
+ KVSO_PARAMETER("x",KVS_PT_UNSIGNEDINTEGER,0,iX)
+ KVSO_PARAMETER("y",KVS_PT_UNSIGNEDINTEGER,0,iY)
+ KVSO_PARAMETERS_END(c)
+ pObject=KviKvsKernel::instance()->objectController()->lookupObject(hObject);
+ if (!pObject)
+ {
+ c->warning(__tr2qs("Widget parameter is not an object"));
+ return true;
+ }
+ if (!pObject->object())
+ {
+ c->warning(__tr2qs("Widget parameter is not a valid object"));
+ return true;
+ }
+ if(!pObject->object()->isWidgetType())
+ {
+ c->warning(__tr2qs("Doesn't a widget object"));
+ return true;
+ }
+
+ ((QMenu *)widget())->exec(((QWidget *)(pObject->object()))->mapToGlobal(QPoint(iX,iY)) );
+
+ return true;
+}
+bool KviKvsObject_popupmenu::functionremoveItem(KviKvsObjectFunctionCall *c)
+{
+ kvs_uint_t uItem;
+ KVSO_PARAMETERS_BEGIN(c)
+ KVSO_PARAMETER("item_id",KVS_PT_UNSIGNEDINTEGER,0,uItem)
+ KVSO_PARAMETERS_END(c)
+ QAction * action=actionsDict.value(uItem);
+ if(widget() && action){
+ ((QMenu *)widget())->removeAction(action);
+ identifier--;
+ }
+ return true;
+}
+
+
+bool KviKvsObject_popupmenu::functioninsertSeparator(KviKvsObjectFunctionCall *c)
+{
+ kvs_uint_t iIndex;
+ KVSO_PARAMETERS_BEGIN(c)
+ KVSO_PARAMETER("index",KVS_PT_UNSIGNEDINTEGER,0,iIndex)
+ KVSO_PARAMETERS_END(c)
+ QAction * action=actionsDict.value(iIndex);
+ if(widget()&& action)((QMenu *)widget())->insertSeparator(action);
+ return true;
+}
+
+void KviKvsObject_popupmenu::slothighlighted(int i)
+{
+ KviKvsVariantList params(new KviKvsVariant((kvs_int_t)i));
+ callFunction(this,"highlightedEvent",¶ms);
+}
+bool KviKvsObject_popupmenu::functionhighlightedEvent(KviKvsObjectFunctionCall *c)
+{
+ emitSignal("highlighted",c,c->params());
+ return true;
+}
+void KviKvsObject_popupmenu::slottriggered(QAction *a)
+{
QHashIterator<int, QAction *> i(actionsDict);
kvs_int_t count=0;
bool found=false;
@@ -376,18 +376,18 @@ void KviKvsObject_popupmenu::slottriggered(QAction *a) i.next();
if (i.value()!= a) count++;
else break;
- } - KviKvsVariantList params(new KviKvsVariant(count)); - callFunction(this,"activatedEvent",¶ms); -} -bool KviKvsObject_popupmenu::functionactivatedEvent(KviKvsObjectFunctionCall *c) -{ - emitSignal("activated",c,c->params()); - return true; -} - - -#ifndef COMPILE_USE_STANDALONE_MOC_SOURCES -#include "m_class_popupmenu.moc" -#endif //!COMPILE_USE_STANDALONE_MOC_SOURCES - + }
+ KviKvsVariantList params(new KviKvsVariant(count));
+ callFunction(this,"activatedEvent",¶ms);
+}
+bool KviKvsObject_popupmenu::functionactivatedEvent(KviKvsObjectFunctionCall *c)
+{
+ emitSignal("activated",c,c->params());
+ return true;
+}
+
+
+#ifndef COMPILE_USE_STANDALONE_MOC_SOURCES
+#include "m_class_popupmenu.moc"
+#endif //!COMPILE_USE_STANDALONE_MOC_SOURCES
+
diff --git a/src/modules/objects/class_widget.cpp b/src/modules/objects/class_widget.cpp index 2c7c7b3b9..eb3b9cda0 100644 --- a/src/modules/objects/class_widget.cpp +++ b/src/modules/objects/class_widget.cpp @@ -231,13 +231,13 @@ const Qt::WindowType widgettypes_cod[] = { !fn: $setEnabled(<bool>)
Sets the widget state to enabled or disabled if <bool> is 1 or 0 respectively.
A disabled widget does not receive keyboard nor mouse input.
- !fn: $setCaption(<text>)
- Sets the caption of this widget to <text>.
+ !fn: $setWindowTitle(<text>)
+ Sets the title of this widget to <text>.
This is meaningful for toplevel widgets only.
!fn: $setToolTip(<tooltip_text>)
Set the tooltip of this widget; the text can contain HTML formatting.
- !fn: $window.caption()
- Returns the caption text of this widget.
+ !fn: $windowTitle()
+ Returns the title text of this widget.
!fn: $isTopLevel()
Returns '1' if this widget is a toplevel (parentless) one,
'0' otherwise.
@@ -379,7 +379,7 @@ const Qt::WindowType widgettypes_cod[] = { If you call "[cmd]return[/cmd] $true" you will stop the internal processing
of this event.
The default implementation does nothing.
- !fn: $setIcon(<image_id>)
+ !fn: $setWindowIcon(<image_id>)
Sets the icon for this widget. This is meaningful only for toplevel widgets.
See the [doc:image_id]image identifier[/doc] documentation for the explaination
of the <image_id> parameter.
@@ -515,7 +515,7 @@ const Qt::WindowType widgettypes_cod[] = { %Widget = $new(widget)
# This is the main container for other elements.
- %Widget->$setCaption("This is the widget title")
+ %Widget->$setWindowTitle("This is the widget title")
%Widget->$setGeometry(100,200,170,290)
# 100 and 200 are distance (pixel) from the left and the top of father widget (in this case the KVIrc window)
@@ -620,13 +620,15 @@ KVSO_BEGIN_REGISTERCLASS(KviKvsObject_widget,"widget","object") KVSO_REGISTER_HANDLER(KviKvsObject_widget,"setEnabled",function_setEnabled)
KVSO_REGISTER_HANDLER(KviKvsObject_widget,"isEnabled",function_isEnabled)
KVSO_REGISTER_HANDLER(KviKvsObject_widget,"setMouseTracking",function_setMouseTracking)
- KVSO_REGISTER_HANDLER(KviKvsObject_widget,"setCaption",function_setCaption)
- KVSO_REGISTER_HANDLER(KviKvsObject_widget,"caption",function_caption)
+ KVSO_REGISTER_HANDLER(KviKvsObject_widget,"setCaption",function_setWindowTitle)
+ KVSO_REGISTER_HANDLER(KviKvsObject_widget,"setWindowTitle",function_setWindowTitle)
+ KVSO_REGISTER_HANDLER(KviKvsObject_widget,"windowTitle",function_windowTitle)
+ KVSO_REGISTER_HANDLER(KviKvsObject_widget,"caption",function_windowTitle)
KVSO_REGISTER_HANDLER(KviKvsObject_widget,"hasFocus",function_hasFocus)
KVSO_REGISTER_HANDLER(KviKvsObject_widget,"setFocus",function_setFocus)
KVSO_REGISTER_HANDLER(KviKvsObject_widget,"setToolTip",function_setToolTip)
KVSO_REGISTER_HANDLER(KviKvsObject_widget,"setWFlags",function_setWFlags)
- KVSO_REGISTER_HANDLER(KviKvsObject_widget,"setIcon",function_setIcon)
+ KVSO_REGISTER_HANDLER(KviKvsObject_widget,"setIcon",function_setWindowIcon)
// fonts
KVSO_REGISTER_HANDLER(KviKvsObject_widget,"fontDescent",function_fontDescent)
KVSO_REGISTER_HANDLER(KviKvsObject_widget,"fontAscent",function_fontAscent)
@@ -1028,7 +1030,6 @@ bool KviKvsObject_widget::function_fontMetricsWidth(KviKvsObjectFunctionCall * c KVSO_PARAMETER("string",KVS_PT_STRING,0,m_szStr)
KVSO_PARAMETERS_END(c)
if(!widget()) return true;
-// int fm = widget()->fontMetrics().width(m_szStr);
c->returnValue()->setInteger(widget()->fontMetrics().width(m_szStr));
return true;
}
@@ -1209,7 +1210,9 @@ bool KviKvsObject_widget::function_setPaletteForeground(KviKvsObjectFunctionCall return false;
}
- } else {
+ }
+ else
+ {
if (c->params()->count()==1)
{
bool bOk,bOk1,bOk2;
@@ -1232,8 +1235,13 @@ bool KviKvsObject_widget::function_setPaletteForeground(KviKvsObjectFunctionCall c->warning(__tr2qs("Not an hex digits"));
return true;
}
- if (widget()) widget()->setPaletteForegroundColor(QColor(iColR,iColG,iColB));
- return true;
+ if (widget())
+ {
+ QPalette p = widget()->palette();
+ p.setColor(widget()->foregroundRole(), QColor(iColR,iColG,iColB));
+ widget()->setPalette(p);
+ return true;
+ }
}
if(c->params()->count() < 3)
@@ -1248,7 +1256,13 @@ bool KviKvsObject_widget::function_setPaletteForeground(KviKvsObjectFunctionCall return false;
}
}
- if (widget()) widget()->setPaletteForegroundColor(QColor(iColR,iColG,iColB));
+
+ if (widget())
+ {
+ QPalette p = widget()->palette();
+ p.setColor(widget()->foregroundRole(), QColor(iColR,iColG,iColB));
+ widget()->setPalette(p);
+ }
return true;
}
@@ -1309,7 +1323,12 @@ bool KviKvsObject_widget::function_setBackgroundColor(KviKvsObjectFunctionCall * c->warning(__tr2qs("Not an hex digits"));
return true;
}
- if (widget()) widget()->setBackgroundColor(QColor(iColR,iColG,iColB));
+ if (widget()) + { + QPalette p = widget()->palette();
+ p.setColor(widget()->backgroundRole(), QColor(iColR,iColG,iColB));
+ widget()->setPalette(p);
+ }
return true;
}
@@ -1325,14 +1344,19 @@ bool KviKvsObject_widget::function_setBackgroundColor(KviKvsObjectFunctionCall * return false;
}
}
- if (widget()) widget()->setBackgroundColor(QColor(iColR,iColG,iColB));
+ if (widget()) + { + QPalette p = widget()->palette();
+ p.setColor(widget()->backgroundRole(), QColor(iColR,iColG,iColB));
+ widget()->setPalette(p);
+ }
return true;
}
bool KviKvsObject_widget::function_backgroundColor(KviKvsObjectFunctionCall *c)
{
if(!widget())return true;
- QColor col = widget()->backgroundColor();
+ QColor col = widget()->palette().color(widget()->backgroundRole());
KviKvsArray * a = new KviKvsArray();
a->set(0,new KviKvsVariant((kvs_int_t)col.red()));
a->set(1,new KviKvsVariant((kvs_int_t)col.green()));
@@ -1344,7 +1368,7 @@ bool KviKvsObject_widget::function_backgroundColor(KviKvsObjectFunctionCall *c) bool KviKvsObject_widget::function_foregroundColor(KviKvsObjectFunctionCall *c)
{
if(!widget())return true;
- QColor col = widget()->foregroundColor();
+ QColor col = widget()->palette().color(widget()->foregroundRole());
KviKvsArray * a = new KviKvsArray();
a->set(0,new KviKvsVariant((kvs_int_t)col.red()));
a->set(1,new KviKvsVariant((kvs_int_t)col.green()));
@@ -1372,19 +1396,19 @@ bool KviKvsObject_widget::function_setMouseTracking(KviKvsObjectFunctionCall *c) return true;
}
-bool KviKvsObject_widget::function_setCaption(KviKvsObjectFunctionCall *c)
+bool KviKvsObject_widget::function_setWindowTitle(KviKvsObjectFunctionCall *c)
{
- QString szCaption;
+ QString szWindowTitle;
KVSO_PARAMETERS_BEGIN(c)
- KVSO_PARAMETER("caption",KVS_PT_STRING,0,szCaption)
+ KVSO_PARAMETER("title",KVS_PT_STRING,0,szWindowTitle)
KVSO_PARAMETERS_END(c)
- if(widget()) widget()->setCaption(szCaption);
+ if(widget()) widget()->setWindowTitle(szWindowTitle);
return true;
}
-bool KviKvsObject_widget::function_caption(KviKvsObjectFunctionCall *c)
+bool KviKvsObject_widget::function_windowTitle(KviKvsObjectFunctionCall *c)
{
- if(widget()) c->returnValue()->setString(widget()->caption().toUtf8().data());
+ if(widget()) c->returnValue()->setString(widget()->windowTitle().toUtf8().data());
return true;
}
@@ -1632,7 +1656,6 @@ bool KviKvsObject_widget::function_setFocusPolicy(KviKvsObjectFunctionCall *c) bool KviKvsObject_widget::function_setWFlags(KviKvsObjectFunctionCall *c)
{
QStringList wflags;
- //Qt::WindowType sum;
KVSO_PARAMETERS_BEGIN(c)
KVSO_PARAMETER("widget_flags",KVS_PT_STRINGLIST,KVS_PF_OPTIONAL,wflags)
KVSO_PARAMETERS_END(c)
@@ -1719,9 +1742,10 @@ bool KviKvsObject_widget::function_addWidgetToWrappedLayout(KviKvsObjectFunction c->warning(__tr2qs("Can't add a non-widget object"));
return true;
}
- lay->add(((QWidget *)(ob->object())));
+ lay->addWidget(((QWidget *)(ob->object())));
return true;
}
+//FIXME
bool KviKvsObject_widget::function_reparent(KviKvsObjectFunctionCall *c)
{
KviKvsObject *ob;
@@ -1745,7 +1769,7 @@ bool KviKvsObject_widget::function_reparent(KviKvsObjectFunctionCall *c) widget()->reparent(((QWidget *)(ob->object())),QPoint(((QWidget *)(ob->object()))->x(),((QWidget *)(ob->object()))->y()));
return true;
}
-bool KviKvsObject_widget::function_setIcon(KviKvsObjectFunctionCall *c)
+bool KviKvsObject_widget::function_setWindowIcon(KviKvsObjectFunctionCall *c)
{
QString icon;
@@ -1754,7 +1778,7 @@ bool KviKvsObject_widget::function_setIcon(KviKvsObjectFunctionCall *c) KVSO_PARAMETERS_END(c)
if(!widget())return true;
QPixmap * pix = g_pIconManager->getImage(icon);
- if(pix)widget()->setIcon(*pix);
+ if(pix)widget()->setWindowIcon(*pix);
return true;
}
diff --git a/src/modules/objects/class_widget.h b/src/modules/objects/class_widget.h index 0863989fe..c3ef7be19 100644 --- a/src/modules/objects/class_widget.h +++ b/src/modules/objects/class_widget.h @@ -52,7 +52,7 @@ protected: bool function_addWidgetToWrappedLayout(KviKvsObjectFunctionCall *c);
bool function_backgroundColor(KviKvsObjectFunctionCall *c);
- bool function_caption(KviKvsObjectFunctionCall *c);
+ bool function_windowTitle(KviKvsObjectFunctionCall *c);
bool function_centerToScreen(KviKvsObjectFunctionCall *c);
bool function_fontAscent(KviKvsObjectFunctionCall * c);
bool function_fontDescent(KviKvsObjectFunctionCall * c);
@@ -82,12 +82,12 @@ protected: bool function_screenResolution(KviKvsObjectFunctionCall * c);
bool function_setBackgroundColor(KviKvsObjectFunctionCall *c);
bool function_setBackgroundImage(KviKvsObjectFunctionCall *c);
- bool function_setCaption(KviKvsObjectFunctionCall *c);
+ bool function_setWindowTitle(KviKvsObjectFunctionCall *c);
bool function_setEnabled(KviKvsObjectFunctionCall *c);
bool function_setFocus(KviKvsObjectFunctionCall *c);
bool function_setFocusPolicy(KviKvsObjectFunctionCall *c);
bool function_setFont(KviKvsObjectFunctionCall *c);
- bool function_setIcon(KviKvsObjectFunctionCall *c);
+ bool function_setWindowIcon(KviKvsObjectFunctionCall *c);
bool function_setMaximumWidth(KviKvsObjectFunctionCall *c);
bool function_setMaximumHeight(KviKvsObjectFunctionCall *c);
bool function_setMinimumWidth(KviKvsObjectFunctionCall *c);
diff --git a/src/modules/objects/class_window.cpp b/src/modules/objects/class_window.cpp index 81222f086..a0cdb4d08 100644 --- a/src/modules/objects/class_window.cpp +++ b/src/modules/objects/class_window.cpp @@ -96,7 +96,7 @@ void KviKvsScriptWindowWindow::centralWidgetDestroyed() KVSO_BEGIN_REGISTERCLASS(KviKvsObject_window,"window","widget") - KVSO_REGISTER_HANDLER(KviKvsObject_window,"setCaption", functionsetCaption) + KVSO_REGISTER_HANDLER(KviKvsObject_window,"setWindowTitle", functionsetWindowTitle) KVSO_REGISTER_HANDLER(KviKvsObject_window,"setCentralWidget", functionsetCentralWidget) // KVSO_REGISTER_HANDLER(KviKvsObject_window,"setIcon", functionsetIcon) KVSO_END_REGISTERCLASS(KviKvsObject_window) @@ -119,14 +119,14 @@ bool KviKvsObject_window::init(KviKvsRunTimeContext * pContext,KviKvsVariantList return true; } -bool KviKvsObject_window::functionsetCaption(KviKvsObjectFunctionCall *c) +bool KviKvsObject_window::functionsetWindowTitle(KviKvsObjectFunctionCall *c) { QString szCaption; KVSO_PARAMETERS_BEGIN(c) KVSO_PARAMETER("caption",KVS_PT_STRING,0,szCaption) KVSO_PARAMETERS_END(c) if(widget()) - ((KviKvsScriptWindowWindow *)widget())->setCaptionString(szCaption); + ((KviKvsScriptWindowWindow *)widget())->setWindowTitleString(szCaption); return true; } bool KviKvsObject_window::functionsetCentralWidget(KviKvsObjectFunctionCall *c) diff --git a/src/modules/objects/class_window.h b/src/modules/objects/class_window.h index 1324a5626..ba7d053b1 100644 --- a/src/modules/objects/class_window.h +++ b/src/modules/objects/class_window.h @@ -36,7 +36,7 @@ public: protected: virtual bool init(KviKvsRunTimeContext * pContext,KviKvsVariantList *pParams); - bool functionsetCaption(KviKvsObjectFunctionCall *c); + bool functionsetWindowTitle(KviKvsObjectFunctionCall *c); bool functionsetCentralWidget(KviKvsObjectFunctionCall *c); }; @@ -53,7 +53,7 @@ protected: QWidget * m_pCentralWidget; public: void setCentralWidget(KviKvsObject_widget *o,QWidget * w); - void setCaptionString(const QString &s){ setFixedCaption(s); }; + void setWindowTitleString(const QString &s){ setFixedCaption(s); }; virtual void resizeEvent(QResizeEvent *e); protected slots: void centralWidgetObjectDestroyed(); diff --git a/src/modules/objects/class_workspace.cpp b/src/modules/objects/class_workspace.cpp index 746786e5d..c32b684ce 100644 --- a/src/modules/objects/class_workspace.cpp +++ b/src/modules/objects/class_workspace.cpp @@ -132,7 +132,7 @@ }[br] %Workspace=$new(workspace)[br] %Workspace->$resize(640,480)[br] - %Workspace->$setCaption("Hit the mouse to stop cycling windows....")[br] + %Workspace->$setWindowTitle("Hit the mouse to stop cycling windows....")[br] %I=0[br] %Cicle=1[br] while (%I<20)[br] diff --git a/src/modules/options/container.cpp b/src/modules/options/container.cpp index 1660a9141..ee0a45168 100644 --- a/src/modules/options/container.cpp +++ b/src/modules/options/container.cpp @@ -79,7 +79,7 @@ void KviOptionsWidgetContainer::setup(KviOptionsWidget * w) { //KviStr caption(KviStr::Format,"%s - KVIrc",e->szName); setIcon(*(g_pIconManager->getSmallIcon(e->iIcon))); - setCaption(e->szName); + setWindowTitle(e->szName); } m_pOptionsWidget = w; diff --git a/src/modules/options/dialog.cpp b/src/modules/options/dialog.cpp index 4863946de..48fb0e7e7 100644 --- a/src/modules/options/dialog.cpp +++ b/src/modules/options/dialog.cpp @@ -174,7 +174,7 @@ KviOptionsDialog::KviOptionsDialog(QWidget * par,const QString &szGroup) ).arg(szDialogTitle).arg(szDialog).arg(szInfoTips).arg(szOkCancelButtons); QString szCaption = szDialogTitle + " - KVIrc"; - setCaption(szCaption); + setWindowTitle(szCaption); QGridLayout * g1 = new QGridLayout(this,2,5,8,8); QSplitter * spl = new QSplitter(Qt::Horizontal,this); diff --git a/src/modules/options/optw_identity.cpp b/src/modules/options/optw_identity.cpp index ebed7337e..ba642dbf3 100644 --- a/src/modules/options/optw_identity.cpp +++ b/src/modules/options/optw_identity.cpp @@ -53,7 +53,7 @@ KviNickAlternativesDialog::KviNickAlternativesDialog(QWidget * par,const QString { QGridLayout * g = new QGridLayout(this,5,3,4,12); - setCaption(__tr2qs_ctx("Nickname alternatives","options")); + setWindowTitle(__tr2qs_ctx("Nickname alternatives","options")); QLabel * l = new QLabel(this); l->setText(__tr2qs_ctx("<center>Here you can choose up to three nicknames " \ @@ -114,7 +114,7 @@ void KviNickAlternativesDialog::fill(QString &n1,QString &n2,QString &n3) KviAvatarDownloadDialog::KviAvatarDownloadDialog(QWidget * par,const QString &szUrl) : QDialog(par) { - setCaption(__tr2qs_ctx("Avatar Download - KVIrc","options")); + setWindowTitle(__tr2qs_ctx("Avatar Download - KVIrc","options")); m_szUrl = szUrl; @@ -197,7 +197,7 @@ void KviAvatarDownloadDialog::downloadTerminated(bool bSuccess) KviAvatarSelectionDialog::KviAvatarSelectionDialog(QWidget * par,const QString &szInitialPath) : QDialog(par) { - setCaption(__tr2qs_ctx("Choose Avatar - KVIrc","options")); + setWindowTitle(__tr2qs_ctx("Choose Avatar - KVIrc","options")); QGridLayout * g = new QGridLayout(this,3,3,4,8); diff --git a/src/modules/options/optw_nickserv.cpp b/src/modules/options/optw_nickserv.cpp index caa881792..84d080800 100644 --- a/src/modules/options/optw_nickserv.cpp +++ b/src/modules/options/optw_nickserv.cpp @@ -46,7 +46,7 @@ extern KVIRC_API KviNickServRuleSet * g_pNickServRuleSet; KviNickServRuleEditor::KviNickServRuleEditor(QWidget * par,bool bUseServerMaskField) : QDialog(par) { - setCaption(__tr2qs_ctx("NickServ Authentication Rule","options")); + setWindowTitle(__tr2qs_ctx("NickServ Authentication Rule","options")); QString html_center_begin = "<center>"; QString html_center_end = "</center>"; diff --git a/src/modules/options/optw_servers.cpp b/src/modules/options/optw_servers.cpp index 39b7a7a84..64036bb9b 100644 --- a/src/modules/options/optw_servers.cpp +++ b/src/modules/options/optw_servers.cpp @@ -91,7 +91,7 @@ KviNetworkDetailsWidget::KviNetworkDetailsWidget(QWidget * par,KviIrcNetwork * n QGridLayout * g = new QGridLayout(this,4,4,10,4); - setCaption(__tr2qs_ctx("Network Details","options")); + setWindowTitle(__tr2qs_ctx("Network Details","options")); setIcon(*(g_pIconManager->getSmallIcon(KVI_SMALLICON_WORLD))); QString szTmp = "<font size=\"+1\"><b>"; @@ -418,7 +418,7 @@ KviServerDetailsWidget::KviServerDetailsWidget(QWidget * par,KviIrcServer * s) m_szHostname = s->hostName(); QGridLayout * g = new QGridLayout(this,4,4,10,4); - setCaption(__tr2qs_ctx("Server Details","options")); + setWindowTitle(__tr2qs_ctx("Server Details","options")); setIcon(*(g_pIconManager->getSmallIcon(KVI_SMALLICON_SERVER))); m_pHeaderLabel = new QLabel("",this); // the text will be set later diff --git a/src/modules/reguser/dialog.cpp b/src/modules/reguser/dialog.cpp index e2952f727..4c23c5338 100644 --- a/src/modules/reguser/dialog.cpp +++ b/src/modules/reguser/dialog.cpp @@ -163,7 +163,7 @@ KviRegisteredUsersDialog::KviRegisteredUsersDialog(QWidget * par) g_pLocalRegisteredUserDataBase->copyFrom(g_pRegisteredUserDataBase);
setIcon(*(g_pIconManager->getSmallIcon(KVI_SMALLICON_REGUSERS)));
- setCaption(__tr2qs("Registered Users - KVIrc"));
+ setWindowTitle(__tr2qs("Registered Users - KVIrc"));
QGridLayout * g = new QGridLayout(this,4,3,4,4);
diff --git a/src/modules/reguser/edituser.cpp b/src/modules/reguser/edituser.cpp index 71a600ba6..9633b3c26 100644 --- a/src/modules/reguser/edituser.cpp +++ b/src/modules/reguser/edituser.cpp @@ -73,7 +73,7 @@ KviReguserPropertiesDialog::KviReguserPropertiesDialog(QWidget * p,KviPointerHas {
m_pPropertyDict = dict;
- setCaption(__tr2qs("Property Editor"));
+ setWindowTitle(__tr2qs("Property Editor"));
setIcon(*(g_pIconManager->getSmallIcon(KVI_SMALLICON_LINUX)));
QGridLayout * g = new QGridLayout(this,3,3,4,4);
@@ -221,7 +221,7 @@ KviReguserMaskDialog::KviReguserMaskDialog(QWidget * p,KviIrcMask * m) {
m_pMask = m;
- setCaption(__tr2qs("Mask Editor"));
+ setWindowTitle(__tr2qs("Mask Editor"));
QGridLayout * g = new QGridLayout(this,3,2,4,4);
@@ -329,7 +329,7 @@ KviRegisteredUserEntryDialog::KviRegisteredUserEntryDialog(QWidget *p,KviRegiste //setMinimumSize(400,450);
setIcon(*(g_pIconManager->getSmallIcon(KVI_SMALLICON_LINUX)));
- setCaption(__tr2qs("Registered User Entry"));
+ setWindowTitle(__tr2qs("Registered User Entry"));
QWidget * p1 = new QWidget(this);
diff --git a/src/modules/reguser/wizard.cpp b/src/modules/reguser/wizard.cpp index 6dae150d5..6d5638926 100644 --- a/src/modules/reguser/wizard.cpp +++ b/src/modules/reguser/wizard.cpp @@ -73,7 +73,7 @@ KviRegistrationWizard::KviRegistrationWizard(const char * startMask,KviRegistere QFrame * f; // resize( 490, 456 ); - setCaption(__tr2qs("User Registration Wizard - KVIrc")); + setWindowTitle(__tr2qs("User Registration Wizard - KVIrc")); setIcon(*(g_pIconManager->getSmallIcon(KVI_SMALLICON_LINUX))); setSizeGripEnabled( TRUE ); diff --git a/src/modules/setup/setupwizard.cpp b/src/modules/setup/setupwizard.cpp index d0c7d26aa..b3d2392a7 100644 --- a/src/modules/setup/setupwizard.cpp +++ b/src/modules/setup/setupwizard.cpp @@ -209,7 +209,7 @@ KviSetupWizard::KviSetupWizard() setHelpEnabled(m_pLicense,false); - setCaption(__tr2qs("KVIrc Setup")); + setWindowTitle(__tr2qs("KVIrc Setup")); #else m_pLicense = 0; #endif diff --git a/src/modules/sharedfileswindow/sharedfileswindow.cpp b/src/modules/sharedfileswindow/sharedfileswindow.cpp index a0d553b41..d9487169f 100644 --- a/src/modules/sharedfileswindow/sharedfileswindow.cpp +++ b/src/modules/sharedfileswindow/sharedfileswindow.cpp @@ -57,7 +57,7 @@ KviSharedFileEditDialog::KviSharedFileEditDialog(QWidget * par,KviSharedFile * f { QGridLayout * g = new QGridLayout(this,1,1,11,6); - setCaption(__tr2qs_ctx("Edit Shared File - KVIrc","sharedfileswindow")); + setWindowTitle(__tr2qs_ctx("Edit Shared File - KVIrc","sharedfileswindow")); QLabel * l = new QLabel(__tr2qs_ctx("Share name:","sharedfileswindow"),this); g->addWidget(l, 0, 0 ); diff --git a/src/modules/theme/managementdialog.cpp b/src/modules/theme/managementdialog.cpp index 43dbe7ee1..a21904018 100644 --- a/src/modules/theme/managementdialog.cpp +++ b/src/modules/theme/managementdialog.cpp @@ -139,7 +139,7 @@ KviThemeManagementDialog * KviThemeManagementDialog::m_pInstance = 0; KviThemeManagementDialog::KviThemeManagementDialog(QWidget * parent) : QDialog(parent,"theme_options_widget") { - setCaption(__tr2qs_ctx("Manage Themes - KVIrc","theme")); + setWindowTitle(__tr2qs_ctx("Manage Themes - KVIrc","theme")); setIcon(*(g_pIconManager->getSmallIcon(KVI_SMALLICON_THEME))); setModal(true); diff --git a/src/modules/theme/packthemedialog.cpp b/src/modules/theme/packthemedialog.cpp index ec34c13a3..b10317032 100644 --- a/src/modules/theme/packthemedialog.cpp +++ b/src/modules/theme/packthemedialog.cpp @@ -112,7 +112,7 @@ KviPackThemeDialog::KviPackThemeDialog(QWidget * pParent,KviPointerList<KviTheme m_szPackagePath += KVI_FILEEXTENSION_THEMEPACKAGE; } - setCaption(__tr2qs_ctx("Export Theme - KVIrc","theme")); + setWindowTitle(__tr2qs_ctx("Export Theme - KVIrc","theme")); setMinimumSize(400,350); // welcome page ================================================================================== diff --git a/src/modules/theme/savethemedialog.cpp b/src/modules/theme/savethemedialog.cpp index 0732bd322..42892927f 100644 --- a/src/modules/theme/savethemedialog.cpp +++ b/src/modules/theme/savethemedialog.cpp @@ -62,7 +62,7 @@ KviSaveThemeDialog::KviSaveThemeDialog(QWidget * pParent) : KviTalWizard(pParent) { - setCaption(__tr2qs_ctx("Save Current Theme - KVIrc","theme")); + setWindowTitle(__tr2qs_ctx("Save Current Theme - KVIrc","theme")); setMinimumSize(400,350); // welcome page ================================================================================== diff --git a/src/modules/tip/libkvitip.cpp b/src/modules/tip/libkvitip.cpp index 79262fb76..6ba8933e8 100644 --- a/src/modules/tip/libkvitip.cpp +++ b/src/modules/tip/libkvitip.cpp @@ -141,7 +141,7 @@ KviTipWindow::KviTipWindow() setIcon(*(g_pIconManager->getSmallIcon(KVI_SMALLICON_IDEA)));
- setCaption(__tr2qs("Did you know..."));
+ setWindowTitle(__tr2qs("Did you know..."));
pb->setFocus();
diff --git a/src/modules/toolbareditor/toolbareditor.cpp b/src/modules/toolbareditor/toolbareditor.cpp index 9d8f4bef5..aac7f3bbd 100644 --- a/src/modules/toolbareditor/toolbareditor.cpp +++ b/src/modules/toolbareditor/toolbareditor.cpp @@ -122,7 +122,7 @@ KviCustomToolBarPropertiesDialog::KviCustomToolBarPropertiesDialog(QWidget * p,c m_szOriginalId = szId; m_szLabel = szLabel; - setCaption(__tr2qs("ToolBar Properties")); + setWindowTitle(__tr2qs("ToolBar Properties")); setIcon(*(g_pIconManager->getSmallIcon(KVI_SMALLICON_TOOLBAR))); QGridLayout * g = new QGridLayout(this,5,6,5,3); @@ -277,7 +277,7 @@ void KviCustomToolBarPropertiesDialog::advancedClicked() KviCustomizeToolBarsDialog::KviCustomizeToolBarsDialog(QWidget * p) : QDialog(p,"" /*,WType_TopLevel | WStyle_Customize | WStyle_Title | WStyle_StaysOnTop | WStyle_DialogBorder*/) { - setCaption(__tr2qs("Customize Toolbars")); + setWindowTitle(__tr2qs("Customize Toolbars")); setIcon(*(g_pIconManager->getSmallIcon(KVI_SMALLICON_TOOLBAR))); m_pInstance = this; diff --git a/src/modules/trayicon/libkvitrayicon.cpp b/src/modules/trayicon/libkvitrayicon.cpp index fc3286515..aa3e8edae 100644 --- a/src/modules/trayicon/libkvitrayicon.cpp +++ b/src/modules/trayicon/libkvitrayicon.cpp @@ -87,7 +87,7 @@ KviTrayIcon::KviTrayIcon(KviFrame * frm) QLabel * l = new QLabel(__tr2qs("KVIrc"),m_pContextPopup); l->setFrameStyle(QFrame::Raised | QFrame::StyledPanel); m_pContextPopup->insertItem(l); - m_pContextPopup->setCaption(__tr2qs("Context")); + m_pContextPopup->setWindowTitle(__tr2qs("Context")); m_iAwayMenuId = m_pContextPopup->insertItem ( __tr2qs("Away"), m_pAwayPopup); m_pContextPopup->changeItem(m_iAwayMenuId,*(g_pIconManager->getSmallIcon(KVI_SMALLICON_AWAY)),__tr2qs("Away")); diff --git a/src/modules/url/libkviurl.cpp b/src/modules/url/libkviurl.cpp index 1ff07a6ad..5afc147cb 100644 --- a/src/modules/url/libkviurl.cpp +++ b/src/modules/url/libkviurl.cpp @@ -339,7 +339,7 @@ UrlDialog::~UrlDialog() ConfigDialog::ConfigDialog() :QDialog() { - setCaption(__tr2qs("URL Module Configuration")); + setWindowTitle(__tr2qs("URL Module Configuration")); QGridLayout *g = new QGridLayout(this,4,2,10,10); diff --git a/src/modules/window/libkviwindow.cpp b/src/modules/window/libkviwindow.cpp index 90f46dffe..05d987d34 100644 --- a/src/modules/window/libkviwindow.cpp +++ b/src/modules/window/libkviwindow.cpp @@ -994,7 +994,7 @@ static bool window_kvs_fnc_list(KviKvsModuleFunctionCall * c) [b]m[/b]: Creates a window that is initially minimized.[br] [b]q[/b]: Don't print warning messages during the creation.[br] If <caption> is given then the new window will have it as the initial plain text <caption>. - You can change the caption later by calling [cmd]window.setCaption[/cmd].[br] + You can change the caption later by calling [cmd]window.setWindowTitle[/cmd].[br] If <irc_context> is given then the new window is bound to the specified irc context and will be destroyed when the attacched console closes. If <irc_context> is omitted or is 0 then the window will be context free (not bound @@ -1060,15 +1060,15 @@ static bool window_kvs_fnc_open(KviKvsModuleFunctionCall * c) } /* - @doc: window.setCaption + @doc: window.setWindowTitle @type: command @title: - window.setCaption + window.setWindowTitle @short: Sets the caption of an user window @syntax: - window.setCaption [-q] <window_id> <plain_text_caption> [html_inactive_caption] [html_active_caption] + window.setWindowTitle [-q] <window_id> <plain_text_caption> [html_inactive_caption] [html_active_caption] @switches: !sw: -q | --quiet Be quiet @@ -1089,7 +1089,7 @@ static bool window_kvs_fnc_open(KviKvsModuleFunctionCall * c) @seealso: */ -static bool window_kvs_cmd_setCaption(KviKvsModuleCommandCall * c) +static bool window_kvs_cmd_setWindowTitle(KviKvsModuleCommandCall * c) { QString szWnd; QString szPlain; @@ -1113,7 +1113,7 @@ static bool window_kvs_cmd_setCaption(KviKvsModuleCommandCall * c) if(pWnd->type() == KVI_WINDOW_TYPE_USERWINDOW) { - ((KviUserWindow *)pWnd)->setCaptionStrings(szPlain,szInactive,szActive); + ((KviUserWindow *)pWnd)->setWindowTitleStrings(szPlain,szInactive,szActive); } else { if(!c->hasSwitch('q',"quiet"))c->warning(__tr2qs("The specified window is not of type \"userwnd\"")); } @@ -1491,7 +1491,7 @@ static bool window_module_init(KviModule *m) KVSM_REGISTER_SIMPLE_COMMAND(m,"demandAttention",window_kvs_cmd_demandAttention); KVSM_REGISTER_SIMPLE_COMMAND(m,"listtypes",window_kvs_cmd_listtypes); KVSM_REGISTER_SIMPLE_COMMAND(m,"setBackground",window_kvs_cmd_setBackground); - KVSM_REGISTER_SIMPLE_COMMAND(m,"setCaption",window_kvs_cmd_setCaption); + KVSM_REGISTER_SIMPLE_COMMAND(m,"setWindowTitle",window_kvs_cmd_setWindowTitle); KVSM_REGISTER_SIMPLE_COMMAND(m,"setCryptEngine",window_kvs_cmd_setCryptEngine); KVSM_REGISTER_SIMPLE_COMMAND(m,"setInputText",window_kvs_cmd_setInputText); KVSM_REGISTER_SIMPLE_COMMAND(m,"insertInInputText",window_kvs_cmd_insertInInputText); diff --git a/src/modules/window/userwindow.cpp b/src/modules/window/userwindow.cpp index cc9187a83..7f38dd0f6 100644 --- a/src/modules/window/userwindow.cpp +++ b/src/modules/window/userwindow.cpp @@ -95,7 +95,7 @@ void KviUserWindow::fillCaptionBuffers() // nothing here } -void KviUserWindow::setCaptionStrings(const QString &szPlainText,const QString &szHtmlInactive,const QString &szHtmlActive) +void KviUserWindow::setWindowTitleStrings(const QString &szPlainText,const QString &szHtmlInactive,const QString &szHtmlActive) { m_szPlainTextCaption = szPlainText; m_szHtmlActiveCaption = szHtmlActive; diff --git a/src/modules/window/userwindow.h b/src/modules/window/userwindow.h index ec0d2d12c..42140c6fe 100644 --- a/src/modules/window/userwindow.h +++ b/src/modules/window/userwindow.h @@ -42,7 +42,7 @@ protected: virtual QPixmap * myIconPtr(); virtual void fillCaptionBuffers(); public: - void setCaptionStrings(const QString &szPlainText,const QString &szHtmlInactive,const QString &szHtmlActive); + void setWindowTitleStrings(const QString &szPlainText,const QString &szHtmlInactive,const QString &szHtmlActive); }; #endif //!_USERWINDOW_H_ |
