MsgEdit::MsgEdit(QWidget *p, unsigned long uin) : QFrame(p), Uin(this, "Uin") { Uin = uin; msg = NULL; tabId = -1; tab = NULL; sendEvent = NULL; mHistory = NULL; bMultiply = false; setWFlags(WDestructiveClose); QVBoxLayout *lay = new QVBoxLayout(this); boxSend = new QVGroupBox(this); lay->addWidget(boxSend); QFrame *frmHead = new QFrame(boxSend); QHBoxLayout *hLay = new QHBoxLayout(frmHead); btnBgColor = new CPushButton(frmHead); btnBgColor->setTip(i18n("Background color")); btnBgColor->setPixmap(Pict("bgcolor")); connect(btnBgColor, SIGNAL(clicked()), this, SLOT(setMsgBackgroundColor())); btnBgColor->hide(); hLay->addWidget(btnBgColor); btnReply = new QPushButton(i18n("&Reply"), frmHead); btnReply->hide(); hLay->addWidget(btnReply); connect(btnReply, SIGNAL(clicked()), this, SLOT(replyClick())); btnGrant = new QPushButton(i18n("&Grant"), frmHead); btnGrant->hide(); hLay->addWidget(btnGrant); connect(btnGrant, SIGNAL(clicked()), this, SLOT(grantClick())); btnAccept = new QPushButton(i18n("&Accept"), frmHead); btnAccept->hide(); hLay->addWidget(btnAccept); connect(btnAccept, SIGNAL(clicked()), this, SLOT(acceptMessage())); btnFgColor = new CPushButton(frmHead); btnFgColor->setTip(i18n("Text color")); btnFgColor->setPixmap(Pict("fgcolor")); connect(btnFgColor, SIGNAL(clicked()), this, SLOT(setMsgForegroundColor())); hLay->addSpacing(2); btnFgColor->hide(); hLay->addWidget(btnFgColor); btnQuote = new QPushButton(i18n("&Quote"), frmHead); btnQuote->hide(); hLay->addWidget(btnQuote); connect(btnQuote, SIGNAL(clicked()), this, SLOT(quoteClick())); btnRefuse = new QPushButton(i18n("&Refuse"), frmHead); btnRefuse->hide(); hLay->addWidget(btnRefuse); declineMenu = new QPopupMenu(this); connect(btnRefuse, SIGNAL(clicked()), this, SLOT(refuseClick())); connect(declineMenu, SIGNAL(activated(int)), this, SLOT(declineMessage(int))); declineMenu->insertItem(reason_string(DECLINE_WITHOUT_REASON), DECLINE_WITHOUT_REASON); declineMenu->insertItem(reason_string(DECLINE_REASON_BUSY), DECLINE_REASON_BUSY); declineMenu->insertItem(reason_string(DECLINE_REASON_LATER), DECLINE_REASON_LATER); declineMenu->insertItem(reason_string(DECLINE_REASON_INPUT), DECLINE_REASON_INPUT); btnDecline = new QPushButton(i18n("&Decline"), frmHead); btnDecline->hide(); btnDecline->setPopup(declineMenu); hLay->addWidget(btnDecline); btnBold = new CPushButton(frmHead); btnBold->setTip(i18n("Bold")); btnBold->setPixmap(Pict("text_bold")); btnBold->setToggleButton(true); connect(btnBold, SIGNAL(toggled(bool)), this, SLOT(setBold(bool))); hLay->addSpacing(2); btnBold->hide(); hLay->addWidget(btnBold); btnForward = new QPushButton(i18n("&Forward"), frmHead); connect(btnForward, SIGNAL(clicked()), this, SLOT(forwardClick())); btnForward->hide(); hLay->addWidget(btnForward); btnItalic = new CPushButton(frmHead); btnItalic->setTip(i18n("Italic")); btnItalic->setPixmap(Pict("text_italic")); btnItalic->setToggleButton(true); connect(btnItalic, SIGNAL(toggled(bool)), this, SLOT(setItalic(bool))); hLay->addSpacing(2); btnItalic->hide(); hLay->addWidget(btnItalic); btnUnder = new CPushButton(frmHead); btnUnder->setTip(i18n("Underline")); btnUnder->setPixmap(Pict("text_under")); btnUnder->setToggleButton(true); connect(btnUnder, SIGNAL(toggled(bool)), this, SLOT(setUnder(bool))); hLay->addSpacing(2); btnUnder->hide(); hLay->addWidget(btnUnder); btnFont = new CPushButton(frmHead); btnFont->setTip(i18n("Text font")); btnFont->setPixmap(Pict("text")); connect(btnFont, SIGNAL(clicked()), this, SLOT(setFont())); hLay->addSpacing(2); btnFont->hide(); hLay->addWidget(btnFont); #ifdef USE_SPELL btnSpell = new CPushButton(frmHead); btnSpell->setTip(i18n("Spell check")); btnSpell->setPixmap(Pict("spellcheck")); connect(btnSpell, SIGNAL(clicked()), this, SLOT(spell())); hLay->addSpacing(2); btnSpell->hide(); hLay->addWidget(btnSpell); #endif hLay->addSpacing(2); hLay->addStretch(); chkClose = new QCheckBox(i18n("C&lose after send"), frmHead); chkClose->setChecked(pMain->CloseAfterSend()); connect(chkClose, SIGNAL(toggled(bool)), this, SLOT(closeToggle(bool))); hLay->addWidget(chkClose); btnSend = new QPushButton(frmHead); connect(btnSend, SIGNAL(clicked()), this, SLOT(sendClick())); hLay->addWidget(btnSend); btnNext = new PictPushButton(frmHead); connect(btnNext, SIGNAL(clicked()), this, SLOT(nextClick())); btnNext->hide(); hLay->addWidget(btnNext); phone = new QFrame(boxSend); phone->hide(); QHBoxLayout *hlay = new QHBoxLayout(phone); QLabel *title = new QLabel(i18n("Phone:"), phone); hlay->addWidget(title); phoneEdit = new QComboBox(phone); phoneEdit->setEditable(true); phoneEdit->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed)); hlay->addWidget(phoneEdit); connect(phoneEdit, SIGNAL(textChanged(const QString&)), this, SLOT(textChanged(const QString&))); url = new QFrame(boxSend); url->hide(); hlay = new QHBoxLayout(url); title = new QLabel(i18n("URL:"), url); hlay->addWidget(title); urlEdit = new QLineEdit(url); hlay->addWidget(urlEdit); connect(urlEdit, SIGNAL(textChanged(const QString&)), this, SLOT(textChanged(const QString&))); file = new QFrame(boxSend); file->hide(); hlay = new QHBoxLayout(file); title = new QLabel(i18n("File:"), file); hlay->addWidget(title); fileEdit = new EditFile(file); hlay->addWidget(fileEdit); connect(fileEdit, SIGNAL(textChanged(const QString&)), this, SLOT(textChanged(const QString&))); btnMultiply = new CPushButton(frmHead); btnMultiply->setTip(i18n("Multiply send")); btnMultiply->setPixmap(Pict("1rightarrow")); connect(btnMultiply, SIGNAL(clicked()), this, SLOT(toggleMultiply())); hLay->addSpacing(2); hLay->addWidget(btnMultiply); lblUsers = new QLabel(i18n("Drag users here"), boxSend); edit = new EditSpell(this); edit->hide(); lay->addWidget(edit); users = new UserTbl(this); users->hide(); lay->addWidget(users); view = new TextShow(this); view->hide(); lay->addWidget(view); connect(edit, SIGNAL(textChanged()), this, SLOT(editTextChanged())); connect(edit, SIGNAL(currentFontChanged(const QFont&)), this, SLOT(editFontChanged(const QFont&))); connect(edit, SIGNAL(ctrlEnterPressed()), this, SLOT(sendClick())); connect(users, SIGNAL(changed()), this, SLOT(textChanged())); connect(pClient, SIGNAL(messageReceived(ICQMessage*)), this, SLOT(messageReceived(ICQMessage*))); connect(pClient, SIGNAL(event(ICQEvent*)), this, SLOT(processEvent(ICQEvent*))); connect(pMain, SIGNAL(chatChanged()), this, SLOT(chatChanged())); connect(pMain, SIGNAL(ftChanged()), this, SLOT(ftChanged())); setState(); setUin(uin); }
CvsForm::CvsForm( QWidget *parent, const char *name, WFlags f ) : CvsFormBase( parent, name, f ) { setWFlags( getWFlags() | WDestructiveClose ); }
Container::Container(unsigned id, const char *cfg) { m_bInit = false; m_bInSize = false; m_bStatusSize = false; m_bBarChanged = false; m_bReceived = false; m_bNoSwitch = false; m_bNoRead = false; m_wnds = NULL; m_tabBar = NULL; SET_WNDPROC("container") setWFlags(WDestructiveClose); if (cfg && *cfg){ Buffer config; config << "[Title]\n" << cfg; config.setWritePos(0); config.getSection(); load_data(containerData, &data, &config); }else{ load_data(containerData, &data, NULL); } bool bPos = true; if (cfg == NULL){ setId(id); memcpy(data.barState, CorePlugin::m_plugin->data.containerBar, sizeof(data.barState)); memcpy(data.geometry, CorePlugin::m_plugin->data.containerGeo, sizeof(data.geometry)); if ((data.geometry[WIDTH].value == (unsigned long)-1) || (data.geometry[HEIGHT].value == (unsigned long)-1)){ QWidget *desktop = QApplication::desktop(); data.geometry[WIDTH].value = desktop->width() / 3; data.geometry[HEIGHT].value = desktop->height() / 3; } bPos = false; if ((data.geometry[TOP].value != (unsigned long)-1) || (data.geometry[LEFT].value != (unsigned long)-1)){ bPos = true; QWidgetList *list = QApplication::topLevelWidgets(); for (int i = 0; i < 2; i++){ bool bOK = true; QWidgetListIt it(*list); QWidget * w; while ((w = it.current()) != NULL){ if (w == this){ ++it; continue; } if (w->inherits("Container")){ int dw = w->pos().x() - data.geometry[LEFT].value; int dh = w->pos().y() - data.geometry[TOP].value; if (dw < 0) dw = -dw; if (dh < 0) dh = -dh; if ((dw < 3) && (dh < 3)){ int nl = data.geometry[LEFT].value; int nt = data.geometry[TOP].value; nl += 21; nt += 20; QWidget *desktop = QApplication::desktop(); if (nl + (int)data.geometry[WIDTH].value > desktop->width()) nl = 0; if (nt + (int)data.geometry[WIDTH].value > desktop->width()) nt = 0; if ((nl != (int)data.geometry[LEFT].value) && (nt != (int)data.geometry[TOP].value)){ data.geometry[LEFT].value = nl; data.geometry[TOP].value = nt; bOK = false; } } } ++it; } if (bOK) break; } delete list; } setStatusSize(CorePlugin::m_plugin->getContainerStatusSize()); } m_bInSize = true; restoreGeometry(this, data.geometry, bPos, true); m_bInSize = false; }
Container::Container(unsigned id, const char *cfg) { m_bInit = false; m_bInSize = false; m_bStatusSize = false; m_bBarChanged = false; m_bReceived = false; m_bNoSwitch = false; SET_WNDPROC("container") setWFlags(WDestructiveClose); QFrame *frm = new QFrame(this); setCentralWidget(frm); connect(CorePlugin::m_plugin, SIGNAL(modeChanged()), this, SLOT(modeChanged())); QVBoxLayout *lay = new QVBoxLayout(frm); m_wnds = new QWidgetStack(frm); m_wnds->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding)); lay->addWidget(m_wnds); m_tabSplitter = new Splitter(frm); m_tabSplitter->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum)); m_tabBar = new UserTabBar(m_tabSplitter); m_tabBar->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Expanding)); m_tabBar->hide(); m_status = new ContainerStatus(m_tabSplitter); lay->addWidget(m_tabSplitter); load_data(containerData, &data, cfg); bool bPos = true; if (cfg == NULL){ setId(id); memcpy(data.barState, CorePlugin::m_plugin->data.containerBar, sizeof(data.barState)); memcpy(data.geometry, CorePlugin::m_plugin->data.containerGeo, sizeof(data.geometry)); if ((data.geometry[WIDTH].value == (unsigned long)-1) || (data.geometry[HEIGHT].value == (unsigned long)-1)){ QWidget *desktop = QApplication::desktop(); data.geometry[WIDTH].value = desktop->width() / 3; data.geometry[HEIGHT].value = desktop->height() / 3; } bPos = false; if ((data.geometry[TOP].value != (unsigned long)-1) || (data.geometry[LEFT].value != (unsigned long)-1)){ bPos = true; QWidgetList *list = QApplication::topLevelWidgets(); for (int i = 0; i < 2; i++){ bool bOK = true; QWidgetListIt it(*list); QWidget * w; while ((w = it.current()) != NULL){ if (w == this){ ++it; continue; } if (w->inherits("Container")){ int dw = w->pos().x() - data.geometry[LEFT].value; int dh = w->pos().y() - data.geometry[TOP].value; if (dw < 0) dw = -dw; if (dh < 0) dh = -dh; if ((dw < 3) && (dh < 3)){ int nl = data.geometry[LEFT].value; int nt = data.geometry[TOP].value; nl += 21; nt += 20; QWidget *desktop = QApplication::desktop(); if (nl + (int)data.geometry[WIDTH].value > desktop->width()) nl = 0; if (nt + (int)data.geometry[WIDTH].value > desktop->width()) nt = 0; if ((nl != (int)data.geometry[LEFT].value) && (nt != (int)data.geometry[TOP].value)){ data.geometry[LEFT].value = nl; data.geometry[TOP].value = nt; bOK = false; } } } ++it; } if (bOK) break; } delete list; } setStatusSize(CorePlugin::m_plugin->getContainerStatusSize()); showBar(); m_bInit = true; } m_bInSize = true; restoreGeometry(this, data.geometry, bPos, true); m_bInSize = false; connect(m_tabBar, SIGNAL(selected(int)), this, SLOT(contactSelected(int))); connect(this, SIGNAL(toolBarPositionChanged(QToolBar*)), this, SLOT(toolbarChanged(QToolBar*))); connect(m_status, SIGNAL(sizeChanged(int)), this, SLOT(statusChanged(int))); m_accel = new QAccel(this); connect(m_accel, SIGNAL(activated(int)), this, SLOT(accelActivated(int))); setupAccel(); }
GroupEditor::GroupEditor(ConfigEstateGroupList *newList, QWidget *parent) : KDialogBase(KDialogBase::Plain, i18n("Group Editor"), Ok|Apply|Cancel, Ok, parent, "Group Editor", false, true), mylist(*newList) { setWFlags(WDestructiveClose); list = newList; QFrame *page = plainPage(); QHBoxLayout *hlayout = new QHBoxLayout(page, marginHint(), spacingHint()); groups = new KListBox(page); hlayout->addWidget(groups); connect(groups, SIGNAL(highlighted(QListBoxItem *)), this, SLOT(updateSettings(QListBoxItem *))); QStringList newgroups; for (ConfigEstateGroupList::Iterator it = list->begin(); it != list->end(); ++it) newgroups.append((*it).name()); groups->insertStringList(newgroups); connect(groups, SIGNAL(selectionChanged()), this, SLOT(selectionChanged())); QVBoxLayout *vlayout = new QVBoxLayout(hlayout, spacingHint()); colorGroupBox = new QVGroupBox(i18n("&Colors"), page); vlayout->addWidget(colorGroupBox); (void) new QLabel(i18n("Foreground:"), colorGroupBox); fgButton = new KColorButton(colorGroupBox, "Foreground Button"); connect(fgButton, SIGNAL(changed(const QColor &)), this, SLOT(fgChanged(const QColor &))); connect(fgButton, SIGNAL(changed(const QColor &)), this, SIGNAL(changed())); (void) new QLabel(i18n("Background:"), colorGroupBox); bgButton = new KColorButton(colorGroupBox, "Background Button"); connect(bgButton, SIGNAL(changed(const QColor &)), this, SLOT(bgChanged(const QColor &))); connect(bgButton, SIGNAL(changed(const QColor &)), this, SIGNAL(changed())); pricesGroupBox = new QVGroupBox(i18n("&Prices"), page); vlayout->addWidget(pricesGroupBox); pricesWidget = new QWidget(pricesGroupBox); QGridLayout *pricesLayout = new QGridLayout(pricesWidget, 2, 2, 0, spacingHint()); pricesLayout->addWidget(new QLabel(i18n("House price:"), pricesWidget), 0, 0); pricesLayout->addWidget(housePrice = new QSpinBox(0, 3000, 25, pricesWidget), 0, 1); housePrice->setSpecialValueText(i18n("None")); housePrice->setSuffix(i18n("$")); connect(housePrice, SIGNAL(valueChanged(int)), this, SLOT(housePriceChanged(int))); pricesLayout->addWidget(new QLabel(i18n("Global price:"), pricesWidget), 1, 0); pricesLayout->addWidget(globalPrice = new QSpinBox(0, 3000, 25, pricesWidget), 1, 1); globalPrice->setSpecialValueText(i18n("None")); globalPrice->setSuffix(i18n("$")); connect(globalPrice, SIGNAL(valueChanged(int)), this, SLOT(globalPriceChanged(int))); dynamicGroupBox = new QVGroupBox(i18n("&Dynamic Rent"), page); vlayout->addWidget(dynamicGroupBox); mathWidget = new QWidget(dynamicGroupBox); QGridLayout *mathLayout = new QGridLayout(mathWidget, 2, 2, 0, spacingHint()); mathLayout->addWidget(new QLabel(i18n("Add rent variable:"), mathWidget), 0, 0); mathLayout->addWidget(new QLabel(i18n("Expression:"), mathWidget), 1, 0); QComboBox *rentVarCombo = new QComboBox(mathWidget); QStringList vars; vars << "DICE"; vars << "HOUSES"; vars << "GROUPOWNED"; rentVarCombo->insertStringList(vars); mathLayout->addWidget(rentVarCombo, 0, 1); rentMathEdit = new KLineEdit(mathWidget); connect(rentMathEdit, SIGNAL(textChanged(const QString &)), this, SLOT(rentMathChanged(const QString &))); connect(rentVarCombo, SIGNAL(activated(const QString &)), rentMathEdit, SLOT(insert(const QString &))); mathLayout->addWidget(rentMathEdit, 1, 1); QHBoxLayout *buttonlayout = new QHBoxLayout(vlayout, spacingHint()); KPushButton *addB = new KPushButton(i18n("&Add..."), page); buttonlayout->addWidget(addB); connect(addB, SIGNAL(clicked()), this, SLOT(add())); removeB = new KPushButton(i18n("&Remove"), page); buttonlayout->addWidget(removeB); connect(removeB, SIGNAL(clicked()), this, SLOT(remove())); selectionChanged(); }