Beispiel #1
0
MainInfoItem::MainInfoItem(QListView *view, unsigned id)
        : ConfigItem(view, id)
{
    setText(0, i18n("User info"));
    setPixmap(0, Pict("info", listView()->colorGroup().base()));
}
Beispiel #2
0
void FloatyWnd::paintEvent(QPaintEvent*)
{
    int w = width()  - 4;
    int h = height() - 4;

    QPixmap pict(w, h);
    QPainter p(&pict);
    p.fillRect(QRect(0, 0, width(), height()), colorGroup().base());
    PaintView pv;
    pv.p        = &p;
    pv.pos      = QPoint(2, 2);
    pv.size		= QSize(w, h);
    pv.win      = this;
    pv.isStatic = false;
    pv.height   = h;
    if (m_plugin->core->getUseSysColors()){
        p.setPen(colorGroup().text());
    }else{
        p.setPen(QColor(m_plugin->core->getColorOnline()));
    }
    Event e(EventPaintView, &pv);
    e.process();

    if (m_plugin->core->getUseSysColors()){
        if (m_status != STATUS_ONLINE)
            p.setPen(palette().disabled().text());
    }else{
        switch (m_status){
        case STATUS_ONLINE:
            break;
        case STATUS_AWAY:
            p.setPen(m_plugin->core->getColorAway());
            break;
        case STATUS_NA:
            p.setPen(m_plugin->core->getColorNA());
            break;
        case STATUS_DND:
            p.setPen(m_plugin->core->getColorDND());
            break;
        default:
            p.setPen(m_plugin->core->getColorOffline());
            break;
        }
    }

    int x = 0;
    const char *statusIcon = m_statusIcon;
    if (m_unread && m_plugin->m_bBlink){
        CommandDef *def = m_plugin->core->messageTypes.find(m_unread);
        if (def)
            statusIcon = def->icon;
    }

    if (statusIcon){
        const QPixmap &pict = Pict(statusIcon);
        x += 2;
        p.drawPixmap(x, (h - pict.height()) / 2, pict);
        x += pict.width() + 2;
    }
    QRect br;
    p.drawText(x, 0, w, h, AlignLeft | AlignVCenter, m_text, -1, &br);
    x = br.right() + 5;
    string icons = m_icons;
    while (icons.length()){
        string icon = getToken(icons, ',');
        const QPixmap &pict = Pict(icon.c_str());
        x += 2;
        p.drawPixmap(x, (h - pict.height()) / 2, pict);
        x += pict.width();
    }
    p.end();

    p.begin(this);
    p.drawPixmap(QPoint(2, 2), pict);
    p.setPen(colorGroup().dark());
    p.moveTo(1, 1);
    p.lineTo(width() - 2, 1);
    p.lineTo(width() - 2, height() - 2);
    p.lineTo(1, height() - 2);
    p.lineTo(1, 1);
    p.setPen(colorGroup().shadow());
    p.moveTo(0, height() - 1);
    p.lineTo(width() - 1, height() - 1);
    p.lineTo(width() - 1, 1);
    p.moveTo(width() - 3, 2);
    p.lineTo(2, 2);
    p.lineTo(2, height() - 3);
    p.setPen(colorGroup().light());
    p.moveTo(2, height() - 3);
    p.lineTo(width() - 3, height() - 3);
    p.lineTo(width() - 3, 2);
    p.moveTo(width() - 1, 0);
    p.lineTo(0, 0);
    p.lineTo(0, height() - 1);
}
Beispiel #3
0
UserBox::UserBox(unsigned long grpId)
        : QMainWindow(NULL, NULL,
                      (WType_TopLevel | WStyle_Customize | WStyle_NormalBorder |
                       WStyle_Title | WStyle_SysMenu |
                       (pMain->UserWndOnTop() ? WStyle_StaysOnTop : 0))
#ifdef USE_KDE
                      | (pMain->UserWindowInTaskManager() ? WStyle_Minimize : 0)
#endif
                     ),
        GrpId(this, "Group"),
        CurrentUser(this, "CurrentUser"),
        mLeft(this, "Left"),
        mTop(this, "Top"),
        mWidth(this, "Width"),
        mHeight(this, "Height"),
        ToolbarDock(this, "ToolbarDock", "Top"),
        ToolbarOffset(this, "ToolbarOffset"),
        ToolbarY(this, "ToolbarY")
{
    ToolbarDock = pMain->UserBoxToolbarDock();
    ToolbarOffset = pMain->UserBoxToolbarOffset();
    ToolbarY = pMain->UserBoxToolbarY();
    users = NULL;
    GrpId = grpId;
    progress = NULL;
    infoPage = 0;
    setWFlags(WDestructiveClose);
    infoWnd = NULL;
    historyWnd = NULL;
    transparent = new TransparentTop(this, pMain->UseTransparentContainer, pMain->TransparentContainer);
    menuUser = new QPopupMenu(this);
    menuUser->setCheckable(true);
    connect(menuUser, SIGNAL(activated(int)), this, SLOT(selectedUser(int)));
    curWnd = NULL;
    frm = new QFrame(this);
    setCentralWidget(frm);
    lay = new QVBoxLayout(frm);
    vSplitter = new QSplitter(Horizontal, frm);
    vSplitter->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
    lay->addWidget(vSplitter);
    frmUser = new QFrame(vSplitter);
    layUser = new QVBoxLayout(frmUser);
    tabSplitter = new Splitter(frm);
    tabSplitter->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum));
    tabs = new UserTabBar(tabSplitter);
    tabs->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum));
    QSize s;
    status = new QStatusBar(tabSplitter);
    {
        QProgressBar p(status);
        status->addWidget(&p);
        s = status->minimumSizeHint();
    }
    status->setMinimumSize(QSize(0, s.height()));
    tabSplitter->setResizeMode(status, QSplitter::KeepSize);
    lay->addWidget(tabSplitter);
    setIcon(Pict(pClient->getStatusIcon()));
    connect(tabs, SIGNAL(selected(int)), this, SLOT(selectedUser(int)));
    connect(tabs, SIGNAL(showUserPopup(int, QPoint)), this, SLOT(showUserPopup(int, QPoint)));
    toolbar = new QToolBar(this);
    toolbar->setHorizontalStretchable(true);
    toolbar->setVerticalStretchable(true);
    menuType = new QPopupMenu(this);
    connect(menuType, SIGNAL(activated(int)), this, SLOT(typeChanged(int)));
    btnType = new PictButton(toolbar);
    btnType->setPopup(menuType);
    btnType->setPopupDelay(0);
    toolbar->addSeparator();
    btnUser = new PictButton(toolbar);
    btnUser->setPopup(menuUser);
    btnUser->setPopupDelay(0);
    toolbar->addSeparator();
    btnIgnore = new QToolButton(toolbar);
    btnIgnore->setIconSet(Icon("ignorelist"));
    btnIgnore->setTextLabel(i18n("Add to ignore list"));
    connect(btnIgnore, SIGNAL(clicked()), this, SLOT(toIgnore()));
    menuGroup = new QPopupMenu(this);
    connect(menuGroup, SIGNAL(aboutToShow()), this, SLOT(showGrpMenu()));
    connect(menuGroup, SIGNAL(activated(int)), this, SLOT(moveUser(int)));
    btnGroup = new CToolButton(toolbar);
    btnGroup->setIconSet(Icon("grp_on"));
    btnGroup->setTextLabel(i18n("Move to group"));
    btnGroup->setPopup(menuGroup);
    btnGroup->setPopupDelay(0);
    toolbar->addSeparator();
    btnInfo = new QToolButton(toolbar);
    btnInfo->setIconSet(Icon("info"));
    btnInfo->setTextLabel(i18n("User info"));
    btnInfo->setToggleButton(true);
    connect(btnInfo, SIGNAL(toggled(bool)), this, SLOT(toggleInfo(bool)));
    btnHistory = new QToolButton(toolbar);
    btnHistory->setIconSet(Icon("history"));
    btnHistory->setTextLabel(i18n("History"));
    btnHistory->setToggleButton(true);
    connect(btnHistory, SIGNAL(toggled(bool)), this, SLOT(toggleHistory(bool)));
    menuEncoding = new QPopupMenu(this);
    menuEncoding->setCheckable(true);
    int index = 0;
    for (QStringList::Iterator it = pClient->encodings->begin(); it != pClient->encodings->end(); ++it){
        menuEncoding->insertItem(*it, ++index);
    }
    connect(menuEncoding, SIGNAL(activated(int)), this, SLOT(setUserEncoding(int)));
    connect(menuEncoding, SIGNAL(aboutToShow()), this, SLOT(showEncodingPopup()));
    btnEncoding = new CToolButton(toolbar);
    btnEncoding->setIconSet(Icon("encoding"));
    btnEncoding->setTextLabel(i18n("Encoding"));
    btnEncoding->setPopup(menuEncoding);
    btnEncoding->setPopupDelay(0);
    toolbar->addSeparator();
    btnQuit = new QToolButton(Icon("exit"), i18n("Close"), "", this, SLOT(quit()), toolbar);
    connect(pClient, SIGNAL(event(ICQEvent*)), this, SLOT(processEvent(ICQEvent*)));
    connect(pClient, SIGNAL(messageRead(ICQMessage*)), this, SLOT(messageRead(ICQMessage*)));
    connect(pMain, SIGNAL(iconChanged()), this, SLOT(iconChanged()));
    connect(pMain, SIGNAL(wmChanged()), this, SLOT(wmChanged()));
    connect(this, SIGNAL(toolBarPositionChanged(QToolBar*)), this, SLOT(toolBarChanged(QToolBar*)));
    connect(pClient, SIGNAL(messageReceived(ICQMessage*)), this, SLOT(messageReceived(ICQMessage*)));
    setGroupButtons();
    wmChanged();
    adjustPos();
    adjustToolbar();
    connect(pMain, SIGNAL(modeChanged(bool)), this, SLOT(modeChanged(bool)));
}
Beispiel #4
0
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);
}
Beispiel #5
0
MainInfoItem::MainInfoItem(QListView *view, unsigned id)
        : ConfigItem(view, id)
{
    setText(0, i18n("User info"));
    setPixmap(0, Pict("info"));
}
Beispiel #6
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);
};
Beispiel #7
0
     txt->setAlignment(AlignRight);
     QLineEdit *edt = new QLineEdit(this);
     edt->setText(clients[0]->getPassword());
     edt->setEchoMode(QLineEdit::Password);
     connect(edt, SIGNAL(textChanged(const QString&)), this, SLOT(pswdChanged(const QString&)));
     passwords.push_back(edt);
     texts.push_back(txt);
     PLayout->addWidget(txt, 2, 1);
     PLayout->addWidget(edt, 2, 2);
     edt->show();
     txt->show();
 }else{
     for (unsigned i = 0; i < clients.size(); i++){
         Client *client = clients[i];
         QLabel *pict = new QLabel(this);
         pict->setPixmap(Pict(client->protocol()->description()->icon));
         QLabel *txt = new QLabel(this);
         txt->setText(QString::fromLocal8Bit(client->name().c_str()));
         QLineEdit *edt = new QLineEdit(this);
         edt->setText(client->getPassword());
         edt->setEchoMode(QLineEdit::Password);
         connect(edt, SIGNAL(textChanged(const QString&)), this, SLOT(pswdChanged(const QString&)));
         passwords.push_back(edt);
         texts.push_back(txt);
         picts.push_back(pict);
         PLayout->addWidget(pict, i + 2, 0);
         PLayout->addWidget(txt, i + 2, 1);
         PLayout->addWidget(edt, i + 2, 2);
         pict->show();
         txt->show();
         edt->show();
Beispiel #8
0
DockWnd::DockWnd(QWidget *main)
        : QWidget(NULL)
{
#ifndef WIN32
    wharfIcon = NULL;
#endif
    connect(this, SIGNAL(toggleWin()), main, SLOT(toggleShow()));
    connect(this, SIGNAL(showPopup(QPoint)), main, SLOT(showPopup(QPoint)));
    connect(pClient, SIGNAL(event(ICQEvent*)), this, SLOT(processEvent(ICQEvent*)));
    connect(pClient, SIGNAL(messageRead(ICQMessage*)), this, SLOT(messageRead(ICQMessage*)));
    connect(pClient, SIGNAL(messageReceived(ICQMessage*)), this, SLOT(messageReceived(ICQMessage*)));
    connect(pMain, SIGNAL(iconChanged()), this, SLOT(reset()));
    m_state = 0;
    showIcon = State;
    QTimer *t = new QTimer(this);
    connect(t, SIGNAL(timeout()), this, SLOT(timer()));
    t->start(800);
    bool bWMDock = false;
#ifndef WIN32
    Atom r_type;
    int r_format;
    unsigned long count, bytes_remain;
    unsigned char *prop = NULL, *prop2 = NULL;
    Atom _XA_WIN_SUPPORTING_WM_CHECK = XInternAtom(qt_xdisplay(), XA_WIN_SUPPORTING_WM_CHECK, False);
    int p = XGetWindowProperty(qt_xdisplay(), qt_xrootwin(), _XA_WIN_SUPPORTING_WM_CHECK,
                               0, 1, False, XA_CARDINAL, &r_type, &r_format,
                               &count, &bytes_remain, &prop);

    if (p == Success && prop && r_type == XA_CARDINAL &&
            r_format == 32 && count == 1)
    {
        Window n = *(long *) prop;

        p = XGetWindowProperty(qt_xdisplay(), n, _XA_WIN_SUPPORTING_WM_CHECK, 0, 1,
                               False, XA_CARDINAL, &r_type, &r_format,
                               &count, &bytes_remain, &prop2);

        if (p == Success && prop2 && r_type == XA_CARDINAL &&
                r_format == 32 && count == 1)
            bWMDock = true;
    }

    if (prop)
        XFree(prop);
    if (prop2)
        XFree(prop2);

#endif
#ifdef USE_KDE
    log(L_DEBUG, "WM props? %u", bWMDock);
    if (!bWMDock)
        KWin::setSystemTrayWindowFor( winId(), main->topLevelWidget()->winId());
#endif
    needToggle = false;
#ifdef WIN32
    QWidget::hide();
    QWidget::setIcon(Pict(pClient->getStatusIcon()));
    gDock = this;
    oldDockProc = (WNDPROC)SetWindowLongW(winId(), GWL_WNDPROC, (LONG)DockWindowProc);
    if (oldDockProc == 0)
        oldDockProc = (WNDPROC)SetWindowLongA(winId(), GWL_WNDPROC, (LONG)DockWindowProc);
    NOTIFYICONDATAA notifyIconData;
    notifyIconData.cbSize = sizeof(notifyIconData);
    notifyIconData.hIcon = topData()->winIcon;
    notifyIconData.hWnd = winId();
    notifyIconData.szTip[0] = 0;
    notifyIconData.uCallbackMessage = WM_DOCK;
    notifyIconData.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP;
    notifyIconData.uID = 0;
    Shell_NotifyIconA(NIM_ADD, &notifyIconData);
#else
    if (!bWMDock){
        setBackgroundMode(X11ParentRelative);
        setIcon(Pict(pClient->getStatusIcon()));
#ifdef USE_KDE
        show();
#else
    hide();
#endif
    }else{
        wharfIcon = new WharfIcon(this);
        Display *dsp = x11Display();
        WId win = winId();
        XWMHints *hints;
        XClassHint classhint;
        classhint.res_name  = (char*)"sim";
        classhint.res_class = (char*)"sim";
        XSetClassHint(dsp, win, &classhint);
        hints = XGetWMHints(dsp, win);
        hints->initial_state = WithdrawnState;
        hints->icon_x = 0;
        hints->icon_y = 0;
        hints->icon_window = wharfIcon->winId();
        hints->window_group = win;
        hints->flags = WindowGroupHint | IconWindowHint | IconPositionHint | StateHint;
        XSetWMHints(dsp, win, hints);
        XFree( hints );
        XSetCommand(dsp, winId(), _argv, _argc);
        resize(64, 64);
        show();
    }
#endif
    loadUnread();
    reset();
}
Beispiel #9
0
void DockWnd::timer()
{
    if (++m_state >= 4) m_state = 0;
    ShowIcon needIcon = State;
    bool bBlinked = (pClient->m_state != ICQClient::Logoff) && (pClient->m_state != ICQClient::Logged);
    unsigned short msgType = 0;
    if (messages.size()) msgType = messages.back().type();
    switch (m_state){
    case 1:
        if (msgType){
            needIcon = Message;
        }else if (bBlinked){
            needIcon = Blinked;
        }
        break;
    case 2:
        if (msgType && bBlinked)
            needIcon = Blinked;
        break;
    case 3:
        if (msgType){
            needIcon = Message;
        }else if (bBlinked){
            needIcon = Blinked;
        }
        break;
    }
    if (needIcon == showIcon) return;
    showIcon = needIcon;
    switch (showIcon){
    case State:
        setIcon(Pict(pClient->getStatusIcon()));
        break;
    case Message:
        setIcon(Pict(Client::getMessageIcon(msgType)));
        break;
    case Blinked:
        setIcon(Pict(Client::getStatusIcon(ICQ_STATUS_ONLINE)));
        break;
    default:
        break;
    }
#ifndef WIN32
    if (wharfIcon == NULL) return;
    const char *msg = NULL;
    if (msgType) msg = Client::getMessageIcon(msgType);
    if (bBlinked){
        if (m_state & 1){
            wharfIcon->set(Client::getStatusIcon(ICQ_STATUS_ONLINE), NULL);
        }else{
            wharfIcon->set(pClient->getStatusIcon(), msg);
        }
    }else{
        if (m_state & 1){
            wharfIcon->set(pClient->getStatusIcon(), NULL);
        }else{
            wharfIcon->set(pClient->getStatusIcon(), msg);
        }
    }
#endif
}
Beispiel #10
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>" +
                       "</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(QString::fromLocal8Bit(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));
}
Beispiel #11
0
void SearchDialog::fillClients()
{
    vector<ClientWidget> widgets = m_widgets;
    m_widgets.clear();
    m_search->cmbClients->clear();
    unsigned nClients = 0;
    int current    = -1;
    int defCurrent = -1;
    for (unsigned i = 0; i < getContacts()->nClients(); i++){
        Client *client = getContacts()->getClient(i);
        QWidget *search = client->searchWindow(m_search->wndCondition);
        if (search == NULL)
            continue;
        unsigned n;
        for (n = 0; n < widgets.size(); n++){
            if ((widgets[n].client != client) || !widgets[n].name.isEmpty())
                continue;
            delete search;
            search = widgets[n].widget;
            widgets[n].widget = NULL;
            break;
        }
        if (n >= widgets.size())
            m_search->wndCondition->addWidget(search, ++m_id);
        m_search->cmbClients->insertItem(Pict(client->protocol()->description()->icon, m_search->cmbClients->colorGroup().base()),
                                         CorePlugin::m_plugin->clientName(client));
        ClientWidget cw;
        cw.client = client;
        cw.widget = search;
        m_widgets.push_back(cw);
        if (search == m_current)
            current = m_widgets.size() - 1;
        if (client->protocol()->description()->flags & PROTOCOL_SEARCH)
            nClients++;
        if (client->name() == CorePlugin::m_plugin->getSearchClient())
            defCurrent = m_widgets.size() - 1;
    }
    if (nClients > 1){
        unsigned n;
        QWidget *search = NULL;
        for (n = 0; n < widgets.size(); n++){
            if (widgets[n].client == (Client*)(-1)){
                search = widgets[n].widget;
                widgets[n].widget = NULL;
                break;
            }
        }
        if (search == NULL){
            search = new SearchAll(m_search->wndCondition);
            m_search->wndCondition->addWidget(new SearchAll(m_search->wndCondition), ++m_id);
        }
        m_search->cmbClients->insertItem(Pict("find", m_search->cmbClients->colorGroup().base()),
                                         i18n("All networks"));
        ClientWidget cw;
        cw.client = (Client*)(-1);
        cw.widget = search;
        m_widgets.push_back(cw);
        if ((search == m_current) || ((m_current == NULL) && (current < 0) && (defCurrent < 0)))
            current = m_widgets.size() - 1;
    }
    unsigned n;
    QWidget *search = NULL;
    for (n = 0; n < widgets.size(); n++){
        if (widgets[n].client == NULL){
            search = widgets[n].widget;
            widgets[n].widget = NULL;
            break;
        }
    }
    if (search == NULL){
        search = new NonIM(m_search->wndCondition);
        m_search->wndCondition->addWidget(search, ++m_id);
    }
    m_search->cmbClients->insertItem(Pict("nonim", m_search->cmbClients->colorGroup().base()),
                                     i18n("Non-IM contact"));
    ClientWidget cw;
    cw.client = NULL;
    cw.widget = search;
    m_widgets.push_back(cw);
    if (search == m_current)
        current = m_widgets.size() - 1;

    if (m_update->isActive()){
        m_update->stop();
    }else if (m_result){
        m_result->viewport()->setUpdatesEnabled(false);
    }
    for (n = 0; n < widgets.size(); n++){
        if (widgets[n].name.isEmpty())
            continue;
        unsigned i;
        for (i = 0; i < m_widgets.size(); i++)
            if (widgets[n].client == m_widgets[i].client)
                break;
        if (i >= m_widgets.size())
            continue;
        m_search->cmbClients->insertItem(Pict(widgets[n].client->protocol()->description()->icon,
                                              m_search->cmbClients->colorGroup().base()), widgets[n].name);
        m_widgets.push_back(widgets[n]);
        widgets[n].widget = NULL;
    }
    for (n = 0; n < widgets.size(); n++){
        if (widgets[n].widget){
            if (widgets[n].widget == m_active)
                searchDone(m_active);
            if (widgets[n].widget == m_current)
                m_current = NULL;
            for (QListViewItem *item = m_result->firstChild(); item; ){
                QListViewItem *next = item->nextSibling();
                if ((QWidget*)(item->text(COL_SEARCH_WND).toUInt()) == widgets[n].widget)
                    delete item;
                if (next == NULL)
                    break;
                item = next;
            }
            delete widgets[n].widget;
        }
    }
    if (current == -1)
        current = defCurrent;
    if (current == -1)
        current = 0;
    m_search->cmbClients->setCurrentItem(current);
    clientActivated(current);
    setStatus();
    m_update->start(500);
}
AutoReplyDialog::AutoReplyDialog(unsigned status)
        : AutoReplyBase(NULL, NULL, true)
{
    m_status = status;
    SET_WNDPROC("mainwnd");
    const char *text = NULL;
    const char *icon = NULL;
    for (unsigned i = 0; i < getContacts()->nClients(); i++){
        for (const CommandDef *d = getContacts()->getClient(i)->protocol()->statusList(); d->text; d++){
            if (d->id == status){
                text = d->text;
                switch (d->id){
                case STATUS_ONLINE:
                    icon="SIM_online";
                    break;
                case STATUS_AWAY:
                    icon="SIM_away";
                    break;
                case STATUS_NA:
                    icon="SIM_na";
                    break;
                case STATUS_DND:
                    icon="SIM_dnd";
                    break;
                case STATUS_FFC:
                    icon="SIM_ffc";
                    break;
                case STATUS_OFFLINE:
                    icon="SIM_offline";
                    break;
                default:
                    icon=d->icon;
                    break;
                }
                break;
            }
        }
        if (text)
            break;
    }
    if (text == NULL)
        return;
    setCaption(i18n("Autoreply message") + " " + i18n(text));
    setIcon(Pict(icon));
    m_time = 15;
    lblTime->setText(i18n("Close after %n second", "Close after %n seconds", m_time));
    m_timer = new QTimer(this);
    connect(m_timer, SIGNAL(timeout()), this, SLOT(timeout()));
    m_timer->start(1000);
    ARUserData *ar = (ARUserData*)getContacts()->getUserData(CorePlugin::m_plugin->ar_data_id);
    text = get_str(ar->AutoReply, m_status);
    if ((text == NULL) || (*text == 0))
        text = get_str(ar->AutoReply, m_status);
    if (text)
        edtAutoResponse->setText(QString::fromUtf8(text));
    connect(edtAutoResponse, SIGNAL(textChanged()), this, SLOT(textChanged()));
    connect(chkNoShow, SIGNAL(toggled(bool)), this, SLOT(toggled(bool)));
    connect(btnHelp, SIGNAL(clicked()), this, SLOT(help()));
    Event e(EventTmplHelpList);
    edtAutoResponse->helpList = (const char**)e.process();
}
Beispiel #13
0
void UserConfig::fill()
{
    ConfigItem::curIndex = 1;
    lstBox->clear();
    QListViewItem *parentItem;
    if (m_contact){
        parentItem = new MainInfoItem(lstBox, CmdInfo);
        ClientDataIterator it(m_contact->clientData);
        void *data;
        while ((data = ++it) != NULL){
            Client *client = m_contact->clientData.activeClient(data, it.client());
            if (client == NULL)
                continue;
            CommandDef *cmds = client->infoWindows(m_contact, data);
            if (cmds){
                parentItem = NULL;
                for (; cmds->text; cmds++){
                    if (parentItem){
                        new ClientItem(parentItem, it.client(), data, cmds);
                    }else{
                        parentItem = new ClientItem(lstBox, it.client(), data, cmds);
                        parentItem->setOpen(true);
                    }
                }
            }
        }
    }

    parentItem = NULL;
    ClientUserData* data;
    if (m_contact) {
        data = &m_contact->clientData;
    } else {
        data = &m_group->clientData;
    }
    ClientDataIterator it(*data);
    list<unsigned> st;
    while (++it){
        if ((it.client()->protocol()->description()->flags & PROTOCOL_AR_USER) == 0)
            continue;
        if (parentItem == NULL){
            parentItem = new ConfigItem(lstBox, 0);
            parentItem->setText(0, i18n("Autoreply"));
            parentItem->setOpen(true);
        }
        for (const CommandDef *d = it.client()->protocol()->statusList(); d->text; d++){
            if ((d->id == STATUS_ONLINE) || (d->id == STATUS_OFFLINE))
                continue;
            list<unsigned>::iterator it;
            for (it = st.begin(); it != st.end(); ++it)
                if ((*it) == d->id)
                    break;
            if (it != st.end())
                continue;
            st.push_back(d->id);
            new ARItem(parentItem, d);
        }
    }

    parentItem = new ConfigItem(lstBox, 0);
    parentItem->setText(0, i18n("Settings"));
    parentItem->setPixmap(0, Pict("configure"));
    parentItem->setOpen(true);
    CommandDef *cmd;
    CommandsMapIterator itc(CorePlugin::m_plugin->preferences);
    m_defaultPage = 0;
    while ((cmd = ++itc) != NULL){
        new PrefItem(parentItem, cmd);
        if (m_defaultPage == 0)
            m_defaultPage = cmd->id;
    }

    QFontMetrics fm(lstBox->font());
    unsigned w = 0;
    for (QListViewItem *item = lstBox->firstChild(); item; item = item->nextSibling()){
        w = QMAX(w, itemWidth(item, fm));
    }
    lstBox->setFixedWidth(w);
    lstBox->setColumnWidth(0, w - 2);
}
Beispiel #14
0
void MsgEdit::toggleMultiply()
{
    bMultiply = !bMultiply;
    btnMultiply->setPixmap(Pict(bMultiply ? "1leftarrow" : "1rightarrow"));
    emit showUsers(bMultiply, Uin);
}
Beispiel #15
0
void AIMInfo::fill()
{
    ICQUserData *data = m_data;
    if (data == NULL) data = &m_client->data.owner;

    setText(edtScreen, data->Screen.ptr);
    setText(edtFirst, data->FirstName.ptr);
    setText(edtLast, data->LastName.ptr);
    setText(edtMiddle, data->MiddleName.ptr);
    setText(edtMaiden, data->Maiden.ptr);
    setText(edtNick, data->Nick.ptr);
    setText(edtStreet, data->Address.ptr);
    setText(edtCity, data->City.ptr);
    setText(edtState, data->State.ptr);
    setText(edtZip, data->Zip.ptr);
    initCombo(cmbCountry, (unsigned short)(data->Country.value), getCountries(), true, getCountryCodes());

    if (m_data == NULL){
        if (edtFirst->text().isEmpty())
            edtFirst->setText(getContacts()->owner()->getFirstName());
        if (edtLast->text().isEmpty())
            edtLast->setText(getContacts()->owner()->getLastName());
    }

    cmbStatus->clear();
    unsigned status = STATUS_ONLINE;
    if (m_data){
        unsigned s = m_data->Status.value;
        if (s == ICQ_STATUS_OFFLINE){
            status = STATUS_OFFLINE;
        }else if (s & ICQ_STATUS_AWAY){
            status = STATUS_AWAY;
        }
    }else{
        status = m_client->getStatus();
    }
    if ((status != STATUS_ONLINE) && (status != STATUS_OFFLINE) && m_data){
        edtAutoReply->setText(getContacts()->toUnicode(getContacts()->contact(m_contact), m_data->AutoReply.ptr));
    }else{
        edtAutoReply->hide();
    }

    int current = 0;
    const char *text = NULL;
    for (const CommandDef *cmd = m_client->protocol()->statusList(); cmd->id; cmd++){
        if (cmd->flags & COMMAND_CHECK_STATE)
            continue;
        if (status == cmd->id){
            current = cmbStatus->count();
            text = cmd->text;
        }
        cmbStatus->insertItem(Pict(cmd->icon), i18n(cmd->text));
    }

    cmbStatus->setCurrentItem(current);
    disableWidget(cmbStatus);
    if (status == STATUS_OFFLINE){
        lblOnline->setText(i18n("Last online") + ":");
        edtOnline->setText(formatDateTime(data->StatusTime.value));
        lblNA->hide();
        edtNA->hide();
    }else{
        if (data->OnlineTime.value){
            edtOnline->setText(formatDateTime(data->OnlineTime.value));
        }else{
            lblOnline->hide();
            edtOnline->hide();
        }
        if ((status == STATUS_ONLINE) || (text == NULL)){
            lblNA->hide();
            edtNA->hide();
        }else{
            lblNA->setText(i18n(text));
            edtNA->setText(formatDateTime(data->StatusTime.value));
        }
    }
    if (data->IP.ptr){
        edtExtIP->setText(formatAddr(data->IP, data->Port.value));
    }else{
        lblExtIP->hide();
        edtExtIP->hide();
    }
    if (data->RealIP.ptr && ((data->IP.ptr == NULL) || (get_ip(data->IP) != get_ip(data->RealIP)))){
        edtIntIP->setText(formatAddr(data->RealIP, data->Port.value));
    }else{
        lblIntIP->hide();
        edtIntIP->hide();
    }
    if (m_data){
        string client_name = m_client->clientName(data);
        if (client_name.length()){
            edtClient->setText(client_name.c_str());
        }else{
            lblClient->hide();
            edtClient->hide();
        }
    }else{
        string name = PACKAGE;
        name += " ";
        name += VERSION;
#ifdef WIN32
        name += "/win32";
#endif
        edtClient->setText(name.c_str());
    }
}
Beispiel #16
0
void YahooInfo::fill()
{
    YahooUserData *data = m_data;
    if (data == NULL) data = &m_client->data.owner;
    edtLogin->setText(QString::fromUtf8(data->Login.ptr));
    edtNick->setText(data->Nick.ptr ? QString::fromUtf8(data->Nick.ptr) : QString(""));
    edtFirst->setText(data->First.ptr ? QString::fromUtf8(data->First.ptr) : QString(""));
    edtLast->setText(data->Last.ptr ? QString::fromUtf8(data->Last.ptr) : QString(""));
    int current = 0;
    const char *text = NULL;
    unsigned long status = STATUS_OFFLINE;
    if (m_data == NULL){
        if (m_client->getState() == Client::Connected){
            const char *statusIcon = NULL;
            unsigned style  = 0;
            m_client->contactInfo(&m_client->data.owner, status, style, statusIcon);
        }
    }else{
        const char *statusIcon = NULL;
        unsigned style  = 0;
        m_client->contactInfo(data, status, style, statusIcon);
    }
    for (const CommandDef *cmd = m_client->protocol()->statusList(); cmd->id; cmd++){
        if (cmd->flags & COMMAND_CHECK_STATE)
            continue;
        if (status == cmd->id){
            current = cmbStatus->count();
            text = cmd->text;
        }
        cmbStatus->insertItem(Pict(cmd->icon), i18n(cmd->text));
    }
    cmbStatus->setCurrentItem(current);
    disableWidget(cmbStatus);
    if (status == STATUS_OFFLINE){
        if (data->StatusTime.value){
            lblOnline->setText(i18n("Last online") + ":");
            edtOnline->setText(formatDateTime(data->StatusTime.value));
            lblOnline->show();
            edtOnline->show();
        }else{
            lblOnline->hide();
            edtOnline->hide();
        }
        lblNA->hide();
        edtNA->hide();
    }else{
        if (data->OnlineTime.value){
            edtOnline->setText(formatDateTime(data->OnlineTime.value));
        }else{
            lblOnline->hide();
            edtOnline->hide();
        }
        if ((status == STATUS_ONLINE) || (text == NULL)){
            lblNA->hide();
            edtNA->hide();
        }else{
            lblNA->setText(i18n(text));
            edtNA->setText(formatDateTime(data->StatusTime.value));
        }
    }
    if (m_bInit)
        return;
    m_bInit = true;
    fillEncoding(data);
}
Beispiel #17
0
void SetupDialog::iconChanged()
{
    setIcon(Pict("configure"));
    for (QListViewItem *item = lstBars->firstChild(); item != NULL; item = item->nextSibling())
        iconChanged(item);
}
Beispiel #18
0
void ICQInfo::fill()
{
    ICQUserData *data = m_data;
    if (data == NULL) data = &m_client->data.owner;

    edtUin->setText(QString::number(data->Uin.value));
    edtFirst->setText(m_client->toUnicode(data->FirstName.ptr, data));
    edtLast->setText(m_client->toUnicode(data->LastName.ptr, data));
    edtNick->setText(m_client->toUnicode(data->Nick.ptr, data));

    if (m_data == NULL){
        if (edtFirst->text().isEmpty())
            edtFirst->setText(getContacts()->owner()->getFirstName());
        if (edtLast->text().isEmpty())
            edtLast->setText(getContacts()->owner()->getLastName());
    }

    cmbStatus->clear();
    unsigned status = STATUS_ONLINE;
    if (m_data){
        unsigned s = m_data->Status.value;
        if (s == ICQ_STATUS_OFFLINE){
            status = STATUS_OFFLINE;
        }else if (s & ICQ_STATUS_DND){
            status = STATUS_DND;
        }else if (s & ICQ_STATUS_OCCUPIED){
            status = STATUS_OCCUPIED;
        }else if (s & ICQ_STATUS_NA){
            status = STATUS_NA;
        }else if (s & ICQ_STATUS_AWAY){
            status = STATUS_AWAY;
        }else if (s & ICQ_STATUS_FFC){
            status = STATUS_FFC;
        }
    }else{
        status = m_client->getStatus();
        initCombo(cmbRandom, m_client->getRandomChatGroup(), chat_groups);
    }
    if ((status != STATUS_ONLINE) && (status != STATUS_OFFLINE) && m_data){
        edtAutoReply->setText(m_client->toUnicode(m_data->AutoReply.ptr, m_data));
    }else{
        edtAutoReply->hide();
    }

    int current = 0;
    const char *text = NULL;
    if (m_data && (status == STATUS_OFFLINE) && m_data->bInvisible.bValue){
        cmbStatus->insertItem(Pict("ICQ_invisible"), i18n("Possibly invisible"));
    }else{
        for (const CommandDef *cmd = m_client->protocol()->statusList(); cmd->id; cmd++){
            if (cmd->flags & COMMAND_CHECK_STATE)
                continue;
            if (status == cmd->id){
                current = cmbStatus->count();
                text = cmd->text;
            }
            cmbStatus->insertItem(Pict(cmd->icon), i18n(cmd->text));
        }
    }
    cmbStatus->setCurrentItem(current);
    disableWidget(cmbStatus);
    if (status == STATUS_OFFLINE){
        lblOnline->setText(i18n("Last online") + ":");
        edtOnline->setText(formatDateTime(data->StatusTime.value));
        lblNA->hide();
        edtNA->hide();
    }else{
        if (data->OnlineTime.value){
            edtOnline->setText(formatDateTime(data->OnlineTime.value));
        }else{
            lblOnline->hide();
            edtOnline->hide();
        }
        if ((status == STATUS_ONLINE) || (text == NULL)){
            lblNA->hide();
            edtNA->hide();
        }else{
            lblNA->setText(i18n(text));
            edtNA->setText(formatDateTime(data->StatusTime.value));
        }
    }
    if (data->IP.ptr){
        edtExtIP->setText(formatAddr(data->IP, data->Port.value));
    }else{
        lblExtIP->hide();
        edtExtIP->hide();
    }
    if ((data->RealIP.ptr) && ((data->IP.ptr == NULL) || (get_ip(data->IP) != get_ip(data->RealIP)))){
        edtIntIP->setText(formatAddr(data->RealIP, data->Port.value));
    }else{
        lblIntIP->hide();
        edtIntIP->hide();
    }
    if (m_data){
        string client_name = m_client->clientName(data);
        if (client_name.length()){
            edtClient->setText(client_name.c_str());
        }else{
            lblClient->hide();
            edtClient->hide();
        }
    }else{
        string name = PACKAGE;
        name += " ";
        name += VERSION;
#ifdef WIN32
        name += "/win32";
#endif
        edtClient->setText(name.c_str());
    }

    if (m_bInit)
        return;
    m_bInit = true;
    m_client->fillEncoding(cmbEncoding, data);
}
Beispiel #19
0
void UserView::drawItem(UserViewItemBase *base, QPainter *p, const QColorGroup &cg, int width, int margin)
{
    if (base->type() == GRP_ITEM){
        GroupItem *item = static_cast<GroupItem*>(base);
        QFont f(font());
        int size = f.pixelSize();
        if (size <= 0){
            size = f.pointSize();
            f.setPointSize(size * 3 / 4);
        }else{
            f.setPixelSize(size * 3 / 4);
        }
        f.setBold(true);
        p->setFont(f);
        QString text;
        if (item->id()){
            Group *grp = getContacts()->group(item->id());
            if (grp){
                text = grp->getName();
            }else{
                text = "???";
            }
        }else{
            text = i18n("Not in list");
        }
        if (item->m_nContacts){
            text += " (";
            if (item->m_nContactsOnline){
                text += QString::number(item->m_nContactsOnline);
                text += "/";
            }
            text += QString::number(item->m_nContacts);
            text += ")";
        }
        const QPixmap &pict = Pict(item->isOpen() ? "expanded" : "collapsed");
        p->drawPixmap(2 + margin, (item->height() - pict.height()) / 2, pict);
        int x = 24 + margin;
        if (!item->isOpen() && item->m_unread){
            CommandDef *def = CorePlugin::m_plugin->messageTypes.find(item->m_unread);
            if (def){
                const QPixmap &pict = Pict(def->icon);
                if (m_bUnreadBlink)
                    p->drawPixmap(x, (item->height() - pict.height()) / 2, pict);
                x += pict.width() + 2;
            }
        }
        if (!CorePlugin::m_plugin->getUseSysColors())
            p->setPen(CorePlugin::m_plugin->getColorGroup());
        x = item->drawText(p, x, width, text);
        if (CorePlugin::m_plugin->getGroupSeparator())
            item->drawSeparator(p, x, width, cg);
        return;
    }
    if (base->type() == USR_ITEM){
        ContactItem *item = static_cast<ContactItem*>(base);
        QFont f(font());
        if (item->style() & CONTACT_ITALIC)
            f.setItalic(true);
        if (item->style() & CONTACT_UNDERLINE)
            f.setUnderline(true);
        if (item->style() & CONTACT_STRIKEOUT)
            f.setStrikeOut(true);
        if (item->m_bBlink){
            f.setBold(true);
        }else{
            f.setBold(false);
        }
        p->setFont(f);
        string icons = item->text(CONTACT_ICONS).latin1();
        string icon = getToken(icons, ',');
        if (item->m_unread && m_bUnreadBlink){
            CommandDef *def = CorePlugin::m_plugin->messageTypes.find(item->m_unread);
            if (def)
                icon = def->icon;
        }
        int x = margin;
        if (icon.length()){
            const QPixmap &pict = Pict(icon.c_str());
            x += 2;
            p->drawPixmap(x, (item->height() - pict.height()) / 2, pict);
            x += pict.width() + 2;
        }
        if (x < 24)
            x = 24;
        if (!item->isSelected() || !hasFocus() || !CorePlugin::m_plugin->getUseDblClick()){
            if (CorePlugin::m_plugin->getUseSysColors()){
                if (item->status() != STATUS_ONLINE)
                    p->setPen(palette().disabled().text());
            }else{
                switch (item->status()){
                case STATUS_ONLINE:
                    break;
                case STATUS_AWAY:
                    p->setPen(CorePlugin::m_plugin->getColorAway());
                    break;
                case STATUS_NA:
                    p->setPen(CorePlugin::m_plugin->getColorNA());
                    break;
                case STATUS_DND:
                    p->setPen(CorePlugin::m_plugin->getColorDND());
                    break;
                default:
                    p->setPen(CorePlugin::m_plugin->getColorOffline());
                    break;
                }
            }
        }
        QString highlight;
        QString text = item->text(CONTACT_TEXT);
        if (!m_search.isEmpty()){
            if (text.left(m_search.length()).upper() == m_search.upper())
                highlight = text.left(m_search.length());
        }
        int save_x = x;
        x = item->drawText(p, x, width, text);
        x += 2;
        if (!highlight.isEmpty()){
            QPen oldPen = p->pen();
            QColor oldBg = p->backgroundColor();
            p->setBackgroundMode(OpaqueMode);
            if (item == m_searchItem){
                if ((item == currentItem()) && CorePlugin::m_plugin->getUseDblClick()){
                    p->setBackgroundColor(cg.highlightedText());
                    p->setPen(cg.highlight());
                }else{
                    p->setBackgroundColor(cg.highlight());
                    p->setPen(cg.highlightedText());
                }
            }else{
                p->setBackgroundColor(oldPen.color());
                p->setPen(oldBg);
            }
            item->drawText(p, save_x, width, highlight);
            p->setPen(oldPen);
            p->setBackgroundColor(oldBg);
            p->setBackgroundMode(TransparentMode);
        }
        unsigned xIcon = width;
        while (icons.length()){
            icon = getToken(icons, ',');
            const QPixmap &pict = Pict(icon.c_str());
            xIcon -= pict.width() + 2;
            if (xIcon < (unsigned)x)
                break;
            p->drawPixmap(xIcon, (item->height() - pict.height()) / 2, pict);
        }
        return;
    }
    UserListBase::drawItem(base, p, cg, width, margin);
}
Beispiel #20
0
void MainInfo::fill()
{
    Contact *contact = m_contact;
    if (contact == NULL)
        contact = getContacts()->owner();

    QString firstName = contact->getFirstName();
    firstName = getToken(firstName, '/');
    edtFirstName->setText(firstName);
    QString lastName = contact->getLastName();
    lastName = getToken(lastName, '/');
    edtLastName->setText(lastName);

    cmbDisplay->clear();
    QString name = contact->getName();
    if (name.length())
        cmbDisplay->insertItem(name);
    if (firstName.length() && lastName.length()){
        cmbDisplay->insertItem(firstName + " " + lastName);
        cmbDisplay->insertItem(lastName + " " + firstName);
    }
    if (firstName.length())
        cmbDisplay->insertItem(firstName);
    if (lastName.length())
        cmbDisplay->insertItem(lastName);
    cmbDisplay->lineEdit()->setText(contact->getName());

    edtNotes->setText(contact->getNotes());
    QString mails = contact->getEMails();
    lstMails->clear();
    while (mails.length()){
        QString mailItem = getToken(mails, ';', false);
        QString mail = getToken(mailItem, '/');
        QListViewItem *item = new QListViewItem(lstMails);
        item->setText(MAIL_ADDRESS, mail);
        item->setText(MAIL_PROTO, mailItem);
        item->setPixmap(MAIL_ADDRESS, Pict("mail_generic"));
        if ((m_contact == NULL) && mailItem.isEmpty())
            item->setText(MAIL_PUBLISH, i18n("Yes"));
    }
    mailSelectionChanged();
    QString phones = contact->getPhones();
    lstPhones->clear();
    unsigned n = 1;
    cmbCurrent->clear();
    cmbCurrent->insertItem("");
    while (phones.length()){
        QString number;
        QString type;
        unsigned icon = 0;
        QString proto;
        QString phone = getToken(phones, ';', false);
        QString phoneItem = getToken(phone, '/', false);
        proto = phone;
        number = getToken(phoneItem, ',');
        type = getToken(phoneItem, ',');
		if (!phoneItem.isEmpty())
			icon = atol(getToken(phoneItem, ',').latin1());
        QListViewItem *item = new QListViewItem(lstPhones);
        fillPhoneItem(item, number, type, icon, proto);
        cmbCurrent->insertItem(number);
        if (!phoneItem.isEmpty()){
            item->setText(PHONE_ACTIVE, "1");
            cmbCurrent->setCurrentItem(n);
        }
        n++;
    }
    connect(lstPhones, SIGNAL(selectionChanged()), this, SLOT(phoneSelectionChanged()));
    phoneSelectionChanged();
}
Beispiel #21
0
void ICQInfo::fill()
{
    ICQUserData *data = m_data;
    if (data == NULL) data = &m_client->data.owner;

    edtUin->setText(QString::number(data->Uin));
    edtFirst->setText(m_client->toUnicode(data->FirstName, data));
    edtLast->setText(m_client->toUnicode(data->LastName, data));
    edtNick->setText(m_client->toUnicode(data->Nick, data));

    if (m_data == NULL){
        if (edtFirst->text().isEmpty())
            edtFirst->setText(getContacts()->owner()->getFirstName());
        if (edtLast->text().isEmpty())
            edtLast->setText(getContacts()->owner()->getLastName());
    }

    cmbStatus->clear();
    unsigned status = STATUS_ONLINE;
    if (m_data){
        unsigned s = m_data->Status;
        if (s == ICQ_STATUS_OFFLINE){
            status = STATUS_OFFLINE;
        }else if (s & ICQ_STATUS_DND){
            status = STATUS_DND;
        }else if (s & ICQ_STATUS_OCCUPIED){
            status = STATUS_OCCUPIED;
        }else if (s & ICQ_STATUS_NA){
            status = STATUS_NA;
        }else if (s & ICQ_STATUS_AWAY){
            status = STATUS_AWAY;
        }else if (s & ICQ_STATUS_FFC){
            status = STATUS_FFC;
        }
    }else{
        status = m_client->getStatus();
        initCombo(cmbRandom, m_client->getRandomChatGroup(), chat_groups);
    }
    if ((status != STATUS_ONLINE) && (status != STATUS_OFFLINE) && m_data){
        edtAutoReply->setText(m_client->toUnicode(m_data->AutoReply, m_data));
    }else{
        edtAutoReply->hide();
    }

    int current = 0;
    const char *text = NULL;
    for (const CommandDef *cmd = m_client->protocol()->statusList(); cmd->id; cmd++){
        if (cmd->flags & COMMAND_CHECK_STATE)
            continue;
        if (status == cmd->id){
            current = cmbStatus->count();
            text = cmd->text;
        }
        cmbStatus->insertItem(Pict(cmd->icon), i18n(cmd->text));
    }
    cmbStatus->setCurrentItem(current);
    disableWidget(cmbStatus);
    if (status == STATUS_OFFLINE){
        lblOnline->setText(i18n("Last online") + ":");
        edtOnline->setText(formatTime(data->StatusTime));
        lblNA->hide();
        edtNA->hide();
    }else{
        if (data->OnlineTime){
            edtOnline->setText(formatTime(data->OnlineTime));
        }else{
            lblOnline->hide();
            edtOnline->hide();
        }
        if ((status == STATUS_ONLINE) || (text == NULL)){
            lblNA->hide();
            edtNA->hide();
        }else{
            lblNA->setText(i18n(text));
            edtNA->setText(formatTime(data->StatusTime));
        }
    }
    if (data->IP){
        edtExtIP->setText(formatAddr(data->IP, data->Port));
    }else{
        lblExtIP->hide();
        edtExtIP->hide();
    }
    if ((data->RealIP) && ((data->IP == NULL) || (get_ip(data->IP) != get_ip(data->RealIP)))){
        edtIntIP->setText(formatAddr(data->IP, data->Port));
    }else{
        lblIntIP->hide();
        edtIntIP->hide();
    }
    if (m_data){
        string client_name = m_client->clientName(data);
        if (client_name.length()){
            edtClient->setText(client_name.c_str());
        }else{
            lblClient->hide();
            edtClient->hide();
        }
    }else{
        string name = PACKAGE;
        name += " ";
        name += VERSION;
#ifdef WIN32
        name += "/win32";
#endif
        edtClient->setText(name.c_str());
    }

    if (m_bInit)
        return;
    m_bInit = true;
    current = 0;
    int n_item = 1;
    cmbEncoding->clear();
    cmbEncoding->insertItem("Default");
    QStringList l;
    const ENCODING *e;
    QStringList main;
    QStringList::Iterator it;
    for (e = encodingTbl; e->language; e++){
        if (!e->bMain)
            continue;
        main.append(i18n(e->language) + " (" + e->codec + ")");
    }
    main.sort();
    for (it = main.begin(); it != main.end(); ++it, n_item++){
        QString str = *it;
        int n = str.find('(');
        str = str.mid(n + 1);
        n = str.find(')');
        str = str.left(n);
        if (data->Encoding && !strcmp(data->Encoding, str.latin1()))
            current = n_item;
        cmbEncoding->insertItem(*it);
    }
    QStringList noMain;
    for (e = encodingTbl; e->language; e++){
        if (e->bMain)
            continue;
        noMain.append(i18n(e->language) + " (" + e->codec + ")");
    }
    noMain.sort();
    for (it = noMain.begin(); it != noMain.end(); ++it, n_item++){
        QString str = *it;
        int n = str.find('(');
        str = str.mid(n + 1);
        n = str.find(')');
        str = str.left(n);
        if (data->Encoding && !strcmp(data->Encoding, str.latin1()))
            current = n_item;
        cmbEncoding->insertItem(*it);
    }
    cmbEncoding->setCurrentItem(current);
}
Beispiel #22
0
SetupDialog::SetupDialog(QWidget *parent, int nWin)
        : SetupDialogBase(parent, "setup", false, WStyle_Minimize)
{
    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"), "100");
    itemMain->setOpen(true);

    addPage(new MainInfo(tabBars), 101, i18n("Main info"), "main");
    addPage(new HomeInfo(tabBars), 102, i18n("Home info"), "home");
    addPage(new WorkInfo(tabBars), 103, i18n("Work info"), "work");
    addPage(new MoreInfo(tabBars), 104, i18n("More info"), "more");
    addPage(new AboutInfo(tabBars), 105, i18n("About info"), "info");
    addPage(new InterestsInfo(tabBars), 106, i18n("Interests"), "interest");
    addPage(new PastInfo(tabBars), 107, i18n("Group/Past"), "past");
    addPage(new PhoneBookDlg(tabBars), 108, i18n("Phone book"), "phone");

    itemMain = new QListViewItem(lstBars, i18n("Preferences"), "200");
    itemMain->setOpen(true);

    addPage(new StatusSetup(tabBars), 201, i18n("Status mode"), "status");
    addPage(new NetworkSetup(tabBars), 202, i18n("Connection"), "network");
    addPage(new ThemeSetup(tabBars), 203, i18n("Style"), "style");
    addPage(new FontSetup(tabBars), 204, i18n("Interface"), "text");
    addPage(new SoundSetup(tabBars), 205, i18n("Sound"), "sound");
    addPage(new XOSDSetup(tabBars), 206, i18n("On Screen notification"), "screen");

    addPage(new AlertDialog(tabBars), 207, i18n("Alert"), "alert");
    addPage(new AcceptDialog(tabBars), 208, i18n("Accept file"), "file");

#ifndef WIN32
    addPage(new MiscSetup(tabBars), 209, i18n("Miscellaneous"), "misc");
#endif

#ifdef USE_SPELL
    addPage(new SpellSetup(tabBars), 210, i18n("Spell check"), "spellcheck");
#endif

    itemMain = new QListViewItem(lstBars, i18n("Auto reply"), "300");
    itemMain->setOpen(true);

    addPage(new MsgDialog(tabBars, ICQ_STATUS_AWAY), 301, Client::getStatusText(ICQ_STATUS_AWAY), "away");
    addPage(new MsgDialog(tabBars, ICQ_STATUS_NA), 302, Client::getStatusText(ICQ_STATUS_NA), "na");
    addPage(new MsgDialog(tabBars, ICQ_STATUS_OCCUPIED), 303, Client::getStatusText(ICQ_STATUS_OCCUPIED), "occupied");
    addPage(new MsgDialog(tabBars, ICQ_STATUS_DND), 304, Client::getStatusText(ICQ_STATUS_DND), "dnd");
    addPage(new MsgDialog(tabBars, ICQ_STATUS_FREEFORCHAT), 305, Client::getStatusText(ICQ_STATUS_FREEFORCHAT), "ffc");

    itemMain = new QListViewItem(lstBars, i18n("Security"), "400");
    itemMain->setOpen(true);

    addPage(new GeneralSecurity(tabBars), 401, i18n("General"), "webaware");
    addPage(new ChangePasswd(tabBars), 402, i18n("Password"), "password");
    addPage(new IgnoreListSetup(tabBars), 403, i18n("Ignore list"), "ignorelist");
    addPage(new InvisibleListSetup(tabBars), 404, i18n("Invisible list"), "invisiblelist");
    addPage(new VisibleListSetup(tabBars), 405, i18n("Visible list"), "visiblelist");

    tabBars->raiseWidget(nWin ? nWin : 101);
    connect(pMain, SIGNAL(iconChanged()), this, SLOT(iconChanged()));

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