Changed css for desktop, add notifications for search and copy button in TranslationW...
authorMateusz Półrola <mateusz.polrola@comarch.pl>
Wed, 22 Sep 2010 06:28:19 +0000 (08:28 +0200)
committerMateusz Półrola <mateusz.polrola@comarch.pl>
Wed, 22 Sep 2010 06:28:19 +0000 (08:28 +0200)
data/css_desktop/style.css
src/mdictionary/gui/MainWindow.cpp
src/mdictionary/gui/NotifyManager.cpp
src/mdictionary/gui/TranslationWidget.cpp
src/mdictionary/gui/TranslationWidget.h

index 43e823e..4f48379 100755 (executable)
@@ -30,7 +30,7 @@ div.tab {
        padding-bottom  : 0px;
         padding-right   : 0px;
        
-        -webkit-box-reflect    : below 5px -webkit-gradient(linear, 0% 0%, 0% 120%, from(transparent), color-stop(0.3, transparent), to(white));
+        -webkit-box-reflect    : below 5px -webkit-gradient(linear, 0% 0%, 0% 190%, from(transparent), color-stop(0.3, transparent), to(white));
 }
 
 div.dict {
index b7e4dca..e347a7b 100644 (file)
@@ -527,12 +527,14 @@ void MainWindow::connectTranslationWidget() {
      #ifdef Q_WS_MAEMO_5
         connect(translationWidget, SIGNAL(search(QString)),
                 this, SLOT(search(QString)));
+
+        connect(translationWidget, SIGNAL(notify(Notify::NotifyType, QString)),
+                this, SLOT(showNotification(Notify::NotifyType,QString)));
     #else
         connect(translationWidget, SIGNAL(search(QString)),
                 this, SLOT(searchExact(QString)));
     #endif
 
-
 }
 
 void MainWindow::connectDictManager() {
index bb3f5ac..6a780f8 100644 (file)
@@ -76,11 +76,10 @@ void NotifyManager::showNotification(Notify::NotifyType type, QString text) {
         QMaemo5InformationBox* mbox =
                 new QMaemo5InformationBox(parent);
 
-        QLabel* infoLabel = new QLabel(text, mbox);
+        QLabel* infoLabel = new QLabel(text);
         infoLabel->setAlignment(Qt::AlignCenter);
         infoLabel->setWordWrap(true);
 
-        infoLabel->setMargin(10);
 
         mbox->setWidget(infoLabel);
 
@@ -118,6 +117,7 @@ void NotifyManager::showNotification(Notify::NotifyType type, QString text) {
     case Notify::Error:
         #ifdef Q_WS_MAEMO_5
             mbox->setTimeout(QMaemo5InformationBox::NoTimeout);
+            ((QLabel*)mbox->widget())->setContentsMargins(5,15,5,15);
         #else
             mbox->setText(text);
             mbox->setWindowTitle(tr("Error"));
index a7bf713..729a906 100644 (file)
@@ -245,12 +245,10 @@ void TranslationWidget::initializeUI() {
         copyButton = new QToolButton(this);
         copyButton->setIcon(QIcon::fromTheme("general_notes"));
         copyButton->setMinimumSize(copyButton->sizeHint());
-        copyButton->setEnabled(false);
 
         searchButton = new QToolButton(this);
         searchButton->setIcon(QIcon::fromTheme("general_search"));
         searchButton->setMinimumSize(searchButton->sizeHint());
-        searchButton->setEnabled(false);
 
         showButtonsButton = new QToolButton(this);
         showButtonsButton->setIcon(QIcon::fromTheme("general_sent"));
@@ -267,13 +265,7 @@ void TranslationWidget::initializeUI() {
                 this, SLOT(searchSelected()));
 
         connect(copyButton, SIGNAL(clicked()),
-                webkit, SLOT(copy()));
-
-        connect(webkit, SIGNAL(copyAvailable(bool)),
-                searchButton, SLOT(setEnabled(bool)));
-
-        connect(webkit, SIGNAL(copyAvailable(bool)),
-                copyButton, SLOT(setEnabled(bool)));
+                this, SLOT(copySelected()));
 
         connect(selectAllButton, SIGNAL(clicked()),
                 webkit, SLOT(selectAll()));
@@ -287,10 +279,24 @@ void TranslationWidget::initializeUI() {
 }
 
 void TranslationWidget::searchSelected() {
-    #ifdef Q_WS_MAEMO_5
-        hide();
-    #endif
-    Q_EMIT search(webkit->selectedText().toLower());
+    if(webkit->selectedText().isEmpty()) {
+        Q_EMIT notify(Notify::Warning, tr("No text is selected"));
+    }
+    else {
+        #ifdef Q_WS_MAEMO_5
+            hide();
+        #endif
+        Q_EMIT search(webkit->selectedText().toLower());
+    }
+}
+
+void TranslationWidget::copySelected() {
+    if(webkit->selectedText().isEmpty()) {
+        Q_EMIT notify(Notify::Warning, tr("No text is selected"));
+    }
+    else {
+        Q_EMIT notify(Notify::Info, tr("Copyied selected text"));
+    }
 }
 
 #ifdef Q_WS_MAEMO_5
index 5907f97..9954fcd 100644 (file)
@@ -45,6 +45,7 @@ public:
 
 Q_SIGNALS:
     void search(QString);
+    void notify(Notify::NotifyType, QString);
 
 public Q_SLOTS:
     //! Show widget.
@@ -64,6 +65,7 @@ protected:
 
 private Q_SLOTS:
     void searchSelected();
+    void copySelected();
     #ifdef Q_WS_MAEMO_5
         void showButtons();
     #endif