From: Andreas Holzammer Date: Fri, 20 Apr 2012 08:26:14 +0000 (+0200) Subject: Fix building designer shared with QT_NO_CLIPBOARD X-Git-Tag: accepted/tizen/20131212.181521~338 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d25d0f9bf91bef3c2ac179c76569dd47121e09b3;p=platform%2Fupstream%2Fqttools.git Fix building designer shared with QT_NO_CLIPBOARD Change-Id: I25194a08f2b840276ec253d63f32cb39e3c69827 Reviewed-by: Stephen Kelly --- diff --git a/src/designer/src/lib/shared/actioneditor.cpp b/src/designer/src/lib/shared/actioneditor.cpp index 66f3c46..df6b803 100644 --- a/src/designer/src/lib/shared/actioneditor.cpp +++ b/src/designer/src/lib/shared/actioneditor.cpp @@ -65,7 +65,9 @@ #include #include #include +#ifndef QT_NO_CLIPBOARD #include +#endif #include #include #include @@ -122,9 +124,11 @@ ActionEditor::ActionEditor(QDesignerFormEditorInterface *core, QWidget *parent, m_actionNew(new QAction(tr("New..."), this)), m_actionEdit(new QAction(tr("Edit..."), this)), m_actionNavigateToSlot(new QAction(tr("Go to slot..."), this)), +#ifndef QT_NO_CLIPBOARD m_actionCopy(new QAction(tr("Copy"), this)), m_actionCut(new QAction(tr("Cut"), this)), m_actionPaste(new QAction(tr("Paste"), this)), +#endif m_actionSelectAll(new QAction(tr("Select all"), this)), m_actionDelete(new QAction(tr("Delete"), this)), m_viewModeGroup(new QActionGroup(this)), @@ -154,6 +158,7 @@ ActionEditor::ActionEditor(QDesignerFormEditorInterface *core, QWidget *parent, connect(m_actionSelectAll, SIGNAL(triggered()), m_actionView, SLOT(selectAll())); +#ifndef QT_NO_CLIPBOARD m_actionCut->setEnabled(false); connect(m_actionCut, SIGNAL(triggered()), this, SLOT(slotCut())); QIcon editCutIcon = QIcon::fromTheme(QStringLiteral("edit-cut"), createIconSet(QStringLiteral("editcut.png"))); @@ -169,6 +174,7 @@ ActionEditor::ActionEditor(QDesignerFormEditorInterface *core, QWidget *parent, QIcon editPasteIcon = QIcon::fromTheme(QStringLiteral("edit-paste"), createIconSet(QStringLiteral("editpaste.png"))); m_actionPaste->setIcon(editPasteIcon); toolbar->addAction(m_actionPaste); +#endif m_actionEdit->setEnabled(false); connect(m_actionEdit, SIGNAL(triggered()), this, SLOT(editCurrentAction())); @@ -297,8 +303,10 @@ void ActionEditor::setFormWindow(QDesignerFormWindowInterface *formWindow) m_actionView->model()->clearActions(); m_actionEdit->setEnabled(false); +#ifndef QT_NO_CLIPBOARD m_actionCopy->setEnabled(false); m_actionCut->setEnabled(false); +#endif m_actionDelete->setEnabled(false); if (!formWindow || !formWindow->mainContainer()) { @@ -324,9 +332,11 @@ void ActionEditor::setFormWindow(QDesignerFormWindowInterface *formWindow) void ActionEditor::slotSelectionChanged(const QItemSelection& selected, const QItemSelection& /*deselected*/) { +#ifndef QT_NO_CLIPBOARD const bool hasSelection = !selected.indexes().empty(); m_actionCopy->setEnabled(hasSelection); m_actionCut->setEnabled(hasSelection); +#endif m_actionDelete->setEnabled(hasSelection); } @@ -615,6 +625,7 @@ void ActionEditor::deleteActions(QDesignerFormWindowInterface *fw, const ActionL fw->endCommand(); } +#ifndef QT_NO_CLIPBOARD void ActionEditor::copyActions(QDesignerFormWindowInterface *fwi, const ActionList &actions) { FormWindowBase *fw = qobject_cast(fwi); @@ -636,6 +647,7 @@ void ActionEditor::copyActions(QDesignerFormWindowInterface *fwi, const ActionLi qApp->clipboard()->setText(QString::fromUtf8(buffer.buffer()), QClipboard::Clipboard); delete formBuilder; } +#endif void ActionEditor::slotDelete() { @@ -736,6 +748,7 @@ void ActionEditor::updateViewModeActions() } } +#ifndef QT_NO_CLIPBOARD void ActionEditor::slotCopy() { QDesignerFormWindowInterface *fw = formWindow(); @@ -771,6 +784,7 @@ void ActionEditor::slotPaste() m_actionView->clearSelection(); fw->paste(FormWindowBase::PasteActionsOnly); } +#endif void ActionEditor::slotContextMenuRequested(QContextMenuEvent *e, QAction *item) { @@ -801,9 +815,11 @@ void ActionEditor::slotContextMenuRequested(QContextMenuEvent *e, QAction *item) } menu.addSeparator(); +#ifndef QT_NO_CLIPBOARD menu.addAction(m_actionCut); menu.addAction(m_actionCopy); menu.addAction(m_actionPaste); +#endif menu.addAction(m_actionSelectAll); menu.addAction(m_actionDelete); menu.addSeparator(); diff --git a/src/designer/src/lib/shared/actioneditor_p.h b/src/designer/src/lib/shared/actioneditor_p.h index 5b80e98..0570596 100644 --- a/src/designer/src/lib/shared/actioneditor_p.h +++ b/src/designer/src/lib/shared/actioneditor_p.h @@ -118,9 +118,11 @@ private slots: void slotContextMenuRequested(QContextMenuEvent *, QAction *); void slotViewMode(QAction *a); void slotSelectAssociatedWidget(QWidget *w); +#ifndef QT_NO_CLIPBOARD void slotCopy(); void slotCut(); void slotPaste(); +#endif signals: void itemActivated(QAction *item); @@ -130,7 +132,9 @@ signals: private: typedef QList ActionList; void deleteActions(QDesignerFormWindowInterface *formWindow, const ActionList &); +#ifndef QT_NO_CLIPBOARD void copyActions(QDesignerFormWindowInterface *formWindow, const ActionList &); +#endif void restoreSettings(); void saveSettings(); @@ -146,9 +150,11 @@ private: QAction *m_actionNew; QAction *m_actionEdit; QAction *m_actionNavigateToSlot; +#ifndef QT_NO_CLIPBOARD QAction *m_actionCopy; QAction *m_actionCut; QAction *m_actionPaste; +#endif QAction *m_actionSelectAll; QAction *m_actionDelete; diff --git a/src/designer/src/lib/shared/codedialog.cpp b/src/designer/src/lib/shared/codedialog.cpp index e050df3..ff2b687 100644 --- a/src/designer/src/lib/shared/codedialog.cpp +++ b/src/designer/src/lib/shared/codedialog.cpp @@ -47,7 +47,9 @@ #include #include +#ifndef QT_NO_CLIPBOARD #include +#endif #include #include #include @@ -95,9 +97,11 @@ CodeDialog::CodeDialog(QWidget *parent) : QAction *saveAction = toolBar->addAction(saveIcon, tr("Save...")); connect(saveAction, SIGNAL(triggered()), this, SLOT(slotSaveAs())); +#ifndef QT_NO_CLIPBOARD const QIcon copyIcon = createIconSet(QStringLiteral("editcopy.png")); QAction *copyAction = toolBar->addAction(copyIcon, tr("Copy All")); connect(copyAction, SIGNAL(triggered()), this, SLOT(copyAll())); +#endif QAction *findAction = toolBar->addAction( TextEditFindWidget::findIconSet(), @@ -252,10 +256,12 @@ void CodeDialog::warning(const QString &msg) msg, QMessageBox::Close); } +#ifndef QT_NO_CLIPBOARD void CodeDialog::copyAll() { QApplication::clipboard()->setText(code()); } +#endif } // namespace qdesigner_internal diff --git a/src/designer/src/lib/shared/codedialog_p.h b/src/designer/src/lib/shared/codedialog_p.h index b324ac5..b044643 100644 --- a/src/designer/src/lib/shared/codedialog_p.h +++ b/src/designer/src/lib/shared/codedialog_p.h @@ -79,7 +79,9 @@ public: private slots: void slotSaveAs(); +#ifndef QT_NO_CLIPBOARD void copyAll(); +#endif private: void setCode(const QString &code); diff --git a/src/designer/src/lib/shared/formwindowbase_p.h b/src/designer/src/lib/shared/formwindowbase_p.h index 3bbedb6..59e6afe 100644 --- a/src/designer/src/lib/shared/formwindowbase_p.h +++ b/src/designer/src/lib/shared/formwindowbase_p.h @@ -135,7 +135,9 @@ public: virtual void highlightWidget(QWidget *w, const QPoint &pos, HighlightMode mode = Highlight) = 0; enum PasteMode { PasteAll, PasteActionsOnly }; +#ifndef QT_NO_CLIPBOARD virtual void paste(PasteMode pasteMode) = 0; +#endif // Factory method to create a form builder virtual QEditorFormBuilder *createFormBuilder() = 0; diff --git a/src/designer/src/lib/shared/qtresourceview.cpp b/src/designer/src/lib/shared/qtresourceview.cpp index 8519765..10ba28c 100644 --- a/src/designer/src/lib/shared/qtresourceview.cpp +++ b/src/designer/src/lib/shared/qtresourceview.cpp @@ -64,7 +64,9 @@ #include #include #include +#ifndef QT_NO_CLIPBOARD #include +#endif #include #include #include @@ -143,7 +145,9 @@ public: void slotResourceActivated(QListWidgetItem *); void slotEditResources(); void slotReloadResources(); +#ifndef QT_NO_CLIPBOARD void slotCopyResourcePath(); +#endif void slotListWidgetContextMenuRequested(const QPoint &pos); void slotFilterChanged(const QString &pattern); void createPaths(); @@ -244,12 +248,14 @@ void QtResourceViewPrivate::slotReloadResources() } } +#ifndef QT_NO_CLIPBOARD void QtResourceViewPrivate::slotCopyResourcePath() { const QString path = q_ptr->selectedResource(); QClipboard *clipboard = QApplication::clipboard(); clipboard->setText(path); } +#endif void QtResourceViewPrivate::slotListWidgetContextMenuRequested(const QPoint &pos) { @@ -596,10 +602,12 @@ QtResourceView::QtResourceView(QDesignerFormEditorInterface *core, QWidget *pare connect(d_ptr->m_reloadResourcesAction, SIGNAL(triggered()), this, SLOT(slotReloadResources())); d_ptr->m_reloadResourcesAction->setEnabled(false); +#ifndef QT_NO_CLIPBOARD QIcon copyIcon = QIcon::fromTheme(QStringLiteral("edit-copy"), qdesigner_internal::createIconSet(QStringLiteral("editcopy.png"))); d_ptr->m_copyResourcePathAction = new QAction(copyIcon, tr("Copy Path"), this); connect(d_ptr->m_copyResourcePathAction, SIGNAL(triggered()), this, SLOT(slotCopyResourcePath())); d_ptr->m_copyResourcePathAction->setEnabled(false); +#endif //d_ptr->m_filterWidget = new qdesigner_internal::FilterWidget(0, qdesigner_internal::FilterWidget::LayoutAlignNone); d_ptr->m_filterWidget = new qdesigner_internal::FilterWidget(d_ptr->m_toolBar); diff --git a/src/designer/src/lib/shared/qtresourceview_p.h b/src/designer/src/lib/shared/qtresourceview_p.h index 107c55a..af137d7 100644 --- a/src/designer/src/lib/shared/qtresourceview_p.h +++ b/src/designer/src/lib/shared/qtresourceview_p.h @@ -111,7 +111,9 @@ private: Q_PRIVATE_SLOT(d_func(), void slotResourceActivated(QListWidgetItem *)) Q_PRIVATE_SLOT(d_func(), void slotEditResources()) Q_PRIVATE_SLOT(d_func(), void slotReloadResources()) +#ifndef QT_NO_CLIPBOARD Q_PRIVATE_SLOT(d_func(), void slotCopyResourcePath()) +#endif Q_PRIVATE_SLOT(d_func(), void slotListWidgetContextMenuRequested(const QPoint &pos)) Q_PRIVATE_SLOT(d_func(), void slotFilterChanged(const QString &pattern)) };