tazweb rev 163
Qt: maximized,icon,ask pass.
author | Xander Ziiryanoff <psychomaniak@xakep.ru> |
---|---|
date | Wed Apr 01 19:18:32 2015 +0300 (2015-04-01) |
parents | cc48c28dedad |
children | 24f6230d2119 |
files | src/main.cpp |
line diff
1.1 --- a/src/main.cpp Mon Nov 03 00:47:50 2014 +0200 1.2 +++ b/src/main.cpp Wed Apr 01 19:18:32 2015 +0300 1.3 @@ -12,9 +12,42 @@ 1.4 int main(int argc, char** argv) 1.5 { 1.6 QApplication app(argc, argv); 1.7 + QApplication::setWindowIcon(QIcon::fromTheme("tazweb")); 1.8 + QFile file(QDir::homePath() + "/.config/slitaz/subox.conf"); 1.9 + QString msg, line; 1.10 + QString msg2("\n ENTER/ok -> tazpanel, ESC/cancel -> bookmarks/webhome"); 1.11 + QUrl url; 1.12 + if (argc > 1) { url = QUrl::fromUserInput(argv[1]); } 1.13 + else { 1.14 + if (file.open(QIODevice::ReadOnly | QIODevice::Text)) { 1.15 + msg = "Using subox pass... Load succesfuly" + msg2; 1.16 + QTextStream in(&file); 1.17 + while (!in.atEnd()) { line = in.readLine(); } 1.18 + file.close(); } 1.19 + else { msg = file.fileName() + " not found.\nroot password requested:" + msg2; 1.20 + line = "root"; } 1.21 + bool ok; 1.22 + QString text = QInputDialog::getText(0, "TazWeb-Qt: TazPanel authentication", 1.23 + msg, QLineEdit::Password, line, &ok); 1.24 + if (ok && !text.isEmpty()) { 1.25 + QApplication::setWindowIcon(QIcon::fromTheme("tazpanel")); 1.26 + url = QUrl("http://root:" + text + "@tazpanel:82"); } 1.27 + else { 1.28 + if (QFile::exists(QDir::homePath() + "/.config/tazweb/bookmarks.txt")) 1.29 + url = QUrl("http://localhost/cgi-bin/bookmarks.cgi?home=" + QDir::homePath()); 1.30 + else 1.31 + url = QUrl("file:///usr/share/webhome/index.html"); } 1.32 + } 1.33 QWebView view; 1.34 +/* 1.35 view.show(); 1.36 //view.setUrl(QUrl("file:///usr/share/webhome/index.html")); 1.37 view.load(QUrl("file:///usr/share/webhome/index.html")); 1.38 +*/ 1.39 + //view.settings()->setAttribute(QWebSettings::JavascriptCanOpenWindows, true); 1.40 + //view.settings()->setAttribute(QWebSettings::ZoomTextOnly, true); 1.41 + //view.setTextSizeMultiplier(1); 1.42 + view.showMaximized(); 1.43 + view.load(url); 1.44 return app.exec(); 1.45 }