KURLLabel *Article::widget(QWidget *parent, const char *name) const { KURLLabel *label = new KURLLabel(d->link.url(), d->title, parent, name); label->setUseTips(true); if (!d->description.isNull()) label->setTipText(d->description); return label; }
void KNotesSummaryWidget::updateView() { mNotes = mCalendar->journals(); QLabel *label; for ( label = mLabels.first(); label; label = mLabels.next() ) label->deleteLater(); mLabels.clear(); KIconLoader loader( "knotes" ); int counter = 0; QPixmap pm = loader.loadIcon( "knotes", KIcon::Small ); KCal::Journal::List::Iterator it; if ( mNotes.count() ) { for (it = mNotes.begin(); it != mNotes.end(); ++it) { // Fill Note Pixmap Field label = new QLabel( this ); label->setPixmap( pm ); label->setMaximumWidth( label->minimumSizeHint().width() ); label->setAlignment( AlignVCenter ); mLayout->addWidget( label, counter, 0 ); mLabels.append( label ); // File Note Summary Field QString newtext = (*it)->summary(); KURLLabel *urlLabel = new KURLLabel( (*it)->uid(), newtext, this ); urlLabel->installEventFilter( this ); urlLabel->setTextFormat(RichText); urlLabel->setAlignment( urlLabel->alignment() | Qt::WordBreak ); mLayout->addWidget( urlLabel, counter, 1 ); mLabels.append( urlLabel ); if ( !(*it)->description().isEmpty() ) { QToolTip::add( urlLabel, (*it)->description().left( 80 ) ); } connect( urlLabel, SIGNAL( leftClickedURL( const QString& ) ), this, SLOT( urlClicked( const QString& ) ) ); counter++; } } else {
TDEAboutContributor::TDEAboutContributor( TQWidget *_parent, const char *wname, const TQString &_name,const TQString &_email, const TQString &_url, const TQString &_work, bool showHeader, bool showFrame, bool showBold ) : TQFrame( _parent, wname ), mShowHeader(showHeader), mShowBold(showBold), d(0) { if( showFrame ) { setFrameStyle(TQFrame::Panel | TQFrame::Raised); } mLabel[0] = new TQLabel( this ); mLabel[1] = new TQLabel( this ); mLabel[2] = new TQLabel( this ); mLabel[3] = new TQLabel( this ); mText[0] = new TQLabel( this ); mText[1] = new KURLLabel( this ); mText[2] = new KURLLabel( this ); mText[3] = new TQLabel( this ); setName( _name, i18n("Author"), false ); setEmail( _email, i18n("Email"), false ); setURL( _url, i18n("Homepage"), false ); setWork( _work, i18n("Task"), false ); KURLLabel *kurl = static_cast<KURLLabel *>(mText[1]); kurl->setFloat(true); kurl->setUnderline(true); kurl->setMargin(0); connect(kurl, TQT_SIGNAL(leftClickedURL(const TQString &)), TQT_SLOT(emailClickedSlot(const TQString &))); kurl = static_cast<KURLLabel *>(mText[2]); kurl->setFloat(true); kurl->setUnderline(true); kurl->setMargin(0); connect(kurl, TQT_SIGNAL(leftClickedURL(const TQString &)), TQT_SLOT(urlClickedSlot(const TQString &))); mLabel[3]->setAlignment( AlignTop ); fontChange( font() ); updateLayout(); }
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(); }
void SummaryWidget::updateView() { mLayouts.setAutoDelete( true ); mLayouts.clear(); mLayouts.setAutoDelete( false ); mLabels.setAutoDelete( true ); mLabels.clear(); mLabels.setAutoDelete( false ); if ( mStations.count() == 0 ) { kdDebug(5602) << "No weather stations defined..." << endl; return; } QValueList<WeatherData> dataList = mWeatherMap.values(); qHeapSort( dataList ); QValueList<WeatherData>::Iterator it; for ( it = dataList.begin(); it != dataList.end(); ++it ) { QString cover; for ( uint i = 0; i < (*it).cover().count(); ++i ) cover += QString( "- %1\n" ).arg( (*it).cover()[ i ] ); QImage img; img = (*it).icon(); QGridLayout *layout = new QGridLayout( mLayout, 3, 3, 3 ); mLayouts.append( layout ); KURLLabel* urlLabel = new KURLLabel( this ); urlLabel->installEventFilter( this ); urlLabel->setURL( (*it).stationID() ); urlLabel->setPixmap( img.smoothScale( 32, 32 ) ); urlLabel->setMaximumSize( urlLabel->sizeHint() ); urlLabel->setAlignment( AlignTop ); layout->addMultiCellWidget( urlLabel, 0, 1, 0, 0 ); mLabels.append( urlLabel ); connect ( urlLabel, SIGNAL( leftClickedURL( const QString& ) ), this, SLOT( showReport( const QString& ) ) ); QLabel* label = new QLabel( this ); label->setText( QString( "%1 (%2)" ).arg( (*it).name() ).arg( (*it).temperature() ) ); QFont font = label->font(); font.setBold( true ); label->setFont( font ); label->setAlignment( AlignLeft ); layout->addMultiCellWidget( label, 0, 0, 1, 2 ); mLabels.append( label ); QString labelText; labelText = QString( "<b>%1:</b> %2<br>" "<b>%3:</b> %4<br>" "<b>%5:</b> %6" ) .arg( i18n( "Last updated on" ) ) .arg( (*it).date() ) .arg( i18n( "Wind Speed" ) ) .arg( (*it).windSpeed() ) .arg( i18n( "Rel. Humidity" ) ) .arg( (*it).relativeHumidity() ); QToolTip::add( label, labelText.replace( " ", " " ) ); label = new QLabel( cover, this ); label->setAlignment( AlignLeft ); layout->addMultiCellWidget( label, 1, 1, 1, 2 ); mLabels.append( label ); } for ( QLabel *label = mLabels.first(); label; label = mLabels.next() ) label->show(); }
KHTMLSearchConfig::KHTMLSearchConfig(QWidget *parent, const char *name) : KCModule(parent, name), indexProc(0) { QVBoxLayout *vbox = new QVBoxLayout(this, 5); QGroupBox *gb = new QGroupBox(i18n("ht://dig"), this); vbox->addWidget(gb); QGridLayout *grid = new QGridLayout(gb, 3,2, 6,6); grid->addRowSpacing(0, gb->fontMetrics().lineSpacing()); QLabel *l = new QLabel(i18n("The fulltext search feature makes use of the " "ht://dig HTML search engine. " "You can get ht://dig at the"), gb); l->setAlignment(QLabel::WordBreak); l->setMinimumSize(l->sizeHint()); grid->addMultiCellWidget(l, 1, 1, 0, 1); QWhatsThis::add( gb, i18n( "Information about where to get the ht://dig package." ) ); KURLLabel *url = new KURLLabel(gb); url->setURL("http://www.htdig.org"); url->setText(i18n("ht://dig home page")); url->setAlignment(QLabel::AlignHCenter); grid->addMultiCellWidget(url, 2,2, 0, 1); connect(url, SIGNAL(leftClickedURL(const QString&)), this, SLOT(urlClicked(const QString&))); gb = new QGroupBox(i18n("Program Locations"), this); vbox->addWidget(gb); grid = new QGridLayout(gb, 4,2, 6,6); grid->addRowSpacing(0, gb->fontMetrics().lineSpacing()); htdigBin = new KURLRequester(gb); l = new QLabel(htdigBin, i18n("ht&dig"), gb); l->setBuddy( htdigBin ); grid->addWidget(l, 1,0); grid->addWidget(htdigBin, 1,1); connect(htdigBin->lineEdit(), SIGNAL(textChanged(const QString&)), this, SLOT(configChanged())); QString wtstr = i18n( "Enter the path to your htdig program here, e.g. /usr/local/bin/htdig" ); QWhatsThis::add( htdigBin, wtstr ); QWhatsThis::add( l, wtstr ); htsearchBin = new KURLRequester(gb); l = new QLabel(htsearchBin, i18n("ht&search"), gb); l->setBuddy( htsearchBin ); grid->addWidget(l, 2,0); grid->addWidget(htsearchBin, 2,1); connect(htsearchBin->lineEdit(), SIGNAL(textChanged(const QString&)), this, SLOT(configChanged())); wtstr = i18n( "Enter the path to your htsearch program here, e.g. /usr/local/bin/htsearch" ); QWhatsThis::add( htsearchBin, wtstr ); QWhatsThis::add( l, wtstr ); htmergeBin = new KURLRequester(gb); l = new QLabel(htmergeBin, i18n("ht&merge"), gb); l->setBuddy( htmergeBin ); grid->addWidget(l, 3,0); grid->addWidget(htmergeBin, 3,1); connect(htmergeBin->lineEdit(), SIGNAL(textChanged(const QString&)), this, SLOT(configChanged())); wtstr = i18n( "Enter the path to your htmerge program here, e.g. /usr/local/bin/htmerge" ); QWhatsThis::add( htmergeBin, wtstr ); QWhatsThis::add( l, wtstr ); QHBoxLayout *hbox = new QHBoxLayout(vbox); gb = new QGroupBox(i18n("Scope"), this); hbox->addWidget(gb); QWhatsThis::add( gb, i18n( "Here you can select which parts of the documentation should be included in the fulltext search index. Available options are the KDE Help pages, the installed man pages, and the installed info pages. You can select any number of these." ) ); QVBoxLayout *vvbox = new QVBoxLayout(gb, 6,2); vvbox->addSpacing(gb->fontMetrics().lineSpacing()); indexKDE = new QCheckBox(i18n("&KDE help"), gb); vvbox->addWidget(indexKDE); connect(indexKDE, SIGNAL(clicked()), this, SLOT(configChanged())); indexMan = new QCheckBox(i18n("&Man pages"), gb); vvbox->addWidget(indexMan); indexMan->setEnabled(false), connect(indexMan, SIGNAL(clicked()), this, SLOT(configChanged())); indexInfo = new QCheckBox(i18n("&Info pages"), gb); vvbox->addWidget(indexInfo); indexInfo->setEnabled(false); connect(indexInfo, SIGNAL(clicked()), this, SLOT(configChanged())); gb = new QGroupBox(i18n("Additional Search Paths"), this); hbox->addWidget(gb); QWhatsThis::add( gb, i18n( "Here you can add additional paths to search for documentation. To add a path, click on the <em>Add...</em> button and select the folder from where additional documentation should be searched. You can remove folders by clicking on the <em>Delete</em> button." ) ); grid = new QGridLayout(gb, 4,3, 6,2); grid->addRowSpacing(0, gb->fontMetrics().lineSpacing()); addButton = new QPushButton(i18n("Add..."), gb); grid->addWidget(addButton, 1,0); delButton = new QPushButton(i18n("Delete"), gb); grid->addWidget(delButton, 2,0); searchPaths = new KListBox(gb); grid->addMultiCellWidget(searchPaths, 1,3, 1,1); grid->setRowStretch(2,2); gb = new QGroupBox(i18n("Language Settings"), this); vbox->addWidget(gb); QWhatsThis::add(gb, i18n("Here you can select the language you want to create the index for.")); language = new KLanguageCombo(gb); l = new QLabel(language, i18n("&Language"), gb); vvbox = new QVBoxLayout(gb, 6,2); vvbox->addSpacing(gb->fontMetrics().lineSpacing()); hbox = new QHBoxLayout(vvbox, 6); hbox->addWidget(l); hbox->addWidget(language,1); hbox->addStretch(1); loadLanguages(); vbox->addStretch(1); runButton = new QPushButton(i18n("Generate Index..."), this); QWhatsThis::add( runButton, i18n( "Click this button to generate the index for the fulltext search." ) ); runButton->setFixedSize(runButton->sizeHint()); vbox->addWidget(runButton, AlignRight); connect(runButton, SIGNAL(clicked()), this, SLOT(generateIndex())); connect(addButton, SIGNAL(clicked()), this, SLOT(addClicked())); connect(delButton, SIGNAL(clicked()), this, SLOT(delClicked())); connect(searchPaths, SIGNAL(highlighted(const QString &)), this, SLOT(pathSelected(const QString &))); checkButtons(); load(); }