1
mirror of https://invent.kde.org/network/falkon.git synced 2024-11-11 01:22:10 +01:00

Coding style: Use empty QString() constructor instead of "" everywhere

This commit is contained in:
nowrep 2012-09-02 11:42:41 +02:00
parent 0437ae171f
commit b2181f0bab
39 changed files with 75 additions and 113 deletions

View File

@ -75,7 +75,7 @@ void EcWin7::setOverlayIcon(QString iconName, QString description)
if (mOverlayIcon != NULL) {
oldIcon = mOverlayIcon;
}
if (iconName == "") {
if (iconName.isEmpty()) {
mTaskbar->SetOverlayIcon(mWindowId, NULL, NULL);
mOverlayIcon = NULL;
}

View File

@ -295,7 +295,7 @@ bool QtSingleApplication::sendMessage(const QString &message, int timeout)
*/
QString QtSingleApplication::id() const
{
return (peer ? peer->applicationId() : "");
return (peer ? peer->applicationId() : QString());
}

View File

@ -481,8 +481,8 @@ void AdBlockRule::parseFilter()
if (parsedLine.contains('*') || parsedLine.contains('^') || parsedLine.contains('|')) {
parsedLine.replace(QRegExp(QLatin1String("\\*+")), QLatin1String("*")) // remove multiple wildcards
.replace(QRegExp(QLatin1String("\\^\\|$")), QLatin1String("^")) // remove anchors following separator placeholder
.replace(QRegExp(QLatin1String("^(\\*)")), QLatin1String("")) // remove leading wildcards
.replace(QRegExp(QLatin1String("(\\*)$")), QLatin1String(""))
.replace(QRegExp(QLatin1String("^(\\*)")), QString()) // remove leading wildcards
.replace(QRegExp(QLatin1String("(\\*)$")), QString())
.replace(QRegExp(QLatin1String("(\\W)")), QLatin1String("\\\\1")) // escape special symbols
.replace(QRegExp(QLatin1String("^\\\\\\|\\\\\\|")),
QLatin1String("^[\\w\\-]+:\\/+(?!\\/)(?:[^\\/]+\\.)?")) // process extended anchor at expression start

View File

@ -372,7 +372,7 @@ void MainApplication::loadSettings()
#endif
setWheelScrollLines(settings.value("wheelScrollLines", wheelScrollLines()).toInt());
m_websettings->setUserStyleSheetUrl(userStyleSheet(settings.value("userStyleSheet", "").toString()));
m_websettings->setUserStyleSheetUrl(userStyleSheet(settings.value("userStyleSheet", QString()).toString()));
settings.endGroup();
settings.beginGroup("Browser-Fonts");
@ -803,7 +803,7 @@ void MainApplication::reloadUserStyleSheet()
{
Settings settings;
settings.beginGroup("Web-Browser-Settings");
m_websettings->setUserStyleSheetUrl(userStyleSheet(settings.value("userStyleSheet", "").toString()));
m_websettings->setUserStyleSheetUrl(userStyleSheet(settings.value("userStyleSheet", QString()).toString()));
settings.endGroup();
}

View File

@ -145,7 +145,7 @@ void QupZilla::postLaunch()
switch (afterLaunch) {
case 0:
startUrl = QUrl("");
startUrl = QUrl();
break;
case 2:

View File

@ -117,7 +117,7 @@ public slots:
void bookmarkPage();
void loadAddress(const QUrl &url);
void showSource(QWebFrame* frame = 0, const QString &selectedHtml = "");
void showSource(QWebFrame* frame = 0, const QString &selectedHtml = QString());
void printPage(QWebFrame* frame = 0);
void showPageInfo();
void receiveMessage(Qz::AppMessageType mes, bool state);

View File

@ -238,7 +238,7 @@ void AutoFillModel::completePage(WebPage* page)
for (int i = 0; i < inputs.count(); i++) {
QWebElement element = inputs.at(i);
if (element.attribute("type") != "text" && element.attribute("type") != "password" && element.attribute("type") != "") {
if (element.attribute("type") != "text" && element.attribute("type") != "password" && !element.attribute("type").isEmpty()) {
continue;
}

View File

@ -16,9 +16,6 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string notr="true">Form</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="spacing">
<number>3</number>

View File

@ -181,7 +181,7 @@ void BookmarksManager::itemChanged(QTreeWidgetItem* item)
int id = item->data(0, Qt::UserRole + 10).toInt();
ui->bookmarksTree->deleteItem(item);
m_bookmarksModel->editBookmark(id, name, url, "");
m_bookmarksModel->editBookmark(id, name, url, QString());
}
void BookmarksManager::itemControlClicked(QTreeWidgetItem* item)

View File

@ -85,7 +85,7 @@ public:
void removeBookmark(int id);
void removeBookmark(const QList<int> list);
bool editBookmark(int id, const QString &title = "", const QUrl &url = QUrl(), const QString &folder = "");
bool editBookmark(int id, const QString &title = QString(), const QUrl &url = QUrl(), const QString &folder = QString());
bool changeIcon(int id, const QIcon &icon);
bool createFolder(const QString &name);

View File

@ -10,9 +10,6 @@
<height>74</height>
</rect>
</property>
<property name="windowTitle">
<string notr="true"/>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="margin">
<number>0</number>

View File

@ -115,7 +115,7 @@ void DesktopNotificationsFactory::nativeNotificationPreview()
args.append(m_uint);
args.append(tmp.fileName());
args.append(QObject::tr("Native System Notification"));
args.append("");
args.append(QString());
args.append(QStringList());
args.append(QVariantMap());
args.append(m_timeout);

View File

@ -10,9 +10,6 @@
<height>73</height>
</rect>
</property>
<property name="windowTitle">
<string notr="true"/>
</property>
<layout class="QGridLayout" name="gridLayout">
<property name="topMargin">
<number>2</number>
@ -73,9 +70,6 @@
<property name="textVisible">
<bool>false</bool>
</property>
<property name="format">
<string notr="true"/>
</property>
</widget>
</item>
<item>

View File

@ -67,14 +67,14 @@ void DownloadManager::loadSettings()
{
Settings settings;
settings.beginGroup("DownloadManager");
m_downloadPath = settings.value("defaultDownloadPath", "").toString();
m_downloadPath = settings.value("defaultDownloadPath", QString()).toString();
m_lastDownloadPath = settings.value("lastDownloadPath", QDir::homePath().append("/")).toString();
m_closeOnFinish = settings.value("CloseManagerOnFinish", false).toBool();
m_useNativeDialog = settings.value("useNativeDialog", DEFAULT_DOWNLOAD_USE_NATIVE_DIALOG).toBool();
m_useExternalManager = settings.value("UseExternalManager", false).toBool();
m_externalExecutable = settings.value("ExternalManagerExecutable", "").toString();
m_externalArguments = settings.value("ExternalManagerArguments", "").toString();
m_externalExecutable = settings.value("ExternalManagerExecutable", QString()).toString();
m_externalArguments = settings.value("ExternalManagerArguments", QString()).toString();
settings.endGroup();
}

View File

@ -112,9 +112,11 @@ void LocationCompleterDelegate::paint(QPainter* painter, const QStyleOptionViewI
drawHighlightedTextLine(linkRect, link, searchText, painter, style, opt, colorLinkRole);
// Draw line at the very bottom of item
QRect lineRect(opt.rect.left(), opt.rect.bottom(), opt.rect.width(), 1);
painter->fillRect(lineRect, opt.palette.color(QPalette::AlternateBase));
// Draw line at the very bottom of item if the item is not highlighted
if (!(opt.state & QStyle::State_Selected)) {
QRect lineRect(opt.rect.left(), opt.rect.bottom(), opt.rect.width(), 1);
painter->fillRect(lineRect, opt.palette.color(QPalette::AlternateBase));
}
}
bool sizeBiggerThan(const QString &s1, const QString &s2)

View File

@ -33,15 +33,15 @@ void NetworkProxyFactory::loadSettings()
m_proxyType = QNetworkProxy::ProxyType(settings.value("ProxyType", QNetworkProxy::HttpProxy).toInt());
m_useDifferentProxyForHttps = settings.value("UseDifferentProxyForHttps", false).toBool();
m_hostName = settings.value("HostName", "").toString();
m_hostName = settings.value("HostName", QString()).toString();
m_port = settings.value("Port", 8080).toInt();
m_username = settings.value("Username", "").toString();
m_password = settings.value("Password", "").toString();
m_username = settings.value("Username", QString()).toString();
m_password = settings.value("Password", QString()).toString();
m_httpsHostName = settings.value("HttpsHostName", "").toString();
m_httpsHostName = settings.value("HttpsHostName", QString()).toString();
m_httpsPort = settings.value("HttpsPort", 8080).toInt();
m_httpsUsername = settings.value("HttpsUsername", "").toString();
m_httpsPassword = settings.value("HttpsPassword", "").toString();
m_httpsUsername = settings.value("HttpsUsername", QString()).toString();
m_httpsPassword = settings.value("HttpsPassword", QString()).toString();
m_proxyExceptions = settings.value("ProxyExceptions", QStringList() << "localhost" << "127.0.0.1").toStringList();
settings.endGroup();

View File

@ -188,7 +188,7 @@ QString FileSchemeReply::loadDirectory()
line += "\">";
line += info.fileName();
line += "</a></td><td class=\"td-size\">";
line += info.isDir() ? "" : qz_fileSizeToString(info.size());
line += info.isDir() ? QString() : qz_fileSizeToString(info.size());
line += "</td><td>";
line += info.lastModified().toString("dd.MM.yyyy");
line += "</td><td>";

View File

@ -176,7 +176,7 @@ QString QupZillaSchemeReply::startPage()
sPage.replace("%SEARCH-BY%", tr("Search results provided by DuckDuckGo"));
sPage.replace("%WWW%", QupZilla::WIKIADDRESS);
sPage.replace("%ABOUT-QUPZILLA%", tr("About QupZilla"));
sPage.replace("%PRIVATE-BROWSING%", mApp->isPrivateSession() ? tr("<h1>Private Browsing</h1>") : "");
sPage.replace("%PRIVATE-BROWSING%", mApp->isPrivateSession() ? tr("<h1>Private Browsing</h1>") : QString());
sPage = qz_applyDirectionToPage(sPage);
return sPage;

View File

@ -264,7 +264,7 @@ void SearchEnginesManager::addEngine(OpenSearchEngine* engine)
en.name = engine->name();
en.url = engine->searchUrl("searchstring").toString().replace("searchstring", "%s");
if (engine->image().isNull()) {
en.icon = iconForSearchEngine(engine->searchUrl(""));
en.icon = iconForSearchEngine(engine->searchUrl(QString()));
}
else {
en.icon = QIcon(QPixmap::fromImage(engine->image()));

View File

@ -138,7 +138,7 @@ void StatusBarMessage::showMessage(const QString &message)
void StatusBarMessage::clearMessage()
{
if (p_QupZilla->statusBar()->isVisible()) {
p_QupZilla->statusBar()->showMessage("");
p_QupZilla->statusBar()->showMessage(QString());
}
else {
m_statusBarText->hideDelayed();

View File

@ -45,8 +45,8 @@ void SpeedDial::loadSettings()
Settings settings;
settings.beginGroup("SpeedDial");
QString allPages = settings.value("pages", "").toString();
m_backgroundImage = settings.value("background", "").toString();
QString allPages = settings.value("pages", QString()).toString();
m_backgroundImage = settings.value("background", QString()).toString();
m_backgroundImageSize = settings.value("backsize", "auto").toString();
m_maxPagesInRow = settings.value("pagesrow", 4).toInt();
m_sizeOfSpeedDials = settings.value("sdsize", 231).toInt();
@ -217,7 +217,7 @@ QString SpeedDial::initialScript()
imgSource = "qrc:html/loading.gif";
if (page.url.isEmpty()) {
imgSource = "";
imgSource.clear();
}
}
else {

View File

@ -77,7 +77,7 @@ void PopupStatusBarMessage::showMessage(const QString &message)
void PopupStatusBarMessage::clearMessage()
{
if (m_popupWindow->statusBar()->isVisible()) {
m_popupWindow->statusBar()->showMessage("");
m_popupWindow->statusBar()->showMessage(QString());
}
else {
m_statusBarText->hideDelayed();

View File

@ -10,9 +10,6 @@
<height>348</height>
</rect>
</property>
<property name="windowTitle">
<string notr="true"/>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QTabWidget" name="tabWidget">

View File

@ -10,9 +10,6 @@
<height>462</height>
</rect>
</property>
<property name="windowTitle">
<string notr="true"/>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="margin">
<number>0</number>

View File

@ -10,9 +10,6 @@
<height>36</height>
</rect>
</property>
<property name="windowTitle">
<string notr="true"/>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="topMargin">
<number>2</number>

View File

@ -10,9 +10,6 @@
<height>70</height>
</rect>
</property>
<property name="windowTitle">
<string notr="true"/>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="margin">
<number>0</number>

View File

@ -41,7 +41,7 @@ SideBar::SideBar(SideBarManager* manager, QupZilla* mainClass)
m_layout->setSpacing(0);
setLayout(m_layout);
m_titleBar = new DockTitleBarWidget("", this);
m_titleBar = new DockTitleBarWidget(QString(), this);
m_layout->addWidget(m_titleBar);
}

View File

@ -279,8 +279,8 @@ QString CertificateInfoWidget::clearCertSpecialSymbols(const QString &string)
n.replace("\\xC2\\xBD", "1/2"); // one half
n.replace("\\xC2\\xBE", "3/4"); // three quarters
n.replace("\\xCA\\xBF", "\\x27"); // c-single quote
n.replace("\\xCC\\xA8", ""); // modifier - under curve
n.replace("\\xCC\\xB1", ""); // modifier - under line
n.replace("\\xCC\\xA8", QChar()); // modifier - under curve
n.replace("\\xCC\\xB1", QChar()); // modifier - under line
return n;
}

View File

@ -27,11 +27,7 @@
<number>0</number>
</property>
<item>
<widget class="QLabel" name="label">
<property name="text">
<string notr="true"/>
</property>
</widget>
<widget class="QLabel" name="label"/>
</item>
<item>
<widget class="QToolButton" name="closeButton">

View File

@ -10,9 +10,6 @@
<height>374</height>
</rect>
</property>
<property name="windowTitle">
<string notr="true"/>
</property>
<layout class="QGridLayout" name="gridLayout">
<property name="spacing">
<number>0</number>

View File

@ -10,9 +10,6 @@
<height>344</height>
</rect>
</property>
<property name="windowTitle">
<string notr="true"/>
</property>
<layout class="QGridLayout" name="gridLayout">
<property name="spacing">
<number>0</number>

View File

@ -10,9 +10,6 @@
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string notr="true"/>
</property>
<layout class="QGridLayout" name="gridLayout">
<property name="spacing">
<number>0</number>

View File

@ -16,9 +16,6 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string notr="true"/>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="margin">
<number>0</number>

View File

@ -218,11 +218,11 @@ void TabbedWebView::linkHovered(const QString &link, const QString &title, const
Q_UNUSED(content)
if (isCurrent()) {
if (link != "") {
p_QupZilla->statusBarMessage()->showMessage(link);
if (link.isEmpty()) {
p_QupZilla->statusBarMessage()->clearMessage();
}
else {
p_QupZilla->statusBarMessage()->clearMessage();
p_QupZilla->statusBarMessage()->showMessage(link);
}
}
}

View File

@ -303,10 +303,10 @@ int TabWidget::addView(QNetworkRequest req, const QString &title, const Qz::NewT
int index;
if (position == -1) {
index = addTab(new WebTab(p_QupZilla, locBar), "");
index = addTab(new WebTab(p_QupZilla, locBar), QString());
}
else {
index = insertTab(position, new WebTab(p_QupZilla, locBar), "");
index = insertTab(position, new WebTab(p_QupZilla, locBar), QString());
}
TabbedWebView* webView = weTab(index)->view();
@ -505,7 +505,7 @@ void TabWidget::setTabText(int index, const QString &text)
if (WebTab* webTab = weTab(index)) {
if (webTab->isPinned()) {
newtext = "";
newtext.clear();
}
}

View File

@ -307,7 +307,7 @@ void WebTab::pinTab(int index)
m_pinned = true;
tabWidget->setCurrentIndex(0); // <<-- those 2 lines fixes
tabWidget->getTabBar()->moveTab(index, 0); // | weird behavior with bad
tabWidget->setTabText(0, ""); // | tabwidget update if we
tabWidget->setTabText(0, QString()); // | tabwidget update if we
tabWidget->setCurrentIndex(0); // <<-- are moving current tab
tabWidget->getTabBar()->updateCloseButton(0);
}

View File

@ -821,7 +821,7 @@ void WebView::createLinkContextMenu(QMenu* menu, const QWebHitTestResult &hitTes
{
// Workaround for QtWebKit <= 2.0 when selecting link text on right click
if (page()->selectedText() == hitTest.linkText()) {
findText("");
findText(QString());
}
menu->addSeparator();
@ -882,7 +882,7 @@ void WebView::createSelectedTextContextMenu(QMenu* menu, const QWebHitTestResult
connect(gtwact, SIGNAL(middleClicked()), this, SLOT(openUrlInBackgroundTab()));
menu->addAction(gtwact);
Action* dictact = new Action(QIcon::fromTheme("accessories-dictionary"), tr("Dictionary"));
dictact->setData(QUrl("http://" + (langCode != "" ? langCode + "." : langCode) + "wiktionary.org/wiki/Special:Search?search=" + selectedText));
dictact->setData(QUrl("http://" + (!langCode.isEmpty() ? langCode + "." : langCode) + "wiktionary.org/wiki/Special:Search?search=" + selectedText));
connect(dictact, SIGNAL(triggered()), this, SLOT(openUrlInSelectedTab()));
connect(dictact, SIGNAL(middleClicked()), this, SLOT(openUrlInBackgroundTab()));
menu->addAction(dictact);

View File

@ -41,20 +41,20 @@ void PIM_Handler::loadSettings()
QSettings settings(m_settingsFile, QSettings::IniFormat);
settings.beginGroup("PIM");
m_allInfo[PI_LastName] = settings.value("LastName", "").toString();
m_allInfo[PI_FirstName] = settings.value("FirstName", "").toString();
m_allInfo[PI_Email] = settings.value("Email", "").toString();
m_allInfo[PI_Mobile] = settings.value("Mobile", "").toString();
m_allInfo[PI_Phone] = settings.value("Phone", "").toString();
m_allInfo[PI_Address] = settings.value("Address", "").toString();
m_allInfo[PI_City] = settings.value("City", "").toString();
m_allInfo[PI_Zip] = settings.value("Zip", "").toString();
m_allInfo[PI_State] = settings.value("State", "").toString();
m_allInfo[PI_Country] = settings.value("Country", "").toString();
m_allInfo[PI_HomePage] = settings.value("HomePage", "").toString();
m_allInfo[PI_Special1] = settings.value("Special1", "").toString();
m_allInfo[PI_Special2] = settings.value("Special2", "").toString();
m_allInfo[PI_Special3] = settings.value("Special3", "").toString();
m_allInfo[PI_LastName] = settings.value("LastName", QString()).toString();
m_allInfo[PI_FirstName] = settings.value("FirstName", QString()).toString();
m_allInfo[PI_Email] = settings.value("Email", QString()).toString();
m_allInfo[PI_Mobile] = settings.value("Mobile", QString()).toString();
m_allInfo[PI_Phone] = settings.value("Phone", QString()).toString();
m_allInfo[PI_Address] = settings.value("Address", QString()).toString();
m_allInfo[PI_City] = settings.value("City", QString()).toString();
m_allInfo[PI_Zip] = settings.value("Zip", QString()).toString();
m_allInfo[PI_State] = settings.value("State", QString()).toString();
m_allInfo[PI_Country] = settings.value("Country", QString()).toString();
m_allInfo[PI_HomePage] = settings.value("HomePage", QString()).toString();
m_allInfo[PI_Special1] = settings.value("Special1", QString()).toString();
m_allInfo[PI_Special2] = settings.value("Special2", QString()).toString();
m_allInfo[PI_Special3] = settings.value("Special3", QString()).toString();
settings.endGroup();
m_translations[PI_LastName] = tr("Last Name");

View File

@ -33,20 +33,20 @@ PIM_Settings::PIM_Settings(const QString &settingsFile, QWidget* parent)
QSettings settings(m_settingsFile, QSettings::IniFormat);
settings.beginGroup("PIM");
ui->pim_firstname->setText(settings.value("FirstName", "").toString());
ui->pim_lastname->setText(settings.value("LastName", "").toString());
ui->pim_email->setText(settings.value("Email", "").toString());
ui->pim_phone->setText(settings.value("Phone", "").toString());
ui->pim_mobile->setText(settings.value("Mobile", "").toString());
ui->pim_address->setText(settings.value("Address", "").toString());
ui->pim_city->setText(settings.value("City", "").toString());
ui->pim_zip->setText(settings.value("Zip", "").toString());
ui->pim_state->setText(settings.value("State", "").toString());
ui->pim_country->setText(settings.value("Country", "").toString());
ui->pim_homepage->setText(settings.value("HomePage", "").toString());
ui->pim_special1->setText(settings.value("Special1", "").toString());
ui->pim_special2->setText(settings.value("Special2", "").toString());
ui->pim_special3->setText(settings.value("Special3", "").toString());
ui->pim_firstname->setText(settings.value("FirstName", QString()).toString());
ui->pim_lastname->setText(settings.value("LastName", QString()).toString());
ui->pim_email->setText(settings.value("Email", QString()).toString());
ui->pim_phone->setText(settings.value("Phone", QString()).toString());
ui->pim_mobile->setText(settings.value("Mobile", QString()).toString());
ui->pim_address->setText(settings.value("Address", QString()).toString());
ui->pim_city->setText(settings.value("City", QString()).toString());
ui->pim_zip->setText(settings.value("Zip", QString()).toString());
ui->pim_state->setText(settings.value("State", QString()).toString());
ui->pim_country->setText(settings.value("Country", QString()).toString());
ui->pim_homepage->setText(settings.value("HomePage", QString()).toString());
ui->pim_special1->setText(settings.value("Special1", QString()).toString());
ui->pim_special2->setText(settings.value("Special2", QString()).toString());
ui->pim_special3->setText(settings.value("Special3", QString()).toString());
settings.endGroup();
connect(this, SIGNAL(accepted()), this, SLOT(dialogAccepted()));