1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
9 * Copyright (C) 2007 by Dominik Wenger
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
18 ****************************************************************************/
24 #if defined(Q_OS_WIN32)
32 // recursive function to delete a dir with files
33 bool recRmdir( const QString
&dirName
)
35 QString dirN
= dirName
;
37 // make list of entries in directory
38 QStringList list
= dir
.entryList(QDir::AllEntries
| QDir::NoDotAndDotDot
);
40 QString curItem
, lstAt
;
41 for(int i
= 0; i
< list
.size(); i
++){ // loop through all items of list
42 QString name
= list
.at(i
);
43 curItem
= dirN
+ "/" + name
;
44 fileInfo
.setFile(curItem
);
45 if(fileInfo
.isDir()) // is directory
46 recRmdir(curItem
); // call recRmdir() recursively for deleting subdirectory
48 QFile::remove(curItem
); // ok, delete file
51 return dir
.rmdir(dirN
); // delete empty dir and return if (now empty) dir-removing was successfull
55 //Function to get the system proxy
56 QUrl
systemProxy(void)
58 #if defined(Q_OS_LINUX)
59 return QUrl(getenv("http_proxy"));
60 #elif defined(Q_OS_WIN32)
66 DWORD enalen
= sizeof(DWORD
);
68 ret
= RegOpenKeyEx(HKEY_CURRENT_USER
,
69 _TEXT("Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings"),
70 0, KEY_QUERY_VALUE
, &hk
);
71 if(ret
!= ERROR_SUCCESS
) return QUrl("");
73 ret
= RegQueryValueEx(hk
, _TEXT("ProxyServer"), NULL
, NULL
, (LPBYTE
)proxyval
, &buflen
);
74 if(ret
!= ERROR_SUCCESS
) return QUrl("");
76 ret
= RegQueryValueEx(hk
, _TEXT("ProxyEnable"), NULL
, NULL
, (LPBYTE
)&enable
, &enalen
);
77 if(ret
!= ERROR_SUCCESS
) return QUrl("");
81 //qDebug() << QString::fromWCharArray(proxyval) << QString("%1").arg(enable);
83 return QUrl("http://" + QString::fromWCharArray(proxyval
));