summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-gutenbrowser/browserDialog.cpp
blob: cc05d048e9a6feb1302bb22102e34f957ae8c535 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
/****************************************************************************
copyright 2001 by L.J. Potter ljp@llornkcor.com
    copyright            : (C) 2000 -2004 by llornkcor
    email                : ljp@llornkcor.com

****************************************************************************/

#include "optionsDialog.h"
//#include "fileBrowser.h"

/* OPIE */
#include <opie2/ofiledialog.h>
#include <opie2/odebug.h>
using namespace Opie::Ui;

/* QT */
#include <qlabel.h>
#include <qlistbox.h>
#include <qpushbutton.h>
#include <qlayout.h>

void optionsDialog::BrowserDlg( )
{
//    setCaption( tr( "Choose Browser" ) );
  http_ListBox1->insertItem( tr( "Opera"));
  http_ListBox1->insertItem( tr( "Konqueror"));
  http_ListBox1->insertItem( tr( "wget"));
}

void optionsDialog::select_title(int) {
    browserName = http_ListBox1->currentText();
    Config config("Gutenbrowser");
    config.setGroup( "Browser" );
    printf("Brow is: "+browserName+"\n");
    config.writeEntry("Preferred", browserName);
    TextLabel3_3->setText( "Current http browser: "+browserName );
}

void optionsDialog::BrowseSelected() {
    QString fileName;
    Config cfg("Gutenbrowser");
    cfg. setGroup ( "View" );
    QString dir = cfg.readEntry("LastOpenDirectory", QPEApplication::documentDir());
    QMap<QString, QStringList> map;
    map.insert(tr("All"), QStringList() );
    QStringList text;
    text << "text/*";
    map.insert(tr("Text"), text );
    text << "*";
    map.insert(tr("All"), text );

    QString str = OFileDialog::getOpenFileName( 2, dir , QString::null, map);
    if( !str.isEmpty() && QFile(str).exists() && !QFileInfo(str).isDir() )  {
      fileName = str;
//      QStringList fileList=browseForFiles->fileList;
//      odebug << selFile << oendl;
//      QStringList::ConstIterator f;
//      QString fileTemp,filer;
//      for (  f = fileList.begin(); f != fileList.end(); f++ ) {

//          fileTemp = *f;
//          fileTemp.right( fileTemp.length()-5);
//          fileName = fileTemp;
//          if( !fileName.isEmpty() ){
//              filer = fileName;
//          } else {
//              QString sMsg;
//              sMsg = "Error opening library filelist "+fileName;
//          }
        if ( !fileName.isNull() ) {                 // got a file name
              //   ...
        }
    }

}

void optionsDialog::setHttp(int index) {
    Config config("Gutenbrowser");
    config.setGroup( "HttpServer" );
    odebug << "writing http server" << oendl;
    if( index== 0) {
        config.writeEntry("Preferred", "http://sailor.gutenberg.org");
    } else {
        config.writeEntry("Preferred", "http://www.prairienet.org/pg");
    }

}