Exemple #1
1
LoginDialog::LoginDialog()
        : LoginDlgBase(NULL, "logindlg", false, WDestructiveClose)
{
    SET_WNDPROC("login")
    setCaption(caption());
    setButtonsPict(this);
    setIcon(Pict("licq"));
    bLogin = false;
    bMyInit = false;
    cmbUIN->setEditable(true);
    cmbUIN->lineEdit()->setValidator(new QIntValidator(100000, 0x7FFFFFFF, this));
    loadUins();
    edtPasswd->setEchoMode(QLineEdit::Password);
    connect(cmbUIN->lineEdit(), SIGNAL(textChanged(const QString&)), this, SLOT(uinChanged(const QString&)));
    connect(edtPasswd, SIGNAL(textChanged(const QString&)), this, SLOT(pswdChanged(const QString&)));
    connect(btnClose, SIGNAL(clicked()), this, SLOT(close()));
    connect(btnLogin, SIGNAL(clicked()), this, SLOT(login()));
    connect(btnDelete, SIGNAL(clicked()), this, SLOT(deleteUin()));
    connect(btnProxy, SIGNAL(clicked()), this, SLOT(proxySetup()));
    connect(chkSave, SIGNAL(toggled(bool)), this, SLOT(saveChanged(bool)));
    QSize s = sizeHint();
    QWidget *desktop = QApplication::desktop();
    move((desktop->width() - s.width()) / 2, (desktop->height() - s.height()) / 2);
    chkSave->setChecked(pSplash->isSavePassword());
    chkNoShow->setChecked(pSplash->isNoShowLogin());
    uinChanged("");
    bPswdChanged = true;
    if (pSplash->isSavePassword()){
        unsigned long uin = cmbUIN->lineEdit()->text().toULong();
        if (uin){
            pClient->load(uin);
            QString pswd;
            for (const char *p = pClient->EncryptedPassword.c_str(); *p; p++){
                if (*p == '\\') continue;
                pswd += '*';
            }
            edtPasswd->setText(pswd);
            pswdChanged("");
            if (!pswd.isEmpty()) bPswdChanged = false;
        }
    }
    bCloseMain = true;
};
Exemple #2
1
BalloonMsg::BalloonMsg(void *param, const QString &_text, QStringList &btn, QWidget *parent, const QRect *rcParent,
                       bool bModal, bool bAutoHide, unsigned bwidth, const QString &box_msg, bool *bChecked)
        : QDialog(parent, "ballon", bModal,
                  (bAutoHide ? WType_Popup : WType_TopLevel | WStyle_StaysOnTop)
                  | WStyle_Customize | WStyle_NoBorderEx | WStyle_Tool | WDestructiveClose | WX11BypassWM)
{
    m_param = param;
    m_parent = parent;
    m_width = bwidth;
    m_bAutoHide = bAutoHide;
    m_bYes = false;
    m_bChecked = bChecked;
    bool bTailDown = true;
    setPalette(QToolTip::palette());
    text = _text;
    QFrame *frm = new QFrame(this);
    frm->setPalette(palette());
    QVBoxLayout *vlay = new QVBoxLayout(frm);
    vlay->setMargin(0);
    m_check = NULL;
    if (!box_msg.isEmpty()){
        m_check = new QCheckBox(box_msg, frm);
        vlay->addWidget(m_check);
        if (m_bChecked)
            m_check->setChecked(*m_bChecked);
    }
    QHBoxLayout *lay = new QHBoxLayout(vlay);
    lay->setSpacing(5);
    lay->addStretch();
    unsigned id = 0;
    bool bFirst = true;
    for (QStringList::Iterator it = btn.begin(); it != btn.end(); ++it, id++){
        BalloonButton *b = new BalloonButton(*it, frm, id);
        connect(b, SIGNAL(action(int)), this, SLOT(action(int)));
        lay->addWidget(b);
        if (bFirst){
            b->setDefault(true);
            bFirst = false;
        }
    }
    setButtonsPict(this);
    lay->addStretch();
    int wndWidth = frm->minimumSizeHint().width();
    int hButton  = frm->minimumSizeHint().height();

    int txtWidth = bwidth;
    QRect rc;
    if (rcParent){
        rc = *rcParent;
    }else{
        QPoint p = parent->mapToGlobal(parent->rect().topLeft());
        rc = QRect(p.x(), p.y(), parent->width(), parent->height());
    }
    if (rc.width() > txtWidth) txtWidth = rc.width();

    QSimpleRichText richText(_text, font(), "", QStyleSheet::defaultSheet(), QMimeSourceFactory::defaultFactory(), -1, Qt::blue, false);
    richText.setWidth(wndWidth);
    richText.adjustSize();
    QSize s(richText.widthUsed(), richText.height());
    QSize sMin = frm->minimumSizeHint();
    if (s.width() < sMin.width())
        s.setWidth(sMin.width());
    int BALLOON_SHADOW = BALLOON_SHADOW_DEF;
#ifdef WIN32
	/* FIXME */
/*    if ((GetClassLong(winId(), GCL_STYLE) & CS_DROPSHADOW) && style().inherits("QWindowsXPStyle"))
        BALLOON_SHADOW = 0; */
#endif
    resize(s.width() + BALLOON_R * 2 + BALLOON_SHADOW,
           s.height() + BALLOON_R * 2 + BALLOON_TAIL + BALLOON_SHADOW + hButton + BALLOON_MARGIN);
    mask = QBitmap(width(), height());
    int w = width() - BALLOON_SHADOW;
    int tailX = w / 2;
    int posX = rc.left() + rc.width() / 2 + BALLOON_TAIL_WIDTH - tailX;
    if (posX <= 0) posX = 1;
    QRect rcScreen = screenGeometry();
    if (posX + width() >= rcScreen.width())
        posX = rcScreen.width() - 1 - width();
    int tx = posX + tailX - BALLOON_TAIL_WIDTH;
    if (tx < rc.left()) tx = rc.left();
    if (tx > rc.left() + rc.width()) tx = rc.left() + rc.width();
    tailX = tx + BALLOON_TAIL_WIDTH - posX;
    if (tailX < BALLOON_R) tailX = BALLOON_R;
    if (tailX > width() - BALLOON_R - BALLOON_TAIL_WIDTH) tailX = width() - BALLOON_R - BALLOON_TAIL_WIDTH;
    if (rc.top() <= height() + 2){
        bTailDown = false;
        move(posX, rc.top() + rc.height() + 1);
    }else{
        move(posX, rc.top() - height() - 1);
    }
    int pos = 0;
    int h = height() - BALLOON_SHADOW - BALLOON_TAIL;
    if (!bTailDown) pos += BALLOON_TAIL;
    textRect.setRect(BALLOON_R, pos + BALLOON_R, w - BALLOON_R * 2, h);
    frm->resize(s.width(), hButton);
    frm->move(BALLOON_R, pos + h - BALLOON_R - hButton);
    QPainter p;
    p.begin(&mask);
#ifdef WIN32
    QColor bg(255, 255, 255);
    QColor fg(0, 0, 0);
#else
    QColor bg(0, 0, 0);
    QColor fg(255, 255, 255);
#endif
    p.fillRect(0, 0, width(), height(), bg);
    p.fillRect(0, pos + BALLOON_R, w, h - BALLOON_R * 2, fg);
    p.fillRect(BALLOON_R, pos, w - BALLOON_R * 2, h, fg);
    p.fillRect(BALLOON_SHADOW, pos + BALLOON_R + BALLOON_SHADOW, w, h - BALLOON_R * 2, fg);
    p.fillRect(BALLOON_R + BALLOON_SHADOW, pos + BALLOON_SHADOW, w - BALLOON_R * 2, h, fg);
    p.setBrush(fg);
    p.drawEllipse(0, pos, BALLOON_R * 2, BALLOON_R * 2);
    p.drawEllipse(w - BALLOON_R * 2, pos, BALLOON_R * 2, BALLOON_R * 2);
    p.drawEllipse(w - BALLOON_R * 2, pos + h - BALLOON_R * 2, BALLOON_R * 2, BALLOON_R * 2);
    p.drawEllipse(0, pos + h - BALLOON_R * 2, BALLOON_R * 2, BALLOON_R * 2);
    p.drawEllipse(BALLOON_SHADOW, pos + BALLOON_SHADOW, BALLOON_R * 2, BALLOON_R * 2);
    p.drawEllipse(w - BALLOON_R * 2 + BALLOON_SHADOW, pos + BALLOON_SHADOW, BALLOON_R * 2, BALLOON_R * 2);
    p.drawEllipse(w - BALLOON_R * 2 + BALLOON_SHADOW, pos + h - BALLOON_R * 2 + BALLOON_SHADOW, BALLOON_R * 2, BALLOON_R * 2);
    p.drawEllipse(BALLOON_SHADOW, pos + h - BALLOON_R * 2 + BALLOON_SHADOW, BALLOON_R * 2, BALLOON_R * 2);
    QPointArray arr(3);
    arr.setPoint(0, tailX, bTailDown ? h : pos);
    arr.setPoint(1, tailX + BALLOON_TAIL_WIDTH, bTailDown ? h : pos);
    arr.setPoint(2, tailX - BALLOON_TAIL_WIDTH, bTailDown ? height() - BALLOON_SHADOW : 0);
    p.drawPolygon(arr);
    arr.setPoint(0, tailX + BALLOON_SHADOW, (bTailDown ? h : pos) + BALLOON_SHADOW);
    arr.setPoint(1, tailX + BALLOON_TAIL_WIDTH + BALLOON_SHADOW, (bTailDown ? h : pos) + BALLOON_SHADOW);
    arr.setPoint(2, tailX - BALLOON_TAIL_WIDTH + BALLOON_SHADOW, bTailDown ? height() : BALLOON_SHADOW);
    p.drawPolygon(arr);
    p.end();
    setMask(mask);
    qApp->syncX();
    QPixmap pict = QPixmap::grabWindow(QApplication::desktop()->winId(), x(), y(), width(), height());
    intensity(pict, -0.50f);
    p.begin(&pict);
    p.setBrush(colorGroup().background());
    p.drawEllipse(0, pos, BALLOON_R * 2, BALLOON_R * 2);
    p.drawEllipse(w - BALLOON_R * 2, pos, BALLOON_R * 2, BALLOON_R * 2);
    p.drawEllipse(w - BALLOON_R * 2, pos + h - BALLOON_R * 2, BALLOON_R * 2, BALLOON_R * 2);
    p.drawEllipse(0, pos + h - BALLOON_R * 2, BALLOON_R * 2, BALLOON_R * 2);
    arr.setPoint(0, tailX, bTailDown ? h - 1 : pos + 1);
    arr.setPoint(1, tailX + BALLOON_TAIL_WIDTH, bTailDown ? h - 1 : pos + 1);
    arr.setPoint(2, tailX - BALLOON_TAIL_WIDTH, bTailDown ? height() - BALLOON_SHADOW : 0);
    p.drawPolygon(arr);
    p.fillRect(0, pos + BALLOON_R, w, h - BALLOON_R * 2, colorGroup().background());
    p.fillRect(BALLOON_R, pos, w - BALLOON_R * 2, h, colorGroup().background());
    p.drawLine(0, pos + BALLOON_R, 0, pos + h - BALLOON_R);
    p.drawLine(w - 1, pos + BALLOON_R, w - 1, pos + h - BALLOON_R);
    if (bTailDown){
        p.drawLine(BALLOON_R, 0, w - BALLOON_R, 0);
        p.drawLine(BALLOON_R, h - 1, tailX, h - 1);
        p.drawLine(tailX + BALLOON_TAIL_WIDTH, h - 1, w - BALLOON_R, h - 1);
    }else{
        p.drawLine(BALLOON_R, pos + h - 1, w - BALLOON_R, pos + h - 1);
        p.drawLine(BALLOON_R, pos, tailX, pos);
        p.drawLine(tailX + BALLOON_TAIL_WIDTH, pos, w - BALLOON_R, pos);
    }
    p.end();
    setBackgroundPixmap(pict);
    setAutoMask(true);
    if (!bAutoHide)
        setFocusPolicy(NoFocus);

    QWidget *top = NULL;
    if (parent)
        top = parent->topLevelWidget();
    if (top){
        raiseWindow(top);
        top->installEventFilter(this);
    }
}
Exemple #3
0
DiscoInfo::DiscoInfo(JabberBrowser *browser)
        : DiscoInfoBase(browser, NULL, false, WDestructiveClose)
{
    m_browser = browser;
    SET_WNDPROC("jbrowser")
    setIcon(Pict("Jabber_online"));
    setTitle();
    setButtonsPict(this);
    connect(buttonApply, SIGNAL(clicked()), this, SLOT(apply()));
    m_bVersion = true;
    m_bTime    = true;
    m_bLast	   = true;
    m_bStat	   = true;
    m_bVCard   = true;
    m_about    = NULL;
    load_data(jabberUserData, &m_data, NULL);
    disableWidget(edtJName);
    disableWidget(edtType);
    disableWidget(edtCategory);
    edtNameSpace->setReadOnly(true);
    disableWidget(edtName);
    disableWidget(edtVersion);
    disableWidget(edtSystem);
    disableWidget(edtTime);
    disableWidget(edtLast);
    lstStat->addColumn(i18n("Name"));
    lstStat->addColumn(i18n("Units"));
    lstStat->addColumn(i18n("Value"));
    lstStat->setExpandingColumn(2);
    btnUrl->setPixmap(Pict("home"));
    connect(btnUrl, SIGNAL(clicked()), this, SLOT(goUrl()));
    connect(edtUrl, SIGNAL(textChanged(const QString&)), this, SLOT(urlChanged(const QString&)));
}
Exemple #4
0
LoginDialog::LoginDialog(bool bInit, Client *client)
        : LoginDialogBase(NULL, "logindlg",
                          client ? false : true,
                          client ? WDestructiveClose : 0)
{
    m_bInit  = bInit;
    m_bProfileChanged = false;
    m_profile = CorePlugin::m_plugin->getProfile();
    m_client = client;
    SET_WNDPROC("login")
    setIcon(Pict("licq"));
    setButtonsPict(this);
    if (m_client){
        setCaption(caption());
    }else{
        setCaption(i18n("Select profile"));
    }
    if (m_client){
        chkSave->hide();
        chkNoShow->hide();
        btnDelete->hide();
        cmbProfile->hide();
        lblProfile->hide();
    }
    chkSave->setChecked(CorePlugin::m_plugin->getSavePasswd());
    chkNoShow->setChecked(CorePlugin::m_plugin->getNoShow());
    connect(buttonOk, SIGNAL(clicked()), this, SLOT(apply()));
    connect(chkSave, SIGNAL(toggled(bool)), this, SLOT(saveToggled(bool)));
    saveToggled(CorePlugin::m_plugin->getSavePasswd());
    fill();
    connect(cmbProfile, SIGNAL(activated(int)), this, SLOT(profileChanged(int)));
    connect(btnDelete, SIGNAL(clicked()), this, SLOT(profileDelete()));
    profileChanged(cmbProfile->currentItem());
}
UserConfig::UserConfig(Contact *contact, Group *group)
        : QDialog( NULL)
{
    this->setAttribute( Qt::WA_DeleteOnClose);
    setupUi( this);
    m_contact  = contact;
    m_group    = group;
    m_nUpdates = 0;

    SET_WNDPROC("configure")
    setIcon(Pict(contact ? "info" : "configure").pixmap());
    setButtonsPict(this);
    setTitle();
    QIcon iconSet = Icon("webpress");
    if (!iconSet.pixmap(QIcon::Small, QIcon::Normal).isNull())
        btnUpdate->setIconSet(iconSet);
    btnUpdate->hide();

    lstBox->setHScrollBarMode(Q3ScrollView::AlwaysOff);
    lstBox->setSorting(1);
    lstBox->header()->hide();

    fill();

    connect(lstBox, SIGNAL(currentChanged(Q3ListViewItem*)), this, SLOT(itemSelected(Q3ListViewItem*)));
    connect(buttonApply, SIGNAL(clicked()), this, SLOT(apply()));
    connect(btnUpdate, SIGNAL(clicked()), this, SLOT(updateInfo()));

    lstBox->setCurrentItem(lstBox->firstChild());
    itemSelected(lstBox->firstChild());
}
Exemple #6
0
FileTransferDlg::FileTransferDlg(FileMessage *msg)
        : FileTransferBase(NULL, "filetransfer", false, WDestructiveClose)
{
    m_msg = msg;
    SET_WNDPROC("filetransfer")
    setIcon(Pict("file"));
    setButtonsPict(this);
    setCaption((msg->getFlags() & MESSAGE_RECEIVED) ? i18n("Receive file") : i18n("Send file"));
    disableWidget(edtTime);
    disableWidget(edtEstimated);
    disableWidget(edtSpeed);
    msg->m_transfer->setNotify(new FileTransferDlgNotify(this));
    sldSpeed->setValue(m_msg->m_transfer->speed());
    connect(sldSpeed, SIGNAL(valueChanged(int)), this, SLOT(speedChanged(int)));
    m_time  = 0;
    m_timer = new QTimer(this);
    connect(m_timer, SIGNAL(timeout()), this, SLOT(timeout()));
    m_timer->start(1000);
    printTime();
    m_bTransfer = false;
    m_transferTime = 0;
    m_speed     = 0;
    m_nAverage  = 0;
    m_files		= 0;
    m_bytes		= 0;
    m_fileSize	= 0;
    m_totalBytes = 0;
    m_totalSize	= 0;
    m_state = FileTransfer::Unknown;
    connect(btnCancel, SIGNAL(clicked()), this, SLOT(close()));
    chkClose->setChecked(CorePlugin::m_plugin->getCloseTransfer());
    connect(chkClose, SIGNAL(toggled(bool)), this, SLOT(closeToggled(bool)));
}
Exemple #7
0
GpgGen::GpgGen(GpgCfg *cfg)
        : GpgGenBase(NULL, NULL, true)
{
    SET_WNDPROC("genkey")
    setIcon(Pict("encrypted"));
    setButtonsPict(this);
    setCaption(caption());
    cmbMail->setEditable(true);
    m_exec = NULL;
    m_cfg  = cfg;
    connect(edtName, SIGNAL(textChanged(const QString&)), this, SLOT(textChanged(const QString&)));
    connect(cmbMail->lineEdit(), SIGNAL(textChanged(const QString&)), this, SLOT(textChanged(const QString&)));
    Contact *owner = getContacts()->owner();
    if (owner){
        QString name;
        name = owner->getFirstName();
        QString firstName = getToken(name, '/');
        name  = owner->getLastName();
        QString lastName  = getToken(name, '/');

        if (firstName.isEmpty() || lastName.isEmpty()){
            name = firstName + lastName;
        }else{
            name = firstName + " " + lastName;
        }
        edtName->setText(name);
        QString mails = owner->getEMails();
        while (!mails.isEmpty()){
            QString item = getToken(mails, ';');
            QString mail = getToken(item, '/');
            cmbMail->insertItem(mail);
        }
    }
}
Exemple #8
0
UserConfig::UserConfig(Contact *contact, Group *group)
        : ConfigureDialogBase(NULL, "userconfig", false, WDestructiveClose)
{
    m_contact  = contact;
    m_group    = group;
    m_nUpdates = 0;

    SET_WNDPROC("configure")
    setIcon(Pict(contact ? "info" : "configure"));
    setButtonsPict(this);
    setTitle();
    const QIconSet *iconSet = Icon("webpress");
    if (iconSet)
        btnUpdate->setIconSet(*iconSet);
    btnUpdate->hide();

    lstBox->setHScrollBarMode(QScrollView::AlwaysOff);
    lstBox->setSorting(1);
    lstBox->header()->hide();

    fill();

    connect(lstBox, SIGNAL(currentChanged(QListViewItem*)), this, SLOT(itemSelected(QListViewItem*)));
    connect(buttonApply, SIGNAL(clicked()), this, SLOT(apply()));
    connect(btnUpdate, SIGNAL(clicked()), this, SLOT(updateInfo()));

    lstBox->setCurrentItem(lstBox->firstChild());
    itemSelected(lstBox->firstChild());
}
Exemple #9
0
NewProtocol::NewProtocol(QWidget *parent)
        : NewProtocolBase(parent, "new_protocol", true)
{
    m_setup  = NULL;
    m_client = NULL;
    m_last   = NULL;
    m_connectWnd = NULL;
    m_bConnected = false;
    m_bConnect = false;
    m_bStart   = (parent == NULL);
    SET_WNDPROC("protocol")
    setIcon(Pict("configure"));
    setButtonsPict(this);
    setCaption(caption());
    helpButton()->hide();
    for (unsigned n = 0;; n++){
        Event e(EventPluginGetInfo, (void*)n);
        pluginInfo *info = (pluginInfo*)e.process();
        if (info == NULL)
            break;
        if (info->info == NULL){
            Event e(EventLoadPlugin, info->name);
            e.process();
            if (info->info && !(info->info->flags & (PLUGIN_PROTOCOL & ~PLUGIN_NOLOAD_DEFAULT))){
                Event e(EventUnloadPlugin, info->name);
                e.process();
            }
        }
        if ((info->info == NULL) || !(info->info->flags & (PLUGIN_PROTOCOL & ~PLUGIN_NOLOAD_DEFAULT)))
            continue;
        info->bDisabled = false;
        Event eApply(EventApplyPlugin, info->name);
        eApply.process();
    }
    Protocol *protocol;
    ContactList::ProtocolIterator it;
    while ((protocol = ++it) != NULL){
        const CommandDef *cmd = protocol->description();
        if (cmd == NULL)
            continue;
        m_protocols.push_back(protocol);
    }
    sort(m_protocols.begin(), m_protocols.end(), cmp_protocol);
    for (unsigned i = 0; i < m_protocols.size(); i++){
        const CommandDef *cmd = m_protocols[i]->description();
        cmbProtocol->insertItem(Pict(cmd->icon), i18n(cmd->text));
    }
    connect(cmbProtocol, SIGNAL(activated(int)), this, SLOT(protocolChanged(int)));
    cmbProtocol->setCurrentItem(0);
    protocolChanged(0);
    connect(this, SIGNAL(selected(const QString&)), this, SLOT(pageChanged(const QString&)));
}
Exemple #10
0
GpgFind::GpgFind(EditFile *edt)
        : GpgFindBase(NULL, NULL, false, WDestructiveClose)
{
    SET_WNDPROC("find")
    setIcon(Pict("find"));
    setButtonsPict(this);
    setCaption(caption());
    m_edit = edt;
    connect(btnCancel, SIGNAL(clicked()), this, SLOT(close()));
    m_drives = *QDir::drives();
    m_drive  = m_drives.first();
    QTimer::singleShot(0, this, SLOT(next()));
}
WIfaceCfg::WIfaceCfg(QWidget *parent, WeatherPlugin *plugin)
        : WIfaceCfgBase(parent)
{
    m_plugin = plugin;
    setButtonsPict(this);
    edtText->setText(unquoteText(m_plugin->getButtonText()));
    edtTip->setText(m_plugin->getTipText());
    edtForecastTip->setText(m_plugin->getForecastText());
    edtText->helpList = helpList;
    edtTip->helpList = helpList;
    edtForecastTip->helpList = helpForecastList;
    connect(btnHelp, SIGNAL(clicked()), this, SLOT(help()));
}
GpgFind::GpgFind(EditFile *edt)
        : QDialog( NULL, Qt::WA_DeleteOnClose)
{
    setupUi( this);
    SET_WNDPROC("find")
    setIcon(Pict("find"));
    setButtonsPict(this);
    setCaption(caption());
    m_edit = edt;
    connect(btnCancel, SIGNAL(clicked()), this, SLOT(close()));
    m_drives = *QDir::drives();
    m_drive  = m_drives.first();
    QTimer::singleShot(0, this, SLOT(next()));
}
Exemple #13
0
SecureDlg::SecureDlg(ICQClient *client, unsigned contact, struct ICQUserData *data)
        : SecureDlgBase(NULL, "securedlg", false, WDestructiveClose)
{
    SET_WNDPROC("secure")
    setIcon(Pict("encrypted"));
    setButtonsPict(this);
    setCaption(caption());
    m_client  = client;
    m_contact = contact;
    m_data    = data;
    m_msg	  = NULL;
    connect(btnCancel, SIGNAL(clicked()), this, SLOT(close()));
    QTimer::singleShot(0, this, SLOT(start()));
}
ConnectionSettings::ConnectionSettings(Client *client)
        : ConnectionSettingsBase(NULL, NULL, true)
{
    SET_WNDPROC("client")
    setButtonsPict(this);
    m_client = client;
    Protocol *protocol = client->protocol();
    const CommandDef *cmd = protocol->description();
    setIcon(Pict(cmd->icon));
    setCaption(i18n("Configure %1 client") .arg(i18n(cmd->text)));
    QVBoxLayout *lay = new QVBoxLayout(addWnd);
    QWidget *setupWnd = client->setupWnd();
    setupWnd->reparent(addWnd, QPoint());
    lay->addWidget(setupWnd);
    setupWnd->show();
}
SearchDialog::SearchDialog()
{
    SET_WNDPROC("search")
    setIcon(Pict("find"));
    setButtonsPict(this);
    setCaption(i18n("Search"));
    m_current = NULL;
    m_currentResult = NULL;
    m_bAdd = true;
    m_id		= 0;
    m_result_id = 0;
    m_active	= NULL;
    m_search	= new SearchBase(this);
    m_update = new QTimer(this);
    connect(m_update, SIGNAL(timeout()), this, SLOT(update()));
    setCentralWidget(m_search);
    m_status = statusBar();
    m_result = NULL;
    setAdd(false);
    m_search->btnOptions->setIconSet(Icon("1downarrow"));
    m_search->btnAdd->setIconSet(Icon("add"));
    m_search->btnNew->setIconSet(Icon("new"));
    connect(m_search->wndCondition, SIGNAL(aboutToShow(QWidget*)), this, SLOT(aboutToShow(QWidget*)));
    connect(m_search->wndResult, SIGNAL(aboutToShow(QWidget*)), this, SLOT(resultShow(QWidget*)));
    fillClients();
    connect(m_search->cmbClients, SIGNAL(activated(int)), this, SLOT(clientActivated(int)));
    m_result = new ListView(m_search->wndResult);
    m_result->addColumn(i18n("Results"));
    m_result->setShowSortIndicator(true);
    m_result->setExpandingColumn(0);
    m_result->setFrameShadow(QFrame::Sunken);
    m_result->setLineWidth(1);
    addResult(m_result);
    showResult(NULL);
    aboutToShow(m_search->wndCondition->visibleWidget());
    connect(m_search->btnSearch, SIGNAL(clicked()), this, SLOT(searchClick()));
    m_search->cmbClients->setFocus();
    connect(m_search->btnOptions, SIGNAL(clicked()), this, SLOT(optionsClick()));
    connect(m_search->btnAdd, SIGNAL(clicked()), this, SLOT(addClick()));
    m_search->btnOptions->setEnabled(false);
    m_search->btnAdd->setEnabled(false);
    connect(m_result, SIGNAL(selectionChanged()), this, SLOT(selectionChanged()));
    connect(m_result, SIGNAL(dragStart()), this, SLOT(dragStart()));
    connect(m_search->btnNew, SIGNAL(clicked()), this, SLOT(newSearch()));
    m_result->setMenu(MenuSearchItem);
    resultShow(m_result);
}
Exemple #16
0
ConnectionManager::ConnectionManager(bool bModal)
        : ConnectionManagerBase(NULL, "manager", bModal)
{
    SET_WNDPROC("manager")
    setIcon(Pict("configure"));
    setButtonsPict(this);
    setCaption(caption());
    lstConnection->setHScrollBarMode(QScrollView::AlwaysOff);
    lstConnection->header()->hide();
    lstConnection->setSorting(1);
    fill();
    connect(btnAdd, SIGNAL(clicked()), this, SLOT(addClient()));
    connect(btnRemove, SIGNAL(clicked()), this, SLOT(removeClient()));
    connect(btnUp, SIGNAL(clicked()), this, SLOT(upClient()));
    connect(btnDown, SIGNAL(clicked()), this, SLOT(downClient()));
    connect(btnUpdate, SIGNAL(clicked()), this, SLOT(updateClient()));
    connect(lstConnection, SIGNAL(selectionChanged()), this, SLOT(selectionChanged()));
    m_bModal = bModal;
}
EditMail::EditMail(QWidget *parent, const QString &mail, bool bPublish, bool bShowPublish)
        : QDialog( parent)
{
    this->setAttribute( Qt::WA_DeleteOnClose);
    setupUi( this);
    SET_WNDPROC("editmail")
    setIcon(Pict("mail_generic").pixmap());
    setButtonsPict(this);
    setCaption(mail.isEmpty() ? i18n("Add mail address") : i18n("Edit mail address"));
    edtMail->setText(mail);
    connect(edtMail, SIGNAL(textChanged(const QString&)), this, SLOT(textChanged(const QString&)));
    textChanged(mail);
    edtMail->setFocus();
    publish = bPublish;
    if (bShowPublish){
        chkPublish->setChecked(publish);
    }else{
        chkPublish->hide();
    }
}
Exemple #18
0
ProxyError::ProxyError(ProxyPlugin *plugin, TCPClient *client, const char *msg)
        : ProxyErrorBase(NULL, NULL, false, WDestructiveClose)
{
    SET_WNDPROC("proxy")
    setIcon(Pict("error"));
    setButtonsPict(this);
    setCaption(caption());
    m_plugin = plugin;
    m_client = client;
    if (msg && *msg)
        lblMessage->setText(i18n(msg));
    if (layout() && layout()->inherits("QBoxLayout")){
        QBoxLayout *lay = static_cast<QBoxLayout*>(layout());
        ProxyConfig *cfg = new ProxyConfig(this, m_plugin, NULL, m_client);
        lay->insertWidget(1, cfg);
        cfg->show();
        setMinimumSize(sizeHint());
        connect(this, SIGNAL(apply()), cfg, SLOT(apply()));
    }
}
Exemple #19
0
LoginDialog::LoginDialog(bool bInit, Client *client, const QString &text, const char *loginProfile)
        : LoginDialogBase(NULL, "logindlg",
                          client ? false : true,
                          client ? WDestructiveClose : 0)
{
    m_bInit  = bInit;
    m_bProfileChanged = false;
    m_profile = CorePlugin::m_plugin->getProfile();
    m_client = client;
    m_bLogin = false;
    if (loginProfile && *loginProfile){
        m_loginProfile = loginProfile;
    }else{
        btnDelete->hide();
    }
    SET_WNDPROC("login")
    setButtonsPict(this);
    lblMessage->setText(text);
    if (m_client){
        setCaption(caption() + " " + QString::fromLocal8Bit(client->name().c_str()));
        setIcon(Pict(m_client->protocol()->description()->icon));
    }else{
        setCaption(i18n("Select profile"));
        setIcon(Pict("licq"));
    }
    if (m_client){
        chkSave->hide();
        chkNoShow->hide();
        btnDelete->hide();
        cmbProfile->hide();
        lblProfile->hide();
    }
    chkSave->setChecked(CorePlugin::m_plugin->getSavePasswd());
    chkNoShow->setChecked(CorePlugin::m_plugin->getNoShow());
    connect(chkSave, SIGNAL(toggled(bool)), this, SLOT(saveToggled(bool)));
    saveToggled(CorePlugin::m_plugin->getSavePasswd());
    fill();
    connect(cmbProfile, SIGNAL(activated(int)), this, SLOT(profileChanged(int)));
    connect(btnDelete, SIGNAL(clicked()), this, SLOT(profileDelete()));
    profileChanged(cmbProfile->currentItem());
}
DiscoInfo::DiscoInfo(JabberBrowser *browser, const QString &features,
                     const QString &name, const QString &type, const QString &category)
        : QDialog( NULL)
{
    setAttribute( Qt::WA_DeleteOnClose);
    setupUi( this);
    m_browser = browser;
    SET_WNDPROC("jbrowser")
    setIcon(Pict("Jabber_online").pixmap());
    setTitle();
    setButtonsPict(this);
    connect(buttonApply, SIGNAL(clicked()), this, SLOT(apply()));
    m_bVersion = true;
    m_bTime    = true;
    m_bLast	   = true;
    m_bStat	   = true;
    m_bVCard   = true;
    m_about    = NULL;
    m_features = features;
    m_name	   = name;
    m_type	   = type;
    m_category = category;
    load_data(jabberUserData, &m_data, NULL);
    disableWidget(edtJName);
    disableWidget(edtType);
    disableWidget(edtCategory);
    edtNameSpace->setReadOnly(true);
    disableWidget(edtName);
    disableWidget(edtVersion);
    disableWidget(edtSystem);
    disableWidget(edtTime);
    disableWidget(edtLast);
    lstStat->addColumn(i18n("Name"));
    lstStat->addColumn(i18n("Units"));
    lstStat->addColumn(i18n("Value"));
    lstStat->setExpandingColumn(2);
    btnUrl->setPixmap(Pict("home").pixmap());
    connect(btnUrl, SIGNAL(clicked()), this, SLOT(goUrl()));
    connect(edtUrl, SIGNAL(textChanged(const QString&)), this, SLOT(urlChanged(const QString&)));
}
ActionConfig::ActionConfig(QWidget *parent, struct ActionUserData *data, ActionPlugin *plugin)
        : ActionConfigBase(parent)
{
    m_data   = data;
    m_plugin = plugin;
    m_menu   = NULL;
    setButtonsPict(this);

    lstEvent->addColumn(i18n("Event"));
    lstEvent->addColumn(i18n("Program"));
    lstEvent->setExpandingColumn(1);

    connect(btnHelp, SIGNAL(clicked()), this, SLOT(help()));

    QListViewItem *item = new QListViewItem(lstEvent, i18n("Contact online"));
    item->setText(2, QString::number(CONTACT_ONLINE));
    item->setPixmap(0, makePixmap("ICQ"));
    if (data->OnLine.ptr)
        item->setText(1, QString::fromUtf8(data->OnLine.ptr));

    item = new QListViewItem(lstEvent, i18n("Status changed"));
    item->setText(2, QString::number(CONTACT_STATUS));
    item->setPixmap(0, makePixmap("ICQ"));
    if (data->Status.ptr)
        item->setText(1, QString::fromUtf8(data->Status.ptr));

    CommandDef *cmd;
    CommandsMapIterator it(m_plugin->core->messageTypes);
    while ((cmd = ++it) != NULL){
        MessageDef *def = (MessageDef*)(cmd->param);
        if ((def == NULL) || (cmd->icon == NULL) ||
                (def->flags & (MESSAGE_HIDDEN | MESSAGE_SENDONLY | MESSAGE_CHILD)))
            continue;
        if ((def->singular == NULL) || (def->plural == NULL) ||
                (*def->singular == 0) || (*def->plural == 0))
            continue;
        QString type = i18n(def->singular, def->plural, 1);
        int pos = type.find("1 ");
        if (pos == 0){
            type = type.mid(2);
        }else if (pos > 0){
            type = type.left(pos);
        }
        type = type.left(1).upper() + type.mid(1);
        QListViewItem *item = new QListViewItem(lstEvent, type);
        item->setText(2, QString::number(cmd->id));
        item->setPixmap(0, makePixmap(cmd->icon));
        item->setText(1, QString::fromUtf8(get_str(data->Message, cmd->id)));
    }
    m_edit = NULL;
    m_editItem = NULL;
    connect(lstEvent, SIGNAL(selectionChanged(QListViewItem*)), this, SLOT(selectionChanged(QListViewItem*)));

    for (QObject *p = parent; p != NULL; p = p->parent()){
        if (!p->inherits("QTabWidget"))
            continue;
        QTabWidget *tab = static_cast<QTabWidget*>(p);
        m_menu = new MenuConfig(tab, data);
        tab->addTab(m_menu, i18n("Menu"));
        tab->adjustSize();
        break;
    }
    lstEvent->adjustColumn();
    setMinimumSize(sizeHint());
}
Exemple #22
0
SetupDialog::SetupDialog(QWidget*, int nWin)
        : SetupDialogBase(NULL, "setup", false, WStyle_Minimize )
{
    SET_WNDPROC

    setButtonsPict(this);

    new TransparentTop(this, pMain->UseTransparentContainer, pMain->TransparentContainer);

    setIcon(Pict("configure"));
    setCaption(i18n("Setup"));

    connect(btnUpdate, SIGNAL(clicked()), this, SLOT(update()));
    connect(btnClose, SIGNAL(clicked()), this, SLOT(close()));
    connect(btnOK, SIGNAL(clicked()), this, SLOT(ok()));
    connect(btnApply, SIGNAL(clicked()), this, SLOT(apply()));
    lstBars->clear();
    lstBars->header()->hide();
    lstBars->setSorting(1);
    connect(lstBars, SIGNAL(selectionChanged()), this, SLOT(selectionChanged()));

    itemMain = new QListViewItem(lstBars, i18n("My details"), QString::number(SETUP_DETAILS));
    itemMain->setOpen(true);

    addPage(p_MainInfo, SETUP_MAININFO, i18n("Main info"), "main");
    addPage(p_HomeInfo, SETUP_HOMEINFO, i18n("Home info"), "home");
    addPage(p_WorkInfo, SETUP_WORKINFO, i18n("Work info"), "work");
    addPage(p_MoreInfo, SETUP_MOREINFO, i18n("More info"), "more");
    addPage(p_AboutInfo, SETUP_ABOUT, i18n("About info"), "info");
    addPage(p_InterestsInfo, SETUP_INTERESTS, i18n("Interests"), "interest");
    addPage(p_PastInfo, SETUP_PAST, i18n("Group/Past"), "past");
    addPage(p_PhoneBookDlg, SETUP_PHONE, i18n("Phone book"), "phone");

    itemMain = new QListViewItem(lstBars, i18n("Preferences"), QString::number(SETUP_PREFERENCES));
    itemMain->setOpen(true);

    addPage(p_StatusSetup, SETUP_STATUS, i18n("Status mode"), "status");
    addPage(p_NetworkSetup, SETUP_CONNECTION, i18n("Connection"), "network");
    addPage(p_ThemeSetup, SETUP_STYLE, i18n("Style"), "style");
    addPage(p_FontSetup, SETUP_INTERFACE, i18n("Interface"), "text");
    addPage(p_KeySetup, SETUP_KEYS, i18n("Key shortcuts"), "key_bindings");
    addPage(p_SoundSetup, SETUP_SOUND, i18n("Sound"), "sound");
    addPage(p_AlertDialog, SETUP_ALERT, i18n("Alert"), "alert");
    addPage(p_AcceptDialog, SETUP_ACCEPT, i18n("Accept"), "message");
    addPage(p_SMSSetup, SETUP_SMS, i18n("SMS"), "sms");

#ifndef WIN32
    addPage(p_MiscSetup, SETUP_MISC, i18n("Miscellaneous"), "misc");
#endif

    itemMain = new QListViewItem(lstBars, i18n("Auto reply"), QString::number(SETUP_AUTOREPLY));
    itemMain->setOpen(true);

    addPage(p_MsgDialog, SETUP_AR_AWAY, SIMClient::getStatusText(ICQ_STATUS_AWAY), "away", ICQ_STATUS_AWAY);
    addPage(p_MsgDialog, SETUP_AR_NA, SIMClient::getStatusText(ICQ_STATUS_NA), "na", ICQ_STATUS_NA);
    addPage(p_MsgDialog, SETUP_AR_OCCUPIED, SIMClient::getStatusText(ICQ_STATUS_OCCUPIED), "occupied", ICQ_STATUS_OCCUPIED);
    addPage(p_MsgDialog, SETUP_AR_DND, SIMClient::getStatusText(ICQ_STATUS_DND), "dnd", ICQ_STATUS_DND);
    addPage(p_MsgDialog, SETUP_AR_FREEFORCHAT, SIMClient::getStatusText(ICQ_STATUS_FREEFORCHAT), "ffc", ICQ_STATUS_FREEFORCHAT);

    itemMain = new QListViewItem(lstBars, i18n("Security"), QString::number(SETUP_SECURITY));
    itemMain->setOpen(true);

    addPage(p_GeneralSecurity, SETUP_GENERAL_SEC, i18n("General"), "webaware");
    addPage(p_IgnoreListSetup, SETUP_IGNORE_LIST, i18n("Ignore list"), "ignorelist");
    addPage(p_InvisibleListSetup, SETUP_INVISIBLE_LIST, i18n("Invisible list"), "invisiblelist");
    addPage(p_VisibleListSetup, SETUP_VISIBLE_LIST, i18n("Visible list"), "visiblelist");

    raiseWidget(nWin ? nWin : SETUP_MAININFO);
    connect(pMain, SIGNAL(iconChanged()), this, SLOT(iconChanged()));

    transparent = new TransparentTop(this, pMain->UseTransparentContainer, pMain->TransparentContainer);
};
Exemple #23
0
KAboutApplication::KAboutApplication( const KAboutData *aboutData, QWidget *parent, const char *name, bool modal)
        : AboutDlgBase(parent, name, modal)
{
    SET_WNDPROC("about")
    setButtonsPict(this);
    setCaption(caption());

    connect(btnOK, SIGNAL(clicked()), this, SLOT(close()));
    setIcon(Pict("licq"));
    const QIconSet *icon = Icon("licq");
    if (icon)
        lblIcon->setPixmap(icon->pixmap(QIconSet::Large, QIconSet::Normal));
    lblVersion->setText(i18n("%1 Version: %2") .arg(aboutData->appName()) .arg(aboutData->version()));
    txtAbout->setText((QString("<center><br>%1<br><br>%2<br><br>") +
                       "<a href=\"%3\">%4</a><br><br>" +
                       i18n("Bug report") + ": <a href=\"mailto:%5\">%6</a><br>" +
                       i18n("Note: This is english mailing list") +
                       "</center>")
                      .arg(quote(aboutData->shortDescription()))
                      .arg(quote(aboutData->copyrightStatement()))
                      .arg(quote(aboutData->homepage()))
                      .arg(quote(aboutData->homepage()))
                      .arg(quote(aboutData->bugAddress()))
                      .arg(quote(aboutData->bugAddress())));
    QString txt;
    QValueList<KAboutPerson>::ConstIterator it;
    for (it = aboutData->authors().begin();
            it != aboutData->authors().end(); ++it)
    {
        txt += addPerson(&(*it));
        txt += "<br>";
    }
    txtAuthors->setText(txt);
    txt = "";
    QValueList<KAboutTranslator> translators = aboutData->translators();
    QValueList<KAboutTranslator>::ConstIterator itt;
    if (!translators.isEmpty()){
        for (itt = translators.begin();
                itt != translators.end(); ++itt)
        {
            const KAboutTranslator &t = *itt;
            txt += QString("%1 &lt;<a href=\"mailto:%2\">%3</a>&gt;<br>")
                   .arg(quote(t.name()))
                   .arg(quote(t.emailAddress()))
                   .arg(quote(t.emailAddress()));
            txt += "<br>";
        }
        txtTranslations->setText(txt);
    }else{
        tabMain->removePage(tabTranslation);
    }
    QString license = aboutData->license();
    license += "\n\n";
    QFile f(QFile::decodeName(app_file("COPYING").c_str()));
    if (f.open(IO_ReadOnly)){
        for (;;){
            QString s;
            if (f.readLine(s, 512) == -1)
                break;
            license += s;
        }
    }
    txtLicence->setText(quote(license));
}
Exemple #24
0
BalloonMsg::BalloonMsg(const QString &_text, const QRect &rc, QStringList &btn, QWidget *parent, bool bModal, bool bAutoHide)
        : QDialog(parent, "ballon", bModal,
                  (bAutoHide ? WType_Popup : WType_TopLevel | WStyle_StaysOnTop)
                  | WStyle_Customize | WStyle_NoBorderEx | WStyle_Tool | WDestructiveClose | WX11BypassWM)
{
    m_bAutoHide = bAutoHide;
    bool bTailDown = true;
    setPalette(QToolTip::palette());
    text = _text;
    int hButton = 0;
    QFrame *frm = new QFrame(this);
    frm->setPalette(palette());
    QHBoxLayout *lay = new QHBoxLayout(frm);
    lay->setSpacing(5);
    lay->addStretch();
    unsigned id = 0;
    bool bFirst = true;
    for (QStringList::Iterator it = btn.begin(); it != btn.end(); ++it, id++){
        BalloonButton *b = new BalloonButton(*it, frm, id);
        connect(b, SIGNAL(action(int)), this, SIGNAL(action(int)));
        lay->addWidget(b);
        if (bFirst){
            b->setDefault(true);
            bFirst = false;
        }
        hButton = b->height();
    }
    setButtonsPict(this);
    lay->addStretch();
    int wndWidth = frm->minimumSizeHint().width();

    int txtWidth = BALLOON_WIDTH;
    if (rc.width() > txtWidth) txtWidth = rc.width();

    QPainter p(this);
    QRect rcText = p.boundingRect(0, 0, QMAX(wndWidth, txtWidth), 1000, AlignLeft | AlignTop | WordBreak, _text);
    if (rcText.width() < wndWidth) rcText.setWidth(wndWidth);
    resize(rcText.width() + BALLOON_R * 2 + BALLOON_SHADOW,
           rcText.height() + BALLOON_R * 2 + BALLOON_TAIL + BALLOON_SHADOW + hButton + BALLOON_MARGIN);
    p.end();
    mask = QBitmap(width(), height());
    int w = width() - BALLOON_SHADOW;
    int tailX = w / 2;
    int posX = rc.left() + rc.width() / 2 + BALLOON_TAIL_WIDTH - tailX;
    if (posX <= 0) posX = 1;
    if (posX + width() >= QApplication::desktop()->width())
        posX = QApplication::desktop()->width() - 1 - width();
    int tx = posX + tailX - BALLOON_TAIL_WIDTH;
    if (tx < rc.left()) tx = rc.left();
    if (tx > rc.left() + rc.width()) tx = rc.left() + rc.width();
    tailX = tx + BALLOON_TAIL_WIDTH - posX;
    if (tailX < BALLOON_R) tailX = BALLOON_R;
    if (tailX > width() - BALLOON_R - BALLOON_TAIL_WIDTH) tailX = width() - BALLOON_R - BALLOON_TAIL_WIDTH;
    if (rc.top() <= height() + 2){
        bTailDown = false;
        move(posX, rc.top() + rc.height() + 1);
    }else{
        move(posX, rc.top() - height() - 1);
    }
    int pos = 0;
    int h = height() - BALLOON_SHADOW - BALLOON_TAIL;
    if (!bTailDown) pos += BALLOON_TAIL;
    textRect.setRect(BALLOON_R, pos + BALLOON_R, w - BALLOON_R * 2, h);
    frm->resize(rcText.width(), hButton);
    frm->move(BALLOON_R, pos + h - BALLOON_R - hButton);
    p.begin(&mask);
#ifdef WIN32
    QColor bg(255, 255, 255);
    QColor fg(0, 0, 0);
#else
    QColor bg(0, 0, 0);
    QColor fg(255, 255, 255);
#endif
    p.fillRect(0, 0, width(), height(), bg);
    p.fillRect(0, pos + BALLOON_R, w, h - BALLOON_R * 2, fg);
    p.fillRect(BALLOON_R, pos, w - BALLOON_R * 2, h, fg);
    p.fillRect(BALLOON_SHADOW, pos + BALLOON_R + BALLOON_SHADOW, w, h - BALLOON_R * 2, fg);
    p.fillRect(BALLOON_R + BALLOON_SHADOW, pos + BALLOON_SHADOW, w - BALLOON_R * 2, h, fg);
    p.setBrush(fg);
    p.drawEllipse(0, pos, BALLOON_R * 2, BALLOON_R * 2);
    p.drawEllipse(w - BALLOON_R * 2, pos, BALLOON_R * 2, BALLOON_R * 2);
    p.drawEllipse(w - BALLOON_R * 2, pos + h - BALLOON_R * 2, BALLOON_R * 2, BALLOON_R * 2);
    p.drawEllipse(0, pos + h - BALLOON_R * 2, BALLOON_R * 2, BALLOON_R * 2);
    p.drawEllipse(BALLOON_SHADOW, pos + BALLOON_SHADOW, BALLOON_R * 2, BALLOON_R * 2);
    p.drawEllipse(w - BALLOON_R * 2 + BALLOON_SHADOW, pos + BALLOON_SHADOW, BALLOON_R * 2, BALLOON_R * 2);
    p.drawEllipse(w - BALLOON_R * 2 + BALLOON_SHADOW, pos + h - BALLOON_R * 2 + BALLOON_SHADOW, BALLOON_R * 2, BALLOON_R * 2);
    p.drawEllipse(BALLOON_SHADOW, pos + h - BALLOON_R * 2 + BALLOON_SHADOW, BALLOON_R * 2, BALLOON_R * 2);
    QPointArray arr(3);
    arr.setPoint(0, tailX, bTailDown ? h : pos);
    arr.setPoint(1, tailX + BALLOON_TAIL_WIDTH, bTailDown ? h : pos);
    arr.setPoint(2, tailX - BALLOON_TAIL_WIDTH, bTailDown ? height() - BALLOON_SHADOW : 0);
    p.drawPolygon(arr);
    arr.setPoint(0, tailX + BALLOON_SHADOW, (bTailDown ? h : pos) + BALLOON_SHADOW);
    arr.setPoint(1, tailX + BALLOON_TAIL_WIDTH + BALLOON_SHADOW, (bTailDown ? h : pos) + BALLOON_SHADOW);
    arr.setPoint(2, tailX - BALLOON_TAIL_WIDTH + BALLOON_SHADOW, bTailDown ? height() : BALLOON_SHADOW);
    p.drawPolygon(arr);
    p.end();
    setMask(mask);
    qApp->syncX();
    QPixmap pict = QPixmap::grabWindow(QApplication::desktop()->winId(), x(), y(), width(), height());
    intensity(pict, -0.50f);
    p.begin(&pict);
    p.setBrush(colorGroup().background());
    p.drawEllipse(0, pos, BALLOON_R * 2, BALLOON_R * 2);
    p.drawEllipse(w - BALLOON_R * 2, pos, BALLOON_R * 2, BALLOON_R * 2);
    p.drawEllipse(w - BALLOON_R * 2, pos + h - BALLOON_R * 2, BALLOON_R * 2, BALLOON_R * 2);
    p.drawEllipse(0, pos + h - BALLOON_R * 2, BALLOON_R * 2, BALLOON_R * 2);
    arr.setPoint(0, tailX, bTailDown ? h - 1 : pos + 1);
    arr.setPoint(1, tailX + BALLOON_TAIL_WIDTH, bTailDown ? h - 1 : pos + 1);
    arr.setPoint(2, tailX - BALLOON_TAIL_WIDTH, bTailDown ? height() - BALLOON_SHADOW : 0);
    p.drawPolygon(arr);
    p.fillRect(0, pos + BALLOON_R, w, h - BALLOON_R * 2, colorGroup().background());
    p.fillRect(BALLOON_R, pos, w - BALLOON_R * 2, h, colorGroup().background());
    p.drawLine(0, pos + BALLOON_R, 0, pos + h - BALLOON_R);
    p.drawLine(w - 1, pos + BALLOON_R, w - 1, pos + h - BALLOON_R);
    if (bTailDown){
        p.drawLine(BALLOON_R, 0, w - BALLOON_R, 0);
        p.drawLine(BALLOON_R, h - 1, tailX, h - 1);
        p.drawLine(tailX + BALLOON_TAIL_WIDTH, h - 1, w - BALLOON_R, h - 1);
    }else{
        p.drawLine(BALLOON_R, pos + h - 1, w - BALLOON_R, pos + h - 1);
        p.drawLine(BALLOON_R, pos, tailX, pos);
        p.drawLine(tailX + BALLOON_TAIL_WIDTH, pos, w - BALLOON_R, pos);
    }
    p.end();
    setBackgroundPixmap(pict);
    setAutoMask(true);
    if (!bAutoHide)
        setFocusPolicy(NoFocus);
}
Exemple #25
0
UserInfo::UserInfo(unsigned long uin, unsigned short grpId, int page)
        : UserInfoBase(NULL, "userinfo", WType_TopLevel | WStyle_Dialog| WDestructiveClose)
{
    SET_WNDPROC("userinfo")

    inSave = false;
    setButtonsPict(this);

    m_nUin   = uin;
    m_nGrpId = grpId;

    ICQUser *u = NULL;
    if (uin){
        u = pClient->getUser(uin);
        if (u == NULL) return;
    }
    ICQGroup *g = NULL;
    if (grpId){
        g = pClient->getGroup(grpId);
        if (g == NULL) return;
    }

    lstBars->clear();
    lstBars->header()->hide();
    lstBars->setSorting(1);
    connect(lstBars, SIGNAL(selectionChanged()), this, SLOT(selectionChanged()));

    itemMain = new QListViewItem(lstBars, i18n("User info"), QString::number(SETUP_DETAILS));
    itemMain->setOpen(true);

    if (u){
        addWidget(p_MainInfo, SETUP_MAININFO, i18n("Main info"), "main");
        if (u->Type == USER_TYPE_ICQ){
            addWidget(p_HomeInfo, SETUP_HOMEINFO, i18n("Home info"), "home");
            addWidget(p_WorkInfo, SETUP_WORKINFO, i18n("Work info"), "work");
            addWidget(p_MoreInfo, SETUP_MOREINFO, i18n("More info"), "more");
            addWidget(p_AboutInfo, SETUP_ABOUT, i18n("About info"), "info");
            addWidget(p_InterestsInfo, SETUP_INTERESTS, i18n("Interests"), "interest");
            addWidget(p_PastInfo, SETUP_PAST, i18n("Group/Past"), "past");
        }
        addWidget(p_PhoneBookDlg, SETUP_PHONE, i18n("Phone book"), "phone");
    }

    if ((uin == 0) || (u->Type == USER_TYPE_ICQ)){
        itemMain = new QListViewItem(lstBars, i18n("Preferences"), QString::number(SETUP_PREFERENCES));
        itemMain->setOpen(true);
        addWidget(p_AlertDialog, SETUP_ALERT, i18n("Alert"), "alert");
        addWidget(p_AcceptDialog, SETUP_ACCEPT, i18n("Accept"), "message");
        addWidget(p_SoundSetup, SETUP_SOUND, i18n("Sound"), "sound");
    }
    if (g || (u && (u->Type == USER_TYPE_ICQ))){
        itemMain = new QListViewItem(lstBars, i18n("Auto reply"), QString::number(SETUP_AUTOREPLY));
        itemMain->setOpen(true);
        addWidget(p_MsgDialog, SETUP_AR_AWAY,
                  SIMClient::getStatusText(ICQ_STATUS_AWAY), SIMClient::getStatusIcon(ICQ_STATUS_AWAY),
                  ICQ_STATUS_AWAY);
        addWidget(p_MsgDialog, SETUP_AR_NA,
                  SIMClient::getStatusText(ICQ_STATUS_NA), SIMClient::getStatusIcon(ICQ_STATUS_NA),
                  ICQ_STATUS_NA);
        addWidget(p_MsgDialog, SETUP_AR_OCCUPIED,
                  SIMClient::getStatusText(ICQ_STATUS_OCCUPIED), SIMClient::getStatusIcon(ICQ_STATUS_OCCUPIED),
                  ICQ_STATUS_OCCUPIED);
        addWidget(p_MsgDialog, SETUP_AR_DND,
                  SIMClient::getStatusText(ICQ_STATUS_DND), SIMClient::getStatusIcon(ICQ_STATUS_DND),
                  ICQ_STATUS_DND);
        addWidget(p_MsgDialog, SETUP_AR_FREEFORCHAT,
                  SIMClient::getStatusText(ICQ_STATUS_FREEFORCHAT), SIMClient::getStatusIcon(ICQ_STATUS_FREEFORCHAT),
                  ICQ_STATUS_FREEFORCHAT);
    }
    raiseWidget(page ? page : (u ? SETUP_MAININFO : SETUP_ALERT));

    connect(pClient, SIGNAL(event(ICQEvent*)), this, SLOT(processEvent(ICQEvent*)));
    connect(btnSave, SIGNAL(clicked()), this, SLOT(saveInfo()));
    connect(btnClose, SIGNAL(clicked()), this, SLOT(close()));
    if (u && (u->Type == USER_TYPE_ICQ)){
        connect(btnUpdate, SIGNAL(clicked()), this, SLOT(update()));
    }else{
        btnUpdate->hide();
    }
    loadInfo();
    setTitle();
    setIcon();
}