Esempio n. 1
0
int main(int argc,char **argv)
{
	QApplication app(argc,argv);
	QPtrList<int> list;
	
	for (int i=0;i<3;i++)
	{
		list.append(new int(i)); // 插入資料
	}

	list.first(); // 先跳到第一個元素
	for (int i=0;i<3;i++,list.next())
	{
		cout << *(list.current()) << endl;
	}

	list.first();
	list.next();
	list.remove();
	list.remove();
	list.remove();
	cout << *(list.current()) << endl;
	// 由這一個例子可以知道,刪掉一個成員後,指標會跑到下一個.但若刪掉後沒有下一個時,指標會跑到前一個

	return 0;
}
Esempio n. 2
0
static PyObject *wpParty_getAttr(wpParty *self, char *name)
{
	cParty *party = self->party;

	if (!strcmp(name, "leader"))
	{
		return party->leader()->getPyObject();
	}
	else if (!strcmp(name, "members"))
	{
		QPtrList<cPlayer> members = party->members();
		PyObject *list = PyList_New(0);
		for (P_PLAYER member = members.first(); member; member = members.next())
			PyList_Append(list, member->getPyObject());
		return list;
	}
	else if (!strcmp(name, "canidates"))
	{
		QPtrList<cPlayer> canidates = party->canidates();
		PyObject *list = PyList_New(0);
		for (P_PLAYER canidate = canidates.first(); canidate; canidate = canidates.next())
			PyList_Append(list, canidate->getPyObject());
		return list;
	}
	else if (!strcmp(name, "lootingallowed"))
	{
		QPtrList<cPlayer> lootlist = party->lootingAllowed();
		PyObject *list = PyList_New(0);
		for (P_PLAYER member = lootlist.first(); member; member = lootlist.next())
			PyList_Append(list, member->getPyObject());
		return list;
	}

	return Py_FindMethod(wpPartyMethods, (PyObject*)self, name);
}
Resource *ResourceSelectDialog::getResource(AddressBook *ab, QWidget *parent)
{
    QPtrList< Resource > resources = ab->resources();
    if(resources.count() == 1)
        return resources.first();

    Resource *found = 0;
    Resource *r = resources.first();
    while(r)
    {
        if(!r->readOnly())
        {
            if(found)
            {
                found = 0;
                break;
            }
            else
            {
                found = r;
            }
        }
        r = resources.next();
    }
    if(found)
        return found;

    ResourceSelectDialog dlg(ab, parent);
    if(dlg.exec() == KDialog::Accepted)
        return dlg.resource();
    else
        return 0;
}
Esempio n. 4
0
void
QueueManager::addItems( QListViewItem *after )
{
    /*
        HACK!!!!! We can know which items where dragged since they should still be selected
        I do this, because:
        - Dragging items from the playlist provides urls
        - Providing urls, requires iterating through the entire list in order to find which
          item was selected.  Possibly a very expensive task - worst case: O(n)
        - After a drag, those items are still selected in the playlist, so we can find out
          which PlaylistItems were dragged by selectedItems();
    */

    if( !after )
        after = m_listview->lastChild();

    QPtrList<QListViewItem> list = Playlist::instance()->selectedItems();

    for( QListViewItem *item = list.first(); item; item = list.next() )
    {
#define item static_cast<PlaylistItem*>(item)
        QValueList<PlaylistItem*> current = m_map.values();

        if( current.find( item ) == current.end() ) //avoid duplication
        {
            QString title = i18n("%1 - %2").arg( item->artist(), item->title() );

            after = new QueueItem( m_listview, after, title );
            m_map[ after ] = item;
        }
#undef item
    }

}
void QEventLoop::setSocketNotifierPending( QSocketNotifier *notifier )
{
    int sockfd = notifier->socket();
    int type = notifier->type();
    if ( sockfd < 0 || type < 0 || type > 2 || notifier == 0 ) {
#if defined(QT_CHECK_RANGE)
	qWarning( "QSocketNotifier: Internal error" );
#endif
	return;
    }

    QPtrList<QSockNot> *list = d->sn_vec[type].list;
    QSockNot *sn;
    if ( ! list )
	return;
    sn = list->first();
    while ( sn && !(sn->obj == notifier && sn->fd == sockfd) )
	sn = list->next();
    if ( ! sn ) { // not found
	return;
    }

    // We choose a random activation order to be more fair under high load.
    // If a constant order is used and a peer early in the list can
    // saturate the IO, it might grab our attention completely.
    // Also, if we're using a straight list, the callback routines may
    // delete other entries from the list before those other entries are
    // processed.
    if ( ! FD_ISSET( sn->fd, sn->queue ) ) {
	d->sn_pending_list.insert( (rand() & 0xff) %
				   (d->sn_pending_list.count()+1), sn );
	FD_SET( sn->fd, sn->queue );
    }
}
void TLFrameSequenceLayout::loadFrames( QPtrList<Layer> layers )
{
    number_of_frame_sequences = 0;
    max_used_frames = 0;
    delete current_frame_sequence;
    list_of_frame_sequences.clear();

    Layer *l_it;
    for ( l_it = layers.first(); l_it; l_it = layers.next() )
    {
	QPtrList<KeyFrame> keyframes = l_it -> keyFrames();
        number_of_frame_sequences++;

    	TLFrameSequence *new_frame_sequence = new TLFrameSequence( number_of_frame_sequences, viewport(), this );
	if ( l_it == layers.getFirst() )
	    current_frame_sequence = new_frame_sequence;
    	addChild( new_frame_sequence, 0, ( number_of_frame_sequences - 1 ) * new_frame_sequence -> height() );
    	connect( new_frame_sequence, SIGNAL( frameInserted() ), SLOT( slotUpdateMaxUsedFrames() ) );
    	connect( new_frame_sequence, SIGNAL( frameRemoved() ), SLOT( slotUpdateMaxUsedFrames() ) );
    	connect( new_frame_sequence, SIGNAL( keyframeRemoved( int ) ), SIGNAL( keyframeRemovedToES( int ) ) );
    	connect( new_frame_sequence, SIGNAL( motionTweenCreated( int ) ), SIGNAL( motionTweenCreatedToES( int ) ) );
    	connect( new_frame_sequence, SIGNAL( motionTweenRemoved( int ) ), SIGNAL( motionTweenRemovedToES( int ) ) );
	list_of_frame_sequences.append( new_frame_sequence );
    	last_frame_sequence = new_frame_sequence;
    	updateContentSize();

	new_frame_sequence -> loadFrames( keyframes );
    }
}
Esempio n. 7
0
STDMETHODIMP QOleDataObject::EnumFormatEtc( DWORD dwDir, IEnumFORMATETC **ppenumFormatEtc )
{

    if ( dwDir == DATADIR_SET )
        return E_NOTIMPL;

    int count = 0;

    while ( m_dragObj->format( count ) )
        count++;

    int *formats = new int[ count ];
    for ( int i = 0; i < count; i++ ) {
        const char *mime = m_dragObj->format( i );
        QPtrList<QWindowsMime> all = QWindowsMime::all();
        for ( QWindowsMime * c = all.first(); c ; c = all.next() ) {
            int cf = c->cfFor( mime );
            if ( cf ) {
                formats[ i ] = cf;
                break;
            }
        }
    }

    qIEnumFORMATETC *pEnum = new qIEnumFORMATETC( formats, count );
    pEnum->AddRef();
    *ppenumFormatEtc = pEnum;

    delete[] formats;

    return ResultFromScode( S_OK );
}
Esempio n. 8
0
STDMETHODIMP QOleDataObject::GetDataHere( FORMATETC *pformatetc, STGMEDIUM *pmedium )
{
    // is data is in our format?
    HRESULT hr = QueryGetData( pformatetc );
    if ( hr != S_OK )
        return hr;

    if ( pmedium->tymed != TYMED_HGLOBAL )
        return DV_E_TYMED;

    if ( !pmedium->hGlobal )
        return STG_E_MEDIUMFULL;

    HGLOBAL hGlobal = pmedium->hGlobal;
    uint size = GlobalSize( hGlobal );

    int cf = pformatetc->cfFormat;
    QPtrList<QWindowsMime> all = QWindowsMime::all();
    for ( QWindowsMime * c = all.first(); c ; c = all.next() ) {
        const char * mime = c->mimeFor( cf );
        if ( mime && m_dragObj->provides( mime ) ) {
            QByteArray ba = m_dragObj->encodedData( mime );
            if ( ba.size() > size )
                return STG_E_MEDIUMFULL;
            memcpy ( GlobalLock ( hGlobal ), ba.data(), ba.size() );
            GlobalUnlock ( hGlobal );
            return S_OK;
        }
    }
    return E_UNEXPECTED;
}
Esempio n. 9
0
bool QDropEvent::provides( const char * mimeType ) const
{
#ifdef DEBUG_QDND_WIN
    qDebug( "QDropEvent::provides ( %s )", mimeType );
#endif

    if ( !pIDataObject )
        return false;

    FORMATETC fmtMemory = { 0,
                            NULL,
                            DVASPECT_CONTENT,
                            -1,
                            TYMED_HGLOBAL };

    /* Search all available mimes for mimeType and look if pIDataObject
       can give us data in this clipboard format */
    QPtrList<QWindowsMime> all = QWindowsMime::all();
    for ( QWindowsMime * c = all.first(); c ; c = all.next() ) {
        int cf = c->cfFor( mimeType );
        if ( c->canConvert( mimeType, cf ) ) {
            fmtMemory.cfFormat = cf;
            if ( pIDataObject->QueryGetData( &fmtMemory ) == S_OK ) {
                return true;
            }

        }
    }
    return false;
}
Esempio n. 10
0
bool Engine::isTagTextValid(TagNode* parent, QString& text, bool ignoreExifTag) const
{
    // a maintag must not be named 'EXIF' (if ignoreExifTag is false)
    if (!ignoreExifTag && parent == 0 && text.upper() == "EXIF") {
        return false;
    }

    QPtrList<TagNode>* siblings = m_tagForest;

    if (parent) {
        siblings = parent->children();
    }

    if (siblings) {
        TagNode* sibling;
        for ( sibling = siblings->first(); sibling; sibling = siblings->next() ) {
            if (*sibling->text() == text) {
                // sibling with the same name already exists!
                return false;
            }
        }
    }

    // no sibling with the same name found
    return true;
}
Esempio n. 11
0
void AccountSelector::initUI()
{
	kdDebug(14010) << k_funcinfo << endl;
	(new QVBoxLayout(this))->setAutoAdd(true);
	d->lv = new KListView(this);
	d->lv->setFullWidth(true);
	d->lv->addColumn(QString::fromLatin1(""));
	d->lv->header()->hide();

	if(d->proto != 0)
	{
		kdDebug(14010) << k_funcinfo << "creating list for a certain protocol" << endl;
		QDict<Kopete::Account> accounts = Kopete::AccountManager::self()->accounts(d->proto);
		QDictIterator<Kopete::Account> it(accounts);
		for(; Kopete::Account *account = it.current(); ++it)
		{
			new AccountListViewItem(d->lv, account);
		}
	}
	else
	{
		kdDebug(14010) << k_funcinfo << "creating list of all accounts" << endl;
		QPtrList<Kopete::Account> accounts = Kopete::AccountManager::self()->accounts();
		Kopete::Account *account = 0;
		for(account = accounts.first(); account; account = accounts.next())
		{
			new AccountListViewItem(d->lv, account);
		}
	}

	connect(d->lv, SIGNAL(selectionChanged(QListViewItem *)),
		this, SLOT(slotSelectionChanged(QListViewItem *)));
}
Esempio n. 12
0
File: app.cpp Progetto: speakman/qlc
void App::slotRefreshWindowMenu()
{
	QWidget* widget;
	int id = 0;

	QPtrList <QWidget> wl = workspace()->windowList();

	m_windowMenu->clear();
	m_windowMenu->insertItem(QPixmap(QString(PIXMAPS) + QString("/view_sidetree.png")),
				 "Cascade", this, SLOT(slotWindowCascade()),
				 0, ID_WINDOW_CASCADE);
	m_windowMenu->insertItem(QPixmap(QString(PIXMAPS) + QString("/view_left_right.png")),
				 "Tile", this, SLOT(slotWindowTile()),
				 0, ID_WINDOW_TILE);
	m_windowMenu->insertSeparator();

	for (widget = wl.first(); widget != NULL; widget = wl.next())
	{
		m_windowMenu->insertItem(widget->caption(), id);
		if (widget->isVisible() == true)
		{
			m_windowMenu->setItemChecked(id, true);
		}
		id++;
	}

	connect(m_windowMenu, SIGNAL(activated(int)),
		this, SLOT(slotWindowMenuCallback(int)));
}
Esempio n. 13
0
/**
 * Load settings from file
 */
void Settings::load()
{
	// Search for a file from user's home directory
	QString path = QString(getenv("HOME")) +
		QString("/") + QString(KQLCUserDir);

	QString fileName = path + QString("/") + QString(KConfigFile);
	QPtrList <QString> list;

	if (FileHandler::readFileToList(fileName, list) == true)
	{
		for (QString* s = list.first(); s != NULL; s = list.next())
		{
			if (*s == QString("Entry"))
			{
				if (*(list.next()) == QString("General"))
				{
					createContents(list);
				}
			}
		}
	}

	while (!list.isEmpty())
	{
		delete list.take(0);
	}
}
void CSSStyleDeclarationImpl::setProperty ( const DOMString &propertyString)
{
    DOMString ppPropertyString = preprocess(propertyString.string(),true);
    QPtrList<CSSProperty> *props = parseProperties(ppPropertyString.unicode(),
						ppPropertyString.unicode()+ppPropertyString.length());
    if(!props || !props->count())
	return;

    props->setAutoDelete(false);

    if(!m_lstValues) {
	m_lstValues = new QPtrList<CSSProperty>;
	m_lstValues->setAutoDelete( true );
    }

    CSSProperty *prop = props->first();
    while( prop ) {
	removeProperty(prop->m_id, false);
	m_lstValues->append(prop);
 	prop = props->next();
    }

    delete props;
    setChanged();
}
Esempio n. 15
0
/*!
  \internal
  Removes from internal read buffer \a nbytes.
  Returns true if successfull or false if there were not enought bytes in buffer to fullfill
  the request.
*/
bool cAsyncNetIOPrivate::consumeWriteBuf( Q_ULONG nbytes )
{
	if ( nbytes > wsize )
	{
		wsize = 0;
		return false;
	}

	if ( nbytes <= 0 || nbytes > wsize )
		return false;
	wsize -= nbytes;
	for ( ; ; )
	{
		QByteArray* a = ewba.first();
		if ( windex + nbytes >= a->size() )
		{
			nbytes -= a->size() - windex;
			ewba.remove();
			windex = 0;
			if ( nbytes == 0 )
				break;
		}
		else
		{
			windex += nbytes;
			break;
		}
	}
	return false;
}
Esempio n. 16
0
void
xQGanttBarViewPort::deleteSelectedItems()
{
#ifdef _DEBUG_
    printf("-> xQGanttBarViewPort::deleteSelectedItems()\n");
#endif

    QPtrList<KGanttItem> list;
    observeList(&list);

    getSelectedItems(_toplevelitem, list);

    for(KGanttItem *subitem = list.first();
            subitem != 0;
            subitem = list.next())
    {
#ifdef _DEBUG_
        printf(" : %s \n", subitem->getText().latin1());
#endif
        connect(subitem, SIGNAL(destroyed(KGanttItem *)),
                this, SLOT(itemDestroyed(KGanttItem *)));
    }

    list.remove(_toplevelitem);

    while(list.count() > 0)
    {
        KGanttItem *item = list.getFirst();
        delete item;
    }

#ifdef _DEBUG_
    printf("<- xQGanttBarViewPort::deleteSelectedItems()\n");
#endif
}
Esempio n. 17
0
QPtrList<File>* Engine::files(FilterNode* filterRootNode)
{
    tracer->sinvoked(__func__) << "with filter:" << endl;
    if (filterRootNode) {
        filterRootNode->dump("");
    }

    // remove all files currently shown
    m_fileList2display->clear();

    // loop over all source directories
    QIntDictIterator<Folder> sourceDirIt(*m_sourceDirDict);
    for ( ; sourceDirIt.current(); ++sourceDirIt ) {
        Folder* sourceDir = sourceDirIt.current();

        // handle the files in this directory only if it is selected
        if (sourceDir->include()) {

            // loop over all files in the current sourcedirectory
            QPtrList<File>* fileList = sourceDir->files();
            for (File* file = fileList->first(); file; file = fileList->next()) {

                // append the file if it matches the filter
                if (filterRootNode->evaluate(file)) {
                    m_fileList2display->append(file);
                }
            }
        }
    }

    return m_fileList2display;
}
Esempio n. 18
0
STDMETHODIMP QOleDataObject::GetData( FORMATETC *pformatetcIn, STGMEDIUM *pmedium )
{
    // is data is in our format?
    HRESULT hr = QueryGetData( pformatetcIn );
    if ( hr != S_OK )
        return hr;

    int cf = pformatetcIn->cfFormat;
    pmedium->tymed = TYMED_HGLOBAL;

    QPtrList<QWindowsMime> all = QWindowsMime::all();
    for ( QWindowsMime * c = all.first(); c ; c = all.next() ) {
        const char * mime = c->mimeFor( cf );
        if ( mime && m_dragObj->provides( mime ) ) {
            QByteArray ba = m_dragObj->encodedData( mime );

            ba = c->convertFromMime( ba, mime, cf );
            HGLOBAL hGlobal = GlobalAlloc ( GMEM_MOVEABLE | GMEM_SHARE, ba.size() );
            if ( !hGlobal )
                return E_OUTOFMEMORY;

            memcpy ( GlobalLock ( hGlobal ), ba.data(), ba.size() );
            GlobalUnlock ( hGlobal );
            pmedium->hGlobal = hGlobal;
            pmedium->pUnkForRelease = NULL;
            return S_OK;
        }
    }
    return E_UNEXPECTED;
}
Esempio n. 19
0
void QDockArea::setFixedExtent( int d, QDockWindow *dw )
{
    QPtrList<QDockWindow> lst;
    QDockWindow *w;
    for ( w = dockWindows->first(); w; w = dockWindows->next() ) {
	if ( w->isHidden() )
	    continue;
	if ( orientation() == Horizontal ) {
	    if ( dw->y() != w->y() )
		continue;
	} else {
	    if ( dw->x() != w->x() )
		continue;
	}
	if ( orientation() == Horizontal )
	    d = QMAX( d, w->minimumHeight() );
	else
	    d = QMAX( d, w->minimumWidth() );
	if ( w->isResizeEnabled() )
	    lst.append( w );
    }
    for ( w = lst.first(); w; w = lst.next() ) {
	if ( orientation() == Horizontal )
	    w->setFixedExtentHeight( d );
	else
	    w->setFixedExtentWidth( d );
    }
}
Esempio n. 20
0
STDMETHODIMP QOleDataObject::QueryGetData( FORMATETC *pformatetc )
{
#ifdef DEBUG_QDND_SRC
    qDebug( "QOleDataObject::QueryGetData( %p )", pformatetc );
#endif

    if ( !pformatetc ) {
        return E_INVALIDARG;
    }
    if ( pformatetc->lindex != -1 ) {
        return DV_E_LINDEX;
    }
    if ( pformatetc->dwAspect != DVASPECT_CONTENT ) {
        return DV_E_DVASPECT;
    }
    int tymed = pformatetc->tymed;
    /* Currently we only support HGLOBAL */
    if ( !( tymed & TYMED_HGLOBAL ) ) {
        return DV_E_TYMED;
    }

    int cf = pformatetc->cfFormat;
    QPtrList<QWindowsMime> all = QWindowsMime::all();
    for ( QWindowsMime * c = all.first(); c ; c = all.next() ) {
        const char * mime = c->mimeFor( cf );
        if ( mime && m_dragObj->provides( mime ) ) {
            return S_OK;
        }
    }
    return DV_E_FORMATETC;
}
Esempio n. 21
0
void KSSLD::cacheSaveToDisk() {
  KSSLCNode *node;

  for (node = certList.first(); node; node = certList.next()) {
    if (node->permanent || node->expires > QDateTime::currentDateTime()) {
      // First convert to a binary format and then write the kconfig entry
      // write the (CN, policy, cert) to KSimpleConfig
      cfg->setGroup(node->cert->getSubject());
      cfg->writeEntry("Certificate", node->cert->toString());
      cfg->writeEntry("Policy", node->policy);
      cfg->writeEntry("Expires", node->expires);
      cfg->writeEntry("Permanent", node->permanent);
      cfg->writeEntry("Hosts", node->hosts);
      // Also write the chain
      QStringList qsl;
      QPtrList<KSSLCertificate> cl = node->cert->chain().getChain();
      for (KSSLCertificate *c = cl.first(); c != 0; c = cl.next()) {
         //kdDebug() << "Certificate in chain: " <<  c->toString() << endl;
         qsl << c->toString();
      }
      cl.setAutoDelete(true);
      cfg->writeEntry("Chain", qsl);
    }
  }  

  cfg->sync();

  // insure proper permissions -- contains sensitive data
  QString cfgName(KGlobal::dirs()->findResource("config", "ksslpolicies"));
  if (!cfgName.isEmpty())
    ::chmod(QFile::encodeName(cfgName), 0600);
}
Esempio n. 22
0
/***********************************************************************************
 KMixToolbox contains several GUI relevant methods that are shared between the 
 KMix Main Program, and the KMix Applet.
 kmixctrl - as not non-GUI application - does NOT link to KMixToolBox.

 This means: Shared GUI stuff goes into the KMixToolBox class , non-GUI stuff goes
 into the MixerToolBox class.
 ***********************************************************************************/
void KMixToolBox::setIcons(QPtrList<QWidget> &mdws, bool on ) {
    for ( QWidget *qmdw=mdws.first(); qmdw!=0; qmdw=mdws.next() ) {
	if ( qmdw->inherits("MixDeviceWidget") ) { // -<- play safe here
	    static_cast<MixDeviceWidget*>(qmdw)->setIcons( on );
	}
    }
}
Esempio n. 23
0
/*!
	\internal
	Reads and removes from internal read buffer \a nbytes and place then into \a sink.
	Returns true if successfull or false if there were not enought bytes to fullfill
	the request.
*/
bool cAsyncNetIOPrivate::consumeReadBuf( Q_ULONG nbytes, char *sink )
{
    if ( nbytes <= 0 || nbytes > rsize )
		return false;
    rsize -= nbytes;
    for ( ;; ) 
	{
		QByteArray *a = rba.first();
		if ( rindex + nbytes >= a->size() ) 
		{
			// Here we skip the whole byte array and get the next later
			int len = a->size() - rindex;
			if ( sink ) 
			{
				memcpy( sink, a->data()+rindex, len );
				sink += len;
			}
			nbytes -= len;
			rba.remove();
			rindex = 0;
			if ( nbytes == 0 ) 
			{		// nothing more to skip
				break;
			}
		} else {
			// Here we skip only a part of the first byte array
			if ( sink )
				memcpy( sink, a->data()+rindex, nbytes );
			rindex += nbytes;
			break;
		}
    }
    return true;
}
Esempio n. 24
0
void RemoveTargetDialog::init()
{
	QPtrList <SubprojectItem> subprojectItems = m_widget->allSubprojectItems();

	TargetItem* titem = 0;

	for ( SubprojectItem* spitem = subprojectItems.first(); spitem; spitem = subprojectItems.next() )
	{
		if ( m_titem->name.isEmpty() )
			break;

		for ( titem = spitem->targets.first(); titem; titem = spitem->targets.next() )
		{
			if ( m_titem->name == titem->name )
				continue;

			if ( titem->primary == "LTLIBRARIES" || titem->primary == "PROGRAMS"
				|| titem->primary == "LIBRARIES"  || titem->primary == "JAVA" )
			{
				QString canonname = AutoProjectTool::canonicalize ( titem->name );

				if ( spitem->variables[canonname + "_LIBADD"].contains ( m_titem->name ) > 0 ||
					spitem->variables[canonname + "_LDADD"].contains ( m_titem->name ) > 0 )
				{
					dependencyListBox->insertItem ( SmallIcon ( "target_kdevelop" ), spitem->path + " (" + titem->name + ")" );

					dependentSubprojects.append ( spitem );
				}
			}
		}
	}

	if ( dependencyListBox->count() == 0 )
		dependencyListBox->insertItem ( i18n("no dependency", "<none>") );
}
Esempio n. 25
0
void MainWindow::dockToolViewsIntoContainers(QPtrList<KDockWidget>& widgetsToReparent,KDockWidget *container) {
  for ( KDockWidget *dw = widgetsToReparent.first(); dw;
      dw=widgetsToReparent.next()){
    dw->manualDock(container,KDockWidget::DockCenter,20);
    dw->loseFormerBrotherDockWidget();
  }
}
Esempio n. 26
0
void KMMimePartTree::slotEdit()
{
  QPtrList<QListViewItem> selected = selectedItems();
  if ( selected.count() != 1 )
    return;
  mReaderWin->slotEditAttachment( static_cast<KMMimePartTreeItem*>( selected.first() )->node() );
}
Esempio n. 27
0
static PyObject* wpParty_getAttr( wpParty* self, char* name )
{
	cParty* party = self->party;

	/*
		\rproperty party.leader A <object id="char">char</object> object for the leader of this party.
	*/
	if ( !strcmp( name, "leader" ) )
	{
		return party->leader()->getPyObject();
	}
	/*
		\rproperty party.members A list of <object id="char">char</object> objects for the members in this party.
	*/
	else if ( !strcmp( name, "members" ) )
	{
		QPtrList<cPlayer> members = party->members();
		PyObject* list = PyList_New( 0 );
		for ( P_PLAYER member = members.first(); member; member = members.next() )
			PyList_Append( list, member->getPyObject() );
		return list;
	}
	/*
		\rproperty party.canidates A list of <object id="char">char</object> objects for the canidates in this party.
	*/
	else if ( !strcmp( name, "canidates" ) )
	{
		QPtrList<cPlayer> canidates = party->canidates();
		PyObject* list = PyList_New( 0 );
		for ( P_PLAYER canidate = canidates.first(); canidate; canidate = canidates.next() )
			PyList_Append( list, canidate->getPyObject() );
		return list;
	}
	/*
		\rproperty party.lootingallowed A list of <object id="char">char</object> objects for the members of this party who allowed looting their corpse.
	*/
	else if ( !strcmp( name, "lootingallowed" ) )
	{
		QPtrList<cPlayer> lootlist = party->lootingAllowed();
		PyObject* list = PyList_New( 0 );
		for ( P_PLAYER member = lootlist.first(); member; member = lootlist.next() )
			PyList_Append( list, member->getPyObject() );
		return list;
	}

	return Py_FindMethod( wpPartyMethods, ( PyObject * ) self, name );
}
Esempio n. 28
0
void
Win32MakefileGenerator::processPrlFiles()
{
    QDict<void> processed;
    QPtrList<MakefileDependDir> libdirs;
    libdirs.setAutoDelete(TRUE);
    {
	QStringList &libpaths = project->variables()["QMAKE_LIBDIR"];
	for(QStringList::Iterator libpathit = libpaths.begin(); libpathit != libpaths.end(); ++libpathit) {
	    QString r = (*libpathit), l = r;
	    fixEnvVariables(l);
	    libdirs.append(new MakefileDependDir(r.replace("\"",""),
						 l.replace("\"","")));
	}
    }
    for(bool ret = FALSE; TRUE; ret = FALSE) {
	//read in any prl files included..
	QStringList l_out;
	QString where = "QMAKE_LIBS";
	if(!project->isEmpty("QMAKE_INTERNAL_PRL_LIBS"))
	    where = project->first("QMAKE_INTERNAL_PRL_LIBS");
	QStringList &l = project->variables()[where];
	for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) {
	    QString opt = (*it);
	    if(opt.startsWith("/")) {
		if(opt.startsWith("/LIBPATH:")) {
		    QString r = opt.mid(9), l = r;
		    fixEnvVariables(l);
		    libdirs.append(new MakefileDependDir(r.replace("\"",""),
							 l.replace("\"","")));
		}
	    } else {
		if(!processed[opt]) {
		    if(processPrlFile(opt)) {
			processed.insert(opt, (void*)1);
			ret = TRUE;
		    } else {
			for(MakefileDependDir *mdd = libdirs.first(); mdd; mdd = libdirs.next() ) {
			    QString prl = mdd->local_dir + Option::dir_sep + opt;
			    if(processed[prl]) {
				break;
			    } else if(processPrlFile(prl)) {
				processed.insert(prl, (void*)1);
				ret = TRUE;
				break;
			    }
			}
		    }
		}
	    }
	    if(!opt.isEmpty())
		l_out.append(opt);
	}
	if(ret)
	    l = l_out;
	else
	    break;
    }
}
Esempio n. 29
0
void KMixToolBox::setTicks(QPtrList<QWidget> &mdws, bool on ) {
    QWidget *qmdw;
    for ( qmdw=mdws.first(); qmdw != 0; qmdw=mdws.next() ) {
	if ( qmdw->inherits("MixDeviceWidget") ) { // -<- in reality it is only in MDWSlider
	    static_cast<MixDeviceWidget*>(qmdw)->setTicks( on );
	}
    }
}
Esempio n. 30
0
void KMixToolBox::setValueStyle(QPtrList<QWidget> &mdws, int vs ) {
    QWidget *qmdw;
    for ( qmdw=mdws.first(); qmdw != 0; qmdw=mdws.next() ) {
	if ( qmdw->inherits("MixDeviceWidget") ) { // -<- in reality it is only in MDWSlider
	  static_cast<MixDeviceWidget*>(qmdw)->setValueStyle( (MixDeviceWidget::ValueStyle) vs );
	}
    }
}