예제 #1
0
	QList<QAction*> ActionsStorage::GetEntryActions (QObject *entry)
	{
		if (Entry2Actions_.contains (entry))
			return Entry2Actions_.value (entry);

		new Util::SlotClosure<Util::DeleteLaterPolicy>
		{
			[this, entry] { Entry2Actions_.remove (entry); },
			entry,
			SIGNAL (destroyed ()),
			this
		};

		const auto paste = new QAction { tr ("Paste to pastebin..."), entry };
		paste->setProperty ("ActionIcon", "edit-paste");
		paste->setProperty ("Azoth/Autopaste/Areas", QStringList { "toolbar" });

		new Util::SlotClosure<Util::NoDeletePolicy>
		{
			[this, entry] { emit pasteRequested (entry); },
			paste,
			SIGNAL (triggered ()),
			paste
		};

		const QList<QAction*> list { paste };
		Entry2Actions_ [entry] = list;
		return list;
	}
예제 #2
0
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()));
}
예제 #3
0
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
}
예제 #4
0
void KexiImageContextMenu::paste()
{
	emit pasteRequested();
}