summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/assistant/lib/qhelpgenerator.cpp94
-rw-r--r--tools/assistant/tools/assistant/centralwidget.cpp3
-rw-r--r--tools/assistant/tools/assistant/mainwindow.cpp4
-rw-r--r--tools/linguist/linguist/messageeditor.cpp2
-rw-r--r--tools/linguist/shared/numerus.cpp5
5 files changed, 59 insertions, 49 deletions
diff --git a/tools/assistant/lib/qhelpgenerator.cpp b/tools/assistant/lib/qhelpgenerator.cpp
index 03df3cc..8512adb 100644
--- a/tools/assistant/lib/qhelpgenerator.cpp
+++ b/tools/assistant/lib/qhelpgenerator.cpp
@@ -467,8 +467,9 @@ bool QHelpGenerator::insertFiles(const QStringList &files, const QString &rootPa
emit statusChanged(tr("Insert files..."));
QList<int> filterAtts;
- foreach (QString filterAtt, filterAttributes) {
- d->query->prepare(QLatin1String("SELECT Id FROM FilterAttributeTable WHERE Name=?"));
+ foreach (const QString &filterAtt, filterAttributes) {
+ d->query->prepare(QLatin1String("SELECT Id FROM FilterAttributeTable "
+ "WHERE Name=?"));
d->query->bindValue(0, filterAtt);
d->query->exec();
if (d->query->next())
@@ -482,76 +483,76 @@ bool QHelpGenerator::insertFiles(const QStringList &files, const QString &rootPa
if (filterSetId < 0)
return false;
++filterSetId;
- foreach (int attId, filterAtts) {
- d->query->prepare(QLatin1String("INSERT INTO FileAttributeSetTable VALUES(?, ?)"));
+ foreach (const int &attId, filterAtts) {
+ d->query->prepare(QLatin1String("INSERT INTO FileAttributeSetTable "
+ "VALUES(?, ?)"));
d->query->bindValue(0, filterSetId);
d->query->bindValue(1, attId);
d->query->exec();
}
- QString title;
- QString charSet;
- QMap<int, QSet<int> > tmpFileFilterMap;
- QList<FileNameTableData> fileNameDataList;
- QList<QByteArray> fileDataList;
-
int tableFileId = 1;
d->query->exec(QLatin1String("SELECT MAX(Id) FROM FileDataTable"));
if (d->query->next())
tableFileId = d->query->value(0).toInt() + 1;
+ QString title;
+ QString charSet;
FileNameTableData fileNameData;
+ QList<QByteArray> fileDataList;
+ QMap<int, QSet<int> > tmpFileFilterMap;
+ QList<FileNameTableData> fileNameDataList;
int i = 0;
- foreach (QString file, files) {
- QFileInfo fi(rootPath + QDir::separator() + file);
+ foreach (const QString &file, files) {
+ const QString fileName = QDir::cleanPath(file);
+ if (fileName.startsWith(QLatin1String("../"))) {
+ emit warning(tr("The referenced file %1 must be inside or within a "
+ "subdirectory of (%2). Skipping it.").arg(fileName).arg(rootPath));
+ continue;
+ }
+
+ QFile fi(rootPath + QDir::separator() + fileName);
if (!fi.exists()) {
emit warning(tr("The file %1 does not exist! Skipping it.")
- .arg(fi.absoluteFilePath()));
+ .arg(QDir::cleanPath(rootPath + QDir::separator() + fileName)));
continue;
}
- QFile f(fi.absoluteFilePath());
- if (!f.open(QIODevice::ReadOnly)) {
+ if (!fi.open(QIODevice::ReadOnly)) {
emit warning(tr("Cannot open file %1! Skipping it.")
- .arg(fi.absoluteFilePath()));
+ .arg(QDir::cleanPath(rootPath + QDir::separator() + fileName)));
continue;
}
- title.clear();
- QByteArray data;
- data = f.readAll();
-
- if (fi.suffix() == QLatin1String("html") || fi.suffix() == QLatin1String("htm")) {
- charSet = QHelpGlobal::charsetFromData(data);
- QTextStream stream(&data);
- stream.setCodec(QTextCodec::codecForName(charSet.toLatin1().constData()));
- title = QHelpGlobal::documentTitle(stream.readAll());
+ QByteArray data = fi.readAll();
+ if (fileName.endsWith(QLatin1String(".html"))
+ || fileName.endsWith(QLatin1String(".htm"))) {
+ charSet = QHelpGlobal::charsetFromData(data);
+ QTextStream stream(&data);
+ stream.setCodec(QTextCodec::codecForName(charSet.toLatin1().constData()));
+ title = QHelpGlobal::documentTitle(stream.readAll());
} else {
title = fi.fileName();
}
- QString fName = QDir::cleanPath(file);
- if (fName.startsWith(QLatin1String("./")))
- fName = fName.mid(2);
-
int fileId = -1;
- if (!d->fileMap.contains(fName)) {
+ if (!d->fileMap.contains(fileName)) {
fileDataList.append(qCompress(data));
- fileNameData.name = fName;
+ fileNameData.name = fileName;
fileNameData.fileId = tableFileId;
fileNameData.title = title;
fileNameDataList.append(fileNameData);
- d->fileMap.insert(fName, tableFileId);
+ d->fileMap.insert(fileName, tableFileId);
d->fileFilterMap.insert(tableFileId, filterAtts.toSet());
tmpFileFilterMap.insert(tableFileId, filterAtts.toSet());
++tableFileId;
} else {
- fileId = d->fileMap.value(fName);
- foreach (int filter, filterAtts) {
+ fileId = d->fileMap.value(fileName);
+ foreach (const int &filter, filterAtts) {
if (!d->fileFilterMap.value(fileId).contains(filter)
&& !tmpFileFilterMap.value(fileId).contains(filter)) {
d->fileFilterMap[fileId].insert(filter);
@@ -565,20 +566,22 @@ bool QHelpGenerator::insertFiles(const QStringList &files, const QString &rootPa
d->query->exec(QLatin1String("BEGIN"));
QMap<int, QSet<int> >::const_iterator it = tmpFileFilterMap.constBegin();
while (it != tmpFileFilterMap.constEnd()) {
- QSet<int>::const_iterator i = it.value().constBegin();
- while (i != it.value().constEnd()) {
- d->query->prepare(QLatin1String("INSERT INTO FileFilterTable VALUES(?, ?)"));
- d->query->bindValue(0, *i);
+ QSet<int>::const_iterator si = it.value().constBegin();
+ while (si != it.value().constEnd()) {
+ d->query->prepare(QLatin1String("INSERT INTO FileFilterTable "
+ "VALUES(?, ?)"));
+ d->query->bindValue(0, *si);
d->query->bindValue(1, it.key());
d->query->exec();
- ++i;
+ ++si;
}
++it;
}
QList<QByteArray>::const_iterator fileIt = fileDataList.constBegin();
while (fileIt != fileDataList.constEnd()) {
- d->query->prepare(QLatin1String("INSERT INTO FileDataTable VALUES (Null, ?)"));
+ d->query->prepare(QLatin1String("INSERT INTO FileDataTable VALUES "
+ "(Null, ?)"));
d->query->bindValue(0, *fileIt);
d->query->exec();
++fileIt;
@@ -586,10 +589,11 @@ bool QHelpGenerator::insertFiles(const QStringList &files, const QString &rootPa
addProgress(d->fileStep*20.0);
}
- QList<FileNameTableData>::const_iterator fileNameIt = fileNameDataList.constBegin();
+ QList<FileNameTableData>::const_iterator fileNameIt =
+ fileNameDataList.constBegin();
while (fileNameIt != fileNameDataList.constEnd()) {
- d->query->prepare(QLatin1String("INSERT INTO FileNameTable (FolderId, Name, FileId, Title) "
- " VALUES (?, ?, ?, ?)"));
+ d->query->prepare(QLatin1String("INSERT INTO FileNameTable "
+ "(FolderId, Name, FileId, Title) VALUES (?, ?, ?, ?)"));
d->query->bindValue(0, 1);
d->query->bindValue(1, (*fileNameIt).name);
d->query->bindValue(2, (*fileNameIt).fileId);
@@ -609,8 +613,8 @@ bool QHelpGenerator::insertFiles(const QStringList &files, const QString &rootPa
return false;
}
-bool QHelpGenerator::registerCustomFilter(const QString &filterName, const QStringList &filterAttribs,
- bool forceUpdate)
+bool QHelpGenerator::registerCustomFilter(const QString &filterName,
+ const QStringList &filterAttribs, bool forceUpdate)
{
if (!d->query)
return false;
diff --git a/tools/assistant/tools/assistant/centralwidget.cpp b/tools/assistant/tools/assistant/centralwidget.cpp
index 52d48d5..95e458c 100644
--- a/tools/assistant/tools/assistant/centralwidget.cpp
+++ b/tools/assistant/tools/assistant/centralwidget.cpp
@@ -780,6 +780,9 @@ void CentralWidget::showTabBarContextMenu(const QPoint &point)
menu.addSeparator();
QAction *newBookmark = menu.addAction(tr("Add Bookmark for this Page..."));
+ const QString &url = viewer->source().toString();
+ if (url.isEmpty() || url == QLatin1String("about:blank"))
+ newBookmark->setEnabled(false);
QAction *pickedAction = menu.exec(tabBar->mapToGlobal(point));
if (pickedAction == newPage)
diff --git a/tools/assistant/tools/assistant/mainwindow.cpp b/tools/assistant/tools/assistant/mainwindow.cpp
index 582eef3..4fc0c78 100644
--- a/tools/assistant/tools/assistant/mainwindow.cpp
+++ b/tools/assistant/tools/assistant/mainwindow.cpp
@@ -468,7 +468,7 @@ void MainWindow::setupActions()
menu = menuBar()->addMenu(tr("&Go"));
m_homeAction = menu->addAction(tr("&Home"), m_centralWidget, SLOT(home()));
- m_homeAction->setShortcut(tr("Ctrl+Home"));
+ m_homeAction->setShortcut(tr("ALT+Home"));
m_homeAction->setIcon(QIcon(resourcePath + QLatin1String("/home.png")));
m_backAction = menu->addAction(tr("&Back"), m_centralWidget, SLOT(backward()));
@@ -748,7 +748,7 @@ void MainWindow::copyAvailable(bool yes)
void MainWindow::addNewBookmark(const QString &title, const QString &url)
{
- if (url.isEmpty())
+ if (url.isEmpty() || url == QLatin1String("about:blank"))
return;
m_bookmarkManager->showBookmarkDialog(this, title, url);
diff --git a/tools/linguist/linguist/messageeditor.cpp b/tools/linguist/linguist/messageeditor.cpp
index 53cbbea..c1d5fb37 100644
--- a/tools/linguist/linguist/messageeditor.cpp
+++ b/tools/linguist/linguist/messageeditor.cpp
@@ -502,6 +502,8 @@ bool MessageEditor::eventFilter(QObject *o, QEvent *e)
m_pluralSource->getEditor()->copy();
return true;
}
+ } else if (ke->key() == Qt::Key_A) {
+ return true;
}
}
} else if (e->type() == QEvent::KeyPress) {
diff --git a/tools/linguist/shared/numerus.cpp b/tools/linguist/shared/numerus.cpp
index 50e85cb..c0960da 100644
--- a/tools/linguist/shared/numerus.cpp
+++ b/tools/linguist/shared/numerus.cpp
@@ -101,7 +101,7 @@ static const uchar arabicRules[] =
Q_EQ, 1, Q_NEWRULE,
Q_EQ, 2, Q_NEWRULE,
Q_MOD_100 | Q_BETWEEN, 3, 10, Q_NEWRULE,
- Q_MOD_100 | Q_NEQ, 0 };
+ Q_MOD_100 | Q_NOT | Q_BETWEEN, 0, 2 };
static const uchar tagalogRules[] =
{ Q_LEQ, 1, Q_NEWRULE,
Q_MOD_10 | Q_EQ, 4, Q_OR, Q_MOD_10 | Q_EQ, 6, Q_OR, Q_MOD_10 | Q_EQ, 9 };
@@ -127,7 +127,7 @@ static const char * const malteseForms[] =
static const char * const welshForms[] =
{ "Nullar", "Singular", "Dual", "Sexal", "Plural", 0 };
static const char * const arabicForms[] =
- { "Nullar", "Singular", "Dual", "Minority Plural", "Plural", "Plural Form for 100, 200, ...", 0 };
+ { "Nullar", "Singular", "Dual", "Minority Plural", "Plural", "Plural (100-102, ...)", 0 };
static const char * const tagalogForms[] =
{ "Singular", "Plural (consonant-ended)", "Plural (vowel-ended)", 0 };
static const char * const catalanForms[] = { "Singular", "Undecal (11)", "Plural", 0 };
@@ -246,6 +246,7 @@ static const QLocale::Language englishStyleLanguages[] = {
QLocale::Turkmen,
QLocale::Twi,
QLocale::Uigur,
+ QLocale::Urdu,
QLocale::Uzbek,
QLocale::Volapuk,
QLocale::Wolof,