diff --git a/src/core/UBApplication.cpp b/src/core/UBApplication.cpp index 1e95f8b7..ec8280e4 100644 --- a/src/core/UBApplication.cpp +++ b/src/core/UBApplication.cpp @@ -357,33 +357,6 @@ int UBApplication::exec(const QString& pFileToImport) else applicationController->showBoard(); - -// if (UBSettings::settings()->appIsInSoftwareUpdateProcess->get().toBool()) -// { -// UBSettings::settings()->appIsInSoftwareUpdateProcess->set(false); - -// // clean potential updater in temp directory -// UBFileSystemUtils::cleanupGhostTempFolders(); - -// QUuid docUuid( UBSettings::settings()->appLastSessionDocumentUUID->get().toString()); - -// if (!docUuid.isNull()) -// { -// UBDocumentProxy* proxy = UBPersistenceManager::persistenceManager()->documentByUuid(docUuid); - -// if (proxy) -// { -// bool ok; -// int lastSceneIndex = UBSettings::settings()->appLastSessionPageIndex->get().toInt(&ok); - -// if (!ok) -// lastSceneIndex = 0; - -// boardController->setActiveDocumentScene(proxy, lastSceneIndex); -// } -// } -// } - return QApplication::exec(); } diff --git a/src/gui/UBTeacherGuideWidgetsTools.cpp b/src/gui/UBTeacherGuideWidgetsTools.cpp index f31e3481..71334fbb 100644 --- a/src/gui/UBTeacherGuideWidgetsTools.cpp +++ b/src/gui/UBTeacherGuideWidgetsTools.cpp @@ -520,6 +520,8 @@ void UBTGMediaWidget::mousePressEvent(QMouseEvent *event) } } + + /*************************************************************************** * class UBTGUrlWidget * ***************************************************************************/ @@ -531,10 +533,12 @@ UBTGUrlWidget::UBTGUrlWidget(QWidget* parent, const char* name ):QWidget(parent) setObjectName(name); SET_STYLE_SHEET(); mpLayout = new QVBoxLayout(this); + setLayout(mpLayout); mpTitle = new QLineEdit(this); mpTitle->setObjectName("UBTGLineEdit"); mpTitle->setPlaceholderText(tr("Insert link title here...")); mpUrl = new QLineEdit(this); + connect(mpUrl,SIGNAL(editingFinished()),this,SLOT(onUrlEditionFinished())); mpUrl->setObjectName("UBTGLineEdit"); mpUrl->setPlaceholderText("http://"); mpLayout->addWidget(mpTitle); @@ -548,6 +552,15 @@ UBTGUrlWidget::~UBTGUrlWidget() DELETEPTR(mpLayout); } +void UBTGUrlWidget::onUrlEditionFinished() +{ + QString url = mpUrl->text(); + if(url.length() && !url.startsWith("http://") && !url.startsWith("https://") && !url.startsWith("ftp://") && !url.startsWith("sftp://") && !url.startsWith("http://")){ + mpUrl->setText("http://" + mpUrl->text()); + setFocus(); + } +} + void UBTGUrlWidget::initializeWithDom(QDomElement element) { mpTitle->setText(element.attribute("title")); diff --git a/src/gui/UBTeacherGuideWidgetsTools.h b/src/gui/UBTeacherGuideWidgetsTools.h index ad1daf57..43e726e3 100644 --- a/src/gui/UBTeacherGuideWidgetsTools.h +++ b/src/gui/UBTeacherGuideWidgetsTools.h @@ -178,6 +178,10 @@ public: ~UBTGUrlWidget(); tUBGEElementNode* saveData(); void initializeWithDom(QDomElement element); + +public slots: + void onUrlEditionFinished(); + private: QVBoxLayout* mpLayout; QLineEdit* mpTitle;