示例#1
0
void KBookmarkDialogPrivate::initLayoutPrivate()
{
    title = new QLineEdit(q);
    title->setMinimumWidth(300);
    titleLabel = new QLabel(KBookmarkDialog::tr("Name:", "@label:textbox"), q);
    titleLabel->setBuddy(title);

    url = new QLineEdit(q);
    url->setMinimumWidth(300);
    urlLabel = new QLabel(KBookmarkDialog::tr("Location:", "@label:textbox"), q);
    urlLabel->setBuddy(url);

    comment = new QLineEdit(q);
    comment->setMinimumWidth(300);
    commentLabel = new QLabel(KBookmarkDialog::tr("Comment:", "@label:textbox"), q);
    commentLabel->setBuddy(comment);

    folderTree = new QTreeWidget(q);
    folderTree->setColumnCount(1);
    folderTree->header()->hide();
    folderTree->setSortingEnabled(false);
    folderTree->setSelectionMode(QTreeWidget::SingleSelection);
    folderTree->setSelectionBehavior(QTreeWidget::SelectRows);
    folderTree->setMinimumSize(60, 100);
    QTreeWidgetItem *root = new KBookmarkTreeItem(folderTree);
    fillGroup(root, mgr->root());

    buttonBox = new QDialogButtonBox(q);
    buttonBox->setStandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
    q->connect(buttonBox, SIGNAL(accepted()), q, SLOT(accept()));
    q->connect(buttonBox, &QDialogButtonBox::rejected, q, &QDialog::reject);

    initLayout();
    layout = true;
}
示例#2
0
JabberAdd::JabberAdd(JabberClient *client)
{
    m_client = client;
    m_wizard = NULL;
    m_result = NULL;
    m_idValidator = new IdValidator(edtID);
    edtID->setValidator(m_idValidator);
    connect(tabAdd, SIGNAL(currentChanged(QWidget*)), this, SLOT(currentChanged(QWidget*)));
    connect(edtID, SIGNAL(returnPressed()), this, SLOT(search()));
    connect(edtID, SIGNAL(textChanged(const QString&)), this, SLOT(textChanged(const QString&)));
    QStringList services;
    for (unsigned i = 0; i < getContacts()->nClients(); i++){
        Client *c = getContacts()->getClient(i);
        if ((c->protocol() != client->protocol()) || (c->getState() != Client::Connected))
            continue;
        JabberClient *jc = static_cast<JabberClient*>(c);
        QString vHost = QString::fromUtf8(jc->VHost().c_str());
        QStringList::Iterator it;
        for (it = services.begin(); it != services.end(); ++it){
            if ((*it) == vHost)
                break;
        }
        if (it != services.end())
            continue;
        services.append(vHost);
    }
    cmbServices->insertStringList(services);
    connect(cmbServices, SIGNAL(activated(const QString&)), this, SLOT(serviceChanged(const QString&)));
    serviceChanged(cmbServices->currentText());
    fillGroup();
}
示例#3
0
MSNSearch::MSNSearch(MSNClient *client)
{
    m_client = client;
    m_result = NULL;
    m_wizard = NULL;
    connect(edtMail, SIGNAL(textChanged(const QString&)), this, SLOT(textChanged(const QString&)));
    fillGroup();
}
示例#4
0
void KonqSidebarBookmarkModule::fillListView()
{
    m_ignoreOpenChange = true;

    KBookmarkGroup root = KonqBookmarkManager::self()->root();
    fillGroup( m_topLevelItem, root );

    m_ignoreOpenChange = false;
}
示例#5
0
void *MSNSearch::processEvent(Event *e)
{
    switch (e->type()){
    case EventGroupChanged:
    case EventGroupDeleted:
        fillGroup();
        break;
    }
    return NULL;
}
示例#6
0
void KBookmarkDialogPrivate::fillGroup(QTreeWidgetItem *parentItem, const KBookmarkGroup &group, const KBookmarkGroup &selectGroup)
{
    for (KBookmark bk = group.first(); !bk.isNull(); bk = group.next(bk)) {
        if (bk.isGroup()) {
            const KBookmarkGroup bkGroup = bk.toGroup();
            QTreeWidgetItem* item = new KBookmarkTreeItem(parentItem, folderTree, bkGroup);
            if (selectGroup == bkGroup) {
                folderTree->setCurrentItem(item);
            }
            fillGroup(item, bkGroup, selectGroup);
        }
    }
}
示例#7
0
ICQSearch::ICQSearch(ICQClient *client)
{
    m_client = client;
    m_result = NULL;
    m_wizard = NULL;
    m_bRandomSearch = false;
    m_randomUin = 0;
    initCombo(cmbGender, 0, p_genders);
    initCombo(cmbAge, 0, ages);
    initCombo(cmbCountry, 0, getCountries());
    initCombo(cmbLang, 0, p_languages);
    connect(tabSearch, SIGNAL(currentChanged(QWidget*)), this, SLOT(currentChanged(QWidget*)));
    connect(edtEmail, SIGNAL(textChanged(const QString&)), this, SLOT(textChanged(const QString&)));
    connect(cmbAge, SIGNAL(activated(const QString&)), this, SLOT(textChanged(const QString&)));
    connect(cmbGender, SIGNAL(activated(const QString&)), this, SLOT(textChanged(const QString&)));
    connect(cmbCountry, SIGNAL(activated(const QString&)), this, SLOT(textChanged(const QString&)));
    connect(cmbLang, SIGNAL(activated(const QString&)), this, SLOT(textChanged(const QString&)));
    connect(edtCity, SIGNAL(textChanged(const QString&)), this, SLOT(textChanged(const QString&)));
    connect(edtState, SIGNAL(textChanged(const QString&)), this, SLOT(textChanged(const QString&)));
    connect(edtCompany, SIGNAL(textChanged(const QString&)), this, SLOT(textChanged(const QString&)));
    connect(edtDepartment, SIGNAL(textChanged(const QString&)), this, SLOT(textChanged(const QString&)));
    connect(edtInterests, SIGNAL(textChanged(const QString&)), this, SLOT(textChanged(const QString&)));
    connect(edtFirst, SIGNAL(textChanged(const QString&)), this, SLOT(textChanged(const QString&)));
    connect(edtLast, SIGNAL(textChanged(const QString&)), this, SLOT(textChanged(const QString&)));
    connect(edtNick, SIGNAL(textChanged(const QString&)), this, SLOT(textChanged(const QString&)));
    connect(edtUin, SIGNAL(textChanged(const QString&)), this, SLOT(textChanged(const QString&)));
    connect(edtScreen, SIGNAL(textChanged(const QString&)), this, SLOT(textChanged(const QString&)));
    connect(edtEmail, SIGNAL(returnPressed()), this, SLOT(search()));
    connect(edtFirst, SIGNAL(returnPressed()), this, SLOT(search()));
    connect(edtLast, SIGNAL(returnPressed()), this, SLOT(search()));
    connect(edtNick, SIGNAL(returnPressed()), this, SLOT(search()));
    connect(edtUin, SIGNAL(returnPressed()), this, SLOT(search()));
    connect(edtCity, SIGNAL(returnPressed()), this, SLOT(search()));
    connect(edtState, SIGNAL(returnPressed()), this, SLOT(search()));
    connect(edtCompany, SIGNAL(returnPressed()), this, SLOT(search()));
    connect(edtDepartment, SIGNAL(returnPressed()), this, SLOT(search()));
    connect(edtInterests, SIGNAL(returnPressed()), this, SLOT(search()));
    edtUin->setValidator(new QIntValidator(10000, 0x7FFFFFFF, edtUin));
    initCombo(cmbGroup, m_client->getRandomChatGroup(), p_chat_groups, false);
    connect(btnFind, SIGNAL(clicked()), this, SLOT(randomFind()));
    setFindText();
    edtStatus->setReadOnly(true);
    edtInfo->setReadOnly(true);
    edtInfo->setTextFormat(QTextEdit::RichText);
    btnAdd->setEnabled(false);
    btnMsg->setEnabled(false);
    connect(btnAdd, SIGNAL(clicked()), this, SLOT(addContact()));
    connect(btnMsg, SIGNAL(clicked()), this, SLOT(sendMessage()));
    edtScreen->setValidator(new AIMValidator(edtScreen));
    fillGroup();
}
示例#8
0
void *JabberAdd::processEvent(Event *e)
{
    if (e->type() == static_cast<JabberPlugin*>(m_client->protocol()->plugin())->EventAgentFound){
        JabberAgentsInfo *data = (JabberAgentsInfo*)(e->param());
        if ((data->Client == m_client) && data->Search){
            AGENTS_MAP::iterator it = m_agents.find(data->ID);
            if (it == m_agents.end()){
                agentInfo info;
                info.search = NULL;
                info.name   = data->Name;
                m_agents.insert(AGENTS_MAP::value_type(data->ID, info));
                m_client->get_agent_info(data->ID, NULL, "search");
            }
        }
        return NULL;
    }
    if (e->type() == static_cast<JabberPlugin*>(m_client->protocol()->plugin())->EventAgentInfo){
        JabberAgentInfo *data = (JabberAgentInfo*)(e->param());
        if (data->ID == NULL)
            return NULL;
        AGENTS_MAP::iterator it = m_agents.find(data->ID);
        if (it != m_agents.end()){
            agentInfo &info = (*it).second;
            if (info.search == NULL){
                if (data->Type == NULL)
                    return NULL;
                info.search = new JabberSearch(this, m_client, data->ID, NULL, QString::fromUtf8(info.name.c_str()), false);
                tabAdd->addTab(info.search, QString::fromUtf8(info.name.c_str()));
            }
            info.search->addWidget(data);
        }
        return NULL;
    }
    switch (e->type()){
    case EventGroupChanged:
    case EventGroupDeleted:
        fillGroup();
        break;
    }
    return NULL;
}
示例#9
0
文件: dataset.cpp 项目: mothur/mothur
void TestDataSet::createCountTable() {
    fillGroup();
    fillNames();
    ct = new CountTable();
    
    for (map<string, string>::iterator itNameMap = nameMap.begin(); itNameMap !=nameMap.end(); itNameMap++) {
        string firstCol = itNameMap->first;
        string secondCol = itNameMap->second;
        vector<string> names;
        util.splitAtChar(secondCol, names, ',');
        
        //set to 0
        map<string, int> groupCounts;
        int total = 0;
        vector<string> Groups = gMap->getNamesOfGroups();
        ct->setNamesOfGroups(Groups);
        for (int i = 0; i < Groups.size(); i++) { groupCounts[Groups[i]] = 0; }
        
        //get counts for each of the users groups
        for (int i = 0; i < names.size(); i++) {
            string group = gMap->getGroup(names[i]);
            
            map<string, int>::iterator it = groupCounts.find(group);
            
            //if not found, then this sequence is not from a group we care about
            if (it != groupCounts.end()) {
                it->second++;
                total++;
            }
        }
        
        if (total != 0) {
            vector<int> abunds;
            for (map<string, int>::iterator it = groupCounts.begin(); it != groupCounts.end(); it++) { abunds.push_back(it->second); }
            ct->push_back(firstCol, abunds);
        }
    }
    delete gMap; gMap = NULL;
    nameMap.clear();
}
示例#10
0
void KonqSidebarBookmarkModule::fillGroup( KonqSidebarTreeItem * parentItem, KBookmarkGroup group )
{
    int n = 0;
    for ( KBookmark bk = group.first() ; !bk.isNull() ; bk = group.next(bk), ++n )
    {
            KonqSidebarBookmarkItem * item = new KonqSidebarBookmarkItem( parentItem, m_topLevelItem, bk, n );
            if ( bk.isGroup() )
            {
                KBookmarkGroup grp = bk.toGroup();
                fillGroup( item, grp );

                QString address(grp.address());
                if (m_folderOpenState.contains(address))
                    item->setOpen(m_folderOpenState[address]);
                else
                    item->setOpen(false);
            }
            else if ( bk.isSeparator() )
                item->setVisible( false );
            else
                item->setExpandable( false );
    }
}
示例#11
0
void KonqSidebarBookmarkModule::slotBookmarksChanged( const QString & groupAddress )
{
    m_ignoreOpenChange = true;

    // update the right part of the tree
    KBookmarkGroup group = KonqBookmarkManager::self()->findByAddress( groupAddress ).toGroup();
    KonqSidebarBookmarkItem * item = findByAddress( groupAddress );
    Q_ASSERT(!group.isNull());
    Q_ASSERT(item);
    if (!group.isNull() && item)
    {
        // Delete all children of item
        QListViewItem * child = item->firstChild();
        while( child ) {
            QListViewItem * next = child->nextSibling();
            delete child;
            child = next;
        }
        fillGroup( item, group );
    }

    m_ignoreOpenChange = false;
}
示例#12
0
KUserGroup::KUserGroup(KUser::UIDMode mode) {
  KUser user(mode);
  fillGroup(getgrgid(user.gid()));
}
示例#13
0
KUserGroup::KUserGroup(struct group *g) {
  fillGroup(g);
}
示例#14
0
void KUserGroup::fillName(const char *name) {
  fillGroup(name ? ::getgrnam( name ) : 0);
}
示例#15
0
 Private(const char *_name) : gid(gid_t(-1))
 {
     fillGroup(_name ? ::getgrnam( _name ) : 0);
 }
示例#16
0
KUserGroup::KUserGroup(long gid) {
  fillGroup(getgrgid(gid));
}
示例#17
0
void *ICQSearch::processEvent(Event *e)
{
    if (e->type() == EventRandomChat){
        m_randomUin = (unsigned)(e->param());
        if (m_randomUin == 0){
            edtStatus->setText(i18n("Search fail"));
        }else{
            edtStatus->setText(i18n("Request user info"));
            btnMsg->setEnabled(true);
            btnAdd->setEnabled(true);
            edtInfo->setText(i18n("<p>UIN: <b><a href=\"icq://%1\"><u>%2</u></a></b></p>")
                             .arg(QString::number(m_randomUin))
                             .arg(QString::number(m_randomUin)));
            edtInfo->sync();
            m_client->randomChatInfo(m_randomUin);
        }
        return this;
    }
    if (e->type() == EventRandomChatInfo){
        ICQUserData *data = (ICQUserData*)(e->param());
        if (data->Uin.value != m_randomUin)
            return NULL;
        edtStatus->setText("");
        m_name  = QString::fromUtf8(data->Alias.ptr);
        QString name  = quoteString(m_name);
        QString topic = quoteString(QString::fromUtf8(data->About.ptr));
        QString page  = QString::fromUtf8(data->Homepage.ptr);
        QString pageLink = page;
        if (pageLink.left(5) != "http:"){
            pageLink  = "http://";
            pageLink += page;
        }
        page = quoteString(page);
        const ext_info *e;
        QString text = i18n("<p><b>%1</b></p>") .arg(name);
        if (!topic.isEmpty())
            text += i18n("%1<br>") .arg(topic);
        text += i18n("<p>Age: <b>%1</b></p>") .arg(data->Age.value);
        QString gender;
        for (e = p_genders; e->nCode; e++){
            if (e->nCode == data->Gender.value){
                gender = i18n(e->szName);
                break;
            }
        }
        if (!gender.isEmpty())
            text += i18n("<p>Gender: <b>%1</b></p>")
                    .arg(gender);
        QString country;
        for (e = getCountries(); e->nCode; e++){
            if (e->nCode == data->Country.value){
                country = i18n(e->szName);
                break;
            }
        }
        if (!country.isEmpty())
            text += i18n("<p>Country: <b>%1</b></p>")
                    .arg(country);
        QString lang;
        for (e = p_languages; e->nCode; e++){
            if (e->nCode == data->Language.value){
                lang = i18n(e->szName);
                break;
            }
        }
        if (!lang.isEmpty())
            text += i18n("<p>Language: <b>%1</b></p>")
                    .arg(lang);
        if (!page.isEmpty())
            text += i18n("<p>Homepage: <a href=\"%1\"><u>%2</u></a></p>")
                    .arg(pageLink)
                    .arg(page);
        edtInfo->append(text);
        edtInfo->sync();
    }
    switch (e->type()){
    case EventGroupCreated:
    case EventGroupDeleted:
    case EventGroupChanged:
        fillGroup();
    }
    return NULL;
}
示例#18
0
 Private(const ::group *p) : gid(gid_t(-1))
 {
     fillGroup(p);
 }