Пример #1
0
void QTodoList::sort()
{
	QTodoSortDialog sort_dialog;

	deselectAll();

	if(sort_dialog.exec() == QDialog::Accepted)
	{
		preserveContentsYPos();
		const QTodoSortCriteriaMap* criterias = sort_dialog.getCriterias();

		QPtrList<QWidget> list_widgets;
		list_widgets.append(0);
		QTodoListIterator it(this);
		for(;it.current();++it)
			list_widgets.append(it.current());

		QTodoListItemsSorter sorter(&list_widgets,criterias);
		QPtrList<QWidget>* sorted = sorter.get();

		QTUM::get()->startRecording();
		takeAll();
		for(unsigned int i = 0; i < sorted->count(); ++i)
		{
			if(QTodoItem* item = dynamic_cast<QTodoItem*>(sorted->at(i)))
			{
				insertTodo(item,i);
				item->setDepth(item->getDepth());
			}
		}
		QTUM::get()->stopRecording();
		restoreContentsYPos();
	}
}
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();
}
Пример #3
0
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;
}
Пример #4
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
}
Пример #5
0
// -----------------------------------------------------------
void QucsApp::slotCursorRight()
{
  if(!editText->isHidden()) return;  // for edit of component property ?

  QPtrList<Element> movingElements;
  Schematic *Doc = (Schematic*)DocumentTab->currentPage();
  int markerCount = Doc->copySelectedElements(&movingElements);

  if((movingElements.count() - markerCount) < 1) {
    if(markerCount > 0) {  // only move marker if nothing else selected
      Doc->markerLeftRight(false, &movingElements);
      movingElements.clear();
    }
    else {
      if(Doc->scrollRight(-Doc->horizontalScrollBar()->lineStep()))
        Doc->scrollBy(Doc->horizontalScrollBar()->lineStep(), 0);
    }

    Doc->viewport()->update();
    view->drawn = false;
    return;
  }

  view->moveElements(&movingElements, Doc->GridX, 0);  // move "GridX" to right
  view->MAx3 = 1;  // sign for moved elements
  view->endElementMoving(Doc, &movingElements);
}
Пример #6
0
//
// A window title was selected from window menu, show that window
//
void App::slotWindowMenuCallback(int item)
{
  QPtrList <QWidget> wl = workspace()->windowList();

  if (item == ID_WINDOW_CASCADE || item == ID_WINDOW_TILE)
    {
      return;
    }

  if (wl.count())
    {
      QWidget* widget;

      widget = wl.at(item);
      if (widget != NULL)
	{
	  widget->show();
	  widget->setFocus();
	}
      else
	{
	  assert(false);
	}
      
      disconnect(m_windowMenu);
    }
}
Пример #7
0
PlotLine * THERM::calculateCustom (QString &p, QPtrList<PlotLine> &d)
{
  // format1: MA_TYPE, MA_PERIOD, THRESHOLD, SMOOTHING_TYPE, SMOOTHING_PERIOD

  if (checkFormat(p, d, 5, 5))
    return 0;

  QStringList mal;
  getMATypes(mal);
  maType = mal.findIndex(formatStringList[0]);
  maPeriod = formatStringList[1].toInt();
  threshold = formatStringList[2].toDouble();
  smoothType = mal.findIndex(formatStringList[3]);
  smoothing = formatStringList[4].toInt();

  QPtrList<PlotLine> pll;
  pll.setAutoDelete(FALSE);
  getTHERM(pll);

  int loop;
  for (loop = pll.count() - 1; loop > 0; loop--)
    pll.remove(loop);

  return pll.at(0);
}
Пример #8
0
void KMMimePartTree::slotEdit()
{
  QPtrList<QListViewItem> selected = selectedItems();
  if ( selected.count() != 1 )
    return;
  mReaderWin->slotEditAttachment( static_cast<KMMimePartTreeItem*>( selected.first() )->node() );
}
Пример #9
0
QDragObject *KfindWindow::dragObject()
{
    KURL::List uris;
    QPtrList< QListViewItem > selected = selectedItems();

    // create a list of URIs from selection
    for(uint i = 0; i < selected.count(); i++)
    {
        KfFileLVI *item = (KfFileLVI *)selected.at(i);
        if(item)
        {
            uris.append(item->fileitem.url());
        }
    }

    if(uris.count() <= 0)
        return 0;

    QUriDrag *ud = new KURLDrag(uris, (QWidget *)this, "kfind uridrag");

    const QPixmap *pix = currentItem()->pixmap(0);
    if(pix && !pix->isNull())
        ud->setPixmap(*pix);

    return ud;
}
Пример #10
0
void App::slotWindowMenuCallback(int item)
{
	QPtrList <QWidget> wl = workspace()->windowList();

	if (item == ID_WINDOW_CASCADE || item == ID_WINDOW_TILE)
	{
		return;
	}

	if (wl.count())
	{
		QWidget* widget;

		widget = wl.at(item);
		if (widget != NULL)
		{
			widget->show();
			widget->setFocus();
		}
		else
		{
			QMessageBox::critical(this,
					      "Unable to select window",
					      "Handle not found");
		}

		disconnect(m_windowMenu);
	}
}
Пример #11
0
    Page * page( const QWidget * w )
    {
	if ( !w )
	    return 0;
	int i = pages.count();
	while( --i >= 0 && pages.at( i ) && pages.at( i )->w != w ) { }
	return i >= 0 ? pages.at( i ) : 0;
    }
Пример #12
0
QLayoutItem *BorderLayoutIterator::takeCurrent()
{
    BorderLayout::BorderLayoutStruct *b
	= idx < int( list->count() ) ? list->take(  idx  ) : 0;
    QLayoutItem *item =  b ? b->item : 0;
    delete b;
    return item;
}
Пример #13
0
ShapeCLPolygon::ShapeCLPolygon( int id, QPtrList<Point>& plist ) {
	_shapeID = id;
	_type = 998;

	numPoints = plist.count();
	points = new Point[numPoints];

	for( int i=0; i<numPoints; i++ ) {
		this->points[i].setXY( plist.at(i)->x(), plist.at(i)->y() );
	}
}
Пример #14
0
void KMCupsJobManager::validatePluginActions(KActionCollection *coll, const QPtrList<KMJob>& joblist)
{
	QPtrListIterator<KMJob>	it(joblist);
	bool	flag(true);
	for (; it.current(); ++it)
	{
		flag = (flag && it.current()->type() == KMJob::System
		        && (it.current()->state() == KMJob::Queued || it.current()->state() == KMJob::Held)
			/*&& !it.current()->isRemote()*/);
	}
	flag = (flag && joblist.count() > 0);
	KAction *a;
	if ( ( a = coll->action( "plugin_ipp" ) ) )
		a->setEnabled( joblist.count() == 1 );
	if ( ( a = coll->action( "plugin_prioup" ) ) )
		a->setEnabled( flag );
	if ( ( a = coll->action( "plugin_priodown" ) ) )
		a->setEnabled( flag );
	if ( ( a = coll->action( "plugin_editjob" ) ) )
		a->setEnabled( flag && ( joblist.count() == 1 ) );
}
Пример #15
0
void QDockArea::dockWindow( QDockWindow *dockWindow, DockWindowData *data )
{
    if ( !data )
	return;

    dockWindow->reparent( this, QPoint( 0, 0 ), FALSE );
    dockWindow->installEventFilter( this );
    dockWindow->dockArea = this;
    dockWindow->updateGui();

    if ( dockWindows->isEmpty() ) {
	dockWindows->append( dockWindow );
    } else {
	QPtrList<QDockWindow> lineStarts = layout->lineStarts();
	int index = 0;
	if ( (int)lineStarts.count() > data->line )
	    index = dockWindows->find( lineStarts.at( data->line ) );
	if ( index == -1 ) {
	    index = 0;
	    (void)dockWindows->at( index );
	}
	bool firstTime = TRUE;
	int offset = data->offset;
	for ( QDockWindow *dw = dockWindows->current(); dw; dw = dockWindows->next() ) {
	    if ( !firstTime && lineStarts.find( dw ) != -1 )
		break;
	    if ( offset <
		 point_pos( fix_pos( dw ), orientation() ) + size_extent( dw->size(), orientation() ) / 2 )
		break;
	    index++;
	    firstTime = FALSE;
	}
	if ( index >= 0 && index < (int)dockWindows->count() &&
	     dockWindows->at( index )->newLine() && lineOf( index ) == data->line ) {
	    dockWindows->at( index )->setNewLine( FALSE );
	    dockWindow->setNewLine( TRUE );
	} else {
	    dockWindow->setNewLine( FALSE );
	}

	dockWindows->insert( index, dockWindow );
    }
    dockWindow->show();

    dockWindow->setFixedExtentWidth( data->fixedExtent.width() );
    dockWindow->setFixedExtentHeight( data->fixedExtent.height() );

    updateLayout();
    setSizePolicy( QSizePolicy( orientation() == Horizontal ? QSizePolicy::Expanding : QSizePolicy::Minimum,
				orientation() == Vertical ? QSizePolicy::Expanding : QSizePolicy::Minimum ) );

}
Пример #16
0
void KMixToolBox::saveConfig(QPtrList<QWidget> &mdws, KConfig *config, const QString &grp, const QString &viewPrefix) {
    config->setGroup( grp  );
    config->writeEntry( viewPrefix + ".Devs", mdws.count() );

    int n=0;
    for ( QWidget *qmdw=mdws.first(); qmdw!=0; qmdw=mdws.next() ) {
	if ( qmdw->inherits("MixDeviceWidget") ) { // -<- play safe here
	    MixDeviceWidget* mdw = static_cast<MixDeviceWidget*>(qmdw);

	    QString devgrp;
	    devgrp.sprintf( "%s.%s.Dev%i", viewPrefix.ascii(), grp.ascii(), n );
	    if ( ! config->hasGroup(devgrp) ) {
		// old-Style configuration (KMix2.1 and earlier => remove now unused group
		config->deleteGroup(devgrp);
            }
	    devgrp.sprintf( "%s.%s.Dev%s", viewPrefix.ascii(), grp.ascii(), mdw->mixDevice()->getPK().ascii() );
	    //devgrp.sprintf( "%s.%s.Dev%i", viewPrefix.ascii(), grp.ascii(), n );

            if ( mdw->mixDevice()->getVolume().isCapture() ) {
               /* see loadConfig() for the rationale of having an own name for capture devices. */
               devgrp.append(".Capture");
            } // isCapture()

	    config->setGroup( devgrp );

	    if ( qmdw->inherits("MixDeviceWidget") ) { // -<- in reality it is only in MDWSlider
		// only sliders have the ability to split apart in mutliple channels
		config->writeEntry( "Split", ! mdw->isStereoLinked() );
	    }
	    config->writeEntry( "Show" , ! mdw->isDisabled() );

	    // Save key bindings
	    /*
	       Implementation hint: Conceptually keys SHOULD be bound to the actual hardware, and not
	       to one GUI representation. Both work, but it COULD confuse users, if we have multiple
	       GUI representations (e.g. "Dock Icon" and "Main Window").
	       If you think about this aspect more deeply, you will find out that this is the case already
	       today with "kmixapplet" and "kmix main application". It would really nice to rework this.
	    */
	    KGlobalAccel *keys=mdw->keys();
	    if (keys) {
		QString devgrpkeys;
		devgrpkeys.sprintf( "%s.%s.Dev%i.keys", viewPrefix.ascii(), grp.ascii(), n );
		//kdDebug(67100) << "KMixToolBox::saveConfig() save Keys " << devgrpkeys << endl;
		keys->setConfigGroup(devgrpkeys);
		keys->writeSettings(config);
	    }
	    n++;
	} // if it is a MixDeviceWidget
    } // for all widgets
}
Пример #17
0
void NPmxExport::inspectTuplet(NPlayable *elem, int staff_nr, int barnr_) {
	QPtrList<NPlayable> *tupletlist;
	badmeasure *bad;
	int len1, len2;
	NPlayable *elem2;
	bool len2set = false;

	tupletlist = elem->getTupletList();

	if ((int)(tupletlist->count()) != elem->getNumNotes()) {
		elem2 = tupletlist->first();
		len1 = len2 = elem2->getSubType();
		for (elem2 = tupletlist->next(); elem2; elem2 = tupletlist->next()) {
			if (elem2->getSubType() != len1) {
				if (len2set) {
					if (elem2->getSubType() != len2) {
						bad = new badmeasure(PMX_ERR_NOT_NUM_TUMPLET, staff_nr, barnr_, 0, 0);
						badlist_.append(bad);
					}
				}
				else {
					len2set = true;
					len2 = elem2->getSubType();
				}
			}
		}
		if (len2set) {
			if (len1 != 2*len2 && len2 != 2*len1) {
				bad = new badmeasure(PMX_ERR_NOT_NUM_TUMPLET, staff_nr, barnr_, 0, 0);
				badlist_.append(bad);
			}
			if (len1 < len2)  {
				tupletBase_ = len1;
			}
			else {
				tupletBase_ = len2;
			}
		}
		else {
			tupletBase_ = len1;
		}
						
	}
	else {
		tupletBase_ = tupletlist->getFirst()->getSubType();
	}
	if (tupletlist->getLast()->getType() == T_REST) {
		bad = new badmeasure(PMX_ERR_TUPLET_ENDS_REST, staff_nr, barnr_, 0, 0);
		badlist_.append(bad);
	}
}
Пример #18
0
void KMMimePartTree::startHandleAttachmentCommand(int type)
{
  QPtrList<QListViewItem> selected = selectedItems();
  if ( selected.count() != 1 )
    return;
  partNode* node = static_cast<KMMimePartTreeItem*>( selected.first() )->node();
  QString name = mReaderWin->tempFileUrlFromPartNode( node ).path();
  KMHandleAttachmentCommand* command = new KMHandleAttachmentCommand(
      node, mReaderWin->message(), node->nodeId(), name,
      KMHandleAttachmentCommand::AttachmentAction( type ), 0, this );
  connect( command, SIGNAL( showAttachment( int, const QString& ) ),
           mReaderWin, SLOT( slotAtmView( int, const QString& ) ) );
  command->start();
}
Пример #19
0
void DockContainer::nextToolView()
{
    QPtrList< KMultiTabBarTab > *tabs = m_tb->tabs();
    int pos = tabs->findRef(m_tb->tab(oldtab));
    if(pos == -1)
        return;
    pos++;
    if(pos >= (int)tabs->count())
        pos = 0;
    KMultiTabBarTab *tab = tabs->at(pos);
    if(!tab)
        return; // can never happen here, but who knows
    m_tb->setTab(tab->id(), true);
    tabClicked(tab->id());
}
Пример #20
0
bool KugarPart::loadXML( QIODevice *file, const QDomDocument & /*doc*/ )
{
    m_docURL = url();
    bool ok = true;
    if ( file )
    {
        file->reset();
        m_reportData=QString(file->readAll());

        if ( m_reportData.length() != 0 )
        {
            ok = m_reportEngine->setReportData( m_reportData );

            if ( m_templateOk )
            {
                m_reportEngine->renderReport();
                if ( ok )
                {
                    QPtrList<KoView> vs = views();
                    if ( vs.count() )
                    {
                        for ( KoView * v = vs.first();v;v = vs.next() )
                        {
                            ok = static_cast<KugarView*>( v->qt_cast( "KugarView" ) ) ->renderReport();
                            if ( !ok )
                                break;
                        }
                    }
                }
            }
            if ( !ok )
                KMessageBox::sorry( 0, i18n( "Invalid data file %1" ).arg( m_file ) );
        }
        else
        {
            ok = false;
            KMessageBox::sorry( 0, i18n( "The zero sized data file %1 can't be rendered" ).arg( m_file ) );
        }

    }
    else
    {
        ok = false;
        KMessageBox::sorry( 0, i18n( "Unable to open data file: %1" ).arg( m_file ) );
    }

    return ok;
}
Пример #21
0
void Writer::spawnWords( QString phrase, effectType fX )
{
	int wordCount = 0;
	float xCenter = 0,
	      yCenter = drand48()*40 - 20,
	      wordsWidth = 0;
	QPtrList<Word> localWords;
	while ( phrase.length() > 0 )
	{
		QString letters = phrase.section(" ",0,0);
		Word * word = new Word( letters.latin1(), &symbolMap );
		wordList.append( word );
		localWords.append( word );
		word->cX = xCenter;
		word->cY = yCenter;
		switch ( fX ) {
		    case Fun1:{
			float	angle = 2*M_PI * drand48(),
				module = 0.25 * (drand48() + drand48());
			word->vX = module * cos( angle );
			word->vY = module * sin( angle );
			word->vScale = 0.6;
			word->scale = 0.7 + 0.3*(drand48() + drand48());}
			word->activateTime = 0.3 * wordCount;
			//fall to the case below for word spacing
		    default:
		    case NoEffect:
			wordsWidth += word->width;
			word->cX += wordsWidth;
			wordsWidth += word->width + 1;
			break;
		    case Sequence:
			word->lifeTime = 1.2;
			word->activateTime = 0.6 + 0.9 * wordCount;
//			word->vY = -5;
			break;
		}
		wordCount ++;
		phrase.remove(0, letters.length() + 1);
	}
	if ( localWords.count() < 1 )
		return;
	//some computations to 'center' the string
	float displace = -(wordsWidth - 1) / 2;
	Word * word = localWords.first();
	for( ; word; word = localWords.next() )
		word->cX += displace;
}
Пример #22
0
Indicator * THERM::calculate ()
{
  Indicator *output = new Indicator;
  output->setDateFlag(dateFlag);
  output->setLogScale(logScale);

  QPtrList<PlotLine> pll;
  pll.setAutoDelete(FALSE);
  getTHERM(pll);

  int loop;
  for (loop = 0; loop < (int) pll.count(); loop++)
    output->addLine(pll.at(loop));

  return output;
}
Пример #23
0
void KWDocStructTextFrameSetItem::setupTextFrames()
{
    // TODO: KWTextFrameSet::frame() method returns frames in screen order?
    // Build a list of frame pointers.
    QPtrList<KWFrame> framePtrs;
    framePtrs.setAutoDelete(false);
    for (uint j = 0; j < m_frameset->frameCount(); j++)
        framePtrs.append(m_frameset->frame(j));

    // Remove deleted frames from the listview.
    KWDocStructTextFrameItem* item = dynamic_cast<KWDocStructTextFrameItem *>(firstChild());
    KWDocStructTextFrameItem* delItem;
    while (item) {
        delItem = item;
        item = dynamic_cast<KWDocStructTextFrameItem *>(item->nextSibling());
        if (framePtrs.containsRef(delItem->frame()) == 0) delete delItem;
    }

    // Add new frames to the list or update existing ones.
    KWDocument* dok = doc();
    KWDocStructTextFrameItem* after = 0;
    for (uint j = 0; j < framePtrs.count(); j++)
    {
        KWFrame* frame = framePtrs.at(j);
        QString name;
        if ( KListViewItem::parent()->firstChild() == this && dok->processingType() == KWDocument::WP )
        {
            if ( dok->numColumns() == 1 )
                name=i18n( "Page %1" ).arg(QString::number(j + 1));
            else
                name=i18n( "Column %1" ).arg(QString::number(j + 1));
        }
        else
            name=i18n( "Text Frame %1" ).arg(QString::number(j + 1));
        KWDocStructTextFrameItem* child = findTextFrameItem(frame);
        if (child)
            child->setText(0, name);
        else {
            if (after)
                child = new KWDocStructTextFrameItem(this, after, name, m_frameset, frame);
            else
                child = new KWDocStructTextFrameItem(this, name, m_frameset, frame);
        }
        child->setupTextParags();
        after = child;
    }
}
Пример #24
0
// -----------------------------------------------------------
void QucsApp::slotCursorDown()
{
  if(!editText->isHidden()) {  // for edit of component property ?
    if(view->MAx3 == 0) return;  // edit component namen ?
    Component *pc = (Component*)view->focusElement;
    Property *pp = pc->Props.at(view->MAx3-1);  // current property
    int Pos = pp->Description.find('[');
    if(Pos < 0) return;  // no selection list ?
    Pos = pp->Description.find(editText->text(), Pos); // current list item
    if(Pos < 0) return;  // should never happen
    Pos = pp->Description.find(',', Pos);
    if(Pos < 0) return;  // was last item ?
    Pos++;
    if(pp->Description.at(Pos) == ' ') Pos++; // remove leading space
    int End = pp->Description.find(',', Pos);
    if(End < 0) {  // is last item ?
      End = pp->Description.find(']', Pos);
      if(End < 0) return;  // should never happen
    }
    editText->setText(pp->Description.mid(Pos, End-Pos));
    editText->selectAll();
    return;
  }

  QPtrList<Element> movingElements;
  Schematic *Doc = (Schematic*)DocumentTab->currentPage();
  int markerCount = Doc->copySelectedElements(&movingElements);

  if((movingElements.count() - markerCount) < 1) {
    if(markerCount > 0) {  // only move marker if nothing else selected
      Doc->markerUpDown(false, &movingElements);
      movingElements.clear();
    }
    else {
      if(Doc->scrollDown(-Doc->verticalScrollBar()->lineStep()))
        Doc->scrollBy(0, Doc->verticalScrollBar()->lineStep());
    }

    Doc->viewport()->update();
    view->drawn = false;
    return;
  }

  view->moveElements(&movingElements, 0, Doc->GridY);  // move "GridY" down
  view->MAx3 = 1;  // sign for moved elements
  view->endElementMoving(Doc, &movingElements);
}
Пример #25
0
void KWDocStructTableItem::setupCells()
{
    // TODO: KWTableFrameSet::cell() method returns cells in screen order?
    // Build a list of cell pointers.
    QPtrList<KWTextFrameSet> cellPtrs;
    cellPtrs.setAutoDelete(false);
    for (uint row = 0; row < m_table->getRows(); ++row)
        for (uint col = 0; col < m_table->getColumns(); ++ col) {
            KWTextFrameSet* cell = m_table->cell(row, col);
            if (cell)
                cellPtrs.append(cell);
        }

    // Remove deleted cells from the listview.
    KWDocStructTextFrameItem* item = dynamic_cast<KWDocStructTextFrameItem *>(firstChild());
    KWDocStructTextFrameItem* delItem;
    while (item) {
        delItem = item;
        item = dynamic_cast<KWDocStructTextFrameItem *>(item->nextSibling());
        if (cellPtrs.containsRef(delItem->frameSet()) == 0) delete delItem;
    }

    // Add new cells to the list or update existing ones.
    // Note we skip over the frameset and add the frame instead,
    // as every cell has exactly one frame in the frameset.
    KWDocStructTextFrameItem* child;
    KWDocStructTextFrameItem* after = 0;
    for (uint j = 0; j < cellPtrs.count(); j++)
    {
        KWTextFrameSet* cell = cellPtrs.at(j);
        KWFrame* frame = cell->frame(0);
        if (frame) {
            QString name = cell->name();
            child = findCellItem(cell);
            if (child)
                child->setText(0, name);
            else {
                if (after)
                    child = new KWDocStructTextFrameItem(this, after, name, cell, frame);
                else
                    child = new KWDocStructTextFrameItem(this, name, cell, frame);
            }
            child->setupTextParags();
            after = child;
        }
    }
}
Пример #26
0
void RenderFlow::paintOutlines(QPainter *p, int _tx, int _ty)
{
    if (style()->outlineStyle() <= BHIDDEN)
        return;
    
    QPtrList <QRect> rects;
    rects.setAutoDelete(true);
    
    rects.append(new QRect(0,0,0,0));
    for (InlineRunBox* curr = firstLineBox(); curr; curr = curr->nextLineBox()) {
        rects.append(new QRect(curr->xPos(), curr->yPos(), curr->width(), curr->height()));
    }
    rects.append(new QRect(0,0,0,0));
    
    for (unsigned int i = 1; i < rects.count() - 1; i++)
        paintOutlineForLine(p, _tx, _ty, *rects.at(i-1), *rects.at(i), *rects.at(i+1));
}
Пример #27
0
bool KMCupsJobManager::doPluginAction(int ID, const QPtrList<KMJob>& jobs)
{
	switch (ID)
	{
		case 0:
			if (jobs.count() == 1)
				return jobIppReport(jobs.getFirst());
			break;
		case 1:
			return changePriority(jobs, true);
		case 2:
			return changePriority(jobs, false);
		case 3:
			return editJobAttributes(jobs.getFirst());
	}
	return false;
}
Пример #28
0
QString localRootIP()
{
    char buf[256];
    buf[0] = '\0';
    if(!gethostname(buf, sizeof(buf)))
        buf[sizeof(buf) - 1] = '\0';
    QPtrList< KAddressInfo > infos = KExtendedSocket::lookup(buf, QString::null);
    infos.setAutoDelete(true);
    if(infos.count() > 0)
    {
        QString IPstr = infos.first()->address()->nodeName();
        int p = IPstr.findRev('.');
        IPstr.truncate(p);
        return IPstr;
    }
    return QString::null;
}
Пример #29
0
void KfindWindow::deleteFiles()
{
    QString tmp =
        i18n("Do you really want to delete the selected file?", "Do you really want to delete the %n selected files?", selectedItems().count());
    if(KMessageBox::warningContinueCancel(parentWidget(), tmp, "", KGuiItem(i18n("&Delete"), "editdelete")) == KMessageBox::Cancel)
        return;

    // Iterate on all selected elements
    QPtrList< QListViewItem > selected = selectedItems();
    for(uint i = 0; i < selected.count(); i++)
    {
        KfFileLVI *item = (KfFileLVI *)selected.at(i);
        KFileItem file = item->fileitem;

        KIO::NetAccess::del(file.url(), this);
    }
    selected.setAutoDelete(true);
}
Пример #30
0
void UIServer::showSSLInfoDialog(const QString &url, const KIO::MetaData &meta, int mainwindow)
{
    KSSLInfoDlg *kid = new KSSLInfoDlg(meta["ssl_in_use"].upper() == "TRUE", 0L /*parent?*/, 0L, true);
    KSSLCertificate *x = KSSLCertificate::fromString(meta["ssl_peer_certificate"].local8Bit());
    if(x)
    {
        // Set the chain back onto the certificate
        QStringList cl = QStringList::split(QString("\n"), meta["ssl_peer_chain"]);
        QPtrList< KSSLCertificate > ncl;

        ncl.setAutoDelete(true);
        for(QStringList::Iterator it = cl.begin(); it != cl.end(); ++it)
        {
            KSSLCertificate *y = KSSLCertificate::fromString((*it).local8Bit());
            if(y)
                ncl.append(y);
        }

        if(ncl.count() > 0)
            x->chain().setChain(ncl);

        kdDebug(7024) << "ssl_cert_errors=" << meta["ssl_cert_errors"] << endl;
        kid->setCertState(meta["ssl_cert_errors"]);
        QString ip = meta.contains("ssl_proxied") ? "" : meta["ssl_peer_ip"];
        kid->setup(x, ip,
                   url, // the URL
                   meta["ssl_cipher"], meta["ssl_cipher_desc"], meta["ssl_cipher_version"], meta["ssl_cipher_used_bits"].toInt(),
                   meta["ssl_cipher_bits"].toInt(), KSSLCertificate::KSSLValidation(meta["ssl_cert_state"].toInt()));
        kdDebug(7024) << "Showing SSL Info dialog" << endl;

        if(mainwindow != 0)
            KWin::setMainWindow(kid, mainwindow);

        kid->exec();
        delete x;
        kdDebug(7024) << "SSL Info dialog closed" << endl;
    }
    else
    {
        KMessageBox::information(0L, // parent ?
                                 i18n("The peer SSL certificate appears to be corrupt."), i18n("SSL"));
    }
    // Don't delete kid!!
}