forked from qt-creator/qt-creator
Codepaster: Always enable send to codepaster menu action.
As the dialog is editable, now. Task-number: QTCREATORBUG-4060
This commit is contained in:
@@ -142,9 +142,6 @@ bool CodepasterPlugin::initialize(const QStringList &arguments, QString *error_m
|
|||||||
connect(m_fetchAction, SIGNAL(triggered()), this, SLOT(fetch()));
|
connect(m_fetchAction, SIGNAL(triggered()), this, SLOT(fetch()));
|
||||||
cpContainer->addAction(command);
|
cpContainer->addAction(command);
|
||||||
|
|
||||||
connect(Core::EditorManager::instance(), SIGNAL(currentEditorChanged(Core::IEditor*)),
|
|
||||||
this, SLOT(updateActions()));
|
|
||||||
updateActions();
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -163,25 +160,19 @@ ExtensionSystem::IPlugin::ShutdownFlag CodepasterPlugin::aboutToShutdown()
|
|||||||
return SynchronousShutdown;
|
return SynchronousShutdown;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CodepasterPlugin::updateActions()
|
|
||||||
{
|
|
||||||
const IEditor* editor = EditorManager::instance()->currentEditor();
|
|
||||||
const BaseTextEditor *textEditor = qobject_cast<const BaseTextEditor *>(editor);
|
|
||||||
m_postEditorAction->setEnabled(textEditor != 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CodepasterPlugin::postEditor()
|
void CodepasterPlugin::postEditor()
|
||||||
{
|
{
|
||||||
const IEditor* editor = EditorManager::instance()->currentEditor();
|
QString data;
|
||||||
const BaseTextEditor *textEditor = qobject_cast<const BaseTextEditor *>(editor);
|
QString mimeType;
|
||||||
if (!textEditor)
|
if (const IEditor* editor = EditorManager::instance()->currentEditor()) {
|
||||||
return;
|
if (const BaseTextEditor *textEditor = qobject_cast<const BaseTextEditor *>(editor)) {
|
||||||
|
data = textEditor->selectedText();
|
||||||
QString data = textEditor->selectedText();
|
if (data.isEmpty())
|
||||||
if (data.isEmpty())
|
data = textEditor->contents();
|
||||||
data = textEditor->contents();
|
mimeType = textEditor->editorWidget()->mimeType();
|
||||||
if (!data.isEmpty())
|
}
|
||||||
post(data, textEditor->editorWidget()->mimeType());
|
}
|
||||||
|
post(data, mimeType);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CodepasterPlugin::postClipboard()
|
void CodepasterPlugin::postClipboard()
|
||||||
|
|||||||
@@ -70,9 +70,6 @@ public slots:
|
|||||||
const QString &content,
|
const QString &content,
|
||||||
bool error);
|
bool error);
|
||||||
|
|
||||||
private slots:
|
|
||||||
void updateActions();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void post(QString data, const QString &mimeType);
|
void post(QString data, const QString &mimeType);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user