projects
/
mdictionary
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
846d5db
)
Fixed bookmarks removing bug
author
Mateusz Półrola
<mateusz.polrola@comarch.pl>
Wed, 15 Sep 2010 07:42:39 +0000
(09:42 +0200)
committer
Mateusz Półrola
<mateusz.polrola@comarch.pl>
Wed, 15 Sep 2010 07:42:39 +0000
(09:42 +0200)
17 files changed:
src/include/translation.h
patch
|
blob
|
history
src/mdictionary/backbone/BookmarkTranslations.h
patch
|
blob
|
history
src/mdictionary/backbone/backbone.cpp
patch
|
blob
|
history
src/mdictionary/gui/AboutWidget.cpp
patch
|
blob
|
history
src/mdictionary/gui/BookmarksWidget.cpp
patch
|
blob
|
history
src/mdictionary/gui/DictManagerWidget.cpp
patch
|
blob
|
history
src/mdictionary/gui/MainWindow.cpp
patch
|
blob
|
history
src/mdictionary/gui/SettingsWidget.cpp
patch
|
blob
|
history
src/mdictionary/gui/WordListWidget.cpp
patch
|
blob
|
history
src/mdictionary/gui/WordListWidget.h
patch
|
blob
|
history
src/mdictionary/gui/main.cpp
patch
|
blob
|
history
src/plugins/google/GoogleDialog.cpp
patch
|
blob
|
history
src/plugins/google/TranslationGoogle.h
patch
|
blob
|
history
src/plugins/xdxf/TranslationXdxf.h
patch
|
blob
|
history
src/plugins/xdxf/XdxfCachingDialog.cpp
patch
|
blob
|
history
src/plugins/xdxf/XdxfCachingDialog.h
patch
|
blob
|
history
src/plugins/xdxf/XdxfDialog.cpp
patch
|
blob
|
history
diff --git
a/src/include/translation.h
b/src/include/translation.h
index
9bfcf3f
..
bc24bac
100644
(file)
--- a/
src/include/translation.h
+++ b/
src/include/translation.h
@@
-55,7
+55,7
@@
class Translation {
virtual QString toHtml() const = 0;
//! \return whether given translation is taken from bookmarks
virtual QString toHtml() const = 0;
//! \return whether given translation is taken from bookmarks
- virtual bool isBookmark() const {
+ virtual int isBookmark() const {
return _bookmark;
}
return _bookmark;
}
@@
-69,7
+69,7
@@
class Translation {
protected:
//! indicates whether this translation is in bookmark
protected:
//! indicates whether this translation is in bookmark
- bool _bookmark;
+ int _bookmark;
};
};
diff --git
a/src/mdictionary/backbone/BookmarkTranslations.h
b/src/mdictionary/backbone/BookmarkTranslations.h
index
61cb55e
..
3b31871
100644
(file)
--- a/
src/mdictionary/backbone/BookmarkTranslations.h
+++ b/
src/mdictionary/backbone/BookmarkTranslations.h
@@
-42,7
+42,7
@@
public:
_key = key;
_dictionaryInfo = dbName;
_bookmarks = bookmarks;
_key = key;
_dictionaryInfo = dbName;
_bookmarks = bookmarks;
- _bookmark = 1;
+ _bookmark = 2;
}
//! \return word to be translated
}
//! \return word to be translated
diff --git
a/src/mdictionary/backbone/backbone.cpp
b/src/mdictionary/backbone/backbone.cpp
index
9fd0297
..
0223c68
100644
(file)
--- a/
src/mdictionary/backbone/backbone.cpp
+++ b/
src/mdictionary/backbone/backbone.cpp
@@
-138,6
+138,7
@@
Backbone::~Backbone()
while(it2.hasNext())
delete it2.next().value();
while(it2.hasNext())
delete it2.next().value();
+ delete _history;
}
}
diff --git
a/src/mdictionary/gui/AboutWidget.cpp
b/src/mdictionary/gui/AboutWidget.cpp
index
fe421eb
..
f287932
100644
(file)
--- a/
src/mdictionary/gui/AboutWidget.cpp
+++ b/
src/mdictionary/gui/AboutWidget.cpp
@@
-26,6
+26,7
@@
AboutWidget::AboutWidget(GUIInterface *parent): QDialog(parent)
{
AboutWidget::AboutWidget(GUIInterface *parent): QDialog(parent)
{
+ setModal(true);
QString infoNote, licenseNote, comarchNote;
infoNote = "<center><h2><u>mDictionary</u></h2></center>";
comarchNote = "<center>Maemo/Meego Multilingual Dictionary</center>";
QString infoNote, licenseNote, comarchNote;
infoNote = "<center><h2><u>mDictionary</u></h2></center>";
comarchNote = "<center>Maemo/Meego Multilingual Dictionary</center>";
diff --git
a/src/mdictionary/gui/BookmarksWidget.cpp
b/src/mdictionary/gui/BookmarksWidget.cpp
index
24ad0f0
..
58ede20
100644
(file)
--- a/
src/mdictionary/gui/BookmarksWidget.cpp
+++ b/
src/mdictionary/gui/BookmarksWidget.cpp
@@
-29,6
+29,8
@@
BookmarksWidget::BookmarksWidget(GUIInterface *parent) :
{
setWindowTitle(tr("Bookmarks"));
{
setWindowTitle(tr("Bookmarks"));
+ setModal(true);
+
verticalLayout = new QVBoxLayout(this);
setLayout(verticalLayout);
verticalLayout = new QVBoxLayout(this);
setLayout(verticalLayout);
diff --git
a/src/mdictionary/gui/DictManagerWidget.cpp
b/src/mdictionary/gui/DictManagerWidget.cpp
index
6727484
..
4ea996c
100644
(file)
--- a/
src/mdictionary/gui/DictManagerWidget.cpp
+++ b/
src/mdictionary/gui/DictManagerWidget.cpp
@@
-35,6
+35,8
@@
DictManagerWidget::DictManagerWidget(GUIInterface *parent) :
this->guiInterface = parent;
initalizeUI();
this->guiInterface = parent;
initalizeUI();
+
+ setModal(true);
}
void DictManagerWidget::initalizeUI() {
}
void DictManagerWidget::initalizeUI() {
@@
-90,6
+92,11
@@
void DictManagerWidget::initalizeUI() {
setMinimumSize(500,300);
closeButton = new QPushButton(tr("Save"));
buttonGroup->addWidget(closeButton);
setMinimumSize(500,300);
closeButton = new QPushButton(tr("Save"));
buttonGroup->addWidget(closeButton);
+
+ setMinimumWidth(sizeHint().width()*1.2);
+ setMaximumWidth(sizeHint().width()*2);
+ setMinimumHeight(sizeHint().height());
+ setMaximumHeight(sizeHint().height()*2);
connect(closeButton, SIGNAL(clicked()), this, SLOT(save()));
#endif
}
connect(closeButton, SIGNAL(clicked()), this, SLOT(save()));
#endif
}
diff --git
a/src/mdictionary/gui/MainWindow.cpp
b/src/mdictionary/gui/MainWindow.cpp
index
e66482d
..
67c733d
100644
(file)
--- a/
src/mdictionary/gui/MainWindow.cpp
+++ b/
src/mdictionary/gui/MainWindow.cpp
@@
-47,13
+47,14
@@
MainWindow::MainWindow(Backbone *backbone, QWidget *parent):
setExactSearch(false);
setExactSearch(false);
+ setMinimumSize(750, 400);
+
showMaximized();
searchBarWidget->setFocus();
}
MainWindow::~MainWindow() {
showMaximized();
searchBarWidget->setFocus();
}
MainWindow::~MainWindow() {
-
}
}
@@
-111,8
+112,8
@@
void MainWindow::initializeSearchWidgets() {
splitter->addWidget(welcomeScreenWidget);
splitter->setStretchFactor(1, 150);
splitter->addWidget(welcomeScreenWidget);
splitter->setStretchFactor(1, 150);
- mainLayout->addWidget(splitter);
- mainLayout->addWidget(searchBarWidget);
+ mainLayout->addWidget(splitter, 1);
+ mainLayout->addWidget(searchBarWidget, 0, Qt::AlignBottom);
#endif
}
#endif
}
@@
-451,6
+452,9
@@
void MainWindow::connectBackbone() {
connect(backbone, SIGNAL(notify(Notify::NotifyType,QString)),
this, SLOT(showNotification(Notify::NotifyType,QString)));
connect(backbone, SIGNAL(notify(Notify::NotifyType,QString)),
this, SLOT(showNotification(Notify::NotifyType,QString)));
+
+ connect(backbone, SIGNAL(closeOk()),
+ this, SLOT(close()));
}
void MainWindow::connectSearchBar() {
}
void MainWindow::connectSearchBar() {
diff --git
a/src/mdictionary/gui/SettingsWidget.cpp
b/src/mdictionary/gui/SettingsWidget.cpp
index
6a66817
..
7b7173e
100644
(file)
--- a/
src/mdictionary/gui/SettingsWidget.cpp
+++ b/
src/mdictionary/gui/SettingsWidget.cpp
@@
-26,13
+26,15
@@
#include <QDebug>
SettingsWidget::SettingsWidget(GUIInterface *parent) :
#include <QDebug>
SettingsWidget::SettingsWidget(GUIInterface *parent) :
- QDialog(parent)
+ QDialog(parent)
{
guiInterface = parent;
setWindowTitle(tr("Settings"));
initalizeUI();
{
guiInterface = parent;
setWindowTitle(tr("Settings"));
initalizeUI();
+
+ setModal(true);
}
void SettingsWidget::initalizeUI() {
}
void SettingsWidget::initalizeUI() {
@@
-139,6
+141,9
@@
void SettingsWidget::initalizeUI() {
footerLayout->addStretch(0);
footerLayout->addWidget(closeButton);
verticalLayout->addLayout(footerLayout);
footerLayout->addStretch(0);
footerLayout->addWidget(closeButton);
verticalLayout->addLayout(footerLayout);
+
+ setMinimumHeight(sizeHint().height());
+ setMaximumHeight(sizeHint().height());
connect(closeButton, SIGNAL(clicked()), this, SLOT(save()));
#endif
}
connect(closeButton, SIGNAL(clicked()), this, SLOT(save()));
#endif
}
diff --git
a/src/mdictionary/gui/WordListWidget.cpp
b/src/mdictionary/gui/WordListWidget.cpp
index
e44a839
..
40b30d1
100644
(file)
--- a/
src/mdictionary/gui/WordListWidget.cpp
+++ b/
src/mdictionary/gui/WordListWidget.cpp
@@
-26,6
+26,7
@@
#include "WordListWidget.h"
#include "WordListProxyStyle.h"
#include "../../include/translation.h"
#include "WordListWidget.h"
#include "WordListProxyStyle.h"
#include "../../include/translation.h"
+#include <QKeyEvent>
WordListWidget::WordListWidget(QWidget *parent):
WordListWidget::WordListWidget(QWidget *parent):
@@
-107,6
+108,8
@@
void WordListWidget::showSearchResults(
model->sort(0);
resizeColumns();
model->sort(0);
resizeColumns();
+
+ setFocus();
}
void WordListWidget::wordClicked(QModelIndex index) {
}
void WordListWidget::wordClicked(QModelIndex index) {
@@
-136,6
+139,20
@@
void WordListWidget::wordChecked(QModelIndex index) {
}
else {
Q_EMIT removeBookmark(searchResult[item.data().toString()]);
}
else {
Q_EMIT removeBookmark(searchResult[item.data().toString()]);
+
+ Translation* t;
+ bool onlyBookmarks = true;
+ foreach(t, searchResult[item.data().toString()]) {
+ if(t->isBookmark() == 1) {
+ onlyBookmarks = false;
+ t->setBookmark(0);
+ }
+ }
+
+ if(onlyBookmarks) {
+ searchResult.remove(item.data().toString());
+ model->removeRow(item.row());
+ }
}
}
}
}
@@
-177,6
+194,16
@@
void WordListWidget::resizeColumns() {
setColumnWidth(1, checkBoxWidth);
}
setColumnWidth(1, checkBoxWidth);
}
+void WordListWidget::keyPressEvent(QKeyEvent *event) {
+ QTreeView::keyPressEvent(event);
+
+ if(event->key() == Qt::Key_Return || event->key() == Qt::Key_Enter) {
+ if(selectedIndexes().count() == 0) return;
+
+ wordClicked(selectedIndexes().at(0));
+ }
+}
+
void WordListWidget::lockList() {
setEnabled(false);
}
void WordListWidget::lockList() {
setEnabled(false);
}
diff --git
a/src/mdictionary/gui/WordListWidget.h
b/src/mdictionary/gui/WordListWidget.h
index
7b26e51
..
8a0b17c
100644
(file)
--- a/
src/mdictionary/gui/WordListWidget.h
+++ b/
src/mdictionary/gui/WordListWidget.h
@@
-82,7
+82,8
@@
protected:
//! side next to scroll bar
void resizeEvent(QResizeEvent *event);
//! side next to scroll bar
void resizeEvent(QResizeEvent *event);
-
+ //! Checks if user press return and if so displays translation of selected word
+ void keyPressEvent( QKeyEvent * event);
private Q_SLOTS:
//! Emits signal to show translation of clicked item. Signal is emitted
private Q_SLOTS:
//! Emits signal to show translation of clicked item. Signal is emitted
diff --git
a/src/mdictionary/gui/main.cpp
b/src/mdictionary/gui/main.cpp
index
69be667
..
ab77e42
100644
(file)
--- a/
src/mdictionary/gui/main.cpp
+++ b/
src/mdictionary/gui/main.cpp
@@
-87,23
+87,30
@@
int main(int argc, char *argv[]) {
retranslate();
retranslate();
- Backbone backbone;
- MainWindow w(&backbone);
+ Backbone* backbone = new Backbone();
+ MainWindow* mainWindow = new MainWindow(backbone);
- DBusAdapter* adapter = new DBusAdapter(&w);
+ DBusAdapter* adapter = new DBusAdapter(mainWindow);
QDBusConnection::sessionBus().registerObject("/mainWindow",
QDBusConnection::sessionBus().registerObject("/mainWindow",
- &w);
+ mainWindow);
QDBusConnection::sessionBus().registerService("com.comarch.mdictionary");
QDBusConnection::sessionBus().registerService("com.comarch.mdictionary");
-
- w.show();
-
+ mainWindow->show();
if(search.count() > 0) {
if(search.count() > 0) {
- w.setExactSearch(true);
- w.searchExact(search[0]);
+ mainWindow->setExactSearch(true);
+ mainWindow->searchExact(search[0]);
}
}
- return a.exec();
+ int res = a.exec();
+
+ QDBusConnection::sessionBus().unregisterObject("/mainWindow");
+ QDBusConnection::sessionBus().unregisterService("com.comarch.mdictionary");
+
+ delete adapter;
+ delete mainWindow;
+ delete backbone;
+
+ return res;
}
}
diff --git
a/src/plugins/google/GoogleDialog.cpp
b/src/plugins/google/GoogleDialog.cpp
index
a7b83ff
..
9b00ee6
100644
(file)
--- a/
src/plugins/google/GoogleDialog.cpp
+++ b/
src/plugins/google/GoogleDialog.cpp
@@
-144,6
+144,9
@@
void GoogleDialog::initializeUI() {
verticalLayout->addWidget(confirmButton);
setModal(true);
verticalLayout->addWidget(confirmButton);
setModal(true);
+
+ setMinimumSize(sizeHint());
+ setMaximumSize(sizeHint());
}
void GoogleDialog::langFromChanged(int index) {
}
void GoogleDialog::langFromChanged(int index) {
diff --git
a/src/plugins/google/TranslationGoogle.h
b/src/plugins/google/TranslationGoogle.h
index
b54a73d
..
51bbe04
100644
(file)
--- a/
src/plugins/google/TranslationGoogle.h
+++ b/
src/plugins/google/TranslationGoogle.h
@@
-53,7
+53,7
@@
public:
void setDictionaryInfo(QString);
//! \return whether given translation is taken from bookmarks
void setDictionaryInfo(QString);
//! \return whether given translation is taken from bookmarks
- bool isBookmark() const {
+ int isBookmark() const {
return _bookmark;
}
return _bookmark;
}
diff --git
a/src/plugins/xdxf/TranslationXdxf.h
b/src/plugins/xdxf/TranslationXdxf.h
index
1dd4a65
..
42d504a
100644
(file)
--- a/
src/plugins/xdxf/TranslationXdxf.h
+++ b/
src/plugins/xdxf/TranslationXdxf.h
@@
-49,7
+49,7
@@
public:
void setDictionaryInfo(QString);
//! \return whether given translation is taken from bookmarks
void setDictionaryInfo(QString);
//! \return whether given translation is taken from bookmarks
- bool isBookmark() const {
+ int isBookmark() const {
return _bookmark;
}
return _bookmark;
}
diff --git
a/src/plugins/xdxf/XdxfCachingDialog.cpp
b/src/plugins/xdxf/XdxfCachingDialog.cpp
index
29a8d18
..
d26e1b5
100644
(file)
--- a/
src/plugins/xdxf/XdxfCachingDialog.cpp
+++ b/
src/plugins/xdxf/XdxfCachingDialog.cpp
@@
-41,11
+41,17
@@
XdxfCachingDialog::XdxfCachingDialog(QWidget *parent): QDialog(parent) {
cancelButton = new QPushButton(tr("Cancel"),this);
cancelButton = new QPushButton(tr("Cancel"),this);
- cachingLabel = new QLabel(this);
- cachingLabel->hide();
+ cachingTimeLabel = new QLabel(this);
+ cachingTimeLabel->hide();
+ #ifndef Q_WS_MAEMO_5
+ cachingLabel = new QLabel(this);
+ cachingLabel->setText(tr("Caching dictionary, please wait"));
+ verticalLayout->addWidget(cachingLabel, 0, Qt::AlignCenter);
+ #endif
- verticalLayout->addWidget(cachingLabel);
+
+ verticalLayout->addWidget(cachingTimeLabel);
verticalLayout->addWidget(cachingProgressBar);
verticalLayout->addWidget(cancelButton);
verticalLayout->addWidget(cachingProgressBar);
verticalLayout->addWidget(cancelButton);
@@
-65,12
+71,12
@@
void XdxfCachingDialog::reject() {
void XdxfCachingDialog::updateCachingProgress(int progress, int time) {
cachingProgressBar->setValue(progress);
void XdxfCachingDialog::updateCachingProgress(int progress, int time) {
cachingProgressBar->setValue(progress);
- if(!cachingLabel->isVisible())
- cachingLabel->show();
+ if(!cachingTimeLabel->isVisible())
+ cachingTimeLabel->show();
int seconds = float((100 - progress)*time) / (5*1000);
int seconds = float((100 - progress)*time) / (5*1000);
- cachingLabel->setText(tr("Estimated time left: ") +
+ cachingTimeLabel->setText(tr("Estimated time left: ") +
tr("%n second(s)", "", seconds));
if(progress >= 100)
this->accept();
tr("%n second(s)", "", seconds));
if(progress >= 100)
this->accept();
diff --git
a/src/plugins/xdxf/XdxfCachingDialog.h
b/src/plugins/xdxf/XdxfCachingDialog.h
index
5632bd9
..
1e42a0b
100644
(file)
--- a/
src/plugins/xdxf/XdxfCachingDialog.h
+++ b/
src/plugins/xdxf/XdxfCachingDialog.h
@@
-55,6
+55,7
@@
private Q_SLOTS:
private:
QLabel* cachingLabel;
private:
QLabel* cachingLabel;
+ QLabel* cachingTimeLabel;
QProgressBar* cachingProgressBar;
QPushButton* cancelButton;
QVBoxLayout* verticalLayout;
QProgressBar* cachingProgressBar;
QPushButton* cancelButton;
QVBoxLayout* verticalLayout;
diff --git
a/src/plugins/xdxf/XdxfDialog.cpp
b/src/plugins/xdxf/XdxfDialog.cpp
index
90fc21e
..
cbacdd5
100644
(file)
--- a/
src/plugins/xdxf/XdxfDialog.cpp
+++ b/
src/plugins/xdxf/XdxfDialog.cpp
@@
-175,7
+175,10
@@
void XdxfDialog::initializeUI() {
scrollArea->setLineWidth(0);
scrollArea->setMidLineWidth(0);
scrollArea->setLineWidth(0);
scrollArea->setMidLineWidth(0);
- scrollArea->setFrameStyle(QFrame::NoFrame);;
+ scrollArea->setFrameStyle(QFrame::NoFrame);
+
+ setMinimumSize(sizeHint().width()*1.2, sizeHint().height());
+ setMaximumSize(sizeHint().width()*2, sizeHint().height()*2);
}
}