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); }
/** @return the Job's current status icon */ QIcon Job::statusIcon() const { static const char* icons[] = { "dialog-information", "dialog-ok", "dialog-error" }; Q_ASSERT(status() >= 0 && static_cast<quint32>(status()) < sizeof(icons) / sizeof(icons[0])); if (status() < 0 || static_cast<quint32>(status()) >= sizeof(icons) / sizeof(icons[0])) return QIcon(); return SmallIcon(icons[status()]); }
KTimerDialog::KTimerDialog( int msec, TimerStyle style, QWidget *parent, const char *name, bool modal, const QString &caption, int buttonMask, ButtonCode defaultButton, bool separator, const KGuiItem &user1, const KGuiItem &user2, const KGuiItem &user3 ) : KDialog( parent ) { setObjectName( name ); setModal( modal ); setCaption( caption ); setButtons( (ButtonCodes)buttonMask ); setDefaultButton( defaultButton ); showButtonSeparator( separator ); setButtonGuiItem( User1, user1 ); setButtonGuiItem( User2, user2 ); setButtonGuiItem( User3, user3 ); totalTimer = new QTimer( this ); totalTimer->setSingleShot( true ); updateTimer = new QTimer( this ); updateTimer->setSingleShot( false ); msecTotal = msecRemaining = msec; updateInterval = 1000; tStyle = style; KWindowSystem::setIcons( winId(), DesktopIcon("randr"), SmallIcon("randr") ); // default to canceling the dialog on timeout if ( buttonMask & Cancel ) buttonOnTimeout = Cancel; connect( totalTimer, SIGNAL( timeout() ), SLOT( slotInternalTimeout() ) ); connect( updateTimer, SIGNAL( timeout() ), SLOT( slotUpdateTime() ) ); // create the widgets mainWidget = new KVBox( this ); timerWidget = new KHBox( mainWidget ); timerLabel = new QLabel( timerWidget ); timerProgress = new QProgressBar( timerWidget ); timerProgress->setRange( 0, msecTotal ); timerProgress->setTextVisible( false ); KDialog::setMainWidget( mainWidget ); slotUpdateTime( false ); }
QuickButton::QuickButton(const QString &u, KAction* configAction, QWidget *parent, const char *name) : QButton(parent, name), m_flashCounter(0), m_sticky(false) { installEventFilter(KickerTip::the()); if (parent && ! parent->parent()) { setBackgroundMode(X11ParentRelative); } setBackgroundOrigin( AncestorOrigin ); setMouseTracking(true); _highlight = false; _oldCursor = cursor(); _qurl=new QuickURL(u); QToolTip::add(this, _qurl->name()); resize(int(DEFAULT_ICON_DIM),int(DEFAULT_ICON_DIM)); QBrush bgbrush(colorGroup().brush(QColorGroup::Background)); QuickAddAppsMenu *addAppsMenu = new QuickAddAppsMenu( parent, this, _qurl->url()); _popup = new QPopupMenu(this); _popup->insertItem(i18n("Add Application"), addAppsMenu); configAction->plug(_popup); _popup->insertSeparator(); _popup->insertItem(SmallIcon("remove"), i18n("Remove"), this, SLOT(removeApp())); m_stickyAction = new KToggleAction(i18n("Never Remove Automatically"), KShortcut(), this); connect(m_stickyAction, SIGNAL(toggled(bool)), this, SLOT(slotStickyToggled(bool))); m_stickyAction->plug(_popup, 2); m_stickyId = _popup->idAt(2); settingsChanged(KApplication::SETTINGS_MOUSE); connect(kapp, SIGNAL(settingsChanged(int)), SLOT(settingsChanged(int))); connect(kapp, SIGNAL(iconChanged(int)), SLOT(iconChanged(int))); connect(this, SIGNAL(clicked()), SLOT(launch())); connect(this, SIGNAL(removeApp(QuickButton *)), parent, SLOT(removeAppManually(QuickButton *))); kapp->addKipcEventMask(KIPC::SettingsChanged); kapp->addKipcEventMask(KIPC::IconChanged); }
void ToolConfig::selectIcon() { KILE_DEBUG() << "icon ---> " << m_icon << endl; //KILE_DEBUG() << "==ToolConfig::selectIcon()=====================" << endl; KIconDialog *dlg = new KIconDialog(this); QString res = dlg->openDialog(); if ( m_icon != res ) { if ( res.isEmpty() ) return; m_icon = res; writeConfig(); if ( m_icon.isEmpty() ) m_configWidget->m_pshbIcon->setPixmap(QString::null); else m_configWidget->m_pshbIcon->setPixmap(SmallIcon(m_icon)); } }
void KonqSidebarTree::loadTopLevelGroup( KonqSidebarTreeItem *parent, const QString &path ) { QDir dir( path ); QString name = dir.dirName(); QString icon = "folder"; bool open = false; kdDebug(1201) << "Scanning " << path << endl; QString dotDirectoryFile = QString( path ).append( "/.directory" ); if ( QFile::exists( dotDirectoryFile ) ) { kdDebug(1201) << "Reading the .directory" << endl; KSimpleConfig cfg( dotDirectoryFile, true ); cfg.setDesktopGroup(); name = cfg.readEntry( "Name", name ); icon = cfg.readEntry( "Icon", icon ); //stripIcon( icon ); open = cfg.readBoolEntry( "Open", open ); } KonqSidebarTreeTopLevelItem *item; if ( parent ) { kdDebug(1201) << "KonqSidebarTree::loadTopLevelGroup Inserting new group under parent " << endl; item = new KonqSidebarTreeTopLevelItem( parent, 0 /* no module */, path ); } else item = new KonqSidebarTreeTopLevelItem( this, 0 /* no module */, path ); item->setText( 0, name ); item->setPixmap( 0, SmallIcon( icon ) ); item->setListable( false ); item->setClickable( false ); item->setTopLevelGroup( true ); item->setOpen( open ); m_topLevelItems.append( item ); kdDebug(1201) << "Inserting group " << name << " " << path << endl; scanDir( item, path ); if ( item->childCount() == 0 ) item->setExpandable( false ); }
void KMConfigFilter::loadConfig(KConfig *conf) { conf->setGroup("Filter"); QStringList m_plist = conf->readListEntry("Printers"); QPtrListIterator< KMPrinter > it(*(KMManager::self()->printerListComplete(false))); for(; it.current(); ++it) { if(!it.current()->isSpecial() && !it.current()->isVirtual()) { KListBox *lb = (m_plist.find(it.current()->printerName()) == m_plist.end() ? m_list1 : m_list2); lb->insertItem(SmallIcon(it.current()->pixmap()), it.current()->printerName()); } } m_list1->sort(); m_list2->sort(); m_locationre->setText(conf->readEntry("LocationRe")); }
void AltLangStrEdit::loadLangAltListEntries() { d->languageCB->blockSignals(true); d->languageCB->clear(); // In first we fill already assigned languages. QStringList list = d->values.keys(); if (!list.isEmpty()) { foreach(const QString& item, list) { d->languageCB->addItem(item); d->languageCB->setItemIcon(d->languageCB->count()-1, SmallIcon("dialog-ok")); }
TopWidget::TopWidget() : KXmlGuiWindow(0) { // Check command line args for "-kppp" KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); bool kpppmode = args->isSet("kppp"); args->clear(); setCaption(i18n("KPPP Log Viewer")); w = new QWidget(this); QBoxLayout *l = new QVBoxLayout(w); l->setSpacing(5); td = new QTabWidget(w); mw = new MonthlyWidget(); td->addTab(mw, i18n("Monthly Log")); // remove buttons if(!kpppmode) { // create menu mb = new KMenuBar; l->addWidget(mb); l->addWidget(td); QMenu *fm = new QMenu; QAction *action = fm->addAction(QIcon(SmallIcon("application-exit")), KStandardGuiItem::quit().text()); action->setShortcut(Qt::CTRL + Qt::Key_Q); connect(action,SIGNAL(triggered()), this, SLOT(slotExit())); fm->setTitle(i18n("&File")); mb->addMenu(fm); } else { l->addWidget(td); mb = 0; QPushButton *but = new KPushButton(KStandardGuiItem::close(),w); QHBoxLayout *lh = new QHBoxLayout(); l->addItem(lh); lh->addStretch(10); lh->addWidget(but); connect(but, SIGNAL(clicked()), kapp, SLOT(quit())); } setMinimumSize(mw->sizeHint().width() + 15, mw->sizeHint().height() + 120); setCentralWidget(w); }
RubySupportPart::RubySupportPart(QObject *parent, const char *name, const QStringList& ) : KDevLanguageSupport (&data, parent, name ? name : "RubySupportPart" ) { setInstance(RubySupportFactory::instance()); setXMLFile("kdevrubysupport.rc"); KAction *action; action = new KAction( i18n("&Run"), "exec", SHIFT + Key_F9, this, SLOT(slotRun()), actionCollection(), "build_execute" ); action->setToolTip(i18n("Run")); action->setWhatsThis(i18n("<b>Run</b><p>Starts an application.")); action->setIcon("ruby_run.png"); action = new KAction( i18n("Run Test Under Cursor"), "exec", ALT + Key_F9, this, SLOT(slotRunTestUnderCursor()), actionCollection(), "build_execute_test_function" ); action->setToolTip(i18n("Run Test Under Cursor")); action->setWhatsThis(i18n("<b>Run Test Under Cursor</b><p>Runs the function under the cursor as test.")); action = new KAction( i18n("Launch Browser"), "network", 0, this, SLOT(slotBrowse()), actionCollection(), "build_launch_browser" ); action->setToolTip(i18n("Launch Browser")); action->setWhatsThis(i18n("<b>Launch Browser</b><p>Opens a web browser pointing to the Ruby Rails server") ); action = new KAction( i18n("Switch To Controller"), 0, CTRL+ALT+Key_1, this, SLOT(slotSwitchToController()), actionCollection(), "switch_to_controller" ); action = new KAction( i18n("Switch To Model"), 0, CTRL+ALT+Key_2, this, SLOT(slotSwitchToModel()), actionCollection(), "switch_to_model" ); action = new KAction( i18n("Switch To View"), 0, CTRL+ALT+Key_3, this, SLOT(slotSwitchToView()), actionCollection(), "switch_to_view" ); action = new KAction( i18n("Switch To Test"), 0, CTRL+ALT+Key_4, this, SLOT(slotSwitchToTest()), actionCollection(), "switch_to_test" ); kdDebug() << "Creating RubySupportPart" << endl; m_shellWidget = new KDevShellWidget( 0, "irb console"); m_shellWidget->setIcon( SmallIcon("ruby_config.png", KIcon::SizeMedium, KIcon::DefaultState, RubySupportPart::instance())); m_shellWidget->setCaption(i18n("Ruby Shell")); mainWindow()->embedOutputView( m_shellWidget, i18n("Ruby Shell"), i18n("Ruby Shell")); mainWindow()->raiseView( m_shellWidget ); connect( core(), SIGNAL(projectOpened()), this, SLOT(projectOpened()) ); connect( core(), SIGNAL(projectClosed()), this, SLOT(projectClosed()) ); connect( core(), SIGNAL(contextMenu(QPopupMenu *, const Context *)), this, SLOT(contextMenu(QPopupMenu *, const Context *)) ); connect( partController(), SIGNAL(savedFile(const KURL&)), this, SLOT(savedFile(const KURL&)) ); connect( core(), SIGNAL(projectConfigWidget(KDialogBase*)), this, SLOT(projectConfigWidget(KDialogBase*)) ); }
void BasketStatusBar::setLockStatus(bool isLocked) { if (!m_lockStatus) return; if (isLocked) { m_lockStatus->setPixmap(SmallIcon("encrypted.png")); m_lockStatus->setToolTip(i18n( "<p>This basket is <b>locked</b>.<br>Click to unlock it.</p>").replace(" ", " ")); // QToolTip::add(m_lockStatus, i18n("This basket is locked.\nClick to unlock it.")); } else { m_lockStatus->clear(); m_lockStatus->setToolTip(i18n( "<p>This basket is <b>unlocked</b>.<br>Click to lock it.</p>").replace(" ", " ")); // QToolTip::add(m_lockStatus, i18n("This basket is unlocked.\nClick to lock it.")); } }
SingleView::SingleView(Plasma::Corona *corona, Plasma::Containment *containment, const QString &pluginName, int appletId, const QVariantList &appletArgs, QWidget *parent) : QGraphicsView(parent), m_applet(0), m_containment(containment), m_corona(corona) { setScene(m_corona); QFileInfo info(pluginName); if (!info.isAbsolute()) { info = QFileInfo(QDir::currentPath() + '/' + pluginName); } if (info.exists()) { m_applet = Plasma::Applet::loadPlasmoid(info.absoluteFilePath(), appletId, appletArgs); } if (!m_applet) { m_applet = Plasma::Applet::load(pluginName, appletId, appletArgs); } if (!m_applet) { kDebug() << "failed to load" << pluginName; return; } m_containment->addApplet(m_applet, QPointF(-1, -1), false); m_containment->resize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX); m_applet->setPos(0, 0); m_applet->setFlag(QGraphicsItem::ItemIsMovable, false); setSceneRect(m_applet->sceneBoundingRect()); setWindowTitle(m_applet->name()); setWindowIcon(SmallIcon(m_applet->icon())); setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setFrameStyle(QFrame::NoFrame); QAction *action = m_applet->action("remove"); delete action; QAction *quitAction = KStandardAction::quit(this, SLOT(close()), this); m_applet->addAction(QString("remove"), quitAction); addAction(quitAction); // enforce the applet being our size connect(m_applet, SIGNAL(geometryChanged()), this, SLOT(updateGeometry())); }
/** * @short Shows a popup * @author Rene Schmidt <*****@*****.**> * @version 0.1 */ void KLAidWidget::showPopUp(QString &caption, QString &text, uint &tOut) { // Tell user when the next popup will be shown QToolTip::add(tray, i18n("K Learning Aid %1").arg(VER) + "\nNext PopUp will be shown at " + aut->projectTime(aut->getInterval())); // this is a candidate for subclassing... Copied in part from kpassivepopup.cpp (c) by KDE Team KPassivePopup *pop = new KPassivePopup( tray ); pop->setPaletteForegroundColor(*tmpFgColor); pop->setPaletteBackgroundColor(*tmpBgColor); QVBox *vb = new QVBox( pop ); vb->setSpacing( KDialog::spacingHint() ); QHBox *hb=0; hb = new QHBox(vb); hb->setMargin(0); hb->setSpacing(KDialog::spacingHint() ); QLabel *ttlIcon=0; ttlIcon = new QLabel( hb, "title_icon" ); ttlIcon->setPixmap( SmallIcon("ktimer") ); ttlIcon->setAlignment( AlignLeft ); if ( !caption.isEmpty() ) { QLabel *ttl=0; ttl = new QLabel(caption, hb ? hb : vb, "title_label"); ttl->setFont( *fntCaption ); ttl->setAlignment( Qt::AlignHCenter ); if ( hb ) hb->setStretchFactor( ttl, 10 ); // enforce centering } if ( !text.isEmpty() ) { QLabel *msg=0; msg = new QLabel( text, vb, "msg_label" ); msg->setFont( *fntBody ); msg->setAlignment( AlignLeft ); } pop->setTimeout(tOut); //pop->setView( title, txt, SmallIcon("ktimer")); pop->setView(vb); pop->show(); }
GDBOutputWidget::GDBOutputWidget( QWidget *parent, const char *name) : QWidget(parent, name), m_userGDBCmdEditor(0), m_Interrupt(0), m_gdbView(0), showInternalCommands_(false), maxLines_(5000) { m_gdbView = new OutputText(this); m_gdbView->setTextFormat(QTextEdit::LogText); QBoxLayout *userGDBCmdEntry = new QHBoxLayout(); m_userGDBCmdEditor = new KHistoryCombo (this, "gdb-user-cmd-editor"); QLabel *label = new QLabel(i18n("&GDB cmd:"), this); label->setBuddy(m_userGDBCmdEditor); userGDBCmdEntry->addWidget(label); userGDBCmdEntry->addWidget(m_userGDBCmdEditor); userGDBCmdEntry->setStretchFactor(m_userGDBCmdEditor, 1); m_Interrupt = new QToolButton( this, "add breakpoint" ); m_Interrupt->setSizePolicy ( QSizePolicy ( (QSizePolicy::SizeType)0, ( QSizePolicy::SizeType)0, 0, 0, m_Interrupt->sizePolicy().hasHeightForWidth()) ); m_Interrupt->setPixmap ( SmallIcon ( "player_pause" ) ); userGDBCmdEntry->addWidget(m_Interrupt); QToolTip::add ( m_Interrupt, i18n ( "Pause execution of the app to enter gdb commands" ) ); QVBoxLayout *topLayout = new QVBoxLayout(this, 2); topLayout->addWidget(m_gdbView, 10); topLayout->addLayout(userGDBCmdEntry); slotDbgStatus( "", s_dbgNotStarted); connect( m_userGDBCmdEditor, SIGNAL(returnPressed()), SLOT(slotGDBCmd()) ); connect( m_Interrupt, SIGNAL(clicked()), SIGNAL(breakInto())); connect( &updateTimer_, SIGNAL(timeout()), this, SLOT(flushPending())); }
void MonthWidget::mouseReleaseEvent(QMouseEvent* event) { if (!contentsRect().contains(event->pos())) return; if (event->button() == Qt::LeftButton) { KIPIPlugins::ImageDialog dlg( this, interface_, true ); setImage(dlg.url()); } else if (event->button() == Qt::RightButton) { imagePath_ = QString(""); CalSettings::instance()->setImage(month_,imagePath_); setThumb(QPixmap(SmallIcon("image-x-generic", KIconLoader::SizeMedium, KIconLoader::DisabledState))); } }
/** * Initializes the ui. * @param parent the parent widget * @param name the name of this widget */ Login::Login(QWidget *parent, const char *name) : KDialog(parent,name), progress(NULL), lastLoginName(""), loggingOnError(false), logingIn(false), manualLogOff(false){ setCaption("Kinkatta - Login"); setIcon(SmallIcon("kinkatta")); i_aimSettings = setup::settings(); initDialog(); KConfig &config = *KGlobal::config(); config.setGroup("Login Window Location"); int x = config.readNumEntry("x", -1); int y = config.readNumEntry("y", -1); if( x != -1 && y != -1) setGeometry(x, y, 300, 200); }
void K3bIsoImageWritingDialog::slotMd5JobFinished( bool success ) { if( success ) { d->md5SumItem->setText( 1, m_md5Job->hexDigest() ); d->haveMd5Sum = true; } else { d->md5SumItem->setForegroundColor( 1, Qt::red ); if( m_md5Job->hasBeenCanceled() ) d->md5SumItem->setText( 1, i18n("Calculation cancelled") ); else d->md5SumItem->setText( 1, i18n("Calculation failed") ); d->md5SumItem->setPixmap( 0, SmallIcon( "stop") ); d->lastCheckedFile.truncate(0); } d->md5SumItem->setDisplayProgressBar( 1, false ); }
UiStyle::UiStyle(QObject *parent) : QObject(parent), _channelJoinedIcon(SmallIcon("irc-channel-active")), _channelPartedIcon(SmallIcon("irc-channel-inactive")), _userOfflineIcon(SmallIcon("im-user-offline")), _userOnlineIcon(SmallIcon("im-user")), _userAwayIcon(SmallIcon("im-user-away")), _categoryOpIcon(SmallIcon("irc-operator")), _categoryVoiceIcon(SmallIcon("irc-voice")), _opIconLimit(UserCategoryItem::categoryFromModes("o")), _voiceIconLimit(UserCategoryItem::categoryFromModes("v")) { // register FormatList if that hasn't happened yet // FIXME I don't think this actually avoids double registration... then again... does it hurt? if (QVariant::nameToType("UiStyle::FormatList") == QVariant::Invalid) { qRegisterMetaType<FormatList>("UiStyle::FormatList"); qRegisterMetaTypeStreamOperators<FormatList>("UiStyle::FormatList"); Q_ASSERT(QVariant::nameToType("UiStyle::FormatList") != QVariant::Invalid); } _uiStylePalette = QVector<QBrush>(NumRoles, QBrush()); // Now initialize the mapping between FormatCodes and FormatTypes... _formatCodes["%O"] = Base; _formatCodes["%B"] = Bold; _formatCodes["%S"] = Italic; _formatCodes["%U"] = Underline; _formatCodes["%R"] = Reverse; _formatCodes["%DN"] = Nick; _formatCodes["%DH"] = Hostmask; _formatCodes["%DC"] = ChannelName; _formatCodes["%DM"] = ModeFlags; _formatCodes["%DU"] = Url; setTimestampFormatString("[hh:mm:ss]"); // BufferView / NickView settings UiStyleSettings s; _showBufferViewIcons = _showNickViewIcons = s.value("ShowItemViewIcons", true).toBool(); s.notify("ShowItemViewIcons", this, SLOT(showItemViewIconsChanged(QVariant))); _allowMircColors = s.value("AllowMircColors", true).toBool(); s.notify("AllowMircColors", this, SLOT(allowMircColorsChanged(QVariant))); loadStyleSheet(); }
SettingsDlg::SettingsDlg(QWidget *parent) : QDialog(parent), _currentPage(0) { ui.setupUi(this); setModal(true); setAttribute(Qt::WA_DeleteOnClose, true); setWindowIcon(SmallIcon("configure")); updateGeometry(); ui.settingsTree->setRootIsDecorated(false); connect(ui.settingsTree, SIGNAL(itemSelectionChanged()), this, SLOT(itemSelected())); connect(ui.buttonBox, SIGNAL(clicked(QAbstractButton *)), this, SLOT(buttonClicked(QAbstractButton *))); setButtonStates(); }
void KXmlCommandAdvancedDlg::slotAddGroup() { if (m_view->currentItem()) { TQString ID = generateId(m_opts); DrGroup *grp = new DrGroup; grp->setName(ID); grp->set("text", i18n("New Group")); m_opts[ID] = grp; TQListViewItem *item = new TQListViewItem(m_view->currentItem(), i18n("New Group"), ID); item->setRenameEnabled(0, true); item->setPixmap(0, SmallIcon("folder")); m_view->ensureItemVisible(item); item->startRename(0); } }
void KXmlCommandAdvancedDlg::slotAddOption() { if (m_view->currentItem()) { TQString ID = generateId(m_opts); DrBase *opt = new DrStringOption; opt->setName(ID); opt->set("text", i18n("New Option")); m_opts[ID] = opt; TQListViewItem *item = new TQListViewItem(m_view->currentItem(), i18n("New Option"), ID); item->setRenameEnabled(0, true); item->setPixmap(0, SmallIcon("document")); m_view->ensureItemVisible(item); item->startRename(0); } }
void BracketStackList::slotThumbnail(const KUrl& url, const QPixmap& pix) { QTreeWidgetItemIterator it(this); while (*it) { BracketStackItem* item = static_cast<BracketStackItem*>(*it); if (item->url() == url) { if (pix.isNull()) item->setThumbnail(SmallIcon("image-x-generic", iconSize().width(), KIconLoader::DisabledState)); else item->setThumbnail(pix.scaled(iconSize().width(), iconSize().height(), Qt::KeepAspectRatio)); return; } ++it; } }
void KMWIppSelect::initPrinter(KMPrinter *p) { // storage variables QString host, login, password; int port; // save config host = CupsInfos::self()->host(); login = CupsInfos::self()->login(); password = CupsInfos::self()->password(); port = CupsInfos::self()->port(); m_list->clear(); // retrieve printer list KURL url = p->device(); CupsInfos::self()->setHost(url.host()); CupsInfos::self()->setLogin(url.user()); CupsInfos::self()->setPassword(url.pass()); CupsInfos::self()->setPort(url.port()); IppRequest req; QString uri; req.setOperation(CUPS_GET_PRINTERS); uri = QString::fromLatin1("ipp://%1/printers/").arg(CupsInfos::self()->hostaddr()); req.addURI(IPP_TAG_OPERATION,"printer-uri",uri); req.addKeyword(IPP_TAG_OPERATION,"requested-attributes",QString::fromLatin1("printer-name")); if (req.doRequest("/printers/")) { ipp_attribute_t *attr = req.first(); while (attr) { if (attr->name && strcmp(attr->name,"printer-name") == 0) m_list->insertItem(SmallIcon("kdeprint_printer"),QString::fromLatin1(attr->values[0].string.text)); attr = attr->next; } m_list->sort(); } // restore config CupsInfos::self()->setHost(host); CupsInfos::self()->setLogin(login); CupsInfos::self()->setPassword(password); CupsInfos::self()->setPort(port); }
void KPager::showPopupMenu( WId wid, QPoint pos) { if (wid <= 0) { if(!m_smnu) { m_smnu = new QPopupMenu(this); m_prefs_action->plug(m_smnu); m_quit_action->plug(m_smnu); } m_smnu->popup(pos); } else { m_winfo = KWin::windowInfo(wid); if (!m_mnu) { m_mnu = new KPopupMenu(this); m_mnu->insertTitle( QString::fromUtf8("KPager"), 1); m_mnu->setCheckable(true); connect(m_mnu, SIGNAL(aboutToShow()), SLOT(clientPopupAboutToShow())); connect(m_mnu, SIGNAL(activated(int)), SLOT(clientPopupActivated(int))); m_dmnu = new QPopupMenu(m_mnu); m_dmnu->setCheckable(true); connect(m_dmnu, SIGNAL(aboutToShow()), SLOT(desktopPopupAboutToShow())); connect(m_dmnu, SIGNAL(activated(int)), SLOT(sendToDesktop(int))); m_mnu->insertItem( i18n("Mi&nimize"), IconifyOp ); m_mnu->insertItem( i18n("Ma&ximize"), MaximizeOp ); if (m_showStickyOption) m_mnu->insertItem( QString("&Sticky"), StickyOp ); // Add translation m_mnu->insertSeparator(); m_mnu->insertItem(i18n("&To Desktop"), m_dmnu ); m_mnu->insertSeparator(); m_mnu->insertItem(SmallIcon("fileclose"),i18n("&Close"), CloseOp); m_mnu->insertSeparator(); m_prefs_action->plug(m_mnu); m_quit_action->plug(m_mnu); } m_mnu->popup(pos); } }
void KonviConfigDialog::addPageInternal(QWidget *page, const QStringList &items, const QString &pixmapName, const QString &header) { if(d->shown) { kdDebug(240) << "KonviConfigDialog::addPage: can not add a page after the dialog has been shown."; return; } switch(d->type) { case TreeList: case IconList: case Tabbed: { QVBox *frame = addVBoxPage(items, header, SmallIcon(pixmapName, 16)); frame->setSpacing( 0 ); frame->setMargin( 0 ); page->reparent(((QWidget*)frame), 0, QPoint()); m_lastAddedIndex = pageIndex(frame); } break; case Swallow: { page->reparent(this, 0, QPoint()); setMainWidget(page); } break; case Plain: { QFrame *main = plainPage(); QVBoxLayout *topLayout = new QVBoxLayout( main, 0, 0 ); page->reparent(((QWidget*)main), 0, QPoint()); topLayout->addWidget( page ); } break; default: kdDebug(240) << "KonviConfigDialog::addpage: unknown type."; } }
ValgrindPart::ValgrindPart( QObject *parent, const char *name, const QStringList& ) : KDevPlugin( &data, parent, name ? name : "ValgrindPart" ) { setInstance( ValgrindFactory::instance() ); setXMLFile( "kdevpart_valgrind.rc" ); proc = new KShellProcess(); connect( proc, SIGNAL(receivedStdout( KProcess*, char*, int )), this, SLOT(receivedStdout( KProcess*, char*, int )) ); connect( proc, SIGNAL(receivedStderr( KProcess*, char*, int )), this, SLOT(receivedStderr( KProcess*, char*, int )) ); connect( proc, SIGNAL(processExited( KProcess* )), this, SLOT(processExited( KProcess* )) ); connect( core(), SIGNAL(stopButtonClicked(KDevPlugin*)), this, SLOT(slotStopButtonClicked(KDevPlugin*)) ); connect( core(), SIGNAL(projectOpened()), this, SLOT(projectOpened()) ); m_widget = new ValgrindWidget( this ); m_widget->setIcon( SmallIcon("fork") ); m_widget->setCaption(i18n("Valgrind Output")); QWhatsThis::add( m_widget, i18n( "<b>Valgrind</b><p>Shows the output of the valgrind. Valgrind detects<br>" "use of uninitialized memory<br>" "reading/writing memory after it has been free'd<br>" "reading/writing off the end of malloc'd blocks<br>" "reading/writing inappropriate areas on the stack<br>" "memory leaks -- where pointers to malloc'd blocks are lost forever<br>" "passing of uninitialised and/or unaddressable memory to system calls<br>" "mismatched use of malloc/new/new [] vs free/delete/delete []<br>" "some abuses of the POSIX pthread API." ) ); KAction* action = new KAction( i18n("&Valgrind Memory Leak Check"), 0, this, SLOT(slotExecValgrind()), actionCollection(), "tools_valgrind" ); action->setToolTip(i18n("Valgrind memory leak check")); action->setWhatsThis(i18n("<b>Valgrind memory leak check</b><p>Runs Valgrind - a tool to help you find memory-management problems in your programs.")); action = new KAction( i18n("P&rofile with KCachegrind"), 0, this, SLOT(slotExecCalltree()), actionCollection(), "tools_calltree" ); action->setToolTip(i18n("Profile with KCachegrind")); action->setWhatsThis(i18n("<b>Profile with KCachegrind</b><p>Runs your program in calltree and then displays profiler information in KCachegrind.")); mainWindow()->embedOutputView( m_widget, "Valgrind", i18n("Valgrind memory leak check") ); }
StatusWindow::StatusWindow(int pid) : QWidget(NULL, "StatusWindow", WType_TopLevel | WStyle_DialogBorder | WStyle_StaysOnTop | WDestructiveClose), m_pid(pid) { m_label = new QLabel(this); m_label->setAlignment(AlignCenter); m_button = new KPushButton(KStdGuiItem::close(), this); m_icon = new QLabel(this); m_icon->setPixmap(DesktopIcon("fileprint")); m_icon->setAlignment(AlignCenter); KWin::setIcons(winId(), *(m_icon->pixmap()), SmallIcon("fileprint")); QGridLayout *l0 = new QGridLayout(this, 2, 3, 10, 10); l0->setRowStretch(0, 1); l0->setColStretch(1, 1); l0->addMultiCellWidget(m_label, 0, 0, 1, 2); l0->addWidget(m_button, 1, 2); l0->addMultiCellWidget(m_icon, 0, 1, 0, 0); connect(m_button, SIGNAL(clicked()), SLOT(hide())); resize(200, 50); }
void Test::toggleLeftButton(bool state) { if (state) { if (!mLeftWidget) { mLeftWidget = new QToolButton( mWidget ); connect( mLeftWidget, SIGNAL( clicked() ), SLOT( addTab() ) ); mLeftWidget->setIconSet( SmallIcon( "tab_new" ) ); mLeftWidget->setTextLabel("New"); mLeftWidget->setTextPosition(QToolButton::Right); mLeftWidget->adjustSize(); //mLeftWidget->setGeometry( 0, 0, h, h ); mLeftWidget->setPopup(mLeftPopup); mWidget->setCornerWidget( mLeftWidget, TopLeft ); } mLeftWidget->show(); } else mLeftWidget->hide(); }
/** * @short Starts timer * @author Rene Schmidt <*****@*****.**> * @version 0.1 */ void KLAidWidget::_startTimer() { // Tell user when the first popup will be shown QToolTip::add(tray, i18n("K Learning Aid %1").arg(VER) + i18n("\nFirst PopUp will be shown at ") + aut->projectTime(aut->getInterval())); // showPopUp(i18n("KLAid information"), // i18n("PopUps enabled. You may stop or quit the program\nvia the KLAid icon in the system tray."), // 8*1000); (void)KPassivePopup::message( QString("KLAid")+" "+i18n("information"), i18n("PopUps enabled. You may stop or quit the program\nvia the KLAid icon in the system tray."), SmallIcon("ktimer"), tray, 0, 8*1000); enPopAction->setChecked(TRUE); enPopAction->setEnabled(TRUE); this->hide(); aut->startTimer(TRUE); }
void Test::toggleRightButton(bool state) { if (state) { if ( !mRightWidget) { mRightWidget = new QToolButton( mWidget ); QObject::connect( mRightWidget, SIGNAL( clicked() ), SLOT( removeCurrentTab() ) ); mRightWidget->setIconSet( SmallIcon( "tab_remove" ) ); mRightWidget->setTextLabel("Close"); mRightWidget->setTextPosition(QToolButton::Right); mRightWidget->adjustSize(); //mRightButton->setGeometry( 0, 0, h, h ); mRightWidget->setPopup(mRightPopup); mWidget->setCornerWidget( mRightWidget, TopRight ); } mRightWidget->show(); } else mRightWidget->hide(); }