KexiBlobTableEdit::KexiBlobTableEdit(KexiTableViewColumn &column, QWidget *parent) : KexiTableEdit(column, parent) , d ( new Private() ) { setName("KexiBlobTableEdit"); // m_proc = 0; // m_content = 0; m_hasFocusableWidget = false; d->button = new KexiDropDownButton( parentWidget() /*usually a viewport*/ ); d->button->hide(); QToolTip::add(d->button, i18n("Click to show available actions for this cell")); d->popup = new KexiImageContextMenu(this); d->popup->installEventFilter(this); if (column.columnInfo) KexiImageContextMenu::updateTitle( d->popup, column.columnInfo->captionOrAliasOrName(), //! @todo pixmaplabel icon is hardcoded... "pixmaplabel" ); d->button->setPopup( d->popup ); //force edit requested to start editing... (this will call slotUpdateActionsAvailabilityRequested()) //connect(d->popup, SIGNAL(aboutToShow()), this, SIGNAL(editRequested())); connect(d->popup, SIGNAL(updateActionsAvailabilityRequested(bool&, bool&)), this, SLOT(slotUpdateActionsAvailabilityRequested(bool&, bool&))); connect(d->popup, SIGNAL(insertFromFileRequested(const KURL&)), this, SLOT(handleInsertFromFileAction(const KURL&))); connect(d->popup, SIGNAL(saveAsRequested(const QString&)), this, SLOT(handleSaveAsAction(const QString&))); connect(d->popup, SIGNAL(cutRequested()), this, SLOT(handleCutAction())); connect(d->popup, SIGNAL(copyRequested()), this, SLOT(handleCopyAction())); connect(d->popup, SIGNAL(pasteRequested()), this, SLOT(handlePasteAction())); connect(d->popup, SIGNAL(clearRequested()), this, SLOT(clear())); connect(d->popup, SIGNAL(showPropertiesRequested()), this, SLOT(handleShowPropertiesAction())); }
KPrViewModeSlidesSorter::KPrViewModeSlidesSorter(KoPAView *view, KoPACanvasBase *canvas) : KoPAViewMode(view, canvas) , m_slidesSorterView(new KPrSlidesManagerView()) , m_customSlideShowView(new KPrSlidesManagerView()) , m_slidesSorterModel(new KPrSlidesSorterDocumentModel(this, view->parentWidget())) , m_centralWidget(new QWidget()) , m_customSlideShowModel(new KPrCustomSlideShowsModel(static_cast<KPrDocument *>(view->kopaDocument()), view->parentWidget())) , m_iconSize(QSize(200, 200)) , m_editCustomSlideShow(false) { setName(i18n("Slides Sorter")); //Create customSlideShow GUI QWidget *m_customShowsToolBar = new QWidget(); QHBoxLayout *toolBarLayout = new QHBoxLayout(m_customShowsToolBar); toolBarLayout->setMargin(0); QVBoxLayout *centralWidgetLayout = new QVBoxLayout(m_centralWidget); centralWidgetLayout->setMargin(0); centralWidgetLayout->setSpacing(0); QLabel *slideShowsLabel = new QLabel(i18n("Slide Show: ")); m_customSlideShowsList = new QComboBox; m_customSlideShowsList->setEditable(false); m_customSlideShowsList->setInsertPolicy(QComboBox::NoInsert); m_customSlideShowsList->setMinimumContentsLength(30); slideShowsLabel->setBuddy(m_customSlideShowsList); m_buttonAddCustomSlideShow = new QToolButton(); m_buttonAddCustomSlideShow->setIcon(koIcon("list-add")); m_buttonAddCustomSlideShow->setToolTip(i18n("Add a new custom slide show")); m_buttonDelCustomSlideShow = new QToolButton(); m_buttonDelCustomSlideShow->setIcon(koIcon("list-remove")); m_buttonDelCustomSlideShow->setEnabled(false); m_buttonDelCustomSlideShow->setToolTip(i18n("Delete current custom slide show")); m_buttonAddSlideToCurrentShow = new QToolButton(); m_buttonAddSlideToCurrentShow->setIcon(koIcon("arrow-down")); m_buttonAddSlideToCurrentShow->setToolTip(i18n("Add slides to current custom slide show")); m_buttonAddSlideToCurrentShow->setEnabled(false); m_buttonDelSlideFromCurrentShow = new QToolButton(); m_buttonDelSlideFromCurrentShow->setIcon(koIcon("arrow-up")); m_buttonDelSlideFromCurrentShow->setToolTip(i18n("Remove slides from current custom slide show")); m_buttonDelSlideFromCurrentShow->setEnabled(false); QSplitter *viewsSplitter = new QSplitter(Qt::Vertical); //hide Custom Shows View m_customSlideShowView->setMaximumHeight(0); //Layout Widgets toolBarLayout->addWidget(slideShowsLabel); toolBarLayout->addWidget(m_customSlideShowsList); toolBarLayout->addWidget(m_buttonAddCustomSlideShow); toolBarLayout->addWidget(m_buttonDelCustomSlideShow); toolBarLayout->addStretch(); toolBarLayout->addWidget(m_buttonAddSlideToCurrentShow); toolBarLayout->addWidget(m_buttonDelSlideFromCurrentShow); viewsSplitter->addWidget(m_slidesSorterView); viewsSplitter->addWidget(m_customSlideShowView); centralWidgetLayout->addWidget(viewsSplitter); centralWidgetLayout->addWidget(m_customShowsToolBar); //initialize widgets m_centralWidget->hide(); m_slidesSorterView->setIconSize(m_iconSize); m_slidesSorterView->setAutoScroll(true); m_customSlideShowView->setIconSize(m_iconSize); m_customSlideShowView->setAutoScroll(true); //Populate ComboBox customShowChanged(0); updateCustomSlideShowsList(); //Setup customSlideShows view m_customSlideShowView->setModel(m_customSlideShowModel); m_customSlideShowView->setSelectionBehavior(QAbstractItemView::SelectRows); m_customSlideShowView->setSelectionMode(QAbstractItemView::ExtendedSelection); m_customSlideShowView->setDragDropMode(QAbstractItemView::InternalMove); m_customSlideShowView->setSpacing(10); //Setup slides sorter view m_slidesSorterModel->setDocument(m_view->kopaDocument()); m_slidesSorterView->setModel(m_slidesSorterModel); m_slidesSorterView->setSelectionBehavior(QAbstractItemView::SelectRows); m_slidesSorterView->setSelectionMode(QAbstractItemView::ExtendedSelection); m_slidesSorterView->setDragDropMode(QAbstractItemView::InternalMove); m_slidesSorterView->setSpacing(10); //setup signals connect(m_slidesSorterView, SIGNAL(requestContextMenu(QContextMenuEvent*)), this, SLOT(slidesSorterContextMenu(QContextMenuEvent*))); connect(m_customSlideShowView, SIGNAL(requestContextMenu(QContextMenuEvent*)), this, SLOT(customSlideShowsContextMenu(QContextMenuEvent*))); connect(m_slidesSorterView, SIGNAL(slideDblClick()), this, SLOT(activateNormalViewMode())); connect(m_buttonAddCustomSlideShow, SIGNAL(clicked()), this, SLOT(addCustomSlideShow())); connect(m_buttonDelCustomSlideShow, SIGNAL(clicked()), this, SLOT(removeCustomSlideShow())); connect(m_buttonAddSlideToCurrentShow, SIGNAL(clicked()), this, SLOT(addSlideToCustomShow())); connect(m_buttonDelSlideFromCurrentShow, SIGNAL(clicked()), this, SLOT(deleteSlidesFromCustomShow())); connect(m_customSlideShowModel, SIGNAL(customSlideShowsChanged()), this, SLOT(updateCustomSlideShowsList())); connect(m_customSlideShowModel, SIGNAL(selectPages(int,int)), this, SLOT(selectCustomShowPages(int,int))); //setup signals for manage edit actions connect(view->copyController(), SIGNAL(copyRequested()), this, SLOT(editCopy())); connect(view->cutController(), SIGNAL(copyRequested()), this, SLOT(editCut())); connect(view, SIGNAL(selectAllRequested()), m_slidesSorterView, SLOT(selectAll())); connect(view, SIGNAL(deselectAllRequested()), m_slidesSorterView, SLOT(clearSelection())); connect(m_slidesSorterView, SIGNAL(selectionCleared()), this, SLOT(disableEditActions())); connect(m_slidesSorterView, SIGNAL(itemSelected()), this, SLOT(enableEditActions())); connect(m_slidesSorterView, SIGNAL(focusLost()), SLOT(disableEditActions())); connect(m_slidesSorterView, SIGNAL(focusGot()), SLOT(manageAddRemoveSlidesButtons())); connect(m_slidesSorterView, SIGNAL(zoomIn()), m_view->zoomController()->zoomAction(), SLOT(zoomIn())); connect(m_slidesSorterView, SIGNAL(zoomOut()), m_view->zoomController()->zoomAction(), SLOT(zoomOut())); connect(m_customSlideShowView, SIGNAL(focusGot()), SLOT(disableEditActions())); connect(m_customSlideShowView, SIGNAL(focusGot()), SLOT(manageAddRemoveSlidesButtons())); //install selection manager for Slides Sorter View and Custom Shows View m_slidesSorterItemContextBar = new KoViewItemContextBar(m_slidesSorterView); new KoViewItemContextBar(m_customSlideShowView); QToolButton *duplicateButton = m_slidesSorterItemContextBar->addContextButton(i18n("Duplicate Slide"),QString("edit-copy")); QToolButton *deleteButton = m_slidesSorterItemContextBar->addContextButton(i18n("Delete Slide"),QString("edit-delete")); QToolButton *startPresentation = m_slidesSorterItemContextBar->addContextButton(i18n("Start Slideshow"),QString("view-presentation")); connect(view->kopaDocument(), SIGNAL(pageRemoved(KoPAPageBase*)), m_slidesSorterItemContextBar, SLOT(update())); //setup signals for item context bar buttons connect(duplicateButton, SIGNAL(clicked()), this, SLOT(contextBarDuplicateSlide())); connect(deleteButton, SIGNAL(clicked()), this, SLOT(contextBarDeleteSlide())); connect(startPresentation, SIGNAL(clicked()), this, SLOT(contextBarStartSlideshow())); //install delegate for Slides Sorter View KPrSlidesSorterItemDelegate *slidesSorterDelegate = new KPrSlidesSorterItemDelegate(m_slidesSorterView); m_slidesSorterView->setItemDelegate(slidesSorterDelegate); }
KexiDBImageBox::KexiDBImageBox(bool designMode, QWidget *parent) : KexiFrame(parent /* Qt 4 not neede: , Qt::WNoAutoErase*/) , KexiFormDataItemInterface() , m_alignment(Qt::AlignAuto | Qt::AlignTop) //2.0 moved to FormWidgetInterface , m_designMode(designMode) , m_readOnly(false) , m_scaledContents(false) , m_smoothTransformation(true) , m_keepAspectRatio(true) , m_insideSetData(false) , m_setFocusOnButtonAfterClosingPopup(false) // , m_lineWidthChanged(false) , m_paintEventEnabled(true) , m_dropDownButtonVisible(true) , m_insideSetPalette(false) { setDesignMode(designMode); installEventFilter(this); setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); QPalette pal(palette()); pal.setBrush(backgroundRole(), QBrush(Qt::transparent)); KexiFrame::setPalette(pal); //setup context menu m_contextMenu = new KexiImageContextMenu(this); m_contextMenu->installEventFilter(this); if (designMode) { m_chooser = 0; } else { m_chooser = new KexiDropDownButton(this); m_chooser->setFocusPolicy(Qt::StrongFocus); m_chooser->setMenu(m_contextMenu); setFocusProxy(m_chooser); m_chooser->installEventFilter(this); // m_chooser->setPalette(qApp->palette()); // hlyr->addWidget(m_chooser); } setFrameShape(QFrame::Box); setFrameShadow(QFrame::Plain); setFrameColor(palette().color(QPalette::Foreground)); m_paletteBackgroundColorChanged = false; //set this here, not before connect(m_contextMenu, SIGNAL(updateActionsAvailabilityRequested(bool&,bool&)), this, SLOT(slotUpdateActionsAvailabilityRequested(bool&,bool&))); connect(m_contextMenu, SIGNAL(insertFromFileRequested(KUrl)), this, SLOT(handleInsertFromFileAction(KUrl))); connect(m_contextMenu, SIGNAL(saveAsRequested(QString)), this, SLOT(handleSaveAsAction(QString))); connect(m_contextMenu, SIGNAL(cutRequested()), this, SLOT(handleCutAction())); connect(m_contextMenu, SIGNAL(copyRequested()), this, SLOT(handleCopyAction())); connect(m_contextMenu, SIGNAL(pasteRequested()), this, SLOT(handlePasteAction())); connect(m_contextMenu, SIGNAL(clearRequested()), this, SLOT(clear())); connect(m_contextMenu, SIGNAL(showPropertiesRequested()), this, SLOT(handleShowPropertiesAction())); // connect(m_contextMenu, SIGNAL(aboutToHide()), this, SLOT(slotAboutToHidePopupMenu())); // if (m_chooser) { //we couldn't use m_chooser->setPopup() because of drawing problems // connect(m_chooser, SIGNAL(pressed()), this, SLOT(slotChooserPressed())); // connect(m_chooser, SIGNAL(released()), this, SLOT(slotChooserReleased())); // connect(m_chooser, SIGNAL(toggled(bool)), this, SLOT(slotToggled(bool))); // } KexiFrame::setLineWidth(0); setDataSource(QString()); //to initialize popup menu and actions availability }
void KexiImageContextMenu::copy() { emit copyRequested(); }