コード例 #1
0
ファイル: mainwindow.cpp プロジェクト: opieproject/opie
void MainWindow::loadPackageList( OPackageList *packages, bool clearList )
{
    if ( clearList )
        m_packageList.clear();

    if ( packages )
    {
        for ( OPackageListIterator packageIt( *packages ); packageIt.current(); ++packageIt )
        {
            OPackage *package = packageIt.current();
            QCheckListItem *item = new QCheckListItem( &m_packageList, package->name(),
                                                    QCheckListItem::CheckBox );
            m_packageList.insertItem( item );

            // If a different version of package is available, show update available icon
            // Otherwise, show installed icon
            if ( !package->versionInstalled().isNull() )
            {
                if ( m_packman.compareVersions( package->version(), package->versionInstalled() ) == 1 )
                    item->setPixmap( 0, m_iconUpdated );
                else
                    item->setPixmap( 0, m_iconInstalled );
            }
            else
                item->setPixmap( 0, m_iconNull );
        }
    }
}
コード例 #2
0
void KMail::ManageSieveScriptsDialog::slotRefresh()
{
    killAllJobs();
    mUrls.clear();
    mListView->clear();

    KMail::AccountManager *am = kmkernel->acctMgr();
    assert(am);
    QCheckListItem *last = 0;
    for(KMAccount *a = am->first() ; a ; a = am->next())
    {
        last = new QCheckListItem(mListView, last, a->name(), QCheckListItem::Controller);
        last->setPixmap(0, SmallIcon("server"));
        if(ImapAccountBase *iab = dynamic_cast<ImapAccountBase *>(a))
        {
            const KURL u = ::findUrlForAccount(iab);
            if(u.isEmpty())
                continue;
            SieveJob *job = SieveJob::list(u);
            connect(job, SIGNAL(item(KMail::SieveJob *, const QString &, bool)),
                    this, SLOT(slotItem(KMail::SieveJob *, const QString &, bool)));
            connect(job, SIGNAL(result(KMail::SieveJob *, bool, const QString &, bool)),
                    this, SLOT(slotResult(KMail::SieveJob *, bool, const QString &, bool)));
            mJobs.insert(job, last);
            mUrls.insert(last, u);
        }
        else
        {
            QListViewItem *item = new QListViewItem(last, i18n("No Sieve URL configured"));
            item->setEnabled(false);
            last->setOpen(true);
        }
    }
コード例 #3
0
void EvaQunMemberPicker::updateBuddyListView()
{
	//if(!mQun) return;
	lvBuddyList->clear();
	
	QTextCodec *codec = QTextCodec::codecForName("GB18030");
	std::list<std::string> names = EvaMain::user->getGroupNames();
	std::list<std::string>::iterator groupIter;
	int i=0;
	for(groupIter = names.begin(); groupIter!= names.end(); ++groupIter){
		QString g = codec->toUnicode(groupIter->c_str());
		QCheckListItem *item = new QCheckListItem(lvBuddyList, g, QCheckListItem::CheckBox);
		item->setState(QCheckListItem::Off);
		groups[i++] = item;
	}
	
	//QunInfo info = mQun->getDetails();
	
	std::map<unsigned int, QQFriend>::iterator iter;
	std::map<unsigned int, QQFriend> list = (EvaMain::user->getFriendList()).getAllFriendsMap();
	for(iter = list.begin(); iter != list.end(); ++iter){
	
		int id = iter->second.getQQ();
		QString nick = EvaTextFilter::filter(codec->toUnicode(iter->second.getNick().c_str()));
		
		int groupIndex = iter->second.getGroupIndex();
		QCheckListItem *group = groups[groupIndex];
		if(!group) continue;
		
		short faceID = (iter->second.getFace())/3 + 1;
		if(faceID<1) faceID = 1;
		QCheckListItem *item = new QCheckListItem(group, nick + "(" + QString::number(id) + ")", QCheckListItem::CheckBox);

		QPixmap *pic = EvaMain::images->getFace(faceID, true);
		if(pic) {
			QImage img(pic->convertToImage().smoothScale(16, 16));
			item->setPixmap(0, QPixmap(img));
		}else{
			fprintf(stderr, "EvaQunMemberPicker::updateBuddyListView (id:%d, faceID:%d, %s) --  NULL QPixmap pointer, ignored!\n", id, faceID, nick.ascii());
		}
		if(mQun && mQun->hasMember(id))
			item->setState(QCheckListItem::On);
		else
			item->setState(QCheckListItem::Off);
			
		buddyList[id] = item;
	}
}
コード例 #4
0
void KPluginSelectionWidget::init(const QValueList< KPluginInfo * > &plugininfos, const QString &category)
{
    // setup Widgets
    (new QVBoxLayout(this, 0, KDialog::spacingHint()))->setAutoAdd(true);
    KListView *listview = new KListView(this);
    d->tooltip = new KPluginListViewToolTip(listview->viewport(), listview);
    connect(listview, SIGNAL(pressed(QListViewItem *)), this, SLOT(executed(QListViewItem *)));
    connect(listview, SIGNAL(spacePressed(QListViewItem *)), this, SLOT(executed(QListViewItem *)));
    connect(listview, SIGNAL(returnPressed(QListViewItem *)), this, SLOT(executed(QListViewItem *)));
    connect(listview, SIGNAL(selectionChanged(QListViewItem *)), this, SLOT(executed(QListViewItem *)));
    listview->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred);
    listview->setAcceptDrops(false);
    listview->setFullWidth(true);
    listview->setSelectionModeExt(KListView::Single);
    listview->setAllColumnsShowFocus(true);
    listview->addColumn(i18n("Name"));
    for(QValueList< KPluginInfo * >::ConstIterator it = plugininfos.begin(); it != plugininfos.end(); ++it)
    {
        d->plugincheckedchanged[*it] = false;
        if(!(*it)->isHidden() && (category.isNull() || (*it)->category() == category))
        {
            QCheckListItem *item = new KPluginInfoLVI(*it, listview);
            if(!(*it)->icon().isEmpty())
                item->setPixmap(0, SmallIcon((*it)->icon(), IconSize(KIcon::Small)));
            item->setOn((*it)->isPluginEnabled());
            d->pluginInfoMap.insert(item, *it);
        }
    }

    // widgetstack
    d->widgetstack = d->kps->widgetStack();
    load();
    // select and highlight the first item in the plugin list
    if(listview->firstChild())
        listview->setSelected(listview->firstChild(), true);
}