forked from qt-creator/qt-creator
move editor creation to plugin
each protocol needed to create the editor on their own. Instead emit fetchDone and let the plugin instantiate it for every protocol
This commit is contained in:
@@ -95,6 +95,8 @@ bool CodepasterPlugin::initialize(const QStringList &arguments, QString *error_m
|
||||
0};
|
||||
for(int i=0; protos[i] != 0; ++i) {
|
||||
connect(protos[i], SIGNAL(pasteDone(QString)), this, SLOT(finishPost(QString)));
|
||||
connect(protos[i], SIGNAL(fetchDone(QString,QString,bool)),
|
||||
this, SLOT(finishFetch(QString,QString,bool)));
|
||||
m_settingsPage->addProtocol(protos[i]->name());
|
||||
if (protos[i]->hasSettings())
|
||||
addObject(protos[i]->settingsPage());
|
||||
@@ -251,4 +253,16 @@ void CodepasterPlugin::finishPost(const QString &link)
|
||||
m_settingsPage->displayOutput());
|
||||
}
|
||||
|
||||
void CodepasterPlugin::finishFetch(const QString &titleDescription,
|
||||
const QString &content,
|
||||
bool error)
|
||||
{
|
||||
QString title = titleDescription;
|
||||
if (error) {
|
||||
ICore::instance()->messageManager()->printToOutputPane(content, true);
|
||||
} else {
|
||||
EditorManager::instance()->newFile(Core::Constants::K_DEFAULT_TEXT_EDITOR, &title, content);
|
||||
}
|
||||
}
|
||||
|
||||
Q_EXPORT_PLUGIN(CodepasterPlugin)
|
||||
|
||||
Reference in New Issue
Block a user