Diffstat (limited to 'noncore/net/ubrowser/mainview.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/net/ubrowser/mainview.cpp | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/noncore/net/ubrowser/mainview.cpp b/noncore/net/ubrowser/mainview.cpp index d3f4c57..f68c5db 100644 --- a/noncore/net/ubrowser/mainview.cpp +++ b/noncore/net/ubrowser/mainview.cpp | |||
@@ -30,12 +30,13 @@ MainView::MainView(QWidget *parent, const char *name) : QMainWindow(parent, name | |||
30 | home = new QToolButton(Resource::loadPixmap("ubrowser/home"), 0, 0, 0, 0, toolbar, "home"); | 30 | home = new QToolButton(Resource::loadPixmap("ubrowser/home"), 0, 0, 0, 0, toolbar, "home"); |
31 | location = new QComboBox(true, toolbar, "location"); | 31 | location = new QComboBox(true, toolbar, "location"); |
32 | go = new QToolButton(Resource::loadPixmap("ubrowser/go"), 0, 0, 0, 0, toolbar, "go"); | 32 | go = new QToolButton(Resource::loadPixmap("ubrowser/go"), 0, 0, 0, 0, toolbar, "go"); |
33 | 33 | ||
34 | toolbar->setStretchableWidget(location); | 34 | toolbar->setStretchableWidget(location); |
35 | toolbar->setHorizontalStretchable(true); | 35 | toolbar->setHorizontalStretchable(true); |
36 | location->setAutoCompletion( true ); | ||
36 | 37 | ||
37 | addToolBar(toolbar); | 38 | addToolBar(toolbar); |
38 | 39 | ||
39 | browser = new QTextBrowser(this, "browser"); | 40 | browser = new QTextBrowser(this, "browser"); |
40 | setCentralWidget(browser); | 41 | setCentralWidget(browser); |
41 | 42 | ||
@@ -58,18 +59,25 @@ MainView::MainView(QWidget *parent, const char *name) : QMainWindow(parent, name | |||
58 | 59 | ||
59 | http = new HttpFactory(browser); | 60 | http = new HttpFactory(browser); |
60 | 61 | ||
61 | if( qApp->argc() > 1 ) | 62 | if( qApp->argc() > 1 ) |
62 | { | 63 | { |
63 | char **argv = qApp->argv(); | 64 | char **argv = qApp->argv(); |
64 | QString *argv1 = new QString( argv[1] ); | 65 | int i = 0; |
65 | if( !argv1->startsWith( "http://" ) && !argv1->startsWith( "/" ) ) | 66 | QString *openfile = new QString( argv[0] ); |
67 | while( openfile->contains( "ubrowser" ) == 0 && i < qApp->argc() ) | ||
66 | { | 68 | { |
67 | argv1->insert( 0, QDir::currentDirPath()+"/" ); | 69 | i++; |
70 | *openfile = argv[i]; | ||
68 | } | 71 | } |
69 | location->setEditText( *argv1 ); | 72 | *openfile = argv[i+1]; |
73 | if( !openfile->startsWith( "http://" ) && !openfile->startsWith( "/" ) ) | ||
74 | { | ||
75 | openfile->insert( 0, QDir::currentDirPath()+"/" ); | ||
76 | } | ||
77 | location->setEditText( *openfile ); | ||
70 | goClicked(); | 78 | goClicked(); |
71 | } | 79 | } |
72 | } | 80 | } |
73 | 81 | ||
74 | void MainView::goClicked() | 82 | void MainView::goClicked() |
75 | { | 83 | { |
@@ -100,6 +108,14 @@ void MainView::textChanged() | |||
100 | { | 108 | { |
101 | setCaption(browser->documentTitle() + " - uBrowser"); | 109 | setCaption(browser->documentTitle() + " - uBrowser"); |
102 | } | 110 | } |
103 | 111 | ||
104 | location->setEditText(browser->source()); | 112 | location->setEditText(browser->source()); |
105 | } | 113 | } |
114 | |||
115 | void MainView::setDocument( const QString& applnk_filename ) | ||
116 | { | ||
117 | DocLnk *file = new DocLnk( applnk_filename ); | ||
118 | |||
119 | location->setEditText( file->file() ); | ||
120 | goClicked(); | ||
121 | } | ||