void KryptDevItem::toggleIgnored() { _ignored = !_ignored; if ( _ignored ) { //setPixmap ( KRYPT_DEV_ITEM_COL_IGNORED, KGlobal::iconLoader()->loadIcon ( "button_cancel", KIcon::NoGroup, KIcon::SizeSmall ) ); setPixmap ( KRYPT_DEV_ITEM_COL_IGNORED, UserIcon ( "ignore" ) ); } else { setPixmap ( KRYPT_DEV_ITEM_COL_IGNORED, 0 ); } }
const QPixmap *PlaylistItem::pixmap(int column) const { static QPixmap image(SmallIcon("image")); static QPixmap playing(UserIcon("playing")); int offset = playlist()->columnOffset(); if((column - offset) == CoverColumn && d->fileHandle.coverInfo()->hasCover()) return ℑ if(column == playlist()->leftColumn() && m_playingItems.contains(const_cast<PlaylistItem *>(this))) return &playing; return KListViewItem::pixmap(column); }
void refreshNamespaces(ClassViewPart *part, KComboView *view) { view->clear(); NamespaceItem *global_item = new NamespaceItem( part, view->listView(), i18n("(Global Namespace)"), part->codeModel()->globalNamespace() ); view->addItem(global_item); global_item->setPixmap( 0, UserIcon("CVnamespace", KIcon::DefaultState, part->instance()) ); NamespaceList namespaces = part->codeModel()->globalNamespace()->namespaceList(); for (NamespaceList::const_iterator it = namespaces.begin(); it != namespaces.end(); ++it) { NamespaceItem *item = new NamespaceItem(part, view->listView(), part->languageSupport()->formatModelItem(*it), *it); view->addItem(item); item->setOpen(true); } view->setCurrentActiveItem(global_item); }
ProjectNewGeneral::ProjectNewGeneral(QWidget *parent, const char *name ) : ProjectNewGeneralS(parent,name) { imagelabel->setPixmap( UserIcon("wiznewprjglb") ); linePrjName->setFocus(); QStringList protocols = KProtocolInfo::protocols(); protocols.sort(); for ( uint i=0; i<protocols.count(); i++ ) { KURL p; p.setProtocol(protocols[i]); QString protocol = protocols[i]; if ( KProtocolInfo::supportsWriting(p) && KProtocolInfo::supportsMakeDir(p) && KProtocolInfo::supportsDeleting(p) && (protocol != "file" && protocol != "fonts" && protocol != "floppy" && protocol != "newcd" )) { comboProtocol->insertItem(protocol); } } comboProtocol->setCurrentItem(0); slotProtocolChanged(i18n("Local")); linePrjTmpl->setText("templates"); linePrjToolbar->setText("toolbars"); connect(comboProtocol, SIGNAL(activated(const QString&)), SLOT(slotProtocolChanged(const QString &))); connect( linePrjFile, SIGNAL(textChanged(const QString &)), this, SLOT(slotLinePrjFile(const QString &))); connect( linePrjName, SIGNAL(textChanged(const QString &)), this, SLOT(slotLinePrjFile(const QString &))); connect( linePrjDir, SIGNAL(textChanged(const QString &)), this, SLOT(slotLinePrjFile(const QString &))); connect( buttonDir, SIGNAL(clicked()), this, SLOT(slotButtonDir())); connect( linePrjName, SIGNAL(textChanged(const QString &)), this, SLOT(slotChangeNames(const QString &))); connect( linePrjTmpl, SIGNAL(textChanged(const QString &)), SLOT(slotLinePrjFile(const QString &))); connect( buttonTmpl, SIGNAL(clicked()), SLOT(slotButtonTmpl())); connect( linePrjToolbar, SIGNAL(textChanged(const QString &)), SLOT(slotLinePrjFile(const QString &))); connect( buttonToolbar, SIGNAL(clicked()), SLOT(slotButtonToolbar())); linePrjTmpl->installEventFilter(this); linePrjToolbar->installEventFilter(this); }
KateSessionChooser::KateSessionChooser(QWidget *parent, const QString &lastSession) : KDialogBase(parent, "", true, i18n("Session Chooser"), KDialogBase::User1 | KDialogBase::User2 | KDialogBase::User3, KDialogBase::User2, true, KStdGuiItem::quit(), KGuiItem(i18n("Open Session"), "fileopen"), KGuiItem(i18n("New Session"), "filenew")) { QHBox *page = new QHBox(this); page->setMinimumSize(400, 200); setMainWidget(page); QHBox *hb = new QHBox(page); hb->setSpacing(KDialog::spacingHint()); QLabel *label = new QLabel(hb); label->setPixmap(UserIcon("sessionchooser")); label->setFrameStyle(QFrame::Panel | QFrame::Sunken); QVBox *vb = new QVBox(hb); vb->setSpacing(KDialog::spacingHint()); m_sessions = new KListView(vb); m_sessions->addColumn(i18n("Session Name")); m_sessions->addColumn(i18n("Open Documents")); m_sessions->setResizeMode(QListView::AllColumns); m_sessions->setSelectionMode(QListView::Single); m_sessions->setAllColumnsShowFocus(true); connect(m_sessions, SIGNAL(selectionChanged()), this, SLOT(selectionChanged())); connect(m_sessions, SIGNAL(doubleClicked(QListViewItem *, const QPoint &, int)), this, SLOT(slotUser2())); KateSessionList &slist(KateSessionManager::self()->sessionList()); for(unsigned int i = 0; i < slist.count(); ++i) { KateSessionChooserItem *item = new KateSessionChooserItem(m_sessions, slist[i]); if(slist[i]->sessionFileRelative() == lastSession) m_sessions->setSelected(item, true); } m_useLast = new QCheckBox(i18n("&Always use this choice"), vb); setResult(resultNone); // trigger action update selectionChanged(); }
void KDFConfigWidget::defaultsBtnClicked( void ) { mStd.setDefault(); mScroll->setValue( mStd.updateFrequency() ); mLCD->display( mStd.updateFrequency() ); mPopupFullCheck->setChecked( mStd.popupIfFull() ); mOpenMountCheck->setChecked( mStd.openFileManager() ); mFileManagerEdit->setText( mStd.fileManager() ); TQListViewItem *item = mList->firstChild(); if( item != 0 ) { for( int i=mList->header()->count(); i>0; i-- ) { item->setText( i-1, i18n("visible") ); item->setPixmap( i-1, UserIcon ( "tick" ) ); } } }
KOSPage::KOSPage(QWidget *parent, const char *name) : KOSPageDlg(parent, name) { px_osSidebar->setPixmap(UserIcon("step2.png")); // initialize the textview with the default description - KDE of course slotKDEDescription(); // Set the configfiles cglobal = new KConfig("kdeglobals"); claunch = new KConfig("klaunchrc", false, false); cwin = new KConfig("kwinrc"); cdesktop = new KConfig("kdesktoprc"); ckcminput = new KConfig("kcminputrc"); ckcmdisplay = new KConfig("kcmdisplayrc"); ckonqueror = new KConfig("konquerorrc"); cklipper = new KConfig("klipperrc", false, false); ckaccess = new KConfig("kaccessrc"); // Save the current user defaults getUserDefaults(); // set default-selections for this page setDefaults(); }
LapsusPanelDefault::LapsusPanelDefault(Qt::Orientation orientation, QWidget *parent): LapsusPanelWidget(orientation, parent, 0), _label(0) { if ( orientation == Qt::Horizontal ) _layout = new QVBoxLayout( this ); else _layout = new QHBoxLayout( this ); _layout->addStretch(); _label = new QLabel(this); _label->setBackgroundMode(X11ParentRelative); QPixmap pic = UserIcon("laptop"); if (!pic.isNull() ) { // scale icon QWMatrix t; t = t.scale( 20.0/pic.width(), 20.0/pic.height() ); pic = pic.xForm( t ); _label->setPixmap( pic ); _label->resize( 20, 20 ); } else { // Desperate fallback... ;) _label->setText("Lapsus\nApplet"); } _layout->add(_label); _layout->addStretch(); _label->show(); QToolTip::add( _label, "Lapsus Panel Applet" ); _label->show(); }
ProjectNewLocal::ProjectNewLocal(QWidget *parent, const char *name ) : ProjectNewLocalS(parent,name) { imagelabel->setPixmap( UserIcon("wiznewprjloc") ); // listView->setColumnAlignment(1,Qt::AlignRight); listView->setColumnText(1, i18n("Add")); listView->removeColumn(2); listView->removeColumn(2); mask->setText("*"); checkInsertWeb->setChecked( true ); connect( checkInsert, SIGNAL(toggled(bool)), this, SLOT(slotSetFiles(bool))); connect( checkInsertWeb, SIGNAL(toggled(bool)), this, SLOT(slotSetFiles(bool))); connect( checkInsertWithMask, SIGNAL(toggled(bool)), this, SLOT(slotSetFiles(bool))); connect(addFiles, SIGNAL(clicked()),this,SLOT(slotAddFiles())); connect(addFolder, SIGNAL(clicked()),this,SLOT(slotAddFolder())); connect(clearList, SIGNAL(clicked()),this,SLOT(slotClearList())); }
servercontroller::servercontroller( QWidget*, const char* name ) : KMainWindow( 0, name ) { we_are_exiting = false; m_notificationCount = 0; m_ncm = new nickColourMaker(); MenuBar = menuBar(); KWin::setIcons( winId(), kapp->icon(), kapp->miniIcon() ); s_self = this; switch (ksopts->displayMode) { case KSOptions::SDI: displayMgr = new DisplayMgrSDI(); break; case KSOptions::MDI: displayMgr = new DisplayMgrMDI(); break; } sci = new scInside(this, QCString(name) + "_mainview"); setCentralWidget(sci); sci->setFrameStyle(QFrame::Box | QFrame::Raised); ConnectionTree = sci->ConnectionTree; connect(ConnectionTree, SIGNAL(clicked( QListViewItem * )), this, SLOT(WindowSelected(QListViewItem *))); setFrameBorderWidth(5); QPopupMenu *file = new QPopupMenu(this, QCString(name) + "_menu_file"); KStdAction::quit(this, SLOT(endksirc()), actionCollection())->plug(file); #ifndef NDEBUG file->insertItem(i18n("Dump Object Tree"), this, SLOT(dump_obj())); file->insertItem(i18n("Server Debug Window"), this, SLOT(server_debug())); #endif MenuBar->insertItem(i18n("&File"), file); connections = new QPopupMenu(this, QCString(name) + "_menu_connections"); server_id = connections->insertItem(i18n("&New Server..."), this, SLOT(new_connection()), Key_F2 ); join_id = connections->insertItem(i18n("&Join Channel..."), this, SLOT(new_channel()), Key_F3 ); connections->insertSeparator(); connections->insertItem(i18n("&Do Autoconnect..."), this, SLOT(start_autoconnect_check())); connections->setItemEnabled(join_id, FALSE); MenuBar->insertItem(i18n("&Connections"), connections); options = new QPopupMenu(this, QCString(name) + "_menu_options"); options->setCheckable(TRUE); options->insertItem(SmallIcon( "filter" ), i18n("&Filter Rule Editor..."), this, SLOT(filter_rule_editor())); options->insertSeparator(); KStdAction::configureNotifications(this, SLOT(notification_prefs()), actionCollection())->plug(options); KStdAction::preferences(this, SLOT(general_prefs()), actionCollection())->plug(options); MenuBar->insertItem(i18n("&Settings"), options); KHelpMenu *help = new KHelpMenu( this, kapp->aboutData() ); MenuBar->insertItem( KStdGuiItem::help().text(), help->menu() ); m_kga = new KGlobalAccel(this, "globalAccess"); m_kga->insert("New Server", i18n("New Server"), i18n("This action allows you to open a new server more easily " "when in docked mode, since you don't need to click on the " "dock icon."), ALT+CTRL+Key_C, KKey::QtWIN+CTRL+Key_C, this, SLOT(new_connection())); open_toplevels = 0; pic_server = UserIcon("server"); pic_gf = UserIcon("ksirc_a"); pic_run = UserIcon("mini-run"); pic_ppl = UserIcon("channels"); pic_icon = UserIcon("ksirc_b"); setCaption( i18n("Server Control") ); KWin::setIcons(winId(), pic_icon, pic_server); resize( 450,200 ); dockWidget = new dockServerController(this, 0x0, "servercontroller_dock"); KWin::setSystemTrayWindowFor( dockWidget->winId(), winId() ); m_kga->readSettings(); m_kga->updateConnections(); checkDocking(); }
void ClassItem::setup() { QListViewItem::setup(); setPixmap( 0, UserIcon("CVclass", KIcon::DefaultState, m_part->instance()) ); }
void NamespaceItem::setup() { QListViewItem::setup(); setPixmap( 0, UserIcon("CVnamespace", KIcon::DefaultState, m_part->instance()) ); }
/** * Returns the pixmap for the given type as user icon. * This is used in worktoolbar to create cursors. * @param type the identification of the icon * @return the wanted cursor */ QCursor Cursor(IconType type) { // TODO: generate from a 32x32 cursor template and place requested icon into return QCursor(UserIcon(QLatin1String("cursor-") + toString(type)), 9, 9); }
AccountingSelector::AccountingSelector(QWidget *parent, bool _isnewaccount, const char *name) : QWidget(parent, name), isnewaccount(_isnewaccount) { QVBoxLayout *l1 = new QVBoxLayout(parent, 0, KDialog::spacingHint()); enable_accounting = new QCheckBox(i18n("&Enable accounting"), parent); l1->addWidget(enable_accounting, 1); connect(enable_accounting, SIGNAL(toggled(bool)), this, SLOT(enableItems(bool))); // insert the tree widget tl = new QListView(parent, "treewidget"); connect(tl, SIGNAL(selectionChanged(QListViewItem*)), this, SLOT(slotSelectionChanged(QListViewItem*))); tl->setMinimumSize(220, 200); l1->addWidget(tl, 1); KURLLabel *up = new KURLLabel(parent); up->setText(i18n("Check for rule updates")); up->setURL("http://developer.kde.org/~kppp/rules.html"); connect(up, SIGNAL(leftClickedURL(const QString&)), SLOT(openURL(const QString&))); l1->addWidget(up, 1); // label to display the currently selected ruleset QHBoxLayout *l11 = new QHBoxLayout; l1->addSpacing(10); l1->addLayout(l11); QLabel *lsel = new QLabel(i18n("Selected:"), parent); selected = new QLabel(parent); selected->setFrameStyle(QFrame::Sunken | QFrame::WinPanel); selected->setLineWidth(1); selected->setFixedHeight(selected->sizeHint().height() + 16); l11->addWidget(lsel, 0); l11->addSpacing(10); l11->addWidget(selected, 1); // volume accounting l1->addStretch(1); QHBoxLayout *l12 = new QHBoxLayout; l1->addLayout(l12); QLabel *usevol_l = new QLabel(i18n("Volume accounting:"), parent); use_vol = new QComboBox(parent); use_vol->insertItem(i18n("No Accounting"), 0); use_vol->insertItem(i18n("Bytes In"), 1); use_vol->insertItem(i18n("Bytes Out"), 2); use_vol->insertItem(i18n("Bytes In & Out"), 3); use_vol->setCurrentItem(gpppdata.VolAcctEnabled()); l12->addWidget(usevol_l); l12->addWidget(use_vol); // load the pmfolder pixmap from KDEdir pmfolder = UserIcon("folder"); // scale the pixmap if(pmfolder.width() > 0) { QWMatrix wm; wm.scale(16.0/pmfolder.width(), 16.0/pmfolder.width()); pmfolder = pmfolder.xForm(wm); } // load the pmfolder pixmap from KDEdir pmfile = UserIcon("phone"); // scale the pixmap if(pmfile.width() > 0) { QWMatrix wm; wm.scale(16.0/pmfile.width(), 16.0/pmfile.width()); pmfile = pmfile.xForm(wm); } enable_accounting->setChecked(gpppdata.AcctEnabled()); setupTreeWidget(); l1->activate(); }
/** * Returns the pixmap for the given type as user icon. * @param type the identification of the icon * @return the wanted pixmap */ QPixmap UserIcon(IconType type) { return UserIcon(toString(type)); }
// protected virtual [base QWidget] void kpDualColorButton::paintEvent (QPaintEvent *e) { #if DEBUG_KP_DUAL_COLOR_BUTTON && 1 qCDebug(kpLogWidgets) << "kpDualColorButton::draw() rect=" << rect () << " contentsRect=" << contentsRect () << endl; #endif // Draw frame first. QFrame::paintEvent (e); QPainter painter (this); // Fill with background. if (isEnabled ()) { kpView::drawTransparentBackground (&painter, contentsRect ().topLeft ()/*checkerboard top-left*/, contentsRect (), true/*preview*/); } else { // Use default widget background. } painter.translate (contentsRect ().x (), contentsRect ().y ()); // Draw "Swap Colours" button (top-right). QPixmap swapPixmap = UserIcon ("colorbutton_swap_16x16"); if (!isEnabled ()) { // Don't let the fill() touch the mask. QBitmap swapBitmapMask = swapPixmap.mask (); swapPixmap.setMask (QBitmap ()); // Grey out the opaque parts of "swapPixmap". swapPixmap.fill (palette ().color (QPalette::Dark)); swapPixmap.setMask (swapBitmapMask); } painter.drawPixmap (swapPixmapRect ().topLeft (), swapPixmap); // Draw background colour patch. QRect bgRect = backgroundRect (); QRect bgRectInside = QRect (bgRect.x () + 2, bgRect.y () + 2, bgRect.width () - 4, bgRect.height () - 4); if (isEnabled ()) { #if DEBUG_KP_DUAL_COLOR_BUTTON && 1 qCDebug(kpLogWidgets) << "\tbackgroundColor=" << (int *) m_color [1].toQRgb () << endl; #endif if (m_color [1].isTransparent ()) // only if fully transparent painter.drawPixmap (bgRectInside, UserIcon ("color_transparent_26x26")); else painter.fillRect (bgRectInside, m_color [1].toQColor ()); } else painter.fillRect (bgRectInside, palette().color (QPalette::Button)); qDrawShadePanel (&painter, bgRect, palette(), false/*not sunken*/, 2/*lineWidth*/, 0/*never fill*/); // Draw foreground colour patch. // Must be drawn after background patch since we're on top. QRect fgRect = foregroundRect (); QRect fgRectInside = QRect (fgRect.x () + 2, fgRect.y () + 2, fgRect.width () - 4, fgRect.height () - 4); if (isEnabled ()) { #if DEBUG_KP_DUAL_COLOR_BUTTON && 1 qCDebug(kpLogWidgets) << "\tforegroundColor=" << (int *) m_color [0].toQRgb () << endl; #endif if (m_color [0].isTransparent ()) // only if fully transparent painter.drawPixmap (fgRectInside, UserIcon ("color_transparent_26x26")); else painter.fillRect (fgRectInside, m_color [0].toQColor ()); } else painter.fillRect (fgRectInside, palette ().color (QPalette::Button)); qDrawShadePanel (&painter, fgRect, palette (), false/*not sunken*/, 2/*lineWidth*/, 0/*never fill*/); }
KDFConfigWidget::KDFConfigWidget(TQWidget *parent, const char *name, bool init) : TQWidget( parent, name) { mTabName.resize(8); mTabName[0] = new CTabName( "Icon", i18n("Icon") ); mTabName[1] = new CTabName( "Device", i18n("Device") ); mTabName[2] = new CTabName( "Type", i18n("Type") ); mTabName[3] = new CTabName( "Size", i18n("Size") ); mTabName[4] = new CTabName( "MountPoint", i18n("Mount Point") ); mTabName[5] = new CTabName( "Free", i18n("Free") ); // xgettext:no-c-format mTabName[6] = new CTabName( "Full%", i18n("Full %") ); mTabName[7] = new CTabName( "UsageBar", i18n("Usage") ); GUI = !init; if(GUI) { TQString text; TQVBoxLayout *topLayout = new TQVBoxLayout( this, 0, KDialog::spacingHint()); mList = new CListView( this, "list", 1 ); mList->setAllColumnsShowFocus(true); mList->setFrameStyle( TQFrame::WinPanel + TQFrame::Sunken ); mList->header()->setMovingEnabled(false); for( uint i=0; i < mTabName.size(); i++ ) { mList->addColumn( mTabName[i]->mName ); } connect( mList, TQT_SIGNAL(clicked(TQListViewItem *, const TQPoint &, int)), this, TQT_SLOT(toggleListText(TQListViewItem *,const TQPoint &,int))); connect( mList, TQT_SIGNAL(clicked(TQListViewItem *, const TQPoint &, int)), this, TQT_SLOT(slotChanged())); topLayout->addWidget( mList ); TQListViewItem *mListItem = new TQListViewItem( mList ); for( uint i=mList->header()->count(); i>0; i-- ) { mListItem->setText(i-1, i18n("visible") ); mListItem->setPixmap( i-1, UserIcon ( "tick" ) ); } mList->setSelected( mListItem, true ); TQGridLayout *gl = new TQGridLayout( 2, 2 ); topLayout->addLayout( gl ); gl->setColStretch( 1, 10 ); mScroll = new TQScrollBar( this ); TQ_CHECK_PTR(mScroll); mScroll->setOrientation( Qt::Horizontal ); mScroll->setSteps(1,20); mScroll->setRange(0, 180 ); gl->addWidget( mScroll, 1, 1 ); connect(mScroll,TQT_SIGNAL(valueChanged(int)),this,TQT_SLOT(slotChanged())); mLCD = new TQLCDNumber( this ); TQ_CHECK_PTR(mLCD); mLCD->setNumDigits( 3 ); mLCD->setSegmentStyle(TQLCDNumber::Filled); connect(mScroll,TQT_SIGNAL(valueChanged(int)),mLCD,TQT_SLOT(display(int))); gl->addMultiCellWidget( mLCD, 0, 1, 0, 0 ); text = i18n("Update frequency [seconds]. The value 0 disables update" ); TQLabel *label = new TQLabel( text, this ); TQ_CHECK_PTR(label); gl->addWidget( label, 0, 1 ); label = new TQLabel( i18n("File manager (e.g. konsole -e mc %m):") ,this); TQ_CHECK_PTR(label); topLayout->addWidget( label ); mFileManagerEdit = new TQLineEdit( this ); TQ_CHECK_PTR(mFileManagerEdit); topLayout->addWidget( mFileManagerEdit ); connect(mFileManagerEdit,TQT_SIGNAL(textChanged (const TQString &)),this,TQT_SLOT(slotChanged())); text = i18n("Open file manager automatically on mount"); mOpenMountCheck = new TQCheckBox(text, this ); TQ_CHECK_PTR(mOpenMountCheck); topLayout->addWidget( mOpenMountCheck ); connect(mOpenMountCheck,TQT_SIGNAL(toggled(bool)),this,TQT_SLOT(slotChanged())); text = i18n("Pop up a window when a disk gets critically full"); mPopupFullCheck = new TQCheckBox( text, this ); TQ_CHECK_PTR(mPopupFullCheck); topLayout->addWidget( mPopupFullCheck ); connect(mPopupFullCheck,TQT_SIGNAL(toggled(bool)),this,TQT_SLOT(slotChanged())); } loadSettings(); if( init ) { applySettings(); } }
virtual void setup() { FancyListViewItem::setup(); setPixmap( 0, UserIcon("CVpublic_meth", KIcon::DefaultState, m_part->instance()) ); }
bool TableEditor::setTableArea( int bLine, int bCol, int eLine, int eCol, Parser *docParser ) { const uint pInitialTableSize = 20; m_bLine = bLine; m_bCol = bCol; m_eLine = eLine; m_eCol = eCol; m_createNodes = false; //don't create the cell and row content when adding a new cell/row Node *node = docParser->nodeAt(bLine, bCol + 1); Node *lastNode = docParser->nodeAt(eLine, eCol); if (node) kdDebug(24000) << "node = " << node->tag->name << endl; if (lastNode) kdDebug(24000) << "lastnode = " << lastNode->tag->name << endl; if (!node || !lastNode) return false; m_write = node->tag->write(); m_dtd = node->tag->dtd(); if ( !QuantaCommon::closesTag(node->tag, lastNode->tag) ) { return false; } int nCol, nRow, maxCol; nCol = nRow = maxCol = 0; bool countRows = false; bool missingBody = false; m_rowSpin = 0L; m_colSpin = 0L; m_dataTable = 0L; QValueList<TableNode> tableRowTags; QValueVector< QValueVector<TableNode> > mergeMatrix; mergeMatrix.resize(pInitialTableSize); for (uint i = 0; i < pInitialTableSize; i++) mergeMatrix[i].resize(pInitialTableSize); TableNode tableNode; Node *n = node; while (n != lastNode->nextSibling()) { QString tagName = n->tag->name.lower(); if (tagName == "table") { if (m_table && m_dataTable && nRow > 0 && nCol > 0) //nested table! { int line, col; n->tag->beginPos(line, col); NestedTable table; table.row = nRow -1; table.col = nCol - 1; table.bLine = line; table.bCol = col; if (n->next && QuantaCommon::closesTag(n->tag, n->next->tag)) { n->next->tag->endPos(table.eLine, table.eCol); table.node = n; table.nestedData = m_write->text(table.bLine, table.bCol, table.eLine, table.eCol); m_nestedTables.append(table); m_dataTable->item(nRow -1, nCol -1)->setPixmap(QIconSet(UserIcon("quick_table")).pixmap()); m_dataTable->updateCell(nRow - 1, nCol - 1); } n = n->next; } else { m_table = new Tag(*(n->tag)); newNum++; } } else if (tagName == "thead") { headerCheckBox->setChecked(true); countRows = true; m_rowSpin = headerRowSpinBox; m_colSpin = headerColSpinBox; m_dataTable= headerTableData; m_tableTags = m_tableHeaderTags; m_tableRows = m_tableHeaderRows; if (m_thead) { //there was already a <thead> tag in the area nRow = m_dataTable->numRows(); } else { m_thead = new Tag(*(n->tag)); newNum++; } } else if (tagName == "/thead") { headerRowSpinBox->setValue(nRow); headerColSpinBox->setValue(maxCol); countRows = false; nCol = nRow = maxCol = 0; m_rowSpin = 0L; m_colSpin = 0L; m_dataTable = 0L; } else if (tagName == "tfoot") { footerCheckBox->setChecked(true); m_rowSpin = footerRowSpinBox; m_colSpin = footerColSpinBox; m_tableTags = m_tableFooterTags; m_tableRows = m_tableFooterRows; m_dataTable = footerTableData; countRows = true; if (m_tfoot) { //there was already a <tfoot> tag in the area nRow = m_dataTable->numRows(); } else { m_tfoot = new Tag(*(n->tag)); newNum++; } } else if (tagName == "/tfoot") { footerRowSpinBox->setValue(nRow); footerColSpinBox->setValue(maxCol); countRows = false; nCol = nRow = maxCol = 0; m_rowSpin = 0L; m_colSpin = 0L; m_dataTable = 0L; } else if (tagName == "tbody") { m_rowSpin = rowSpinBox; m_colSpin = colSpinBox; m_tableTags = m_tableDataTags; m_tableRows = m_tableDataRows; m_dataTable = tableData; countRows = true; m_tbody = new Tag(*(n->tag)); newNum++; } else if (tagName == "/tbody") { rowSpinBox->setValue(nRow); colSpinBox->setValue(maxCol); countRows = false; nCol = nRow = maxCol = 0; m_tableTags = 0L; m_tableRows = 0L; m_rowSpin = 0L; m_colSpin = 0L; m_dataTable = 0L; } else if (tagName == "tr") { if (!countRows) { missingBody = true; m_rowSpin = rowSpinBox; m_colSpin = colSpinBox; m_tableTags = m_tableDataTags; m_tableRows = m_tableDataRows; m_dataTable = tableData; countRows = true; m_tbody = new Tag(); newNum++; m_tbody->parse("<tbody>", m_write); } nRow++; if ((uint)nRow >= mergeMatrix.size()) { // Check if there are enough rows in mergeMatriz mergeMatrix.resize(2 * mergeMatrix.size()); for (uint i = mergeMatrix.size() / 2; i < mergeMatrix.size(); i++) mergeMatrix[i].resize(mergeMatrix[0].size()); } m_rowSpin->setValue(nRow); nCol = 0; tableNode.node = new Node(0L); tableNode.node->tag = new Tag(*(n->tag)); newNum++; tableNode.merged = false; m_tableRows->append(tableNode); } else if (tagName == "/tr") { if (countRows) { maxCol = (nCol > maxCol) ? nCol : maxCol; maxCol = (maxCol == 0) ? 1 : maxCol; for (int col = nCol; col < maxCol; col++) { if (mergeMatrix[nRow - 1][col].node != 0L) { if (m_colSpin->value() < col) m_colSpin->setValue(col); TableNode tableN = mergeMatrix[nRow - 1][col]; Node *n = tableN.node; setCellText(m_dataTable, nRow - 1, col, i18n("Merged with (%1, %2).").arg(tableN.mergedRow + 1).arg(tableN.mergedCol + 1)); m_dataTable->item(nRow-1, col)->setEnabled(false); tableNode.node = new Node(0L); tableNode.node->tag = new Tag(*(n->tag)); configureCell(nRow-1, col, tableNode.node); newNum++; tableNode.merged = true; tableNode.mergedRow = tableN.mergedRow; tableNode.mergedCol = tableN.mergedCol; tableRowTags.append(tableNode); if ((uint)nCol >= mergeMatrix[0].size()) // Check if there are enough cols for (uint i=0; i<mergeMatrix.size(); i++) mergeMatrix[i].resize(2 * mergeMatrix[i].size()); } else { tableNode.node = new Node(0L); newNum++; tableNode.node->tag = new Tag(); tableNode.node->tag->setDtd(m_dtd); tableNode.node->tag->parse("<td>", m_write); tableNode.merged = false; tableRowTags.append(tableNode); } } if (!tableRowTags.isEmpty()) m_tableTags->append(tableRowTags); tableRowTags.clear(); } } else if (tagName == "th" || tagName == "td") { if (countRows) { int col = nCol; while (mergeMatrix[nRow - 1][col].node != 0L) { if (m_colSpin->value() < col) m_colSpin->setValue(col); TableNode tableN = mergeMatrix[nRow - 1][col]; Node *n = tableN.node; setCellText(m_dataTable, nRow - 1, col, i18n("Merged with (%1, %2).").arg(tableN.mergedRow + 1).arg(tableN.mergedCol + 1)); m_dataTable->item(nRow-1, col)->setEnabled(false); tableNode.node = new Node(0L); tableNode.node->tag = new Tag(*(n->tag)); configureCell(nRow-1, col, tableNode.node); newNum++; tableNode.merged = true; tableNode.mergedRow = tableN.mergedRow; tableNode.mergedCol = tableN.mergedCol; tableRowTags.append(tableNode); col++; nCol++; if ((uint)nCol >= mergeMatrix[0].size()) // Check if there are enough cols for (uint i = 0; i < mergeMatrix.size(); i++) mergeMatrix[i].resize(2 * mergeMatrix[i].size()); } nCol++; if (m_rowSpin && m_colSpin && m_dataTable) { m_rowSpin->setValue(nRow); if (m_colSpin->value() < nCol) m_colSpin->setValue(nCol); setCellText(m_dataTable, nRow - 1, nCol - 1, tagContent(n)); tableNode.node = new Node(0L); tableNode.node->tag = new Tag(*(n->tag)); configureCell(nRow-1, col, tableNode.node); newNum++; tableNode.merged = false; tableRowTags.append(tableNode); } QString colspanValue = n->tag->attributeValue("colspan", true); int colValue = 1; int lastCol = nCol; if (!colspanValue.isEmpty()) { bool ok; colValue = colspanValue.toInt(&ok, 10); if (ok && colValue > 1) { nCol += (colValue - 1); if (m_colSpin->value() < nCol) m_colSpin->setValue(nCol); for (int i = 0; i < colValue - 1; i++) { setCellText(m_dataTable, nRow - 1, lastCol + i, i18n("Merged with (%1, %2).").arg(nRow).arg(lastCol)); m_dataTable->item(nRow-1, lastCol + i)->setEnabled(false); tableNode.node = new Node(0L); tableNode.node->tag = new Tag(*(n->tag)); configureCell(nRow-1, col, tableNode.node); newNum++; tableNode.merged = true; tableNode.mergedRow = nRow - 1; tableNode.mergedCol = lastCol - 1; tableRowTags.append(tableNode); } } else colValue = 1; } QString rowspanValue = n->tag->attributeValue("rowspan", true); if (!rowspanValue.isEmpty()) { bool ok; int rowValue = rowspanValue.toInt(&ok, 10); if (ok && rowValue > 1) { lastCol--; // Check if there are enough columns in mergeMatriz if ((uint)(lastCol + colValue) >= mergeMatrix[0].size()) for (uint i = 0; i < mergeMatrix.size(); i++) mergeMatrix[i].resize(2 * mergeMatrix[i].size()); // Check if there are enough rows in mergeMatriz if ((uint)(nRow + rowValue) >= mergeMatrix.size()) { mergeMatrix.resize(2 * mergeMatrix.size()); for (uint i = mergeMatrix.size() / 2; i < mergeMatrix.size(); i++) mergeMatrix[i].resize(mergeMatrix[0].size()); } for (int i = 0; i < rowValue - 1; i++) for (int j = 0; j < colValue; j++) { mergeMatrix[nRow + i][lastCol + j].mergedRow = nRow - 1; mergeMatrix[nRow + i][lastCol + j].mergedCol = lastCol; mergeMatrix[nRow + i][lastCol + j].node = n; } } } } } else if (tagName == "caption") { captionText->setText(tagContent(n)); } else if (tagName == "col" || tagName == "colgroup") { m_colTags.append(n->tag); } n = n->nextSibling(); } /* if (missingBody) { //Hm, why do we need it? I don't remember now. ;-) rowSpinBox->setValue(nRow); colSpinBox->setValue(maxCol); } */ //by default the current page is the data handling page m_tableTags = m_tableDataTags; m_tableRows = m_tableDataRows; m_dataTable = tableData; m_rowSpin = rowSpinBox; m_colSpin = colSpinBox; //create the thead, tbody, tfoot tags if they were not present in the parsed area if (!m_thead) { m_thead = new Tag(); newNum++; m_thead->parse("<thead>", m_write); } if (!m_tfoot) { m_tfoot = new Tag(); newNum++; m_tfoot->parse("<tfoot>", m_write); } m_createNodes = true; //enable cell/row creation configureTable(tableData); configureTable(headerTableData); configureTable(footerTableData); return true; }
ProjectNewFinal::ProjectNewFinal(QWidget *parent, const char *name ) : ProjectNewFinalS(parent,name) { imagelabel->setPixmap( UserIcon("wiznewprjfin") ); }