SANKORE-320 automatically remove all invalid characters from application name, and show correspond popup messagebox when user try add it manually

preferencesAboutTextFull
Anatoly Mihalchenko 13 years ago
parent d7be307005
commit 39211e361f
  1. 9
      src/domain/UBGraphicsScene.cpp
  2. 38
      src/web/UBTrapFlashController.cpp
  3. 3
      src/web/UBTrapFlashController.h

@ -453,8 +453,17 @@ void UBGraphicsScene::DisposeMagnifierQWidgets()
magniferDisplayViewWidget = NULL; magniferDisplayViewWidget = NULL;
} }
// some time have crash here on access to app (when call from destructor when close sankore app)
// so i just add try/catch section here
try
{
UBApplication::app()->restoreOverrideCursor(); UBApplication::app()->restoreOverrideCursor();
} }
catch (...)
{
}
}
void UBGraphicsScene::moveTo(const QPointF &pPoint) void UBGraphicsScene::moveTo(const QPointF &pPoint)
{ {

@ -73,12 +73,50 @@ void UBTrapFlashController::showTrapFlash()
, viewHeight); , viewHeight);
connect(mTrapFlashUi->flashCombobox, SIGNAL(currentIndexChanged(int)), this, SLOT(selectFlash(int))); connect(mTrapFlashUi->flashCombobox, SIGNAL(currentIndexChanged(int)), this, SLOT(selectFlash(int)));
connect(mTrapFlashUi->widgetNameLineEdit, SIGNAL(textChanged(const QString &)), this, SLOT(text_Changed(const QString &)));
connect(mTrapFlashUi->widgetNameLineEdit, SIGNAL(textEdited(const QString &)), this, SLOT(text_Edited(const QString &)));
connect(mTrapFlashUi->createWidgetButton, SIGNAL(clicked(bool)), this, SLOT(createWidget())); connect(mTrapFlashUi->createWidgetButton, SIGNAL(clicked(bool)), this, SLOT(createWidget()));
} }
mTrapFlashDialog->show(); mTrapFlashDialog->show();
} }
void UBTrapFlashController::text_Changed(const QString &newText)
{
QString new_text = newText;
#ifdef Q_WS_WIN // Defined on Windows.
QString illegalCharList(" < > : \" / \\ | ? * ");
QRegExp regExp("[<>:\"/\\\\|?*]");
#endif
#ifdef Q_WS_QWS // Defined on Qt for Embedded Linux.
QString illegalCharList(" < > : \" / \\ | ? * ");
QRegExp regExp("[<>:\"/\\\\|?*]");
#endif
#ifdef Q_WS_MAC // Defined on Mac OS X.
QString illegalCharList(" < > : \" / \\ | ? * ");
QRegExp regExp("[<>:\"/\\\\|?*]");
#endif
#ifdef Q_WS_X11 // Defined on X11.
QString illegalCharList(" < > : \" / \\ | ? * ");
QRegExp regExp("[<>:\"/\\\\|?*]");
#endif
if(new_text.indexOf(regExp) > -1)
{
new_text.remove(regExp);
mTrapFlashUi->widgetNameLineEdit->setText(new_text);
QToolTip::showText(mTrapFlashUi->widgetNameLineEdit->mapToGlobal(QPoint()), "Application name can`t contain any of the following characters:\r\n"+illegalCharList);
}
}
void UBTrapFlashController::text_Edited(const QString &newText)
{
}
void UBTrapFlashController::hideTrapFlash() void UBTrapFlashController::hideTrapFlash()
{ {

@ -37,6 +37,9 @@ class UBTrapFlashController : public QObject
public slots: public slots:
void updateTrapFlashFromPage(QWebFrame* pCurrentWebFrame); void updateTrapFlashFromPage(QWebFrame* pCurrentWebFrame);
void text_Changed(const QString &);
void text_Edited(const QString &);
private slots: private slots:
void selectFlash(int pFlashIndex); void selectFlash(int pFlashIndex);

Loading…
Cancel
Save