KlipperTray::KlipperTray() : KSystemTrayIcon( "klipper" ) { klipper = new Klipper( this, KGlobal::config()); setToolTip( i18n("Klipper - clipboard tool")); setContextMenu( NULL ); show(); connect( this, SIGNAL( activated( QSystemTrayIcon::ActivationReason )), klipper, SLOT( slotPopupMenu())); }
TaskWPGanttView *View::createGanttView() { TaskWPGanttView *v = new TaskWPGanttView( part(), this ); connect( v, SIGNAL(requestPopupMenu(QString,QPoint)), this, SLOT(slotPopupMenu(QString,QPoint)) ); connect( v, SIGNAL(selectionChanged()), SLOT(slotSelectionChanged()) ); v->updateReadWrite( m_readWrite ); v->loadContext(); return v; }
KHTMLImage::KHTMLImage( QWidget *parentWidget, QObject *parent, KHTMLPart::GUIProfile prof ) : KParts::ReadOnlyPart( parent ), m_image( 0 ) { KHTMLPart* parentPart = qobject_cast<KHTMLPart*>( parent ); setComponentData( KHTMLImageFactory::componentData(), prof == KHTMLPart::BrowserViewGUI && !parentPart ); KVBox *box = new KVBox( parentWidget ); box->setAcceptDrops( true ); m_khtml = new KHTMLPart( box, this, prof ); m_khtml->setAutoloadImages( true ); // We do not want our subpart to be destroyed when its widget is, // since that may cause all KHTMLParts to die when we're dealing // with m_khtml->setAutoDeletePart( false ); connect( m_khtml->view(), SIGNAL(finishedLayout()), this, SLOT(restoreScrollPosition()) ); setWidget( box ); // VBox can't take focus, so pass it on to sub-widget box->setFocusProxy( m_khtml->widget() ); m_ext = new KHTMLImageBrowserExtension( this ); m_ext->setObjectName( "be" ); m_sbExt = new KParts::StatusBarExtension( this ); m_sbExt->setObjectName( "sbe" ); // Remove unnecessary actions. delete actionCollection()->action( "setEncoding" ); delete actionCollection()->action( "viewDocumentSource" ); delete actionCollection()->action( "selectAll" ); // forward important signals from the khtml part // forward opening requests to parent frame (if existing) KHTMLPart *p = qobject_cast<KHTMLPart*>(parent); KParts::BrowserExtension *be = p ? p->browserExtension() : m_ext; connect(m_khtml->browserExtension(), SIGNAL(openUrlRequestDelayed(KUrl,KParts::OpenUrlArguments,KParts::BrowserArguments)), be, SIGNAL(openUrlRequestDelayed(KUrl,KParts::OpenUrlArguments,KParts::BrowserArguments))); connect(m_khtml->browserExtension(), SIGNAL(popupMenu(QPoint,KUrl,mode_t,KParts::OpenUrlArguments,KParts::BrowserArguments,KParts::BrowserExtension::PopupFlags,KParts::BrowserExtension::ActionGroupMap)), this, SLOT(slotPopupMenu(QPoint,KUrl,mode_t,KParts::OpenUrlArguments,KParts::BrowserArguments,KParts::BrowserExtension::PopupFlags,KParts::BrowserExtension::ActionGroupMap))); connect( m_khtml->browserExtension(), SIGNAL(enableAction(const char*,bool)), m_ext, SIGNAL(enableAction(const char*,bool)) ); m_ext->setURLDropHandlingEnabled( true ); }
void K3b::FillStatusDisplay::slotMenuButtonClicked() { QRect alignedMenu = style()->alignedRect( layoutDirection(), Qt::AlignRight, d->popup->sizeHint(), d->buttonMenu->frameGeometry() ); alignedMenu.moveBottom( d->buttonMenu->frameGeometry().top() - 1 ); slotPopupMenu( mapToGlobal( alignedMenu.topLeft() ) ); }
void K3b::FillStatusDisplay::setupPopupMenu() { d->actionCollection = new KActionCollection( this ); // we use a nother popup for the dvd sizes d->popup = new QMenu( this ); d->actionShowMinutes = K3b::createToggleAction( this, i18n("Minutes"), 0, 0, this, SLOT(showTime()), d->actionCollection, "fillstatus_show_minutes" ); d->actionShowMegs = K3b::createToggleAction( this, i18n("Megabytes"), 0, 0, this, SLOT(showSize()), d->actionCollection, "fillstatus_show_megabytes" ); d->actionAuto = K3b::createToggleAction( this, i18n("Automatic Size"), 0, 0, this, SLOT(slotAutoSize()), d->actionCollection, "fillstatus_auto" ); d->action74Min = K3b::createToggleAction( this, i18n("%1 MB",650), 0, 0, this, SLOT(slot74Minutes()), d->actionCollection, "fillstatus_74minutes" ); d->action80Min = K3b::createToggleAction( this, i18n("%1 MB",700), 0, 0, this, SLOT(slot80Minutes()), d->actionCollection, "fillstatus_80minutes" ); d->action100Min = K3b::createToggleAction( this, i18n("%1 MB",880), 0, 0, this, SLOT(slot100Minutes()), d->actionCollection, "fillstatus_100minutes" ); d->actionDvd4_7GB = K3b::createToggleAction( this, KIO::convertSizeFromKiB((int)(4.4*1024.0*1024.0)), 0, 0, this, SLOT(slotDvd4_7GB()), d->actionCollection, "fillstatus_dvd_4_7gb" ); d->actionDvdDoubleLayer = K3b::createToggleAction( this, KIO::convertSizeFromKiB((int)(8.0*1024.0*1024.0)), 0, 0, this, SLOT(slotDvdDoubleLayer()), d->actionCollection, "fillstatus_dvd_double_layer" ); d->actionBD25 = K3b::createToggleAction( this, KIO::convertSizeFromKiB( 25*1024*1024 ), 0, 0, this, SLOT(slotBD25()), d->actionCollection, "fillstatus_bd_25" ); d->actionBD50 = K3b::createToggleAction( this, KIO::convertSizeFromKiB( 50*1024*1024 ), 0, 0, this, SLOT(slotBD50()), d->actionCollection, "fillstatus_bd_50" ); d->actionCustomSize = K3b::createAction( this, i18n("Custom..."), 0, 0, this, SLOT(slotCustomSize()), d->actionCollection, "fillstatus_custom_size" ); d->actionDetermineSize = K3b::createAction( this, i18n("From Medium..."), "media-optical", 0, this, SLOT(slotDetermineSize()), d->actionCollection, "fillstatus_size_from_disk" ); QActionGroup* showSizeInGroup = new QActionGroup( this ); showSizeInGroup->addAction( d->actionShowMegs ); showSizeInGroup->addAction( d->actionShowMinutes ); d->cdSizeGroup = new QActionGroup( this ); d->cdSizeGroup->addAction( d->actionAuto ); d->cdSizeGroup->addAction( d->action74Min ); d->cdSizeGroup->addAction( d->action80Min ); d->cdSizeGroup->addAction( d->action100Min ); d->cdSizeGroup->addAction( d->actionDvd4_7GB ); d->cdSizeGroup->addAction( d->actionDvdDoubleLayer ); d->cdSizeGroup->addAction( d->actionBD25 ); d->cdSizeGroup->addAction( d->actionBD50 ); d->actionLoadUserDefaults = K3b::createAction( this, i18n("User Defaults"), "", 0, this, SLOT(slotLoadUserDefaults()), d->actionCollection, "load_user_defaults" ); d->actionSaveUserDefaults = K3b::createAction( this, i18n("Save User Defaults"), "", 0, this, SLOT(slotSaveUserDefaults()), d->actionCollection, "save_user_defaults" ); QAction* dvdSizeInfoAction = K3b::createAction( this, i18n("Why 4.4 instead of 4.7?"), "", 0, this, SLOT(slotWhy44()), d->actionCollection, "why_44_gb" ); d->popup->addSection( i18n("Show Size In") ); d->popup->addAction( d->actionShowMinutes ); d->popup->addAction( d->actionShowMegs ); d->popup->addSeparator(); d->popup->addAction( d->actionAuto ); if ( d->doc->supportedMediaTypes() & K3b::Device::MEDIA_CD_ALL ) { d->popup->addSection( i18n("CD Size") ); d->popup->addAction( d->action74Min ); d->popup->addAction( d->action80Min ); d->popup->addAction( d->action100Min ); } if ( d->doc->supportedMediaTypes() & K3b::Device::MEDIA_DVD_ALL ) { d->popup->addSection( i18n("DVD Size") ); d->popup->addAction( dvdSizeInfoAction ); d->popup->addAction( d->actionDvd4_7GB ); d->popup->addAction( d->actionDvdDoubleLayer ); } if ( d->doc->supportedMediaTypes() & K3b::Device::MEDIA_BD_ALL ) { d->popup->addSection( i18n("Blu-ray Size") ); d->popup->addAction( d->actionBD25 ); d->popup->addAction( d->actionBD50 ); } d->popup->addSeparator(); d->popup->addAction( d->actionCustomSize ); d->popup->addAction( d->actionDetermineSize ); d->popup->addSeparator(); d->popup->addAction( d->actionLoadUserDefaults ); d->popup->addAction( d->actionSaveUserDefaults ); connect( d->displayWidget, SIGNAL(contextMenu(QPoint)), this, SLOT(slotPopupMenu(QPoint)) ); }