author | kergoth <kergoth> | 2003-08-09 17:42:14 (UTC) |
---|---|---|
committer | kergoth <kergoth> | 2003-08-09 17:42:14 (UTC) |
commit | 1ab4ca95e4d2cf24d32b38c9031cb6076351e730 (patch) (unidiff) | |
tree | 644d196b01c7f280981bd17da23c7592a18e5643 /core | |
parent | ec14206f63dd93e9fb84c76cbc76fc1968637590 (diff) | |
download | opie-1ab4ca95e4d2cf24d32b38c9031cb6076351e730.zip opie-1ab4ca95e4d2cf24d32b38c9031cb6076351e730.tar.gz opie-1ab4ca95e4d2cf24d32b38c9031cb6076351e730.tar.bz2 |
Merge from BRANCH_1_0
-rw-r--r-- | core/apps/.cvsignore | 1 | ||||
-rw-r--r-- | core/apps/embeddedkonsole/MyPty.cpp | 1 | ||||
-rw-r--r-- | core/apps/helpbrowser/helpbrowser.cpp | 48 | ||||
-rw-r--r-- | core/apps/helpbrowser/helpbrowser.h | 4 | ||||
-rw-r--r-- | core/apps/helpbrowser/helpbrowser.pro | 4 | ||||
-rw-r--r-- | core/apps/helpbrowser/magictextbrowser.cpp | 99 | ||||
-rw-r--r-- | core/apps/helpbrowser/magictextbrowser.h | 42 | ||||
-rw-r--r-- | core/apps/helpbrowser/main.cpp | 9 | ||||
-rw-r--r-- | core/apps/textedit/textedit.cpp | 8 | ||||
-rw-r--r-- | core/opie-login/main.cpp | 28 | ||||
-rw-r--r-- | core/opie-login/opie-login.conffiles | 1 | ||||
-rw-r--r-- | core/opiealarm/Makefile | 4 | ||||
-rw-r--r-- | core/opiealarm/config.in | 2 | ||||
-rw-r--r-- | core/opiealarm/opiealarm.c | 5 | ||||
-rw-r--r-- | core/settings/launcher/tabdialog.cpp | 6 | ||||
-rw-r--r-- | core/settings/security/security.cpp | 72 | ||||
-rw-r--r-- | core/settings/security/security.h | 6 | ||||
-rw-r--r-- | core/settings/security/securitybase.ui | 253 |
18 files changed, 521 insertions, 72 deletions
diff --git a/core/apps/.cvsignore b/core/apps/.cvsignore index faa68ae..6d678c6 100644 --- a/core/apps/.cvsignore +++ b/core/apps/.cvsignore | |||
@@ -1,2 +1 @@ | |||
1 | binconfig.in | ||
2 | config.in | config.in | |
diff --git a/core/apps/embeddedkonsole/MyPty.cpp b/core/apps/embeddedkonsole/MyPty.cpp index 9adc248..7e820ad 100644 --- a/core/apps/embeddedkonsole/MyPty.cpp +++ b/core/apps/embeddedkonsole/MyPty.cpp | |||
@@ -154,24 +154,25 @@ int MyPty::run(const char* cmd, QStrList &, const char*, int) | |||
154 | close(ttyfd); | 154 | close(ttyfd); |
155 | static struct termios ttmode; | 155 | static struct termios ttmode; |
156 | if ( setsid() < 0 ) | 156 | if ( setsid() < 0 ) |
157 | perror( "failed to set process group" ); | 157 | perror( "failed to set process group" ); |
158 | #if defined (TIOCSCTTY) | 158 | #if defined (TIOCSCTTY) |
159 | // grabbed from APUE by Stevens | 159 | // grabbed from APUE by Stevens |
160 | ioctl(STDIN_FILENO, TIOCSCTTY, 0); | 160 | ioctl(STDIN_FILENO, TIOCSCTTY, 0); |
161 | #endif | 161 | #endif |
162 | tcgetattr( STDIN_FILENO, &ttmode ); | 162 | tcgetattr( STDIN_FILENO, &ttmode ); |
163 | ttmode.c_cc[VINTR] = 3; | 163 | ttmode.c_cc[VINTR] = 3; |
164 | ttmode.c_cc[VERASE] = 8; | 164 | ttmode.c_cc[VERASE] = 8; |
165 | tcsetattr( STDIN_FILENO, TCSANOW, &ttmode ); | 165 | tcsetattr( STDIN_FILENO, TCSANOW, &ttmode ); |
166 | if(strlen(getenv("TERM"))<=0) | ||
166 | setenv("TERM","vt100",1); | 167 | setenv("TERM","vt100",1); |
167 | setenv("COLORTERM","0",1); | 168 | setenv("COLORTERM","0",1); |
168 | 169 | ||
169 | if (getuid() == 0) { | 170 | if (getuid() == 0) { |
170 | char msg[] = "WARNING: You are running this shell as root!\n"; | 171 | char msg[] = "WARNING: You are running this shell as root!\n"; |
171 | write(ttyfd, msg, sizeof(msg)); | 172 | write(ttyfd, msg, sizeof(msg)); |
172 | } | 173 | } |
173 | 174 | ||
174 | QString ccmd = "-"+QFileInfo(cmd).fileName(); //creates a login shell | 175 | QString ccmd = "-"+QFileInfo(cmd).fileName(); //creates a login shell |
175 | 176 | ||
176 | execl(cmd, ccmd.latin1(), 0); | 177 | execl(cmd, ccmd.latin1(), 0); |
177 | 178 | ||
diff --git a/core/apps/helpbrowser/helpbrowser.cpp b/core/apps/helpbrowser/helpbrowser.cpp index 48da7c6..531dbff 100644 --- a/core/apps/helpbrowser/helpbrowser.cpp +++ b/core/apps/helpbrowser/helpbrowser.cpp | |||
@@ -1,143 +1,165 @@ | |||
1 | #/********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of the Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | #define QTOPIA_INTERNAL_LANGLIST | ||
22 | |||
21 | #include "helpbrowser.h" | 23 | #include "helpbrowser.h" |
22 | 24 | ||
23 | #include <qpe/qpeapplication.h> | 25 | #include <qpe/qpeapplication.h> |
24 | #include <qpe/resource.h> | 26 | #include <qpe/resource.h> |
27 | #include <qpe/mimetype.h> | ||
28 | #include <qpe/applnk.h> | ||
25 | #include <qpe/global.h> | 29 | #include <qpe/global.h> |
26 | 30 | ||
27 | #include <qstatusbar.h> | 31 | #include <qstatusbar.h> |
28 | #include <qdragobject.h> | 32 | #include <qdragobject.h> |
29 | #include <qpixmap.h> | 33 | #include <qpixmap.h> |
30 | #include <qpopupmenu.h> | 34 | #include <qpopupmenu.h> |
31 | #include <qpe/qpemenubar.h> | 35 | #include <qpe/qpemenubar.h> |
32 | #include <qpe/qpetoolbar.h> | 36 | #include <qpe/qpetoolbar.h> |
37 | #include <qpe/qcopenvelope_qws.h> | ||
33 | #include <qtoolbutton.h> | 38 | #include <qtoolbutton.h> |
34 | #include <qiconset.h> | 39 | #include <qiconset.h> |
35 | #include <qfile.h> | 40 | #include <qfile.h> |
36 | #include <qtextstream.h> | 41 | #include <qtextstream.h> |
37 | #include <qstylesheet.h> | 42 | #include <qstylesheet.h> |
38 | #include <qmessagebox.h> | 43 | #include <qmessagebox.h> |
39 | #include <qfiledialog.h> | 44 | #include <qfiledialog.h> |
40 | #include <qevent.h> | 45 | #include <qevent.h> |
41 | #include <qlineedit.h> | 46 | #include <qlineedit.h> |
42 | #include <qobjectlist.h> | 47 | #include <qobjectlist.h> |
43 | #include <qfileinfo.h> | 48 | #include <qfileinfo.h> |
44 | #include <qfile.h> | 49 | #include <qfile.h> |
45 | #include <qdatastream.h> | 50 | #include <qdatastream.h> |
46 | #include <qprinter.h> | 51 | #include <qprinter.h> |
47 | #include <qsimplerichtext.h> | 52 | #include <qsimplerichtext.h> |
48 | #include <qpaintdevicemetrics.h> | 53 | #include <qpaintdevicemetrics.h> |
49 | #include <qaction.h> | 54 | #include <qaction.h> |
50 | 55 | ||
51 | #include <ctype.h> | 56 | #include <cctype> |
52 | 57 | ||
58 | #include "magictextbrowser.h" | ||
53 | 59 | ||
54 | HelpBrowser::HelpBrowser( QWidget* parent, const char *name, WFlags f ) | 60 | HelpBrowser::HelpBrowser( QWidget* parent, const char *name, WFlags f ) |
55 | : QMainWindow( parent, name, f ), | 61 | : QMainWindow( parent, name, f ), |
56 | selectedURL() | 62 | selectedURL() |
57 | { | 63 | { |
58 | init( "index.html" ); | 64 | init( "index.html" ); |
59 | } | 65 | } |
60 | 66 | ||
67 | |||
68 | |||
61 | void HelpBrowser::init( const QString& _home ) | 69 | void HelpBrowser::init( const QString& _home ) |
62 | { | 70 | { |
63 | setIcon( Resource::loadPixmap( "help_icon" ) ); | 71 | setIcon( Resource::loadPixmap( "HelpBrowser" ) ); |
72 | setBackgroundMode( PaletteButton ); | ||
64 | 73 | ||
65 | browser = new QTextBrowser( this ); | 74 | browser = new MagicTextBrowser( this ); |
66 | browser->setFrameStyle( QFrame::Panel | QFrame::Sunken ); | 75 | browser->setFrameStyle( QFrame::Panel | QFrame::Sunken ); |
67 | connect( browser, SIGNAL( textChanged() ), | 76 | connect( browser, SIGNAL( textChanged() ), |
68 | this, SLOT( textChanged() ) ); | 77 | this, SLOT( textChanged() ) ); |
69 | 78 | ||
70 | setCentralWidget( browser ); | 79 | setCentralWidget( browser ); |
71 | setToolBarsMovable( FALSE ); | 80 | setToolBarsMovable( FALSE ); |
72 | 81 | ||
73 | if ( !_home.isEmpty() ) | 82 | if ( !_home.isEmpty() ) |
74 | browser->setSource( _home ); | 83 | browser->setSource( _home ); |
75 | 84 | ||
76 | QPEToolBar* toolbar = new QPEToolBar( this ); | 85 | QPEToolBar* toolbar = new QPEToolBar( this ); |
77 | toolbar->setHorizontalStretchable( TRUE ); | 86 | toolbar->setHorizontalStretchable( TRUE ); |
78 | QPEMenuBar *menu = new QPEMenuBar( toolbar ); | 87 | QPEMenuBar *menu = new QPEMenuBar( toolbar ); |
79 | 88 | ||
80 | toolbar = new QPEToolBar( this ); | 89 | toolbar = new QPEToolBar( this ); |
81 | // addToolBar( toolbar, "Toolbar"); | 90 | // addToolBar( toolbar, "Toolbar"); |
82 | 91 | ||
83 | //QPopupMenu* go = new QPopupMenu( this ); | 92 | QPopupMenu* go = new QPopupMenu( this ); |
84 | backAction = new QAction( tr( "Backward" ), Resource::loadIconSet( "back" ), QString::null, 0, this, 0 ); | 93 | backAction = new QAction( tr( "Backward" ), Resource::loadIconSet( "back" ), QString::null, 0, this, 0 ); |
85 | connect( backAction, SIGNAL( activated() ), browser, SLOT( backward() ) ); | 94 | connect( backAction, SIGNAL( activated() ), browser, SLOT( backward() ) ); |
86 | connect( browser, SIGNAL( backwardAvailable( bool ) ), | 95 | connect( browser, SIGNAL( backwardAvailable( bool ) ), |
87 | backAction, SLOT( setEnabled( bool ) ) ); | 96 | backAction, SLOT( setEnabled( bool ) ) ); |
88 | //backAction->addTo( go ); | 97 | backAction->addTo( go ); |
89 | backAction->addTo( toolbar ); | 98 | backAction->addTo( toolbar ); |
90 | backAction->setEnabled( FALSE ); | 99 | backAction->setEnabled( FALSE ); |
91 | 100 | ||
92 | forwardAction = new QAction( tr( "Forward" ), Resource::loadIconSet( "forward" ), QString::null, 0, this, 0 ); | 101 | forwardAction = new QAction( tr( "Forward" ), Resource::loadIconSet( "forward" ), QString::null, 0, this, 0 ); |
93 | connect( forwardAction, SIGNAL( activated() ), browser, SLOT( forward() ) ); | 102 | connect( forwardAction, SIGNAL( activated() ), browser, SLOT( forward() ) ); |
94 | connect( browser, SIGNAL( forwardAvailable( bool ) ), | 103 | connect( browser, SIGNAL( forwardAvailable( bool ) ), |
95 | forwardAction, SLOT( setEnabled( bool ) ) ); | 104 | forwardAction, SLOT( setEnabled( bool ) ) ); |
96 | //forwardAction->addTo( go ); | 105 | forwardAction->addTo( go ); |
97 | forwardAction->addTo( toolbar ); | 106 | forwardAction->addTo( toolbar ); |
98 | forwardAction->setEnabled( FALSE ); | 107 | forwardAction->setEnabled( FALSE ); |
99 | 108 | ||
100 | QAction *a = new QAction( tr( "Home" ), Resource::loadPixmap( | 109 | QAction *a = new QAction( tr( "Home" ), Resource::loadIconSet( "home" ), QString::null, 0, this, 0 ); |
101 | "home" ), QString::null, 0, this, 0 ); | ||
102 | connect( a, SIGNAL( activated() ), browser, SLOT( home() ) ); | 110 | connect( a, SIGNAL( activated() ), browser, SLOT( home() ) ); |
103 | //a->addTo( go ); | 111 | a->addTo( go ); |
104 | a->addTo( toolbar ); | 112 | a->addTo( toolbar ); |
105 | 113 | ||
106 | bookm = new QPopupMenu( this ); | 114 | bookm = new QPopupMenu( this ); |
107 | bookm->insertItem( tr( "Add Bookmark" ), this, SLOT( addBookmark() ) ); | 115 | bookm->insertItem( tr( "Add Bookmark" ), this, SLOT( addBookmark() ) ); |
108 | bookm->insertItem( tr( "Remove from Bookmarks" ), this, SLOT( removeBookmark() ) ); | 116 | bookm->insertItem( tr( "Remove from Bookmarks" ), this, SLOT( removeBookmark() ) ); |
109 | bookm->insertSeparator(); | 117 | bookm->insertSeparator(); |
110 | connect( bookm, SIGNAL( activated( int ) ), | 118 | connect( bookm, SIGNAL( activated( int ) ), |
111 | this, SLOT( bookmChosen( int ) ) ); | 119 | this, SLOT( bookmChosen( int ) ) ); |
112 | 120 | ||
113 | readBookmarks(); | 121 | readBookmarks(); |
114 | 122 | ||
115 | //menu->insertItem( tr("Go"), go ); | 123 | menu->insertItem( tr("Go"), go ); |
116 | menu->insertItem( tr( "Bookmarks" ), bookm ); | 124 | menu->insertItem( tr( "Bookmarks" ), bookm ); |
117 | 125 | ||
118 | resize( 240, 300 ); | 126 | resize( 240, 300 ); |
119 | browser->setFocus(); | 127 | browser->setFocus(); |
128 | browser->setFrameStyle( QFrame::NoFrame ); | ||
129 | |||
130 | #if !defined(QT_NO_COP) | ||
131 | QCopChannel *addressChannel = new QCopChannel("QPE/HelpBrowser" , this ); | ||
132 | connect (addressChannel, SIGNAL( received(const QCString &, const QByteArray &)), | ||
133 | this, SLOT ( appMessage(const QCString &, const QByteArray &) ) ); | ||
134 | #endif | ||
120 | 135 | ||
121 | connect( qApp, SIGNAL(appMessage(const QCString&, const QByteArray&)), | 136 | connect( qApp, SIGNAL(appMessage(const QCString&, const QByteArray&)), |
122 | this, SLOT(appMessage(const QCString&, const QByteArray&)) ); | 137 | this, SLOT(appMessage(const QCString&, const QByteArray&)) ); |
123 | } | 138 | } |
124 | 139 | ||
125 | void HelpBrowser::appMessage(const QCString& msg, const QByteArray& data) | 140 | void HelpBrowser::appMessage(const QCString& msg, const QByteArray& data) |
126 | { | 141 | { |
142 | qDebug("reached appMessage"); | ||
127 | if ( msg == "showFile(QString)" ) { | 143 | if ( msg == "showFile(QString)" ) { |
128 | QDataStream ds(data,IO_ReadOnly); | 144 | QDataStream ds(data,IO_ReadOnly); |
129 | QString fn; | 145 | QString fn; |
130 | ds >> fn; | 146 | ds >> fn; |
131 | setDocument( fn ); | 147 | setDocument( fn ); |
148 | |||
149 | QPEApplication::setKeepRunning(); | ||
150 | |||
151 | showMaximized(); | ||
152 | setActiveWindow(); | ||
153 | raise(); | ||
132 | } | 154 | } |
133 | } | 155 | } |
134 | 156 | ||
135 | void HelpBrowser::setDocument( const QString &doc ) | 157 | void HelpBrowser::setDocument( const QString &doc ) |
136 | { | 158 | { |
137 | if ( !doc.isEmpty() ) | 159 | if ( !doc.isEmpty() ) |
138 | browser->setSource( doc ); | 160 | browser->setSource( doc ); |
139 | raise(); | 161 | raise(); |
140 | } | 162 | } |
141 | 163 | ||
142 | 164 | ||
143 | void HelpBrowser::textChanged() | 165 | void HelpBrowser::textChanged() |
diff --git a/core/apps/helpbrowser/helpbrowser.h b/core/apps/helpbrowser/helpbrowser.h index 2f7153a..5f7e6b6 100644 --- a/core/apps/helpbrowser/helpbrowser.h +++ b/core/apps/helpbrowser/helpbrowser.h | |||
@@ -1,16 +1,16 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of the Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
diff --git a/core/apps/helpbrowser/helpbrowser.pro b/core/apps/helpbrowser/helpbrowser.pro index 6bb43bd..3525b7e 100644 --- a/core/apps/helpbrowser/helpbrowser.pro +++ b/core/apps/helpbrowser/helpbrowser.pro | |||
@@ -1,17 +1,17 @@ | |||
1 | TEMPLATE= app | 1 | TEMPLATE= app |
2 | CONFIG = qt warn_on release | 2 | CONFIG = qt warn_on release |
3 | DESTDIR = $(OPIEDIR)/bin | 3 | DESTDIR = $(OPIEDIR)/bin |
4 | HEADERS = helpbrowser.h | 4 | HEADERS = helpbrowser.h magictextbrowser.h |
5 | SOURCES = helpbrowser.cpp \ | 5 | SOURCES = helpbrowser.cpp magictextbrowser.cpp \ |
6 | main.cpp | 6 | main.cpp |
7 | INCLUDEPATH += $(OPIEDIR)/include | 7 | INCLUDEPATH += $(OPIEDIR)/include |
8 | DEPENDPATH+= $(OPIEDIR)/include | 8 | DEPENDPATH+= $(OPIEDIR)/include |
9 | LIBS += -lqpe | 9 | LIBS += -lqpe |
10 | INTERFACES= | 10 | INTERFACES= |
11 | TARGET = helpbrowser | 11 | TARGET = helpbrowser |
12 | TRANSLATIONS = ../../../i18n/de/helpbrowser.ts \ | 12 | TRANSLATIONS = ../../../i18n/de/helpbrowser.ts \ |
13 | ../../../i18n/nl/helpbrowser.ts \ | 13 | ../../../i18n/nl/helpbrowser.ts \ |
14 | ../../../i18n/xx/helpbrowser.ts \ | 14 | ../../../i18n/xx/helpbrowser.ts \ |
15 | ../../../i18n/en/helpbrowser.ts \ | 15 | ../../../i18n/en/helpbrowser.ts \ |
16 | ../../../i18n/es/helpbrowser.ts \ | 16 | ../../../i18n/es/helpbrowser.ts \ |
17 | ../../../i18n/fr/helpbrowser.ts \ | 17 | ../../../i18n/fr/helpbrowser.ts \ |
diff --git a/core/apps/helpbrowser/magictextbrowser.cpp b/core/apps/helpbrowser/magictextbrowser.cpp new file mode 100644 index 0000000..8ce0325 --- a/dev/null +++ b/core/apps/helpbrowser/magictextbrowser.cpp | |||
@@ -0,0 +1,99 @@ | |||
1 | #include <qfile.h> | ||
2 | #include <qstring.h> | ||
3 | #include <qdragobject.h> | ||
4 | #include <qregexp.h> | ||
5 | |||
6 | /* need to get Global::helpPath() */ | ||
7 | #define QTOPIA_INTERNAL_LANGLIST | ||
8 | |||
9 | #include <qtopia/global.h> | ||
10 | #include <qtopia/mimetype.h> | ||
11 | #include <qtopia/applnk.h> | ||
12 | |||
13 | #include "magictextbrowser.h" | ||
14 | |||
15 | |||
16 | |||
17 | MagicTextBrowser::MagicTextBrowser(QWidget* parent) : | ||
18 | QTextBrowser(parent){ | ||
19 | } | ||
20 | |||
21 | void MagicTextBrowser::setSource( const QString& source ) { | ||
22 | QTextBrowser::setSource(source); | ||
23 | if ( magicQpe(source,"applications") || magicQpe(source,"games") || magicQpe(source,"settings") || magicQpe(source, "1Pim") ) // No tr | ||
24 | return; | ||
25 | if ( magicOpe(source, "applets") || magicOpe(source, "input") ) | ||
26 | return; | ||
27 | // Just those are magic (for now). Could do CGI here, | ||
28 | // or in Qtopia's mime source factory. | ||
29 | } | ||
30 | |||
31 | bool MagicTextBrowser::magicQpe(const QString& source, const QString& name) { | ||
32 | if ( name+".html" == source || "help/"+name+".html" == source) { | ||
33 | QString fn = mimeSourceFactory()->makeAbsolute( source, context() ); | ||
34 | const QMimeSource* m = mimeSourceFactory()->data( fn, context() ); | ||
35 | if ( m ) { | ||
36 | QString txt; | ||
37 | if ( QTextDrag::decode(m,txt) ) { | ||
38 | QRegExp re("<qtopia-"+name+">.*</qtopia-"+name+">"); | ||
39 | int start,len; | ||
40 | if ( (start=re.match(txt,0,&len))>=0 ) { | ||
41 | QString generated = generateQpe(name); | ||
42 | txt.replace(start,len,generated); | ||
43 | setText(txt); | ||
44 | return true; | ||
45 | } | ||
46 | } | ||
47 | } | ||
48 | } | ||
49 | return false; | ||
50 | } | ||
51 | bool MagicTextBrowser::magicOpe( const QString& source, const QString& name ) { | ||
52 | if ( name+".html" != source && "help/"+name+".html" != source) return false; | ||
53 | |||
54 | QString fn = mimeSourceFactory()->makeAbsolute( source, context() ); | ||
55 | const QMimeSource* m = mimeSourceFactory()->data(fn, context() ); | ||
56 | if (!m) return false; | ||
57 | |||
58 | QString txt; | ||
59 | if ( !QTextDrag::decode(m, txt ) ) return false; | ||
60 | |||
61 | QRegExp re("<opie-"+name+">.*</opie-"+name+">"); | ||
62 | int start,len; | ||
63 | if ( (start=re.match(txt,0,&len))>=0 ) { | ||
64 | QString generated = generateOpe(name); | ||
65 | txt.replace(start,len,generated); | ||
66 | setText(txt); | ||
67 | return true; | ||
68 | } | ||
69 | return false; | ||
70 | } | ||
71 | QString MagicTextBrowser::generateOpe(const QString& name)const { | ||
72 | if ( name == QString::fromLatin1("applets") ) { | ||
73 | return QString::fromLatin1("<h3>No Applets found</h3>"); | ||
74 | }else if ( name == QString::fromLatin1("input") ) { | ||
75 | return QString::fromLatin1("<h3>No input methods available</h3>"); | ||
76 | }else | ||
77 | return QString::null; | ||
78 | } | ||
79 | |||
80 | QString MagicTextBrowser::generateQpe(const QString& name) const { | ||
81 | QString dir = MimeType::appsFolderName()+"/"+name[0].upper()+name.mid(1); | ||
82 | AppLnkSet lnkset(dir); | ||
83 | AppLnk* lnk; | ||
84 | QString r; | ||
85 | for (QListIterator<AppLnk> it(lnkset.children()); (lnk=it.current()); ++it) { | ||
86 | QString name = lnk->name(); | ||
87 | QString icon = lnk->icon(); | ||
88 | QString helpFile = lnk->exec()+".html"; | ||
89 | QStringList helpPath = Global::helpPath(); | ||
90 | bool helpExists = FALSE; | ||
91 | for (QStringList::ConstIterator it=helpPath.begin(); it!=helpPath.end() && !helpExists; ++it) | ||
92 | helpExists = QFile::exists( *it + "/" + helpFile ); | ||
93 | |||
94 | if ( helpExists ) { | ||
95 | r += "<h3><a href="+helpFile+"><img src="+icon+">"+name+"</a></h3>\n"; | ||
96 | } | ||
97 | } | ||
98 | return r; | ||
99 | } | ||
diff --git a/core/apps/helpbrowser/magictextbrowser.h b/core/apps/helpbrowser/magictextbrowser.h new file mode 100644 index 0000000..ff91e68 --- a/dev/null +++ b/core/apps/helpbrowser/magictextbrowser.h | |||
@@ -0,0 +1,42 @@ | |||
1 | /********************************************************************** | ||
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | ||
3 | ** Copyright (C) 2003 zecke | ||
4 | ** | ||
5 | ** This file is part of the Qtopia Environment. | ||
6 | ** | ||
7 | ** This file may be distributed and/or modified under the terms of the | ||
8 | ** GNU General Public License version 2 as published by the Free Software | ||
9 | ** Foundation and appearing in the file LICENSE.GPL included in the | ||
10 | ** packaging of this file. | ||
11 | ** | ||
12 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | ||
13 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | ||
14 | ** | ||
15 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | ||
16 | ** | ||
17 | ** Contact info@trolltech.com if any conditions of this licensing are | ||
18 | ** not clear to you. | ||
19 | ** | ||
20 | **********************************************************************/ | ||
21 | #ifndef HELP_BROWSER_MAGIC_TEXT_BROWSER_H | ||
22 | #define HELP_BROWSER_MAGIC_TEXT_BROWSER_H | ||
23 | |||
24 | #include <qtextbrowser.h> | ||
25 | |||
26 | class MagicTextBrowser : public QTextBrowser { | ||
27 | public: | ||
28 | MagicTextBrowser(QWidget* parent); | ||
29 | |||
30 | void setSource( const QString& source ); | ||
31 | |||
32 | /** honor QPE Attributes */ | ||
33 | bool magicQpe(const QString& source, const QString& name); | ||
34 | /** honor OPIE Attributes */ | ||
35 | bool magicOpe(const QString& source, const QString& name ); | ||
36 | private: | ||
37 | |||
38 | QString generateQpe(const QString& name) const; | ||
39 | QString generateOpe(const QString& name) const; | ||
40 | }; | ||
41 | |||
42 | #endif | ||
diff --git a/core/apps/helpbrowser/main.cpp b/core/apps/helpbrowser/main.cpp index 1cb10b7..b1bea56 100644 --- a/core/apps/helpbrowser/main.cpp +++ b/core/apps/helpbrowser/main.cpp | |||
@@ -1,34 +1,33 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of the Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | #include "helpbrowser.h" | 21 | #include "helpbrowser.h" |
22 | 22 | ||
23 | #include <qpe/qpeapplication.h> | 23 | #include <qtopia/qpeapplication.h> |
24 | 24 | ||
25 | int main( int argc, char ** argv ) | 25 | int main( int argc, char ** argv ) |
26 | { | 26 | { |
27 | QPEApplication a( argc, argv ); | 27 | QPEApplication a( argc, argv ); |
28 | 28 | ||
29 | HelpBrowser mw; | 29 | HelpBrowser mw; |
30 | mw.setCaption( HelpBrowser::tr("HelpBrowser") ); | 30 | a.showMainWidget( &mw ); |
31 | a.showMainDocumentWidget( &mw ); | ||
32 | 31 | ||
33 | return a.exec(); | 32 | return a.exec(); |
34 | } | 33 | } |
diff --git a/core/apps/textedit/textedit.cpp b/core/apps/textedit/textedit.cpp index 6f96574..1c95a97 100644 --- a/core/apps/textedit/textedit.cpp +++ b/core/apps/textedit/textedit.cpp | |||
@@ -560,38 +560,36 @@ void TextEdit::setSearchBar(bool b) { | |||
560 | } | 560 | } |
561 | 561 | ||
562 | void TextEdit::fileNew() { | 562 | void TextEdit::fileNew() { |
563 | // if( !bFromDocView ) { | 563 | // if( !bFromDocView ) { |
564 | // saveAs(); | 564 | // saveAs(); |
565 | // } | 565 | // } |
566 | newFile(DocLnk()); | 566 | newFile(DocLnk()); |
567 | } | 567 | } |
568 | 568 | ||
569 | void TextEdit::fileOpen() { | 569 | void TextEdit::fileOpen() { |
570 | Config cfg("TextEdit"); | 570 | Config cfg("TextEdit"); |
571 | cfg. setGroup ( "View" ); | 571 | cfg. setGroup ( "View" ); |
572 | QString dir = cfg.readEntry("LastOpenDirectory", QPEApplication::documentDir()); | ||
573 | QMap<QString, QStringList> map; | 572 | QMap<QString, QStringList> map; |
574 | map.insert(tr("All"), QStringList() ); | 573 | map.insert(tr("All"), QStringList() ); |
575 | QStringList text; | 574 | QStringList text; |
576 | text << "text/*"; | 575 | text << "text/*"; |
577 | map.insert(tr("Text"), text ); | 576 | map.insert(tr("Text"), text ); |
578 | text << "*"; | 577 | text << "*"; |
579 | map.insert(tr("All"), text ); | 578 | map.insert(tr("All"), text ); |
580 | QString str = OFileDialog::getOpenFileName( 2, | 579 | QString str = OFileDialog::getOpenFileName( 2, |
581 | dir , | 580 | QString::null , |
582 | QString::null, map); | 581 | QString::null, map); |
583 | if( !str.isEmpty() && QFile(str).exists() && !QFileInfo(str).isDir() ) | 582 | if( !str.isEmpty() && QFile(str).exists() && !QFileInfo(str).isDir() ) |
584 | { | 583 | { |
585 | cfg.writeEntry("LastOpenDirectory", QFileInfo(str).dirPath(false)); | ||
586 | openFile( str ); | 584 | openFile( str ); |
587 | } | 585 | } |
588 | else | 586 | else |
589 | updateCaption(); | 587 | updateCaption(); |
590 | } | 588 | } |
591 | 589 | ||
592 | void TextEdit::doSearchBar() { | 590 | void TextEdit::doSearchBar() { |
593 | if(!useSearchBar) | 591 | if(!useSearchBar) |
594 | searchBar->hide(); | 592 | searchBar->hide(); |
595 | else | 593 | else |
596 | searchBar->show(); | 594 | searchBar->show(); |
597 | } | 595 | } |
@@ -967,25 +965,25 @@ void TextEdit::updateCaption( const QString &name ) { | |||
967 | if ( name.isEmpty() ) | 965 | if ( name.isEmpty() ) |
968 | setCaption( tr("Text Editor") ); | 966 | setCaption( tr("Text Editor") ); |
969 | else { | 967 | else { |
970 | QString s = name; | 968 | QString s = name; |
971 | if ( s.isNull() ) | 969 | if ( s.isNull() ) |
972 | s = doc->name(); | 970 | s = doc->name(); |
973 | if ( s.isEmpty() ) { | 971 | if ( s.isEmpty() ) { |
974 | s = tr( "Unnamed" ); | 972 | s = tr( "Unnamed" ); |
975 | currentFileName=s; | 973 | currentFileName=s; |
976 | } | 974 | } |
977 | // if(s.left(1) == "/") | 975 | // if(s.left(1) == "/") |
978 | // s = s.right(s.length()-1); | 976 | // s = s.right(s.length()-1); |
979 | setCaption( s + " - " + tr("Text Editor") ); | 977 | setCaption( tr("%1 - Text Editor").arg( s ) ); |
980 | } | 978 | } |
981 | } | 979 | } |
982 | 980 | ||
983 | void TextEdit::setDocument(const QString& fileref) { | 981 | void TextEdit::setDocument(const QString& fileref) { |
984 | if(fileref != "Unnamed") { | 982 | if(fileref != "Unnamed") { |
985 | currentFileName=fileref; | 983 | currentFileName=fileref; |
986 | qDebug("setDocument"); | 984 | qDebug("setDocument"); |
987 | QFileInfo fi(currentFileName); | 985 | QFileInfo fi(currentFileName); |
988 | qDebug("basename:"+fi.baseName()+": current filenmame "+currentFileName); | 986 | qDebug("basename:"+fi.baseName()+": current filenmame "+currentFileName); |
989 | if( (fi.baseName().left(1)).isEmpty() ) { | 987 | if( (fi.baseName().left(1)).isEmpty() ) { |
990 | openDotFile(currentFileName); | 988 | openDotFile(currentFileName); |
991 | 989 | ||
@@ -1013,25 +1011,25 @@ void TextEdit::changeFont() { | |||
1013 | 1011 | ||
1014 | d-> showMaximized ( ); | 1012 | d-> showMaximized ( ); |
1015 | if ( d-> exec ( ) == QDialog::Accepted ) | 1013 | if ( d-> exec ( ) == QDialog::Accepted ) |
1016 | editor-> setFont ( ofs-> selectedFont ( )); | 1014 | editor-> setFont ( ofs-> selectedFont ( )); |
1017 | delete d; | 1015 | delete d; |
1018 | 1016 | ||
1019 | } | 1017 | } |
1020 | 1018 | ||
1021 | void TextEdit::editDelete() { | 1019 | void TextEdit::editDelete() { |
1022 | switch ( QMessageBox::warning(this,tr("Text Editor"), | 1020 | switch ( QMessageBox::warning(this,tr("Text Editor"), |
1023 | tr("Do you really want<BR>to <B>delete</B> " | 1021 | tr("Do you really want<BR>to <B>delete</B> " |
1024 | "the current file\nfrom the disk?<BR>This is " | 1022 | "the current file\nfrom the disk?<BR>This is " |
1025 | "<B>irreversable!!</B>"), | 1023 | "<B>irreversable!</B>"), |
1026 | tr("Yes"),tr("No"),0,0,1) ) { | 1024 | tr("Yes"),tr("No"),0,0,1) ) { |
1027 | case 0: | 1025 | case 0: |
1028 | if(doc) { | 1026 | if(doc) { |
1029 | doc->removeFiles(); | 1027 | doc->removeFiles(); |
1030 | clear(); | 1028 | clear(); |
1031 | setCaption( tr("Text Editor") ); | 1029 | setCaption( tr("Text Editor") ); |
1032 | } | 1030 | } |
1033 | break; | 1031 | break; |
1034 | case 1: | 1032 | case 1: |
1035 | // exit | 1033 | // exit |
1036 | break; | 1034 | break; |
1037 | }; | 1035 | }; |
diff --git a/core/opie-login/main.cpp b/core/opie-login/main.cpp index d95a59b..7dcb5f6 100644 --- a/core/opie-login/main.cpp +++ b/core/opie-login/main.cpp | |||
@@ -45,44 +45,46 @@ | |||
45 | #include <qpe/qpestyle.h> | 45 | #include <qpe/qpestyle.h> |
46 | #include <qpe/power.h> | 46 | #include <qpe/power.h> |
47 | #include <qpe/config.h> | 47 | #include <qpe/config.h> |
48 | 48 | ||
49 | #include <opie/odevice.h> | 49 | #include <opie/odevice.h> |
50 | 50 | ||
51 | #include <qwindowsystem_qws.h> | 51 | #include <qwindowsystem_qws.h> |
52 | #include <qwsmouse_qws.h> | 52 | #include <qwsmouse_qws.h> |
53 | #include <qmessagebox.h> | 53 | #include <qmessagebox.h> |
54 | #include <qlabel.h> | 54 | #include <qlabel.h> |
55 | #include <qtimer.h> | 55 | #include <qtimer.h> |
56 | #include <qfile.h> | 56 | #include <qfile.h> |
57 | #include <qtextstream.h> | ||
57 | 58 | ||
58 | #include "loginapplication.h" | 59 | #include "loginapplication.h" |
59 | #include "loginwindowimpl.h" | 60 | #include "loginwindowimpl.h" |
60 | #include "calibrate.h" | 61 | #include "calibrate.h" |
61 | 62 | ||
62 | using namespace Opie; | 63 | using namespace Opie; |
63 | 64 | ||
64 | int login_main ( int argc, char **argv, pid_t ppid ); | 65 | int login_main ( int argc, char **argv, pid_t ppid ); |
65 | void sigterm ( int sig ); | 66 | void sigterm ( int sig ); |
66 | void sigint ( int sig ); | 67 | void sigint ( int sig ); |
67 | void exit_closelog ( ); | 68 | void exit_closelog ( ); |
68 | 69 | ||
69 | static struct option long_options [] = { | 70 | static struct option long_options [] = { |
70 | { "autologin", 1, 0, 'a' }, | 71 | { "autologin", 1, 0, 'a' }, |
71 | { 0, 0, 0, 0 } | 72 | { 0, 0, 0, 0 } |
72 | }; | 73 | }; |
73 | 74 | ||
74 | 75 | ||
75 | int main ( int argc, char **argv ) | 76 | int main ( int argc, char **argv ) |
76 | { | 77 | { |
78 | int userExited = 0; | ||
77 | pid_t ppid = ::getpid ( ); | 79 | pid_t ppid = ::getpid ( ); |
78 | 80 | ||
79 | if ( ::geteuid ( ) != 0 ) { | 81 | if ( ::geteuid ( ) != 0 ) { |
80 | ::fprintf ( stderr, "%s can only be executed by root. (or chmod +s)", argv [0] ); | 82 | ::fprintf ( stderr, "%s can only be executed by root. (or chmod +s)", argv [0] ); |
81 | return 1; | 83 | return 1; |
82 | } | 84 | } |
83 | if ( ::getuid ( ) != 0 ) // qt doesn't really like SUID and | 85 | if ( ::getuid ( ) != 0 ) // qt doesn't really like SUID and |
84 | ::setuid ( 0 ); // messes up things like config files | 86 | ::setuid ( 0 ); // messes up things like config files |
85 | 87 | ||
86 | char *autolog = 0; | 88 | char *autolog = 0; |
87 | int c; | 89 | int c; |
88 | while (( c = ::getopt_long ( argc, argv, "a:", long_options, 0 )) != -1 ) { | 90 | while (( c = ::getopt_long ( argc, argv, "a:", long_options, 0 )) != -1 ) { |
@@ -128,82 +130,96 @@ int main ( int argc, char **argv ) | |||
128 | 130 | ||
129 | if (( ::time ( 0 ) - started ) < 3 ) { | 131 | if (( ::time ( 0 ) - started ) < 3 ) { |
130 | if ( autolog ) { | 132 | if ( autolog ) { |
131 | ::syslog ( LOG_ERR, "Respawning too fast -- disabling auto-login\n" ); | 133 | ::syslog ( LOG_ERR, "Respawning too fast -- disabling auto-login\n" ); |
132 | autolog = 0; | 134 | autolog = 0; |
133 | } | 135 | } |
134 | else { | 136 | else { |
135 | ::syslog ( LOG_ERR, "Respawning too fast -- going down\n" ); | 137 | ::syslog ( LOG_ERR, "Respawning too fast -- going down\n" ); |
136 | break; | 138 | break; |
137 | } | 139 | } |
138 | } | 140 | } |
139 | int killedbysig = 0; | 141 | int killedbysig = 0; |
142 | userExited=0; | ||
143 | if (WIFEXITED(status)!=0 ) { | ||
144 | if (WEXITSTATUS(status)==137) { | ||
145 | userExited=1; | ||
146 | } | ||
147 | } | ||
140 | 148 | ||
141 | if ( WIFSIGNALED( status )) { | 149 | if ( WIFSIGNALED( status )) { |
142 | switch ( WTERMSIG( status )) { | 150 | switch ( WTERMSIG( status )) { |
143 | case SIGINT : | ||
144 | case SIGTERM: | 151 | case SIGTERM: |
152 | case SIGINT : | ||
145 | case SIGKILL: | 153 | case SIGKILL: |
146 | break; | 154 | break; |
147 | 155 | ||
148 | default : | 156 | default : |
149 | killedbysig = WTERMSIG( status ); | 157 | killedbysig = WTERMSIG( status ); |
150 | break; | 158 | break; |
151 | } | 159 | } |
152 | } | 160 | } |
153 | if ( killedbysig ) { // qpe was killed by an uncaught signal | 161 | if ( killedbysig ) { // qpe was killed by an uncaught signal |
154 | qApp = 0; | 162 | qApp = 0; |
155 | 163 | ||
156 | ::syslog ( LOG_ERR, "Opie was killed by a signal #%d", killedbysig ); | 164 | ::syslog ( LOG_ERR, "Opie was killed by a signal #%d", killedbysig ); |
157 | 165 | ||
158 | QWSServer::setDesktopBackground ( QImage ( )); | 166 | QWSServer::setDesktopBackground ( QImage ( )); |
159 | QApplication *app = new QApplication ( argc, argv, QApplication::GuiServer ); | 167 | QApplication *app = new QApplication ( argc, argv, QApplication::GuiServer ); |
160 | app-> setFont ( QFont ( "Helvetica", 10 )); | 168 | app-> setFont ( QFont ( "Helvetica", 10 )); |
161 | app-> setStyle ( new QPEStyle ( )); | 169 | app-> setStyle ( new QPEStyle ( )); |
162 | 170 | ||
163 | const char *sig = ::strsignal ( killedbysig ); | 171 | const char *sig = ::strsignal ( killedbysig ); |
164 | QLabel *l = new QLabel ( 0, "sig", Qt::WStyle_Customize | Qt::WStyle_NoBorder | Qt::WStyle_Tool ); | 172 | QLabel *l = new QLabel ( 0, "sig", Qt::WStyle_Customize | Qt::WStyle_NoBorder | Qt::WStyle_Tool ); |
165 | l-> setText ( LoginWindowImpl::tr( "OPIE was terminated\nby an uncaught signal\n(%1)\n" ). arg ( sig )); | 173 | l-> setText ( LoginWindowImpl::tr( "Opie was terminated\nby an uncaught signal\n(%1)\n" ). arg ( sig )); |
166 | l-> setAlignment ( Qt::AlignCenter ); | 174 | l-> setAlignment ( Qt::AlignCenter ); |
167 | l-> move ( 0, 0 ); | 175 | l-> move ( 0, 0 ); |
168 | l-> resize ( app-> desktop ( )-> width ( ), app-> desktop ( )-> height ( )); | 176 | l-> resize ( app-> desktop ( )-> width ( ), app-> desktop ( )-> height ( )); |
169 | l-> show ( ); | 177 | l-> show ( ); |
170 | QTimer::singleShot ( 3000, app, SLOT( quit ( ))); | 178 | QTimer::singleShot ( 3000, app, SLOT( quit ( ))); |
171 | app-> exec ( ); | 179 | app-> exec ( ); |
172 | delete app; | 180 | delete app; |
173 | qApp = 0; | 181 | qApp = 0; |
174 | } | 182 | } |
175 | } | 183 | } |
176 | else { | 184 | else { |
177 | if ( !autolog ) { | 185 | if ( !autolog ) { |
178 | Config cfg ( "opie-login" ); | 186 | QString confFile=QPEApplication::qpeDir() + "/etc/opie-login.conf"; |
187 | Config cfg ( confFile, Config::File ); | ||
179 | cfg. setGroup ( "General" ); | 188 | cfg. setGroup ( "General" ); |
180 | QString user = cfg. readEntry ( "AutoLogin" ); | 189 | QString user = cfg. readEntry ( "AutoLogin" ); |
181 | 190 | ||
182 | if ( !user. isEmpty ( )) | 191 | if ( !user. isEmpty ( )) |
183 | autolog = ::strdup ( user. latin1 ( )); | 192 | autolog = ::strdup ( user. latin1 ( )); |
184 | } | 193 | } |
185 | 194 | ||
186 | if ( autolog ) { | 195 | if ( autolog && !userExited ) { |
196 | |||
197 | QWSServer::setDesktopBackground( QImage() ); | ||
198 | ODevice::inst ( )-> setDisplayStatus ( true ); | ||
199 | ODevice::inst ( )-> setSoftSuspend ( false ); | ||
200 | LoginApplication *app = new LoginApplication ( argc, argv, ppid ); | ||
187 | LoginApplication::setLoginAs ( autolog ); | 201 | LoginApplication::setLoginAs ( autolog ); |
188 | 202 | ||
203 | |||
189 | if ( LoginApplication::changeIdentity ( )) | 204 | if ( LoginApplication::changeIdentity ( )) |
190 | ::exit ( LoginApplication::login ( )); | 205 | ::exit ( LoginApplication::login ( )); |
191 | else | 206 | else |
192 | ::exit ( 0 ); | 207 | ::exit ( 0 ); |
193 | } | 208 | } |
194 | else | 209 | else { |
195 | ::exit ( login_main ( argc, argv, ppid )); | 210 | ::exit ( login_main ( argc, argv, ppid )); |
196 | } | 211 | } |
197 | } | 212 | } |
213 | } | ||
198 | return 0; | 214 | return 0; |
199 | } | 215 | } |
200 | 216 | ||
201 | void sigterm ( int /*sig*/ ) | 217 | void sigterm ( int /*sig*/ ) |
202 | { | 218 | { |
203 | ::exit ( 0 ); | 219 | ::exit ( 0 ); |
204 | } | 220 | } |
205 | 221 | ||
206 | 222 | ||
207 | void exit_closelog ( ) | 223 | void exit_closelog ( ) |
208 | { | 224 | { |
209 | ::closelog ( ); | 225 | ::closelog ( ); |
@@ -346,24 +362,24 @@ int login_main ( int argc, char **argv, pid_t ppid ) | |||
346 | lw-> show ( ); | 362 | lw-> show ( ); |
347 | 363 | ||
348 | int rc = app-> exec ( ); | 364 | int rc = app-> exec ( ); |
349 | 365 | ||
350 | ODevice::inst ( )-> setSoftSuspend ( false ); | 366 | ODevice::inst ( )-> setSoftSuspend ( false ); |
351 | 367 | ||
352 | if ( app-> loginAs ( )) { | 368 | if ( app-> loginAs ( )) { |
353 | if ( app-> changeIdentity ( )) { | 369 | if ( app-> changeIdentity ( )) { |
354 | app-> login ( ); | 370 | app-> login ( ); |
355 | 371 | ||
356 | // if login succeeds, it never comes back | 372 | // if login succeeds, it never comes back |
357 | 373 | ||
358 | QMessageBox::critical ( 0, LoginWindowImpl::tr( "Failure" ), LoginWindowImpl::tr( "Could not start OPIE." )); | 374 | QMessageBox::critical ( 0, LoginWindowImpl::tr( "Failure" ), LoginWindowImpl::tr( "Could not start Opie." )); |
359 | rc = 1; | 375 | rc = 1; |
360 | } | 376 | } |
361 | else { | 377 | else { |
362 | QMessageBox::critical ( 0, LoginWindowImpl::tr( "Failure" ), LoginWindowImpl::tr( "Could not switch to new user identity" )); | 378 | QMessageBox::critical ( 0, LoginWindowImpl::tr( "Failure" ), LoginWindowImpl::tr( "Could not switch to new user identity" )); |
363 | rc = 2; | 379 | rc = 2; |
364 | } | 380 | } |
365 | 381 | ||
366 | } | 382 | } |
367 | return rc; | 383 | return rc; |
368 | } | 384 | } |
369 | 385 | ||
diff --git a/core/opie-login/opie-login.conffiles b/core/opie-login/opie-login.conffiles new file mode 100644 index 0000000..90645ee --- a/dev/null +++ b/core/opie-login/opie-login.conffiles | |||
@@ -0,0 +1 @@ | |||
/opt/QtPalmtop/etc/opie-login.conf | |||
diff --git a/core/opiealarm/Makefile b/core/opiealarm/Makefile index 0c8467e..255083d 100644 --- a/core/opiealarm/Makefile +++ b/core/opiealarm/Makefile | |||
@@ -11,16 +11,12 @@ LDFLAGS:= | |||
11 | 11 | ||
12 | all: $(DESTDIR)/opiealarm | 12 | all: $(DESTDIR)/opiealarm |
13 | 13 | ||
14 | $(DESTDIR)/opiealarm: opiealarm.c | 14 | $(DESTDIR)/opiealarm: opiealarm.c |
15 | $(CC) $(CFLAGS) opiealarm.c -o $(DESTDIR)/opiealarm $(LDFLAGS) | 15 | $(CC) $(CFLAGS) opiealarm.c -o $(DESTDIR)/opiealarm $(LDFLAGS) |
16 | $(STRIP) --strip-all $(DESTDIR)/opiealarm | 16 | $(STRIP) --strip-all $(DESTDIR)/opiealarm |
17 | chmod u+s $(DESTDIR)/opiealarm | 17 | chmod u+s $(DESTDIR)/opiealarm |
18 | chown root $(DESTDIR)/opiealarm 2>/dev/null || echo -e "\nopiealarm must be owned by root to work correctly.\n" | 18 | chown root $(DESTDIR)/opiealarm 2>/dev/null || echo -e "\nopiealarm must be owned by root to work correctly.\n" |
19 | 19 | ||
20 | clean: | 20 | clean: |
21 | -rm -f *~ core | 21 | -rm -f *~ core |
22 | 22 | ||
23 | install: | ||
24 | cp $(DESTDIR)/opiealarm $(INSTALL_ROOT)/opt/QtPalmtop/bin | ||
25 | chown root $(INSTALL_ROOT)/opt/QtPalmtop/bin/opiealarm | ||
26 | chmod u+s $(INSTALL_ROOT)/opt/QtPalmtop/bin/opiealarm 2>/dev/null || echo -e "\nopiealarm must be owned by root to work correctly.\n" | ||
diff --git a/core/opiealarm/config.in b/core/opiealarm/config.in index 2be9bd4..f86d01c 100644 --- a/core/opiealarm/config.in +++ b/core/opiealarm/config.in | |||
@@ -1,4 +1,4 @@ | |||
1 | config OPIEALARM | 1 | config OPIEALARM |
2 | boolean "opie-opiealarm (Alarm daemon, sets RTC with wakeup time on suspend)" | 2 | boolean "Opiealarm (Alarm daemon, sets RTC with wakeup time on suspend)" |
3 | depends ! TARGET_X86 | 3 | depends ! TARGET_X86 |
4 | default "y" | 4 | default "y" |
diff --git a/core/opiealarm/opiealarm.c b/core/opiealarm/opiealarm.c index 998cabd..90a743f 100644 --- a/core/opiealarm/opiealarm.c +++ b/core/opiealarm/opiealarm.c | |||
@@ -84,24 +84,25 @@ int fork_with_pidfile ( void ) | |||
84 | // Solution: just wait for SIGUSR1 - the child process will | 84 | // Solution: just wait for SIGUSR1 - the child process will |
85 | // signal this when it thinks it is safe to exit. | 85 | // signal this when it thinks it is safe to exit. |
86 | 86 | ||
87 | signal ( SIGUSR1, sig_handler_parent ); | 87 | signal ( SIGUSR1, sig_handler_parent ); |
88 | while ( 1 ) | 88 | while ( 1 ) |
89 | sleep ( 1000 ); | 89 | sleep ( 1000 ); |
90 | exit ( 0 ); | 90 | exit ( 0 ); |
91 | } | 91 | } |
92 | else if ( pid < 0 ) { | 92 | else if ( pid < 0 ) { |
93 | perror ( "forking failed" ); | 93 | perror ( "forking failed" ); |
94 | return 0; | 94 | return 0; |
95 | } | 95 | } |
96 | //sleep( 60 ); | ||
96 | 97 | ||
97 | // child process needs to react to SIGUSR2. This is sent when | 98 | // child process needs to react to SIGUSR2. This is sent when |
98 | // a new opiealarm process is started. | 99 | // a new opiealarm process is started. |
99 | 100 | ||
100 | signal ( SIGUSR2, sig_handler_child ); | 101 | signal ( SIGUSR2, sig_handler_child ); |
101 | 102 | ||
102 | // save pid | 103 | // save pid |
103 | if (( fp = fopen ( PIDFILE, "w" ))) { | 104 | if (( fp = fopen ( PIDFILE, "w" ))) { |
104 | fprintf ( fp, "%d", getpid ( )); | 105 | fprintf ( fp, "%d", getpid ( )); |
105 | fclose ( fp ); | 106 | fclose ( fp ); |
106 | 107 | ||
107 | // detach | 108 | // detach |
@@ -197,25 +198,25 @@ int main ( int argc, char **argv ) | |||
197 | case 's': | 198 | case 's': |
198 | default : opt = suspend ( fix_rtc ); | 199 | default : opt = suspend ( fix_rtc ); |
199 | break; | 200 | break; |
200 | } | 201 | } |
201 | 202 | ||
202 | parent_pid = 0; | 203 | parent_pid = 0; |
203 | return opt; | 204 | return opt; |
204 | } | 205 | } |
205 | 206 | ||
206 | 207 | ||
207 | int suspend ( int fix_rtc ) | 208 | int suspend ( int fix_rtc ) |
208 | { | 209 | { |
209 | FILE *fp; | 210 | FILE *fp = NULL; |
210 | char buf [64]; | 211 | char buf [64]; |
211 | time_t alrt, syst, rtct; | 212 | time_t alrt, syst, rtct; |
212 | struct tm alr, sys, rtc; | 213 | struct tm alr, sys, rtc; |
213 | int fd; | 214 | int fd; |
214 | int rtc_sys_diff; | 215 | int rtc_sys_diff; |
215 | 216 | ||
216 | 217 | ||
217 | if ( !fork_with_pidfile ( )) | 218 | if ( !fork_with_pidfile ( )) |
218 | return 3; | 219 | return 3; |
219 | 220 | ||
220 | // we are the child process from here on ... | 221 | // we are the child process from here on ... |
221 | 222 | ||
@@ -249,25 +250,25 @@ int suspend ( int fix_rtc ) | |||
249 | if ( ioctl ( fd, RTC_SET_TIME, &set ) < 0 ) | 250 | if ( ioctl ( fd, RTC_SET_TIME, &set ) < 0 ) |
250 | break; // ( 1, "ioctl RTC_SET_TIME" ); | 251 | break; // ( 1, "ioctl RTC_SET_TIME" ); |
251 | } | 252 | } |
252 | 253 | ||
253 | // read the wakeup time from TIMEFILE | 254 | // read the wakeup time from TIMEFILE |
254 | if (!( fp = fopen ( TIMEFILE, "r" ))) | 255 | if (!( fp = fopen ( TIMEFILE, "r" ))) |
255 | break; // ( 1, TIMEFILE ); | 256 | break; // ( 1, TIMEFILE ); |
256 | 257 | ||
257 | if ( !fgets ( buf, sizeof( buf ) - 1, fp )) | 258 | if ( !fgets ( buf, sizeof( buf ) - 1, fp )) |
258 | break; // ( 1, TIMEFILE ); | 259 | break; // ( 1, TIMEFILE ); |
259 | 260 | ||
260 | fclose ( fp ); | 261 | fclose ( fp ); |
261 | fp = 0; | 262 | fp = NULL; |
262 | 263 | ||
263 | alrt = atoi ( buf ); // get the alarm time | 264 | alrt = atoi ( buf ); // get the alarm time |
264 | 265 | ||
265 | if ( alrt == 0 ) | 266 | if ( alrt == 0 ) |
266 | break; // ( 0, TIMEFILE " contains an invalid time description" ); | 267 | break; // ( 0, TIMEFILE " contains an invalid time description" ); |
267 | alrt -= 5; // wake up 5 sec before the specified time | 268 | alrt -= 5; // wake up 5 sec before the specified time |
268 | 269 | ||
269 | alr = *gmtime ( &alrt ); | 270 | alr = *gmtime ( &alrt ); |
270 | 271 | ||
271 | if ( ioctl ( fd, RTC_ALM_SET, &alr ) < 0 ) // set RTC alarm time | 272 | if ( ioctl ( fd, RTC_ALM_SET, &alr ) < 0 ) // set RTC alarm time |
272 | break; // ( 1, "ioctl RTC_ALM_SET" ); | 273 | break; // ( 1, "ioctl RTC_ALM_SET" ); |
273 | 274 | ||
diff --git a/core/settings/launcher/tabdialog.cpp b/core/settings/launcher/tabdialog.cpp index 5f68010..de99a09 100644 --- a/core/settings/launcher/tabdialog.cpp +++ b/core/settings/launcher/tabdialog.cpp | |||
@@ -82,27 +82,27 @@ public: | |||
82 | setItemsMovable ( false ); | 82 | setItemsMovable ( false ); |
83 | setAutoArrange ( true ); | 83 | setAutoArrange ( true ); |
84 | setSorting ( true ); | 84 | setSorting ( true ); |
85 | setFrameStyle ( QFrame::NoFrame ); | 85 | setFrameStyle ( QFrame::NoFrame ); |
86 | setSpacing ( 4 ); | 86 | setSpacing ( 4 ); |
87 | setMargin ( 0 ); | 87 | setMargin ( 0 ); |
88 | setSelectionMode ( QIconView::NoSelection ); | 88 | setSelectionMode ( QIconView::NoSelection ); |
89 | setBackgroundMode ( PaletteBase ); | 89 | setBackgroundMode ( PaletteBase ); |
90 | setViewMode ( TabConfig::Icon ); | 90 | setViewMode ( TabConfig::Icon ); |
91 | calculateGrid ( Bottom ); | 91 | calculateGrid ( Bottom ); |
92 | 92 | ||
93 | 93 | ||
94 | new SampleItem ( this, tr( "Sample 1" ), Resource::loadPixmap ( "datebook/DateBook" )); | 94 | new SampleItem ( this, QObject::tr( "Sample 1" ), Resource::loadPixmap ( "datebook/DateBook" )); |
95 | new SampleItem ( this, tr( "Sample 2" ), Resource::loadPixmap ( "Calibrate" )); | 95 | new SampleItem ( this, QObject::tr( "Sample 2" ), Resource::loadPixmap ( "Calibrate" )); |
96 | new SampleItem ( this, tr( "Sample 3" ), Resource::loadPixmap ( "UnknownDocument" )); | 96 | new SampleItem ( this, QObject::tr( "Sample 3" ), Resource::loadPixmap ( "UnknownDocument" )); |
97 | 97 | ||
98 | setBackgroundType ( TabConfig::Ruled, QString::null ); | 98 | setBackgroundType ( TabConfig::Ruled, QString::null ); |
99 | 99 | ||
100 | setMaximumHeight ( firstItem ( )-> height ( ) + 16 ); | 100 | setMaximumHeight ( firstItem ( )-> height ( ) + 16 ); |
101 | } | 101 | } |
102 | 102 | ||
103 | void setViewMode ( TabConfig::ViewMode m ) | 103 | void setViewMode ( TabConfig::ViewMode m ) |
104 | { | 104 | { |
105 | viewport ( )-> setUpdatesEnabled ( false ); | 105 | viewport ( )-> setUpdatesEnabled ( false ); |
106 | 106 | ||
107 | switch ( m ) { | 107 | switch ( m ) { |
108 | case TabConfig::List: | 108 | case TabConfig::List: |
diff --git a/core/settings/security/security.cpp b/core/settings/security/security.cpp index 4701506..75a181b 100644 --- a/core/settings/security/security.cpp +++ b/core/settings/security/security.cpp | |||
@@ -10,32 +10,36 @@ | |||
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #include "security.h" | 20 | #include "security.h" |
21 | 21 | ||
22 | #include <qpe/qpeapplication.h> | ||
22 | #include <qpe/config.h> | 23 | #include <qpe/config.h> |
23 | #include <qpe/password.h> | 24 | #include <qpe/password.h> |
24 | #include <qpe/qpedialog.h> | 25 | #include <qpe/qpedialog.h> |
25 | 26 | ||
26 | #include <qcheckbox.h> | 27 | #include <qcheckbox.h> |
27 | #include <qpushbutton.h> | 28 | #include <qpushbutton.h> |
28 | #include <qcombobox.h> | 29 | #include <qcombobox.h> |
29 | #include <qmessagebox.h> | 30 | #include <qmessagebox.h> |
31 | #include <qfile.h> | ||
32 | #include <qlistview.h> | ||
33 | #include <qtextstream.h> | ||
30 | 34 | ||
31 | Security::Security( QWidget* parent, const char* name, WFlags fl ) | 35 | Security::Security( QWidget* parent, const char* name, WFlags fl ) |
32 | : SecurityBase( parent, name, TRUE, fl ) | 36 | : SecurityBase( parent, name, TRUE, fl ) |
33 | { | 37 | { |
34 | valid=FALSE; | 38 | valid=FALSE; |
35 | Config cfg("Security"); | 39 | Config cfg("Security"); |
36 | cfg.setGroup("Passcode"); | 40 | cfg.setGroup("Passcode"); |
37 | passcode = cfg.readEntry("passcode"); | 41 | passcode = cfg.readEntry("passcode"); |
38 | passcode_poweron->setChecked(cfg.readBoolEntry("passcode_poweron",FALSE)); | 42 | passcode_poweron->setChecked(cfg.readBoolEntry("passcode_poweron",FALSE)); |
39 | cfg.setGroup("Sync"); | 43 | cfg.setGroup("Sync"); |
40 | int auth_peer = cfg.readNumEntry("auth_peer",0xc0a88100);//new default 192.168.129.0/24 | 44 | int auth_peer = cfg.readNumEntry("auth_peer",0xc0a88100);//new default 192.168.129.0/24 |
41 | int auth_peer_bits = cfg.readNumEntry("auth_peer_bits",24); | 45 | int auth_peer_bits = cfg.readNumEntry("auth_peer_bits",24); |
@@ -47,45 +51,66 @@ Security::Security( QWidget* parent, const char* name, WFlags fl ) | |||
47 | cfg.setGroup("Remote"); | 51 | cfg.setGroup("Remote"); |
48 | if ( telnetAvailable() ) | 52 | if ( telnetAvailable() ) |
49 | telnet->setChecked(cfg.readEntry("allow_telnet")); | 53 | telnet->setChecked(cfg.readEntry("allow_telnet")); |
50 | else | 54 | else |
51 | telnet->hide(); | 55 | telnet->hide(); |
52 | 56 | ||
53 | if ( sshAvailable() ) | 57 | if ( sshAvailable() ) |
54 | ssh->setChecked(cfg.readEntry("allow_ssh")); | 58 | ssh->setChecked(cfg.readEntry("allow_ssh")); |
55 | else | 59 | else |
56 | ssh->hide(); | 60 | ssh->hide(); |
57 | */ | 61 | */ |
58 | 62 | ||
63 | QString configFile = QPEApplication::qpeDir() + "/etc/opie-login.conf"; | ||
64 | Config loginCfg(configFile,Config::File); | ||
65 | |||
66 | loginCfg.setGroup("General"); | ||
67 | autoLoginName=loginCfg.readEntry("AutoLogin",""); | ||
68 | |||
69 | if (autoLoginName.stripWhiteSpace().isEmpty()) { | ||
70 | autoLogin=false; | ||
71 | } else { | ||
72 | autoLogin=true; | ||
73 | } | ||
74 | |||
75 | |||
76 | connect(autologinToggle, SIGNAL(toggled(bool)), this, SLOT(toggleAutoLogin(bool))); | ||
77 | connect(userlist, SIGNAL(activated(int)), this, SLOT(changeLoginName(int))); | ||
59 | connect(changepasscode,SIGNAL(clicked()), this, SLOT(changePassCode())); | 78 | connect(changepasscode,SIGNAL(clicked()), this, SLOT(changePassCode())); |
60 | connect(clearpasscode,SIGNAL(clicked()), this, SLOT(clearPassCode())); | 79 | connect(clearpasscode,SIGNAL(clicked()), this, SLOT(clearPassCode())); |
80 | |||
81 | loadUsers(); | ||
61 | updateGUI(); | 82 | updateGUI(); |
62 | 83 | ||
63 | dl = new QPEDialogListener(this); | 84 | dl = new QPEDialogListener(this); |
64 | showMaximized(); | 85 | showMaximized(); |
65 | } | 86 | } |
66 | 87 | ||
67 | Security::~Security() | 88 | Security::~Security() |
68 | { | 89 | { |
69 | } | 90 | } |
70 | 91 | ||
71 | 92 | ||
72 | void Security::updateGUI() | 93 | void Security::updateGUI() |
73 | { | 94 | { |
74 | bool empty = passcode.isEmpty(); | 95 | bool empty = passcode.isEmpty(); |
75 | 96 | ||
76 | changepasscode->setText( empty ? tr("Set passcode" ) | 97 | changepasscode->setText( empty ? tr("Set passcode" ) |
77 | : tr("Change passcode" ) ); | 98 | : tr("Change passcode" ) ); |
78 | passcode_poweron->setEnabled( !empty ); | 99 | passcode_poweron->setEnabled( !empty ); |
79 | clearpasscode->setEnabled( !empty ); | 100 | clearpasscode->setEnabled( !empty ); |
101 | |||
102 | autologinToggle->setChecked(autoLogin); | ||
103 | userlist->setEnabled(autoLogin); | ||
104 | |||
80 | } | 105 | } |
81 | 106 | ||
82 | 107 | ||
83 | void Security::show() | 108 | void Security::show() |
84 | { | 109 | { |
85 | valid=FALSE; | 110 | valid=FALSE; |
86 | setEnabled(FALSE); | 111 | setEnabled(FALSE); |
87 | SecurityBase::show(); | 112 | SecurityBase::show(); |
88 | if ( passcode.isEmpty() ) { | 113 | if ( passcode.isEmpty() ) { |
89 | // could insist... | 114 | // could insist... |
90 | //changePassCode(); | 115 | //changePassCode(); |
91 | //if ( passcode.isEmpty() ) | 116 | //if ( passcode.isEmpty() ) |
@@ -151,24 +176,54 @@ void Security::parseNet(const QString& sn,int& auth_peer,int& auth_peer_bits) | |||
151 | } else { | 176 | } else { |
152 | int x=0; | 177 | int x=0; |
153 | for (int i=0; i<4; i++) { | 178 | for (int i=0; i<4; i++) { |
154 | int nx = sn.find(QChar(i==3 ? '/' : '.'),x); | 179 | int nx = sn.find(QChar(i==3 ? '/' : '.'),x); |
155 | auth_peer = (auth_peer<<8)|sn.mid(x,nx-x).toInt(); | 180 | auth_peer = (auth_peer<<8)|sn.mid(x,nx-x).toInt(); |
156 | x = nx+1; | 181 | x = nx+1; |
157 | } | 182 | } |
158 | uint n = (uint)sn.find(' ',x)-x; | 183 | uint n = (uint)sn.find(' ',x)-x; |
159 | auth_peer_bits = sn.mid(x,n).toInt(); | 184 | auth_peer_bits = sn.mid(x,n).toInt(); |
160 | } | 185 | } |
161 | } | 186 | } |
162 | 187 | ||
188 | void Security::loadUsers ( void ) | ||
189 | { | ||
190 | QFile passwd("/etc/passwd"); | ||
191 | if ( passwd.open(IO_ReadOnly) ) { | ||
192 | QTextStream t( &passwd ); | ||
193 | QString s; | ||
194 | QStringList account; | ||
195 | while ( !t.eof() ) { | ||
196 | account = QStringList::split(':',t.readLine()); | ||
197 | |||
198 | // Hide disabled accounts | ||
199 | if (*account.at(1)!="*") { | ||
200 | |||
201 | userlist->insertItem(*account.at(0)); | ||
202 | // Highlight this item if it is set to autologinToggle | ||
203 | if ( *account.at(0) == autoLoginName) | ||
204 | userlist->setCurrentItem(userlist->count()-1); | ||
205 | } | ||
206 | } | ||
207 | passwd.close(); | ||
208 | } | ||
209 | |||
210 | } | ||
211 | void Security::toggleAutoLogin(bool val) | ||
212 | { | ||
213 | autoLogin=val; | ||
214 | userlist->setEnabled(val); | ||
215 | if (!autoLogin) | ||
216 | autoLoginName=userlist->currentText(); | ||
217 | } | ||
163 | void Security::setSyncNet(const QString& sn) | 218 | void Security::setSyncNet(const QString& sn) |
164 | { | 219 | { |
165 | int auth_peer,auth_peer_bits; | 220 | int auth_peer,auth_peer_bits; |
166 | parseNet(sn,auth_peer,auth_peer_bits); | 221 | parseNet(sn,auth_peer,auth_peer_bits); |
167 | selectNet(auth_peer,auth_peer_bits); | 222 | selectNet(auth_peer,auth_peer_bits); |
168 | } | 223 | } |
169 | 224 | ||
170 | void Security::applySecurity() | 225 | void Security::applySecurity() |
171 | { | 226 | { |
172 | if ( valid ) { | 227 | if ( valid ) { |
173 | Config cfg("Security"); | 228 | Config cfg("Security"); |
174 | cfg.setGroup("Passcode"); | 229 | cfg.setGroup("Passcode"); |
@@ -180,25 +235,42 @@ void Security::applySecurity() | |||
180 | QString sn = syncnet->currentText(); | 235 | QString sn = syncnet->currentText(); |
181 | parseNet(sn,auth_peer,auth_peer_bits); | 236 | parseNet(sn,auth_peer,auth_peer_bits); |
182 | cfg.writeEntry("auth_peer",auth_peer); | 237 | cfg.writeEntry("auth_peer",auth_peer); |
183 | cfg.writeEntry("auth_peer_bits",auth_peer_bits); | 238 | cfg.writeEntry("auth_peer_bits",auth_peer_bits); |
184 | /* | 239 | /* |
185 | cfg.setGroup("Remote"); | 240 | cfg.setGroup("Remote"); |
186 | if ( telnetAvailable() ) | 241 | if ( telnetAvailable() ) |
187 | cfg.writeEntry("allow_telnet",telnet->isChecked()); | 242 | cfg.writeEntry("allow_telnet",telnet->isChecked()); |
188 | if ( sshAvailable() ) | 243 | if ( sshAvailable() ) |
189 | cfg.writeEntry("allow_ssh",ssh->isChecked()); | 244 | cfg.writeEntry("allow_ssh",ssh->isChecked()); |
190 | // ### write ssh/telnet sys config files | 245 | // ### write ssh/telnet sys config files |
191 | */ | 246 | */ |
247 | |||
248 | QString configFile = QPEApplication::qpeDir() + "/etc/opie-login.conf"; | ||
249 | Config loginCfg(configFile,Config::File); | ||
250 | loginCfg.setGroup("General"); | ||
251 | |||
252 | if (autoLogin) { | ||
253 | loginCfg.writeEntry("AutoLogin",autoLoginName); | ||
254 | } else { | ||
255 | loginCfg.removeEntry("AutoLogin"); | ||
256 | } | ||
257 | |||
258 | } | ||
192 | } | 259 | } |
260 | |||
261 | void Security::changeLoginName( int idx ) | ||
262 | { | ||
263 | autoLoginName = userlist->text(idx);; | ||
264 | updateGUI(); | ||
193 | } | 265 | } |
194 | 266 | ||
195 | void Security::changePassCode() | 267 | void Security::changePassCode() |
196 | { | 268 | { |
197 | QString new1; | 269 | QString new1; |
198 | QString new2; | 270 | QString new2; |
199 | 271 | ||
200 | do { | 272 | do { |
201 | new1 = enterPassCode(tr("Enter new passcode")); | 273 | new1 = enterPassCode(tr("Enter new passcode")); |
202 | if ( new1.isNull() ) | 274 | if ( new1.isNull() ) |
203 | return; | 275 | return; |
204 | new2 = enterPassCode(tr("Re-enter new passcode")); | 276 | new2 = enterPassCode(tr("Re-enter new passcode")); |
diff --git a/core/settings/security/security.h b/core/settings/security/security.h index efc83a2..2f18f91 100644 --- a/core/settings/security/security.h +++ b/core/settings/security/security.h | |||
@@ -34,31 +34,37 @@ public: | |||
34 | 34 | ||
35 | void show(); | 35 | void show(); |
36 | 36 | ||
37 | protected: | 37 | protected: |
38 | void accept(); | 38 | void accept(); |
39 | void applySecurity(); | 39 | void applySecurity(); |
40 | void done(int); | 40 | void done(int); |
41 | 41 | ||
42 | private slots: | 42 | private slots: |
43 | void changePassCode(); | 43 | void changePassCode(); |
44 | void clearPassCode(); | 44 | void clearPassCode(); |
45 | void setSyncNet(const QString&); | 45 | void setSyncNet(const QString&); |
46 | void changeLoginName(int); | ||
47 | void toggleAutoLogin(bool); | ||
48 | |||
46 | 49 | ||
47 | private: | 50 | private: |
51 | void loadUsers(void); | ||
48 | bool telnetAvailable() const; | 52 | bool telnetAvailable() const; |
49 | bool sshAvailable() const; | 53 | bool sshAvailable() const; |
50 | void updateGUI(); | 54 | void updateGUI(); |
51 | 55 | ||
52 | static void parseNet(const QString& sn,int& auth_peer,int& auth_peer_bits); | 56 | static void parseNet(const QString& sn,int& auth_peer,int& auth_peer_bits); |
53 | void selectNet(int auth_peer,int auth_peer_bits); | 57 | void selectNet(int auth_peer,int auth_peer_bits); |
54 | 58 | ||
55 | QString enterPassCode(const QString&); | 59 | QString enterPassCode(const QString&); |
56 | QString passcode; | 60 | QString passcode; |
57 | bool valid; | 61 | bool valid; |
62 | bool autoLogin; | ||
63 | QString autoLoginName; | ||
58 | 64 | ||
59 | QPEDialogListener *dl; | 65 | QPEDialogListener *dl; |
60 | }; | 66 | }; |
61 | 67 | ||
62 | 68 | ||
63 | #endif // SECURITY_H | 69 | #endif // SECURITY_H |
64 | 70 | ||
diff --git a/core/settings/security/securitybase.ui b/core/settings/security/securitybase.ui index c2a8953..da25f39 100644 --- a/core/settings/security/securitybase.ui +++ b/core/settings/security/securitybase.ui | |||
@@ -2,48 +2,95 @@ | |||
2 | <class>SecurityBase</class> | 2 | <class>SecurityBase</class> |
3 | <widget> | 3 | <widget> |
4 | <class>QDialog</class> | 4 | <class>QDialog</class> |
5 | <property stdset="1"> | 5 | <property stdset="1"> |
6 | <name>name</name> | 6 | <name>name</name> |
7 | <cstring>SecurityBase</cstring> | 7 | <cstring>SecurityBase</cstring> |
8 | </property> | 8 | </property> |
9 | <property stdset="1"> | 9 | <property stdset="1"> |
10 | <name>geometry</name> | 10 | <name>geometry</name> |
11 | <rect> | 11 | <rect> |
12 | <x>0</x> | 12 | <x>0</x> |
13 | <y>0</y> | 13 | <y>0</y> |
14 | <width>277</width> | 14 | <width>329</width> |
15 | <height>328</height> | 15 | <height>483</height> |
16 | </rect> | 16 | </rect> |
17 | </property> | 17 | </property> |
18 | <property stdset="1"> | 18 | <property stdset="1"> |
19 | <name>caption</name> | 19 | <name>caption</name> |
20 | <string>Security Settings</string> | 20 | <string>Security Settings</string> |
21 | </property> | 21 | </property> |
22 | <property> | 22 | <property> |
23 | <name>layoutMargin</name> | 23 | <name>layoutMargin</name> |
24 | </property> | 24 | </property> |
25 | <property> | 25 | <property> |
26 | <name>layoutSpacing</name> | 26 | <name>layoutSpacing</name> |
27 | </property> | 27 | </property> |
28 | <grid> | 28 | <vbox> |
29 | <property stdset="1"> | 29 | <property stdset="1"> |
30 | <name>margin</name> | 30 | <name>margin</name> |
31 | <number>3</number> | 31 | <number>0</number> |
32 | </property> | 32 | </property> |
33 | <property stdset="1"> | 33 | <property stdset="1"> |
34 | <name>spacing</name> | 34 | <name>spacing</name> |
35 | <number>3</number> | 35 | <number>0</number> |
36 | </property> | ||
37 | <widget> | ||
38 | <class>QTabWidget</class> | ||
39 | <property stdset="1"> | ||
40 | <name>name</name> | ||
41 | <cstring>TabWidget2</cstring> | ||
42 | </property> | ||
43 | <property> | ||
44 | <name>layoutMargin</name> | ||
36 | </property> | 45 | </property> |
37 | <widget row="0" column="0" > | 46 | <widget> |
47 | <class>QWidget</class> | ||
48 | <property stdset="1"> | ||
49 | <name>name</name> | ||
50 | <cstring>tab</cstring> | ||
51 | </property> | ||
52 | <attribute> | ||
53 | <name>title</name> | ||
54 | <string>Passcode</string> | ||
55 | </attribute> | ||
56 | <vbox> | ||
57 | <property stdset="1"> | ||
58 | <name>margin</name> | ||
59 | <number>6</number> | ||
60 | </property> | ||
61 | <property stdset="1"> | ||
62 | <name>spacing</name> | ||
63 | <number>6</number> | ||
64 | </property> | ||
65 | <widget> | ||
66 | <class>QGroupBox</class> | ||
67 | <property stdset="1"> | ||
68 | <name>name</name> | ||
69 | <cstring>GroupBox4</cstring> | ||
70 | </property> | ||
71 | <property stdset="1"> | ||
72 | <name>title</name> | ||
73 | <string>Passcode</string> | ||
74 | </property> | ||
75 | <vbox> | ||
76 | <property stdset="1"> | ||
77 | <name>margin</name> | ||
78 | <number>11</number> | ||
79 | </property> | ||
80 | <property stdset="1"> | ||
81 | <name>spacing</name> | ||
82 | <number>6</number> | ||
83 | </property> | ||
84 | <widget> | ||
38 | <class>QLayoutWidget</class> | 85 | <class>QLayoutWidget</class> |
39 | <property stdset="1"> | 86 | <property stdset="1"> |
40 | <name>name</name> | 87 | <name>name</name> |
41 | <cstring>Layout1</cstring> | 88 | <cstring>Layout1</cstring> |
42 | </property> | 89 | </property> |
43 | <property> | 90 | <property> |
44 | <name>layoutSpacing</name> | 91 | <name>layoutSpacing</name> |
45 | </property> | 92 | </property> |
46 | <hbox> | 93 | <hbox> |
47 | <property stdset="1"> | 94 | <property stdset="1"> |
48 | <name>margin</name> | 95 | <name>margin</name> |
49 | <number>0</number> | 96 | <number>0</number> |
@@ -67,70 +114,222 @@ | |||
67 | <class>QPushButton</class> | 114 | <class>QPushButton</class> |
68 | <property stdset="1"> | 115 | <property stdset="1"> |
69 | <name>name</name> | 116 | <name>name</name> |
70 | <cstring>clearpasscode</cstring> | 117 | <cstring>clearpasscode</cstring> |
71 | </property> | 118 | </property> |
72 | <property stdset="1"> | 119 | <property stdset="1"> |
73 | <name>text</name> | 120 | <name>text</name> |
74 | <string>Clear passcode</string> | 121 | <string>Clear passcode</string> |
75 | </property> | 122 | </property> |
76 | </widget> | 123 | </widget> |
77 | </hbox> | 124 | </hbox> |
78 | </widget> | 125 | </widget> |
79 | <widget row="1" column="0" > | 126 | <widget> |
80 | <class>QCheckBox</class> | 127 | <class>QCheckBox</class> |
81 | <property stdset="1"> | 128 | <property stdset="1"> |
82 | <name>name</name> | 129 | <name>name</name> |
83 | <cstring>passcode_poweron</cstring> | 130 | <cstring>passcode_poweron</cstring> |
84 | </property> | 131 | </property> |
85 | <property stdset="1"> | 132 | <property stdset="1"> |
86 | <name>text</name> | 133 | <name>text</name> |
87 | <string>Require pass code at power-on</string> | 134 | <string>Require pass code at power-on</string> |
88 | </property> | 135 | </property> |
89 | </widget> | 136 | </widget> |
90 | <widget row="3" column="0" > | 137 | <widget> |
91 | <class>QTabWidget</class> | 138 | <class>QLabel</class> |
92 | <property stdset="1"> | 139 | <property stdset="1"> |
93 | <name>name</name> | 140 | <name>name</name> |
94 | <cstring>TabWidget2</cstring> | 141 | <cstring>TextLabel1</cstring> |
142 | </property> | ||
143 | <property stdset="1"> | ||
144 | <name>sizePolicy</name> | ||
145 | <sizepolicy> | ||
146 | <hsizetype>5</hsizetype> | ||
147 | <vsizetype>7</vsizetype> | ||
148 | </sizepolicy> | ||
149 | </property> | ||
150 | <property stdset="1"> | ||
151 | <name>text</name> | ||
152 | <string><P>Pass code protection provides a minimal level of protection from casual access to this device.</string> | ||
153 | </property> | ||
154 | <property stdset="1"> | ||
155 | <name>textFormat</name> | ||
156 | <enum>RichText</enum> | ||
157 | </property> | ||
158 | <property stdset="1"> | ||
159 | <name>alignment</name> | ||
160 | <set>AlignTop|AlignLeft</set> | ||
161 | </property> | ||
162 | <property> | ||
163 | <name>vAlign</name> | ||
164 | </property> | ||
165 | </widget> | ||
166 | </vbox> | ||
167 | </widget> | ||
168 | <spacer> | ||
169 | <property> | ||
170 | <name>name</name> | ||
171 | <cstring>Spacer3</cstring> | ||
172 | </property> | ||
173 | <property stdset="1"> | ||
174 | <name>orientation</name> | ||
175 | <enum>Vertical</enum> | ||
176 | </property> | ||
177 | <property stdset="1"> | ||
178 | <name>sizeType</name> | ||
179 | <enum>Expanding</enum> | ||
180 | </property> | ||
181 | <property> | ||
182 | <name>sizeHint</name> | ||
183 | <size> | ||
184 | <width>20</width> | ||
185 | <height>20</height> | ||
186 | </size> | ||
187 | </property> | ||
188 | </spacer> | ||
189 | </vbox> | ||
190 | </widget> | ||
191 | <widget> | ||
192 | <class>QWidget</class> | ||
193 | <property stdset="1"> | ||
194 | <name>name</name> | ||
195 | <cstring>tab</cstring> | ||
196 | </property> | ||
197 | <attribute> | ||
198 | <name>title</name> | ||
199 | <string>Login</string> | ||
200 | </attribute> | ||
201 | <vbox> | ||
202 | <property stdset="1"> | ||
203 | <name>margin</name> | ||
204 | <number>6</number> | ||
205 | </property> | ||
206 | <property stdset="1"> | ||
207 | <name>spacing</name> | ||
208 | <number>6</number> | ||
209 | </property> | ||
210 | <widget> | ||
211 | <class>QGroupBox</class> | ||
212 | <property stdset="1"> | ||
213 | <name>name</name> | ||
214 | <cstring>GroupBox3</cstring> | ||
215 | </property> | ||
216 | <property stdset="1"> | ||
217 | <name>title</name> | ||
218 | <string>Login</string> | ||
219 | </property> | ||
220 | <vbox> | ||
221 | <property stdset="1"> | ||
222 | <name>margin</name> | ||
223 | <number>11</number> | ||
224 | </property> | ||
225 | <property stdset="1"> | ||
226 | <name>spacing</name> | ||
227 | <number>6</number> | ||
228 | </property> | ||
229 | <widget> | ||
230 | <class>QCheckBox</class> | ||
231 | <property stdset="1"> | ||
232 | <name>name</name> | ||
233 | <cstring>autologinToggle</cstring> | ||
234 | </property> | ||
235 | <property stdset="1"> | ||
236 | <name>text</name> | ||
237 | <string>Login Automatically</string> | ||
238 | </property> | ||
239 | </widget> | ||
240 | <widget> | ||
241 | <class>QComboBox</class> | ||
242 | <property stdset="1"> | ||
243 | <name>name</name> | ||
244 | <cstring>userlist</cstring> | ||
245 | </property> | ||
246 | </widget> | ||
247 | </vbox> | ||
248 | </widget> | ||
249 | <spacer> | ||
250 | <property> | ||
251 | <name>name</name> | ||
252 | <cstring>Spacer2</cstring> | ||
95 | </property> | 253 | </property> |
254 | <property stdset="1"> | ||
255 | <name>orientation</name> | ||
256 | <enum>Vertical</enum> | ||
257 | </property> | ||
258 | <property stdset="1"> | ||
259 | <name>sizeType</name> | ||
260 | <enum>Expanding</enum> | ||
261 | </property> | ||
262 | <property> | ||
263 | <name>sizeHint</name> | ||
264 | <size> | ||
265 | <width>20</width> | ||
266 | <height>20</height> | ||
267 | </size> | ||
268 | </property> | ||
269 | </spacer> | ||
270 | </vbox> | ||
271 | </widget> | ||
96 | <widget> | 272 | <widget> |
97 | <class>QWidget</class> | 273 | <class>QWidget</class> |
98 | <property stdset="1"> | 274 | <property stdset="1"> |
99 | <name>name</name> | 275 | <name>name</name> |
100 | <cstring>tab</cstring> | 276 | <cstring>tab</cstring> |
101 | </property> | 277 | </property> |
102 | <attribute> | 278 | <attribute> |
103 | <name>title</name> | 279 | <name>title</name> |
104 | <string>Sync</string> | 280 | <string>Sync</string> |
105 | </attribute> | 281 | </attribute> |
106 | <vbox> | 282 | <vbox> |
107 | <property stdset="1"> | 283 | <property stdset="1"> |
108 | <name>margin</name> | 284 | <name>margin</name> |
285 | <number>6</number> | ||
286 | </property> | ||
287 | <property stdset="1"> | ||
288 | <name>spacing</name> | ||
289 | <number>6</number> | ||
290 | </property> | ||
291 | <widget> | ||
292 | <class>QGroupBox</class> | ||
293 | <property stdset="1"> | ||
294 | <name>name</name> | ||
295 | <cstring>GroupBox2</cstring> | ||
296 | </property> | ||
297 | <property stdset="1"> | ||
298 | <name>title</name> | ||
299 | <string>Sync</string> | ||
300 | </property> | ||
301 | <vbox> | ||
302 | <property stdset="1"> | ||
303 | <name>margin</name> | ||
109 | <number>11</number> | 304 | <number>11</number> |
110 | </property> | 305 | </property> |
111 | <property stdset="1"> | 306 | <property stdset="1"> |
112 | <name>spacing</name> | 307 | <name>spacing</name> |
113 | <number>6</number> | 308 | <number>6</number> |
114 | </property> | 309 | </property> |
115 | <widget> | 310 | <widget> |
116 | <class>QLabel</class> | 311 | <class>QLabel</class> |
117 | <property stdset="1"> | 312 | <property stdset="1"> |
118 | <name>name</name> | 313 | <name>name</name> |
119 | <cstring>TextLabel1_2</cstring> | 314 | <cstring>TextLabel1_2</cstring> |
120 | </property> | 315 | </property> |
121 | <property stdset="1"> | 316 | <property stdset="1"> |
122 | <name>text</name> | 317 | <name>text</name> |
123 | <string>Accept sync from network:</string> | 318 | <string>Accept sync from network:</string> |
124 | </property> | 319 | </property> |
320 | <property stdset="1"> | ||
321 | <name>textFormat</name> | ||
322 | <enum>RichText</enum> | ||
323 | </property> | ||
125 | </widget> | 324 | </widget> |
126 | <widget> | 325 | <widget> |
127 | <class>QComboBox</class> | 326 | <class>QComboBox</class> |
128 | <item> | 327 | <item> |
129 | <property> | 328 | <property> |
130 | <name>text</name> | 329 | <name>text</name> |
131 | <string>192.168.129.0/24 (default)</string> | 330 | <string>192.168.129.0/24 (default)</string> |
132 | </property> | 331 | </property> |
133 | </item> | 332 | </item> |
134 | <item> | 333 | <item> |
135 | <property> | 334 | <property> |
136 | <name>text</name> | 335 | <name>text</name> |
@@ -175,41 +374,39 @@ | |||
175 | </item> | 374 | </item> |
176 | <property stdset="1"> | 375 | <property stdset="1"> |
177 | <name>name</name> | 376 | <name>name</name> |
178 | <cstring>syncnet</cstring> | 377 | <cstring>syncnet</cstring> |
179 | </property> | 378 | </property> |
180 | <property stdset="1"> | 379 | <property stdset="1"> |
181 | <name>editable</name> | 380 | <name>editable</name> |
182 | <bool>true</bool> | 381 | <bool>true</bool> |
183 | </property> | 382 | </property> |
184 | </widget> | 383 | </widget> |
185 | </vbox> | 384 | </vbox> |
186 | </widget> | 385 | </widget> |
187 | </widget> | 386 | <spacer> |
188 | <widget row="2" column="0" > | 387 | <property> |
189 | <class>QLabel</class> | ||
190 | <property stdset="1"> | ||
191 | <name>name</name> | 388 | <name>name</name> |
192 | <cstring>TextLabel1</cstring> | 389 | <cstring>Spacer1</cstring> |
193 | </property> | 390 | </property> |
194 | <property stdset="1"> | 391 | <property stdset="1"> |
195 | <name>sizePolicy</name> | 392 | <name>orientation</name> |
196 | <sizepolicy> | 393 | <enum>Vertical</enum> |
197 | <hsizetype>5</hsizetype> | ||
198 | <vsizetype>7</vsizetype> | ||
199 | </sizepolicy> | ||
200 | </property> | 394 | </property> |
201 | <property stdset="1"> | 395 | <property stdset="1"> |
202 | <name>text</name> | 396 | <name>sizeType</name> |
203 | <string><P>Pass code protection provides a minimal level of protection from casual access to this device.</string> | 397 | <enum>Expanding</enum> |
204 | </property> | ||
205 | <property stdset="1"> | ||
206 | <name>alignment</name> | ||
207 | <set>AlignTop|AlignLeft</set> | ||
208 | </property> | 398 | </property> |
209 | <property> | 399 | <property> |
210 | <name>vAlign</name> | 400 | <name>sizeHint</name> |
401 | <size> | ||
402 | <width>20</width> | ||
403 | <height>20</height> | ||
404 | </size> | ||
211 | </property> | 405 | </property> |
406 | </spacer> | ||
407 | </vbox> | ||
212 | </widget> | 408 | </widget> |
213 | </grid> | 409 | </widget> |
410 | </vbox> | ||
214 | </widget> | 411 | </widget> |
215 | </UI> | 412 | </UI> |