Mercurial > projects > qtd
changeset 80:85c59c4e5f19
remove QLatin1String and other fixes
author | mandel |
---|---|
date | Sun, 24 May 2009 15:25:41 +0000 |
parents | 957f549cfc65 |
children | 1750a803af74 |
files | demos/browser/bookmarks.d demos/browser/browserapplication.d demos/browser/browsermainwindow.d demos/browser/cookiejar.d demos/browser/downloadmanager.d demos/browser/history.d demos/browser/networkaccessmanager.d demos/browser/searchlineedit.d demos/browser/settings.d demos/browser/tabwidget.d demos/browser/toolbarsearch.d demos/browser/urllineedit.d demos/browser/webview.d demos/browser/xbel.d |
diffstat | 14 files changed, 223 insertions(+), 223 deletions(-) [+] |
line wrap: on
line diff
--- a/demos/browser/bookmarks.d Sun May 24 14:05:40 2009 +0000 +++ b/demos/browser/bookmarks.d Sun May 24 15:25:41 2009 +0000 @@ -203,7 +203,7 @@ XbelReader reader; BookmarkNode importRootNode = reader.read(fileName); if (reader.error() != QXmlStreamReader.NoError) { - QMessageBox.warning(0, QLatin1String("Loading Bookmark"), + QMessageBox.warning(0, "Loading Bookmark", tr("Error when loading bookmarks on line %1, column %2:\n" "%3").arg(reader.lineNumber()).arg(reader.columnNumber()).arg(reader.errorString())); } @@ -236,7 +236,7 @@ XbelWriter writer; string dir = QDesktopServices.storageLocation(QDesktopServices.DataLocation); - string bookmarkFile = dir + QLatin1String("/bookmarks.xbel"); + string bookmarkFile = dir ~ "/bookmarks.xbel"; if (!writer.write(bookmarkFile, m_bookmarkRootNode)) qWarning() << "BookmarkManager: error saving to" << bookmarkFile; } @@ -250,14 +250,14 @@ m_loaded = true; string dir = QDesktopServices.storageLocation(QDesktopServices.DataLocation); - string bookmarkFile = dir ~ QLatin1String("/bookmarks.xbel"); + string bookmarkFile = dir ~ "/bookmarks.xbel"; if (!QFile.exists(bookmarkFile)) - bookmarkFile = QLatin1String(":defaultbookmarks.xbel"); + bookmarkFile = ":defaultbookmarks.xbel"; XbelReader reader; m_bookmarkRootNode = reader.read(bookmarkFile); if (reader.error() != QXmlStreamReader.NoError) { - QMessageBox.warning(0, QLatin1String("Loading Bookmark"), + QMessageBox.warning(0, "Loading Bookmark", tr("Error when loading bookmarks on line %1, column %2:\n" "%3").arg(reader.lineNumber()).arg(reader.columnNumber()).arg(reader.errorString())); } @@ -676,7 +676,7 @@ return mimeData; } - const string MIMETYPE = QLatin1String("application/bookmarks.xbel"); + const string MIMETYPE = "application/bookmarks.xbel"; string[] mimeTypes() { @@ -697,7 +697,7 @@ return false; QUndoStack undoStack = m_bookmarksManager.undoRedoStack(); - undoStack.beginMacro(QLatin1String("Move Bookmarks")); + undoStack.beginMacro("Move Bookmarks"); while (!stream.atEnd()) { QByteArray encodedData; @@ -705,7 +705,7 @@ QBuffer buffer = new QBuffer(&encodedData); buffer.open(QBuffer.ReadOnly); - XbelReader reader; + auto reader = new XbelReader; BookmarkNode rootNode = reader.read(&buffer); BookmarkNode[] children = rootNode.children(); for (int i = 0; i < children.count(); ++i) {
--- a/demos/browser/browserapplication.d Sun May 24 14:05:40 2009 +0000 +++ b/demos/browser/browserapplication.d Sun May 24 15:25:41 2009 +0000 @@ -84,15 +84,15 @@ { super(args); m_localServer = null; - QCoreApplication.setOrganizationName(QLatin1String("Trolltech")); - QCoreApplication.setApplicationName(QLatin1String("demobrowser")); - QCoreApplication.setApplicationVersion(QLatin1String("0.1")); + QCoreApplication.setOrganizationName("Trolltech"); + QCoreApplication.setApplicationName("demobrowser"); + QCoreApplication.setApplicationVersion("0.1"); version(Q_WS_QWS) { // Use a different server name for QWS so we can run an X11 // browser and a QWS browser in parallel on the same machine for // debugging - string serverName = QCoreApplication.applicationName() + QLatin1String("_qws"); + string serverName = QCoreApplication.applicationName() ~ "_qws"; } else { string serverName = QCoreApplication.applicationName(); } @@ -133,14 +133,14 @@ } } - QDesktopServices.setUrlHandler(QLatin1String("http"), this, "openUrl"); + QDesktopServices.setUrlHandler("http", this, "openUrl"); string localSysName = QLocale.system().name(); - installTranslator(QLatin1String("qt_") + localSysName); + installTranslator("qt_" ~ localSysName); QSettings settings; - settings.beginGroup(QLatin1String("sessions")); - m_lastSession = settings.value(QLatin1String("lastSession")).toByteArray(); + settings.beginGroup("sessions"); + m_lastSession = settings.value("lastSession").toByteArray(); settings.endGroup(); version(Q_WS_MAC) { @@ -169,27 +169,27 @@ void loadSettings() { QSettings settings; - settings.beginGroup(QLatin1String("websettings")); + settings.beginGroup("websettings"); QWebSettings defaultSettings = QWebSettings.globalSettings(); string standardFontFamily = defaultSettings.fontFamily(QWebSettings.StandardFont); int standardFontSize = defaultSettings.fontSize(QWebSettings.DefaultFontSize); QFont standardFont = QFont(standardFontFamily, standardFontSize); - standardFont = qVariantValue!(QFont)(settings.value(QLatin1String("standardFont"), standardFont)); + standardFont = qVariantValue!(QFont)(settings.value("standardFont", standardFont)); defaultSettings.setFontFamily(QWebSettings.StandardFont, standardFont.family()); defaultSettings.setFontSize(QWebSettings.DefaultFontSize, standardFont.pointSize()); string fixedFontFamily = defaultSettings.fontFamily(QWebSettings.FixedFont); int fixedFontSize = defaultSettings.fontSize(QWebSettings.DefaultFixedFontSize); QFont fixedFont = QFont(fixedFontFamily, fixedFontSize); - fixedFont = qVariantValue!(QFont)(settings.value(QLatin1String("fixedFont"), fixedFont)); + fixedFont = qVariantValue!(QFont)(settings.value("fixedFont", fixedFont)); defaultSettings.setFontFamily(QWebSettings.FixedFont, fixedFont.family()); defaultSettings.setFontSize(QWebSettings.DefaultFixedFontSize, fixedFont.pointSize()); - defaultSettings.setAttribute(QWebSettings.JavascriptEnabled, settings.value(QLatin1String("enableJavascript"), true).toBool()); - defaultSettings.setAttribute(QWebSettings.PluginsEnabled, settings.value(QLatin1String("enablePlugins"), true).toBool()); + defaultSettings.setAttribute(QWebSettings.JavascriptEnabled, settings.value("enableJavascript", true).toBool()); + defaultSettings.setAttribute(QWebSettings.PluginsEnabled, settings.value("enablePlugins", true).toBool()); - QUrl url = settings.value(QLatin1String("userStyleSheet")).toUrl(); + QUrl url = settings.value("userStyleSheet").toUrl(); defaultSettings.setUserStyleSheetUrl(url); settings.endGroup(); @@ -223,7 +223,7 @@ if (!icon.isNull()) return icon.pixmap(16, 16); if (m_defaultIcon.isNull()) - m_defaultIcon = QIcon(QLatin1String(":defaulticon.png")); + m_defaultIcon = QIcon(":defaulticon.png"); return m_defaultIcon.pixmap(16, 16); } @@ -236,7 +236,7 @@ clean(); QSettings settings; - settings.beginGroup(QLatin1String("sessions")); + settings.beginGroup("sessions"); QByteArray data; auto buffer = new QBuffer(&data); @@ -246,7 +246,7 @@ stream << m_mainWindows.length; for (int i = 0; i < m_mainWindows.length; ++i) stream << m_mainWindows[i].saveState(); - settings.setValue(QLatin1String("lastSession"), data); + settings.setValue("lastSession", data); settings.endGroup(); } @@ -403,10 +403,10 @@ { string directory = QDesktopServices.storageLocation(QDesktopServices.DataLocation); if (directory.isEmpty()) - directory = QDir.homePath() ~ QLatin1String("/.") ~ QCoreApplication.applicationName(); + directory = QDir.homePath() ~ "/." ~ QCoreApplication.applicationName(); QWebSettings.setIconDatabasePath(directory); - setWindowIcon(QIcon(QLatin1String(":browser.svg"))); + setWindowIcon(new QIcon(":browser.svg")); loadSettings(); @@ -437,8 +437,8 @@ stream >> url; if (!url.isEmpty()) { QSettings settings; - settings.beginGroup(QLatin1String("general")); - int openLinksIn = settings.value(QLatin1String("openLinksIn"), 0).toInt(); + settings.beginGroup("general"); + int openLinksIn = settings.value("openLinksIn", 0).toInt(); settings.endGroup(); if (openLinksIn == 1) newMainWindow();
--- a/demos/browser/browsermainwindow.d Sun May 24 14:05:40 2009 +0000 +++ b/demos/browser/browsermainwindow.d Sun May 24 15:25:41 2009 +0000 @@ -168,7 +168,7 @@ static QUrl guessUrlFromString(string string) { string urlStr = string.trimmed(); - auto test = new QRegExp(QLatin1String("^[a-zA-Z]+\\:.*")); + auto test = new QRegExp("^[a-zA-Z]+\\:.*"); // Check if it looks like a qualified URL. Try parsing it and see. bool hasSchema = test.exactMatch(urlStr); @@ -189,7 +189,7 @@ int dotIndex = urlStr.indexOf(QLatin1Char('.')); if (dotIndex != -1) { string prefix = urlStr.left(dotIndex).toLower(); - QByteArray schema = (prefix == QLatin1String("ftp")) ? prefix.toLatin1() : "http"; + QByteArray schema = (prefix == "ftp") ? prefix.toLatin1() : "http"; QUrl url = QUrl.fromEncoded(schema + "://" + urlStr.toUtf8(), QUrl.TolerantMode); if (url.isValid()) @@ -292,8 +292,8 @@ void slotHome() { QSettings settings; - settings.beginGroup(QLatin1String("MainWindow")); - string home = settings.value(QLatin1String("home"), QLatin1String("http://qtsoftware.com/")).toString(); + settings.beginGroup("MainWindow"); + string home = settings.value("home", "http://qtsoftware.com/").toString(); loadPage(home); } @@ -323,9 +323,9 @@ BrowserApplication.instance().saveSession(); QSettings settings; - settings.beginGroup(QLatin1String("BrowserMainWindow")); + settings.beginGroup("BrowserMainWindow"); QByteArray data = saveState(false); - settings.setValue(QLatin1String("defaultState"), data); + settings.setValue("defaultState", data); settings.endGroup(); } @@ -754,8 +754,8 @@ void loadDefaultState() { QSettings settings; - settings.beginGroup(QLatin1String("BrowserMainWindow")); - QByteArray data = settings.value(QLatin1String("defaultState")).toByteArray(); + settings.beginGroup("BrowserMainWindow"); + QByteArray data = settings.value("defaultState").toByteArray(); restoreState(data); settings.endGroup(); } @@ -920,7 +920,7 @@ QAction showAllBookmarksAction = new QAction(tr("Show All Bookmarks"), this); showAllBookmarksAction.triggered().connect(&this.slotShowBookmarksDialog); - m_addBookmark = new QAction(QIcon(QLatin1String(":addbookmark.png")), tr("Add Bookmark..."), this); + m_addBookmark = new QAction(new QIcon(":addbookmark.png"), tr("Add Bookmark..."), this); m_addBookmark.setIconVisibleInMenu(false); m_addBookmark.triggered().connect(&this.slotAddBookmark);
--- a/demos/browser/cookiejar.d Sun May 24 14:05:40 2009 +0000 +++ b/demos/browser/cookiejar.d Sun May 24 15:25:41 2009 +0000 @@ -69,7 +69,7 @@ static const uint JAR_VERSION = 23; -QDataStream operator<<(QDataStream stream, QNetworkCookie[] list) +QDataStream opShl(QDataStream stream, QNetworkCookie[] list) { stream << JAR_VERSION; stream << cast(uint) list.length; @@ -78,14 +78,14 @@ return stream; } -QDataStream operator>>(QDataStream stream, ref QNetworkCookie[] list) +QDataStream opShr(QDataStream stream, ref QNetworkCookie[] list) { list.clear(); uint version_; stream >> version_; - if (version != JAR_VERSION) + if (version_ != JAR_VERSION) return stream; uint count; @@ -303,15 +303,15 @@ void loadSettings() { QSettings settings; - settings.beginGroup(QLatin1String("cookies")); - QByteArray value = settings.value(QLatin1String("acceptCookies"), - QLatin1String("AcceptOnlyFromSitesNavigatedTo")).toByteArray(); + settings.beginGroup("cookies"); + QByteArray value = settings.value("acceptCookies", + "AcceptOnlyFromSitesNavigatedTo").toByteArray(); QMetaEnum acceptPolicyEnum = staticMetaObject.enumerator(staticMetaObject.indexOfEnumerator("AcceptPolicy")); m_acceptCookies = acceptPolicyEnum.keyToValue(value) == -1 ? AcceptOnlyFromSitesNavigatedTo : cast(AcceptPolicy) acceptPolicyEnum.keyToValue(value); - value = settings.value(QLatin1String("keepCookiesUntil"), QLatin1String("KeepUntilExpire")).toByteArray(); + value = settings.value("keepCookiesUntil", "KeepUntilExpire").toByteArray(); QMetaEnum keepPolicyEnum = staticMetaObject.enumerator(staticMetaObject.indexOfEnumerator("KeepPolicy")); m_keepCookies = keepPolicyEnum.keyToValue(value) == -1 ? KeepUntilExpire : @@ -333,31 +333,31 @@ purgeOldCookies(); string directory = QDesktopServices.storageLocation(QDesktopServices.DataLocation); if (directory.isEmpty()) - directory = QDir.homePath() + QLatin1String("/.") + QCoreApplication.applicationName(); + directory = QDir.homePath() ~ "/." ~ QCoreApplication.applicationName(); if (!QFile.exists(directory)) { QDir dir; dir.mkpath(directory); } - auto cookieSettings = new QSettings(directory + QLatin1String("/cookies.ini"), QSettings.IniFormat); + auto cookieSettings = new QSettings(directory ~ "/cookies.ini", QSettings.IniFormat); QNetworkCookie[] cookies = allCookies(); for (int i = cookies.count() - 1; i >= 0; --i) { if (cookies[i].isSessionCookie()) cookies.removeAt(i); } - cookieSettings.setValue(QLatin1String("cookies"), qVariantFromValue<QNetworkCookie[] >(cookies)); - cookieSettings.beginGroup(QLatin1String("Exceptions")); - cookieSettings.setValue(QLatin1String("block"), m_exceptions_block); - cookieSettings.setValue(QLatin1String("allow"), m_exceptions_allow); - cookieSettings.setValue(QLatin1String("allowForSession"), m_exceptions_allowForSession); + cookieSettings.setValue("cookies", qVariantFromValue<QNetworkCookie[] >(cookies)); + cookieSettings.beginGroup("Exceptions"); + cookieSettings.setValue("block", m_exceptions_block); + cookieSettings.setValue("allow", m_exceptions_allow); + cookieSettings.setValue("allowForSession", m_exceptions_allowForSession); // save cookie settings QSettings settings; - settings.beginGroup(QLatin1String("cookies")); + settings.beginGroup("cookies"); QMetaEnum acceptPolicyEnum = staticMetaObject.enumerator(staticMetaObject.indexOfEnumerator("AcceptPolicy")); - settings.setValue(QLatin1String("acceptCookies"), QLatin1String(acceptPolicyEnum.valueToKey(m_acceptCookies))); + settings.setValue("acceptCookies", acceptPolicyEnum.valueToKey(m_acceptCookies)); QMetaEnum keepPolicyEnum = staticMetaObject.enumerator(staticMetaObject.indexOfEnumerator("KeepPolicy")); - settings.setValue(QLatin1String("keepCookiesUntil"), QLatin1String(keepPolicyEnum.valueToKey(m_keepCookies))); + settings.setValue("keepCookiesUntil", keepPolicyEnum.valueToKey(m_keepCookies)); } private: @@ -385,12 +385,12 @@ return; // load cookies and exceptions qRegisterMetaTypeStreamOperators!(QNetworkCookie[])("QNetworkCookie[]"); - auto cookieSettings = new QSettings(QDesktopServices.storageLocation(QDesktopServices.DataLocation) + QLatin1String("/cookies.ini"), QSettings.IniFormat); - setAllCookies(cast(QNetworkCookie[]) (cookieSettings.value(QLatin1String("cookies")))); - cookieSettings.beginGroup(QLatin1String("Exceptions")); - m_exceptions_block = cookieSettings.value(QLatin1String("block")).toStringList(); - m_exceptions_allow = cookieSettings.value(QLatin1String("allow")).toStringList(); - m_exceptions_allowForSession = cookieSettings.value(QLatin1String("allowForSession")).toStringList(); + auto cookieSettings = new QSettings(QDesktopServices.storageLocation(QDesktopServices.DataLocation) ~ "/cookies.ini", QSettings.IniFormat); + setAllCookies(cast(QNetworkCookie[]) (cookieSettings.value("cookies"))); + cookieSettings.beginGroup("Exceptions"); + m_exceptions_block = cookieSettings.value("block").toStringList(); + m_exceptions_allow = cookieSettings.value("allow").toStringList(); + m_exceptions_allowForSession = cookieSettings.value("allowForSession").toStringList(); qSort(m_exceptions_block.begin(), m_exceptions_block.end()); qSort(m_exceptions_allow.begin(), m_exceptions_allow.end()); qSort(m_exceptions_allowForSession.begin(), m_exceptions_allowForSession.end()); @@ -571,16 +571,16 @@ int header = cookiesTable.horizontalHeader().sectionSizeHint(i); switch (i) { case 0: - header = fm.width(QLatin1String("averagehost.domain.com")); + header = fm.width("averagehost.domain.com"); break; case 1: - header = fm.width(QLatin1String("_session_id")); + header = fm.width("_session_id"); break; case 4: header = fm.width(QDateTime.currentDateTime().toString(Qt.LocalDate)); break; } - int buffer = fm.width(QLatin1String("xx")); + int buffer = fm.width("xx"); header += buffer; cookiesTable.horizontalHeader().resizeSection(i, header); } @@ -767,13 +767,13 @@ int header = exceptionTable.horizontalHeader().sectionSizeHint(i); switch (i) { case 0: - header = fm.width(QLatin1String("averagebiglonghost.domain.com")); + header = fm.width("averagebiglonghost.domain.com"); break; case 1: - header = fm.width(QLatin1String("Allow For Session")); + header = fm.width("Allow For Session"); break; } - int buffer = fm.width(QLatin1String("xx")); + int buffer = fm.width("xx"); header += buffer; exceptionTable.horizontalHeader().resizeSection(i, header); }
--- a/demos/browser/downloadmanager.d Sun May 24 14:05:40 2009 +0000 +++ b/demos/browser/downloadmanager.d Sun May 24 15:25:41 2009 +0000 @@ -213,11 +213,11 @@ void getFileName() { auto settings = new QSettings; - settings.beginGroup(QLatin1String("downloadmanager")); + settings.beginGroup("downloadmanager"); string defaultLocation = QDesktopServices.storageLocation(QDesktopServices.DesktopLocation); - string downloadDirectory = settings.value(QLatin1String("downloadDirectory"), defaultLocation).toString(); + string downloadDirectory = settings.value("downloadDirectory", defaultLocation).toString(); if (!downloadDirectory.isEmpty()) - downloadDirectory += QLatin1Char('/'); + downloadDirectory ~= QLatin1Char('/'); string defaultFileName = saveFileName(downloadDirectory); string fileName = defaultFileName; @@ -319,7 +319,7 @@ size /= 1024*1024; unit = tr("MB"); } - return Format(QLatin1String("{} {}"), size, unit); + return Format("{} {}", size, unit); } string saveFileName(string directory) @@ -331,7 +331,7 @@ string endName = info.suffix(); if (baseName.isEmpty()) { - baseName = QLatin1String("unnamed_download"); + baseName = "unnamed_download"; qDebug() << "DownloadManager:: downloading unknown file:" << m_url; } string name = directory ~ baseName ~ QLatin1Char('.') ~ endName; @@ -466,26 +466,26 @@ void save() { QSettings settings; - settings.beginGroup(QLatin1String("downloadmanager")); + settings.beginGroup("downloadmanager"); QMetaEnum removePolicyEnum = staticMetaObject.enumerator(staticMetaObject.indexOfEnumerator("RemovePolicy")); - settings.setValue(QLatin1String("removeDownloadsPolicy"), QLatin1String(removePolicyEnum.valueToKey(m_removePolicy))); - settings.setValue(QLatin1String("size"), size()); + settings.setValue("removeDownloadsPolicy", removePolicyEnum.valueToKey(m_removePolicy)); + settings.setValue("size", size()); if (m_removePolicy == Exit) return; for (int i = 0; i < m_downloads.length; ++i) { - string key = Format(QLatin1String("download_{}_"), i); - settings.setValue(key ~ QLatin1String("url"), m_downloads[i].m_url); - settings.setValue(key ~ QLatin1String("location"), (new QFileInfo(m_downloads[i].m_output)).filePath()); - settings.setValue(key ~ QLatin1String("done"), m_downloads[i].downloadedSuccessfully()); + string key = Format("download_{}_", i); + settings.setValue(key ~ "url", m_downloads[i].m_url); + settings.setValue(key ~ "location", (new QFileInfo(m_downloads[i].m_output)).filePath()); + settings.setValue(key ~ "done", m_downloads[i].downloadedSuccessfully()); } int i = m_downloads.length; - string key = Format(QLatin1String("download_{}_"), i); - while (settings.contains(key ~ QLatin1String("url"))) { - settings.remove(key ~ QLatin1String("url")); - settings.remove(key ~ QLatin1String("location")); - settings.remove(key ~ QLatin1String("done")); - key = Format(QLatin1String("download_{}_"), ++i); + string key = Format("download_{}_", i); + while (settings.contains(key ~ "url")) { + settings.remove(key ~ "url"); + settings.remove(key ~ "location"); + settings.remove(key ~ "done"); + key = Format("download_{}_", ++i); } } @@ -545,21 +545,21 @@ void load() { QSettings settings; - settings.beginGroup(QLatin1String("downloadmanager")); - QSize size = settings.value(QLatin1String("size")).toSize(); + settings.beginGroup("downloadmanager"); + QSize size = settings.value("size").toSize(); if (size.isValid()) resize(size); - QByteArray value = settings.value(QLatin1String("removeDownloadsPolicy"), QLatin1String("Never")).toByteArray(); + QByteArray value = settings.value("removeDownloadsPolicy", "Never").toByteArray(); QMetaEnum removePolicyEnum = staticMetaObject.enumerator(staticMetaObject.indexOfEnumerator("RemovePolicy")); m_removePolicy = removePolicyEnum.keyToValue(value) == -1 ? Never : cast(RemovePolicy) removePolicyEnum.keyToValue(value); int i = 0; - string key = Format(QLatin1String("download_{}_"), i); - while (settings.contains(key + QLatin1String("url"))) { - QUrl url = settings.value(key + QLatin1String("url")).toUrl(); - string fileName = settings.value(key + QLatin1String("location")).toString(); - bool done = settings.value(key + QLatin1String("done"), true).toBool(); + string key = Format("download_{}_", i); + while (settings.contains(key ~ "url")) { + QUrl url = settings.value(key ~ "url").toUrl(); + string fileName = settings.value(key ~ "location").toString(); + bool done = settings.value(key ~ "done", true).toBool(); if (!url.isEmpty() && !fileName.isEmpty()) { DownloadItem item = new DownloadItem(0, this); item.m_output.setFileName(fileName); @@ -572,7 +572,7 @@ item.progressBar.setVisible(!done); addItem(item); } - key = Format(QLatin1String("download_{}_"), ++i); + key = Format("download_{}_", ++i); } cleanupButton.setEnabled(m_downloads.length - activeDownloads() > 0); }
--- a/demos/browser/history.d Sun May 24 14:05:40 2009 +0000 +++ b/demos/browser/history.d Sun May 24 15:25:41 2009 +0000 @@ -244,8 +244,8 @@ { // load settings QSettings settings; - settings.beginGroup(QLatin1String("history")); - m_historyLimit = settings.value(QLatin1String("historyLimit"), 30).toInt(); + settings.beginGroup("history"); + m_historyLimit = settings.value("historyLimit", 30).toInt(); } private: @@ -253,8 +253,8 @@ void save() { QSettings settings; - settings.beginGroup(QLatin1String("history")); - settings.setValue(QLatin1String("historyLimit"), m_historyLimit); + settings.beginGroup("history"); + settings.setValue("historyLimit", m_historyLimit); bool saveAll = m_lastSavedUrl.isEmpty(); int first = m_history.length - 1; @@ -273,13 +273,13 @@ string directory = QDesktopServices.storageLocation(QDesktopServices.DataLocation); if (directory.isEmpty()) - directory = QDir.homePath() + QLatin1String("/.") + QCoreApplication.applicationName(); + directory = QDir.homePath() ~ "/." ~ QCoreApplication.applicationName(); if (!QFile.exists(directory)) { QDir dir; dir.mkpath(directory); } - auto historyFile = new QFile(directory ~ QLatin1String("/history")); + auto historyFile = new QFile(directory ~ "/history"); // When saving everything use a temporary file to prevent possible data loss. auto tempFile = new QTemporaryFile; tempFile.setAutoRemove(false); @@ -364,7 +364,7 @@ { loadSettings(); - historyFile = new QFile(QDesktopServices.storageLocation(QDesktopServices.DataLocation) ~ QLatin1String("/history")); + historyFile = new QFile(QDesktopServices.storageLocation(QDesktopServices.DataLocation) ~ "/history"); if (!historyFile.exists()) return; if (!historyFile.open(QFile.ReadOnly)) { @@ -1095,7 +1095,7 @@ QDate date = idx.data(HistoryModel.DateRole).toDate(); if (date == QDate.currentDate()) return tr("Earlier Today"); - return date.toString(QLatin1String("dddd, MMMM d, yyyy")); + return date.toString("dddd, MMMM d, yyyy"); } if (index.column() == 1) { return Format(tr("{} items"), rowCount(index.sibling(index.row(), 0))); @@ -1103,7 +1103,7 @@ } } if (role == Qt.DecorationRole && index.column() == 0 && !index.parent().isValid()) - return QIcon(QLatin1String(":history.png")); + return new QIcon(":history.png"); if (role == HistoryModel.DateRole && index.column() == 0 && index.internalId() == 0) { int offset = sourceDateRow(index.row()); QModelIndex idx = sourceModel().index(offset, 0);
--- a/demos/browser/networkaccessmanager.d Sun May 24 14:05:40 2009 +0000 +++ b/demos/browser/networkaccessmanager.d Sun May 24 15:25:41 2009 +0000 @@ -94,17 +94,17 @@ void loadSettings() { auto settings = new QSettings; - settings.beginGroup(QLatin1String("proxy")); + settings.beginGroup("proxy"); QNetworkProxy proxy; - if (settings.value(QLatin1String("enabled"), false).toBool()) { - if (settings.value(QLatin1String("type"), 0).toInt() == 0) + if (settings.value("enabled", false).toBool()) { + if (settings.value("type", 0).toInt() == 0) proxy = QNetworkProxy.Socks5Proxy; else proxy = QNetworkProxy.HttpProxy; - proxy.setHostName(settings.value(QLatin1String("hostName")).toString()); - proxy.setPort(settings.value(QLatin1String("port"), 1080).toInt()); - proxy.setUser(settings.value(QLatin1String("userName")).toString()); - proxy.setPassword(settings.value(QLatin1String("password")).toString()); + proxy.setHostName(settings.value("hostName").toString()); + proxy.setPort(settings.value("port", 1080).toInt()); + proxy.setUser(settings.value("userName").toString()); + proxy.setPassword(settings.value("password").toString()); } setProxy(proxy); } @@ -169,7 +169,7 @@ string[] errorStrings; for (int i = 0; i < error.count(); ++i) errorStrings += error[i].errorString(); - string errors = errorStrings ~ QLatin1String("\n")); + string errors = errorStrings ~ "\n"; int ret = QMessageBox.warning(mainWindow, QCoreApplication.applicationName(), Format(tr("SSL Errors:\n\n{}\n\n{}\n\n" "Do you want to ignore these errors for this host?"), reply.url().toString(), errors),
--- a/demos/browser/searchlineedit.d Sun May 24 14:05:40 2009 +0000 +++ b/demos/browser/searchlineedit.d Sun May 24 15:25:41 2009 +0000 @@ -109,7 +109,7 @@ { super(parent); m_menu = 0; - setObjectName(QLatin1String("SearchButton")); + setObjectName("SearchButton"); setCursor(Qt.ArrowCursor); setFocusPolicy(Qt.NoFocus); }
--- a/demos/browser/settings.d Sun May 24 14:05:40 2009 +0000 +++ b/demos/browser/settings.d Sun May 24 15:25:41 2009 +0000 @@ -89,12 +89,12 @@ string standardFontFamily = defaultSettings.fontFamily(QWebSettings.StandardFont); int standardFontSize = defaultSettings.fontSize(QWebSettings.DefaultFontSize); standardFont = QFont(standardFontFamily, standardFontSize); - standardLabel.setText(Format(QLatin1String("{} {}"), standardFont.family(), standardFont.pointSize())); + standardLabel.setText(Format("{} {}", standardFont.family(), standardFont.pointSize())); string fixedFontFamily = defaultSettings.fontFamily(QWebSettings.FixedFont); int fixedFontSize = defaultSettings.fontSize(QWebSettings.DefaultFixedFontSize); fixedFont = QFont(fixedFontFamily, fixedFontSize); - fixedLabel.setText(Format(QLatin1String("{} {}"), fixedFont.family(), fixedFont.pointSize())); + fixedLabel.setText(Format("{} {}", fixedFont.family(), fixedFont.pointSize())); downloadsLocation.setText(QDesktopServices.storageLocation(QDesktopServices.DesktopLocation)); @@ -105,13 +105,13 @@ void loadFromSettings() { auto settings = new QSettings; - settings.beginGroup(QLatin1String("MainWindow")); - string defaultHome = QLatin1String("http://qtsoftware.com"); - homeLineEdit.setText(settings.value(QLatin1String("home"), defaultHome).toString()); + settings.beginGroup("MainWindow"); + string defaultHome = "http://qtsoftware.com"; + homeLineEdit.setText(settings.value("home", defaultHome).toString()); settings.endGroup(); - settings.beginGroup(QLatin1String("history")); - int historyExpire = settings.value(QLatin1String("historyExpire")).toInt(); + settings.beginGroup("history"); + int historyExpire = settings.value("historyExpire").toInt(); int idx = 0; switch (historyExpire) { case 1: idx = 0; break; @@ -126,34 +126,34 @@ expireHistory.setCurrentIndex(idx); settings.endGroup(); - settings.beginGroup(QLatin1String("downloadmanager")); - string downloadDirectory = settings.value(QLatin1String("downloadDirectory"), downloadsLocation.text()).toString(); + settings.beginGroup("downloadmanager"); + string downloadDirectory = settings.value("downloadDirectory", downloadsLocation.text()).toString(); downloadsLocation.setText(downloadDirectory); settings.endGroup(); - settings.beginGroup(QLatin1String("general")); - openLinksIn.setCurrentIndex(settings.value(QLatin1String("openLinksIn"), openLinksIn.currentIndex()).toInt()); + settings.beginGroup("general"); + openLinksIn.setCurrentIndex(settings.value("openLinksIn", openLinksIn.currentIndex()).toInt()); settings.endGroup(); // Appearance - settings.beginGroup(QLatin1String("websettings")); - fixedFont = qVariantValue<QFont>(settings.value(QLatin1String("fixedFont"), fixedFont)); - standardFont = qVariantValue<QFont>(settings.value(QLatin1String("standardFont"), standardFont)); + settings.beginGroup("websettings"); + fixedFont = new QFont(settings.value("fixedFont", fixedFont)); + standardFont = new QFont(settings.value("standardFont", standardFont)); - standardLabel.setText(Format(QLatin1String("{} {}"), standardFont.family(), standardFont.pointSize())); - fixedLabel.setText(Format(QLatin1String("{} {}"), fixedFont.family(), fixedFont.pointSize())); + standardLabel.setText(Format("{} {}", standardFont.family(), standardFont.pointSize())); + fixedLabel.setText(Format("{} {}", fixedFont.family(), fixedFont.pointSize())); - enableJavascript.setChecked(settings.value(QLatin1String("enableJavascript"), enableJavascript.isChecked()).toBool()); - enablePlugins.setChecked(settings.value(QLatin1String("enablePlugins"), enablePlugins.isChecked()).toBool()); - userStyleSheet.setText(settings.value(QLatin1String("userStyleSheet")).toUrl().toString()); + enableJavascript.setChecked(settings.value("enableJavascript", enableJavascript.isChecked()).toBool()); + enablePlugins.setChecked(settings.value("enablePlugins", enablePlugins.isChecked()).toBool()); + userStyleSheet.setText(settings.value("userStyleSheet").toUrl().toString()); settings.endGroup(); // Privacy - settings.beginGroup(QLatin1String("cookies")); + settings.beginGroup("cookies"); CookieJar jar = BrowserApplication.cookieJar(); - QByteArray value = settings.value(QLatin1String("acceptCookies"), QLatin1String("AcceptOnlyFromSitesNavigatedTo")).toByteArray(); + QByteArray value = settings.value("acceptCookies", "AcceptOnlyFromSitesNavigatedTo").toByteArray(); QMetaEnum acceptPolicyEnum = jar.staticMetaObject.enumerator(jar.staticMetaObject.indexOfEnumerator("AcceptPolicy")); CookieJar.AcceptPolicy acceptCookies = acceptPolicyEnum.keyToValue(value) == -1 ? CookieJar.AcceptOnlyFromSitesNavigatedTo : cast(CookieJar.AcceptPolicy) acceptPolicyEnum.keyToValue(value); @@ -169,7 +169,7 @@ break; } - value = settings.value(QLatin1String("keepCookiesUntil"), QLatin1String("Expire")).toByteArray(); + value = settings.value("keepCookiesUntil", "Expire").toByteArray(); QMetaEnum keepPolicyEnum = jar.staticMetaObject.enumerator(jar.staticMetaObject.indexOfEnumerator("KeepPolicy")); CookieJar.KeepPolicy keepCookies = keepPolicyEnum.keyToValue(value) == -1 ? CookieJar.KeepUntilExpire : cast(CookieJar.KeepPolicy)(keepPolicyEnum.keyToValue(value)); @@ -187,28 +187,28 @@ settings.endGroup(); // Proxy - settings.beginGroup(QLatin1String("proxy")); - proxySupport.setChecked(settings.value(QLatin1String("enabled"), false).toBool()); - proxyType.setCurrentIndex(settings.value(QLatin1String("type"), 0).toInt()); - proxyHostName.setText(settings.value(QLatin1String("hostName")).toString()); - proxyPort.setValue(settings.value(QLatin1String("port"), 1080).toInt()); - proxyUserName.setText(settings.value(QLatin1String("userName")).toString()); - proxyPassword.setText(settings.value(QLatin1String("password")).toString()); + settings.beginGroup("proxy"); + proxySupport.setChecked(settings.value("enabled", false).toBool()); + proxyType.setCurrentIndex(settings.value("type", 0).toInt()); + proxyHostName.setText(settings.value("hostName").toString()); + proxyPort.setValue(settings.value("port", 1080).toInt()); + proxyUserName.setText(settings.value("userName").toString()); + proxyPassword.setText(settings.value("password").toString()); settings.endGroup(); } void saveToSettings() { QSettings settings; - settings.beginGroup(QLatin1String("MainWindow")); - settings.setValue(QLatin1String("home"), homeLineEdit.text()); + settings.beginGroup("MainWindow"); + settings.setValue("home", homeLineEdit.text()); settings.endGroup(); - settings.beginGroup(QLatin1String("general")); - settings.setValue(QLatin1String("openLinksIn"), openLinksIn.currentIndex()); + settings.beginGroup("general"); + settings.setValue("openLinksIn", openLinksIn.currentIndex()); settings.endGroup(); - settings.beginGroup(QLatin1String("history")); + settings.beginGroup("history"); int historyExpire = expireHistory.currentIndex(); int idx = -1; switch (historyExpire) { @@ -219,24 +219,24 @@ case 4: idx = 365; break; case 5: idx = -1; break; } - settings.setValue(QLatin1String("historyExpire"), idx); + settings.setValue("historyExpire", idx); settings.endGroup(); // Appearance - settings.beginGroup(QLatin1String("websettings")); - settings.setValue(QLatin1String("fixedFont"), fixedFont); - settings.setValue(QLatin1String("standardFont"), standardFont); - settings.setValue(QLatin1String("enableJavascript"), enableJavascript.isChecked()); - settings.setValue(QLatin1String("enablePlugins"), enablePlugins.isChecked()); + settings.beginGroup("websettings"); + settings.setValue("fixedFont", fixedFont); + settings.setValue("standardFont", standardFont); + settings.setValue("enableJavascript", enableJavascript.isChecked()); + settings.setValue("enablePlugins", enablePlugins.isChecked()); string userStyleSheetString = userStyleSheet.text(); if (QFile.exists(userStyleSheetString)) - settings.setValue(QLatin1String("userStyleSheet"), QUrl.fromLocalFile(userStyleSheetString)); + settings.setValue("userStyleSheet", QUrl.fromLocalFile(userStyleSheetString)); else - settings.setValue(QLatin1String("userStyleSheet"), QUrl(userStyleSheetString)); + settings.setValue("userStyleSheet", QUrl(userStyleSheetString)); settings.endGroup(); //Privacy - settings.beginGroup(QLatin1String("cookies")); + settings.beginGroup("cookies"); CookieJar.KeepPolicy keepCookies; switch(acceptCombo.currentIndex()) { @@ -253,7 +253,7 @@ } CookieJar jar = BrowserApplication.cookieJar(); QMetaEnum acceptPolicyEnum = jar.staticMetaObject.enumerator(jar.staticMetaObject.indexOfEnumerator("AcceptPolicy")); - settings.setValue(QLatin1String("acceptCookies"), QLatin1String(acceptPolicyEnum.valueToKey(keepCookies))); + settings.setValue("acceptCookies", acceptPolicyEnum.valueToKey(keepCookies)); CookieJar.KeepPolicy keepPolicy; switch(keepUntilCombo.currentIndex()) { @@ -270,18 +270,18 @@ } QMetaEnum keepPolicyEnum = jar.staticMetaObject.enumerator(jar.staticMetaObject.indexOfEnumerator("KeepPolicy")); - settings.setValue(QLatin1String("keepCookiesUntil"), QLatin1String(keepPolicyEnum.valueToKey(keepPolicy))); + settings.setValue("keepCookiesUntil", keepPolicyEnum.valueToKey(keepPolicy)); settings.endGroup(); // proxy - settings.beginGroup(QLatin1String("proxy")); - settings.setValue(QLatin1String("enabled"), proxySupport.isChecked()); - settings.setValue(QLatin1String("type"), proxyType.currentIndex()); - settings.setValue(QLatin1String("hostName"), proxyHostName.text()); - settings.setValue(QLatin1String("port"), proxyPort.text()); - settings.setValue(QLatin1String("userName"), proxyUserName.text()); - settings.setValue(QLatin1String("password"), proxyPassword.text()); + settings.beginGroup("proxy"); + settings.setValue("enabled", proxySupport.isChecked()); + settings.setValue("type", proxyType.currentIndex()); + settings.setValue("hostName", proxyHostName.text()); + settings.setValue("port", proxyPort.text()); + settings.setValue("userName", proxyUserName.text()); + settings.setValue("password", proxyPassword.text()); settings.endGroup(); BrowserApplication.instance().loadSettings(); @@ -316,7 +316,7 @@ QFont font = QFontDialog.getFont(&ok, standardFont, this); if ( ok ) { standardFont = font; - standardLabel.setText(Format(QLatin1String("{} {}"), font.family(), font.pointSize())); + standardLabel.setText(Format("{} {}", font.family(), font.pointSize())); } } @@ -326,7 +326,7 @@ QFont font = QFontDialog.getFont(&ok, fixedFont, this); if ( ok ) { fixedFont = font; - fixedLabel.setText(Format(QLatin1String("{} {}"), font.family(), font.pointSize())); + fixedLabel.setText(Format("{} {}", font.family(), font.pointSize())); } }
--- a/demos/browser/tabwidget.d Sun May 24 14:05:40 2009 +0000 +++ b/demos/browser/tabwidget.d Sun May 24 15:25:41 2009 +0000 @@ -83,7 +83,7 @@ setAcceptDrops(true); this.customContextMenuRequested.connect(&this.contextMenuRequested); - string alt = QLatin1String("Alt+%1"); + string alt = "Alt+%1"; for (int i = 1; i <= 10; ++i) { int key = i; if (key == 10) @@ -121,7 +121,7 @@ urls ~= url; mimeData.setUrls(urls); mimeData.setText(tabText(index)); - mimeData.setData(QLatin1String("action"), "tab-reordering"); + mimeData.setData("action", "tab-reordering"); drag.setMimeData(mimeData); drag.exec(); } @@ -360,12 +360,12 @@ setDocumentMode(true); // Actions - m_newTabAction = new QAction(QIcon(QLatin1String(":addtab.png")), tr("New &Tab"), this); + m_newTabAction = new QAction(new QIcon(":addtab.png"), tr("New &Tab"), this); m_newTabAction.setShortcuts(QKeySequence.AddTab); m_newTabAction.setIconVisibleInMenu(false); m_newTabAction.triggered.connect(&this.newTab); - m_closeTabAction = new QAction(QIcon(QLatin1String(":closetab.png")), tr("&Close Tab"), this); + m_closeTabAction = new QAction(new QIcon(":closetab.png"), tr("&Close Tab"), this); m_closeTabAction.setShortcuts(QKeySequence.Close); m_closeTabAction.setIconVisibleInMenu(false); m_closeTabAction.triggered.connect(&this.closeTab); @@ -819,7 +819,7 @@ WebView webView = cast(WebView) signalSender(); int index = webViewIndex(webView); if (-1 != index) { - auto icon = new QIcon(QLatin1String(":loading.gif")); + auto icon = new QIcon(":loading.gif"); setTabIcon(index, icon); } }
--- a/demos/browser/toolbarsearch.d Sun May 24 14:05:40 2009 +0000 +++ b/demos/browser/toolbarsearch.d Sun May 24 15:25:41 2009 +0000 @@ -113,11 +113,11 @@ m_autosaver.changeOccurred(); } - auto url = new QUrl(QLatin1String("http://www.google.com/search")); - url.addQueryItem(QLatin1String("q"), searchText); - url.addQueryItem(QLatin1String("ie"), QLatin1String("UTF-8")); - url.addQueryItem(QLatin1String("oe"), QLatin1String("UTF-8")); - url.addQueryItem(QLatin1String("client"), QLatin1String("qtdemobrowser")); + auto url = new QUrl("http://www.google.com/search"); + url.addQueryItem("q", searchText); + url.addQueryItem("ie", "UTF-8"); + url.addQueryItem("oe", "UTF-8"); + url.addQueryItem("client", "qtdemobrowser"); search.emit(url); } @@ -126,9 +126,9 @@ void save() { QSettings settings; - settings.beginGroup(QLatin1String("toolbarsearch")); - settings.setValue(QLatin1String("recentSearches"), m_stringListModel.stringList()); - settings.setValue(QLatin1String("maximumSaved"), m_maxSavedSearches); + settings.beginGroup("toolbarsearch"); + settings.setValue("recentSearches", m_stringListModel.stringList()); + settings.setValue("maximumSaved", m_maxSavedSearches); settings.endGroup(); } @@ -169,9 +169,9 @@ void load() { QSettings settings; - settings.beginGroup(QLatin1String("toolbarsearch")); - string[] list = settings.value(QLatin1String("recentSearches")).toStringList(); - m_maxSavedSearches = settings.value(QLatin1String("maximumSaved"), m_maxSavedSearches).toInt(); + settings.beginGroup("toolbarsearch"); + string[] list = settings.value("recentSearches").toStringList(); + m_maxSavedSearches = settings.value("maximumSaved", m_maxSavedSearches).toInt(); m_stringListModel.setStringList(list); settings.endGroup(); }
--- a/demos/browser/urllineedit.d Sun May 24 14:05:40 2009 +0000 +++ b/demos/browser/urllineedit.d Sun May 24 15:25:41 2009 +0000 @@ -302,7 +302,7 @@ void paintEvent(QPaintEvent event) { QPalette p = palette(); - if (m_webView && m_webView.url().scheme() == QLatin1String("https")) { + if (m_webView && m_webView.url().scheme() == "https") { QColor lightYellow(248, 248, 210); p.setBrush(QPalette.Base, generateGradient(lightYellow)); } else { @@ -311,13 +311,13 @@ setPalette(p); ExLineEdit.paintEvent(event); - QPainter painter(this); + auto painter = new QPainter(this); QStyleOptionFrameV2 panel; initStyleOption(&panel); QRect backgroundRect = style().subElementRect(QStyle.SE_LineEditContents, &panel, this); if (m_webView && !hasFocus()) { int progress = m_webView.progress(); - QColor loadingColor = QColor(116, 192, 250); + QColor loadingColor = new QColor(116, 192, 250); painter.setBrush(generateGradient(loadingColor)); painter.setPen(Qt.transparent); int mid = backgroundRect.width() / 100 * progress;
--- a/demos/browser/webview.d Sun May 24 14:05:40 2009 +0000 +++ b/demos/browser/webview.d Sun May 24 15:25:41 2009 +0000 @@ -153,11 +153,11 @@ return; } - auto file = new QFile(QLatin1String(":/notfound.html")); + auto file = new QFile(":/notfound.html"); bool isOpened = file.open(QIODevice.ReadOnly); assert(isOpened); string title = Format(tr("Error loading page: {}"), reply.url().toString()); - string html = Format(QLatin1String(file.readAll()), + string html = Format(file.readAll(), title, reply.errorString(), reply.url().toString()); @@ -167,8 +167,8 @@ QIcon icon = view().style().standardIcon(QStyle.SP_MessageBoxWarning, 0, view()); QPixmap pixmap = icon.pixmap(QSize(32,32)); if (pixmap.save(&imageBuffer, "PNG")) { - html.replace(QLatin1String("IMAGE_BINARY_DATA_HERE"), - QLatin1String(imageBuffer.buffer().toBase64())); + html.replace("IMAGE_BINARY_DATA_HERE", + imageBuffer.buffer().toBase64()); } QWebFrame[] frames;
--- a/demos/browser/xbel.d Sun May 24 14:05:40 2009 +0000 +++ b/demos/browser/xbel.d Sun May 24 15:25:41 2009 +0000 @@ -77,16 +77,16 @@ m_type = BookmarkNode.Root; } - bool operator==(BookmarkNode other) + int opEquals(BookmarkNode other) { if (url != other.url || title != other.title || desc != other.desc || expanded != other.expanded || m_type != other.m_type || m_children.length != other.m_children.length) - return false; + return cast(int) false; for (int i = 0; i < m_children.length; ++i) if (!((*(m_children[i])) == (*(other.m_children[i])))) - return false; - return true; + return cast(int) false; + return cast(int) true; } Type type() @@ -163,8 +163,8 @@ while (!atEnd()) { readNext(); if (isStartElement()) { - string version_ = attributes().value(QLatin1String("version")).toString(); - if (name() == QLatin1String("xbel") && (version_.isEmpty() || version_ == QLatin1String("1.0"))) { + string version_ = attributes().value("version").toString(); + if (name() == "xbel" && (version_.isEmpty() || version_ == "1.0")) { readXBEL(root); } else { raiseError(QObject.tr("The file is not an XBEL version 1.0 file.")); @@ -193,7 +193,7 @@ void readXBEL(BookmarkNode parent) { - assert(isStartElement() && name() == QLatin1String("xbel")); + assert(isStartElement() && name() == "xbel"); while (!atEnd()) { readNext(); @@ -201,11 +201,11 @@ break; if (isStartElement()) { - if (name() == QLatin1String("folder")) + if (name() == "folder") readFolder(parent); - else if (name() == QLatin1String("bookmark")) + else if (name() == ("bookmark") readBookmarkNode(parent); - else if (name() == QLatin1String("separator")) + else if (name() == ("separator") readSeparator(parent); else skipUnknownElement(); @@ -215,13 +215,13 @@ void readTitle(BookmarkNode parent) { - assert(isStartElement() && name() == QLatin1String("title")); + assert(isStartElement() && name() == "title"); parent.title = readElementText(); } void readDescription(BookmarkNode parent) { - assert(isStartElement() && name() == QLatin1String("desc")); + assert(isStartElement() && name() == "desc"); parent.desc = readElementText(); } @@ -235,10 +235,10 @@ void readFolder(BookmarkNode parent) { - assert(isStartElement() && name() == QLatin1String("folder")); + assert(isStartElement() && name() == "folder"); BookmarkNode folder = new BookmarkNode(BookmarkNode.Folder, parent); - folder.expanded = (attributes().value(QLatin1String("folded")) == QLatin1String("no")); + folder.expanded = (attributes().value("folded") == "no"); while (!atEnd()) { readNext(); @@ -247,15 +247,15 @@ break; if (isStartElement()) { - if (name() == QLatin1String("title")) + if (name() == "title") readTitle(folder); - else if (name() == QLatin1String("desc")) + else if (name() == "desc") readDescription(folder); - else if (name() == QLatin1String("folder")) + else if (name() == "folder") readFolder(folder); - else if (name() == QLatin1String("bookmark")) + else if (name() == "bookmark") readBookmarkNode(folder); - else if (name() == QLatin1String("separator")) + else if (name() == "separator") readSeparator(folder); else skipUnknownElement(); @@ -265,18 +265,18 @@ void readBookmarkNode(BookmarkNode parent) { - assert(isStartElement() && name() == QLatin1String("bookmark")); + assert(isStartElement() && name() == "bookmark"); BookmarkNode bookmark = new BookmarkNode(BookmarkNode.Bookmark, parent); - bookmark.url = attributes().value(QLatin1String("href")).toString(); + bookmark.url = attributes().value("href").toString(); while (!atEnd()) { readNext(); if (isEndElement()) break; if (isStartElement()) { - if (name() == QLatin1String("title")) + if (name() == "title") readTitle(bookmark); - else if (name() == QLatin1String("desc")) + else if (name() == "desc") readDescription(bookmark); else skipUnknownElement(); @@ -311,9 +311,9 @@ setDevice(device); writeStartDocument(); - writeDTD(QLatin1String("<!DOCTYPE xbel>")); - writeStartElement(QLatin1String("xbel")); - writeAttribute(QLatin1String("version"), QLatin1String("1.0")); + writeDTD("<!DOCTYPE xbel>"); + writeStartElement("xbel"); + writeAttribute("version", "1.0"); if (root.type() == BookmarkNode.Root) { for (int i = 0; i < root.children().length; ++i) writeItem(root.children()[i]); @@ -331,24 +331,24 @@ { switch (parent.type()) { case BookmarkNode.Folder: - writeStartElement(QLatin1String("folder")); - writeAttribute(QLatin1String("folded"), parent.expanded ? QLatin1String("no") : QLatin1String("yes")); - writeTextElement(QLatin1String("title"), parent.title); + writeStartElement("folder"); + writeAttribute("folded", parent.expanded ? "no" : "yes"); + writeTextElement("title", parent.title); for (int i = 0; i < parent.children().count(); ++i) writeItem(parent.children()[i]); writeEndElement(); break; case BookmarkNode.Bookmark: - writeStartElement(QLatin1String("bookmark")); + writeStartElement("bookmark"); if (!parent.url.isEmpty()) - writeAttribute(QLatin1String("href"), parent.url); - writeTextElement(QLatin1String("title"), parent.title); + writeAttribute("href", parent.url); + writeTextElement("title", parent.title); if (!parent.desc.isEmpty()) - writeAttribute(QLatin1String("desc"), parent.desc); + writeAttribute("desc", parent.desc); writeEndElement(); break; case BookmarkNode.Separator: - writeEmptyElement(QLatin1String("separator")); + writeEmptyElement("separator"); break; default: break;