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 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411
|
/***************************************************************************
* $Id: tork.h,v 1.106 2008/06/08 21:05:11 hoganrobert Exp $
* Copyright (C) 2006 by Robert Hogan *
* robert@roberthogan.net *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
#ifndef _TORK_H_
#define _TORK_H_
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <kapplication.h>
#include <kmainwindow.h>
#include <ktempfile.h>
#include "torkview.h"
#include "torclient.h"
#include "statgraph.h"
#include "popupMessage.h"
#include "torkconfig.h"
#include "version.h"
#include "dcoptork.h"
#include <kconfigskeleton.h>
#include <kwinmodule.h>
#include <kpopupmenu.h>
#include <qvaluevector.h>
#include "update.h"
#include "trayicon.h"
#include "upnpmanager.h"
#include "hiddensrvs.h"
class KPrinter;
class KToggleAction;
class KPopupMenu;
class KActionMenu;
class KURL;
class TrayIcon;
class QLabel;
class KProcIO;
class TorClient;
class QPoint;
class StatGraph;
class TorkConfig;
class KConfigSkeleton;
class KConfigSkeletonItem;
class KTempFile;
class KWindModule;
class UPnPManager;
class SetMaxRate;
class MyHidden;
//class QValueVector;
/** Enumeration of types which option values can take */
typedef enum display_status_t {
DISPLAY_NONE = 0, /**< An arbitrary string. */
DISPLAY_QUEUED, /**< A non-negative integer less than MAX_INT */
} display_status_t;
/**
* This class serves as the main window for tork. It handles the
* menus, toolbars, and status bars.
*
* @short Main window class
* @author Robert Hogan <robert@roberthogan.net>
* @version 0.03
*/
class tork : public KMainWindow, virtual public DCOPTork
{
Q_OBJECT
public:
/**
* Default Constructor
*/
tork();
/**
* Default Destructor
*/
virtual ~tork();
torkView *m_view;
TrayIcon *_tray;
QDict<QListViewItem> inodes;
bool connectedToTor(){return (client!=0) ? true : false;};
KPopupMenu* m_LaunchMenu;
void anonymousFirefox(){m_view->anonymousFirefox();};
void anonymousOpera(){m_view->anonymousOpera();};
void anonymousEmail(){m_view->sendAnonymousEmail(); hide();};
void anonymizedFirefox(const QString & url){m_view->anonymizedFirefox(url);};
void anonymizedOpera(const QString & url){m_view->anonymizedOpera(url);};
void anonymousKonversation(){torkify( 0 );};
void anonymousKopete(){torkify( 1 );};
void anonymousGaim(){torkify( 2 );};
void anonymousPidgin(){torkify( 3 );};
void anonymousKonsole(){torkify( 4 );};
bool getKDESetting();
bool routerDiscovered(){ return m_routerDiscovered;};
void setRouterDiscovered(bool discovered){ m_routerDiscovered = discovered;};
QStringList getDiscoveredRouters(){ return discoveredRouters;};
void setBandwidthFromSysTray(int rate );
private slots:
void fileNew();
void optionsShowToolbar();
void optionsShowStatusbar();
void optionsConfigureKeys();
void optionsConfigureToolbars();
void optionsPreferences();
void newToolbarConfig();
void startTor();
void startNetStat();
void stopNetStat();
void updatePrivoxy();
void childExited();
void privoxyExited();
void netStatExited();
void filterExited();
void startFromBeginning();
void isControllerWorking( );
void checkRouterDiscovered( );
void changeStatusbar(const QString& in,const QString& out);
void changeCaption(const QString& text);
void startController();
void stopController();
void startEverything();
void receivedOutput(KProcIO *);
void processFilter(KProcIO *filterproc);
void receivedNetStatOutput(KProcIO *);
void toggleKDESetting();
void enableKDE(bool enable);
void toggleKDESettingAndLaunchKonq();
void setKDE(bool set);
void turnOffKDE();
void sayWhatImDoing(const QString& );
void slotOnItem( int, QListViewItem *, const QPoint &, int );
void slotOnORItem( QListViewItem * );
void slotOffItem( );
void openConfig(const QCString& page);
void slotHandle(/*TFunctor *functor*/);
void noClicked(/*TFunctor *functor*/);
void popUpClosed();
void processHashProc(KProcIO *hashproc);
void toggleTorMon();
void toggleTorMon2();
void toggleTorBar();
void hiddenServices();
void mixminionHome();
void networkList();
void infoUpdated(const QString &type, const QString &summary, const QString &data);
void shuttingDown();
void showMyServer();
void showFirewallEvasion();
void useNewIdentity();
void showMyKonqueror();
void showMyHiddenServices();
void toggleNonTorTraffic(bool state);
void toggleTorTraffic(bool state);
void checkForKonqWindow(WId);
void configurePrivoxy();
void warnNoServerInfo();
void startingPeriodOver();
void needAlphaVersion( );
void filterServers( int );
void filterLog( int );
void filterSubnets( int );
void filterCountries( int );
void filterTorTraffic( int );
void filterNonTorTraffic( int );
void sortByCountry( );
void toggleTextFilter( int );
void createSubnetList( );
void torkify( int );
void allowNewIdentityRequests();
void populateSubNetMenu();
void populatePseudoMenu();
void populateCountryMenu();
void applyPseudonymity( int country_id );
void checkBandwidthSettings();
void setTorCaption(const QString &caption);
void configureServer(int);
void configureSecurity( int id );
void updateServerButton( );
void torUsedAfterDNSRequest();
void updateTrayStats(const QString &,const QString &,const QString &,const QString &);
void updateTrayIcon(const QString &);
void resetExited();
void switchMode();
void upnpForwardingOK(kt::UPnPRouter*,const QString &, bool);
void upnpForwardingError(kt::UPnPRouter*,const QString &, bool);
void routerDiscovered(kt::UPnPRouter* );
void configureRouter(bool force,bool silent=false);
public slots:
void startPrivoxy();
void serverHelp();
void enterContactInfo();
void fixAddressPort();
void continueAsClient();
void updateTorStable();
void reconnectWithCookie();
void copyCookie();
void updateTork();
void quickConfig();
void cannotContactTor();
void showTip();
void showTipOnStart();
void runWizard();
void copyOldConfig();
void shouldIApplySettings();
void applySettingsToRunningTor();
bool showUsage();
bool showSecurityWarnings();
bool showGuideQuestions();
bool showApplySettingsQuestions();
bool contactInfoSet();
bool showDNSLeaks();
void readEavesdropping();
void aboutTorify();
void aboutTor();
void showSecurityNotice(const QString &port);
void showScreamingNotice(const QString &port);
void torClosedConnection();
void makeTorkStoppable();
void createService(const QString& dir,const QString& port);
void aboutParanoidMode();
void processWarning(const QString& type, const QString& text);
void processQuestion(const QString& type, const QString& text);
void updateTorUnstable();
void currentTabChanged(QWidget* cur );
void stopTor();
void resetTor();
void toggleServerButton( bool on );
void dummyAction();
void retryUPnP();
void allowPlainTextPorts();
void assignPortToRemove();
private:
void setupAccel();
void setupActions();
QString writeConf();
QString writePrivoxyConf();
void writeCustomOptions(QTextStream &ts);
void writeCustomOptions2(QTextStream &ts);
void showWarning( display_status_t &msg, const QString &headline,const QString &torsaid,const QString &thismeans, const QString &type, const QString &icon, bool always, bool showstopper);
void askQuestion(display_status_t &msg, const QString &headline,const QString &torsaid,const QString &body,const QString &question,void (tork::*pt2Func)(), const QString &type, const QString &icon, bool persistent, bool showstopper);
void processQueue();
bool elementShouldBeUsed(const KConfigSkeletonItem* it);
bool noSpecialProcessing(const KConfigSkeletonItem* it, QTextStream &ts);
QString doHashPassword();
bool queryClose();
void prepareToShut();
void filterViewServers( QValueVector<QString> &possibleValues, QListView* &view, KPopupMenu* &menu, int id, int column );
void filterView( QValueVector<QString> &possibleValues, QListView* &view, KPopupMenu* &menu, int id, int column );
QString createFailSafeCommand( const QStringList &filterRules, bool set );
void updateServerClientStatusBar(const QStringList &client, const QStringList &server);
void updateToolBar();
private:
KPrinter *m_printer;
KToggleAction *m_toolbarAction;
KToggleAction *m_statusbarAction;
KAction *torkConfigure;
KAction *torkStop;
KAction *torkStart;
KAction *torkUpdateTork;
KAction *torkUpdateStable;
KAction *torkUpdateUnstable;
KAction *torkUpdatePrivoxy;
KAction *torkFirstRunWizard;
KAction *torkTip;
KAction *enableKonqi;
KAction *enableTormon;
//KAction *toggleParanoid;
KAction *browseHiddenServices;
KAction *browseNetworkList;
KAction *toggleTorbar;
KActionMenu* m_ServerFilterButton;
KActionMenu* m_LaunchMenuButton;
KActionMenu* m_LogFilterButton;
KActionMenu* m_TrafficFilterButton;
KPopupMenu* m_ServerFilterMenu;
KPopupMenu* m_LogFilterMenu;
KPopupMenu* m_TrafficFilterMenu;
KPopupMenu* m_TorTrafficFilterMenu;
KPopupMenu* m_NonTorTrafficFilterMenu;
KPopupMenu* m_IPFilterMenu;
KPopupMenu* m_PseudoMenu;
KPopupMenu* m_PseudoMenuEU;
KPopupMenu* m_PseudoMenuSA;
KPopupMenu* m_PseudoMenuAS;
KPopupMenu* m_PseudoMenuNA;
KPopupMenu* m_PseudoMenuAF;
KPopupMenu* m_PseudoMenuNN;
KPopupMenu* m_PseudoMenuOC;
KActionMenu* m_PseudoButton;
KAction* m_IdentityButton;
KAction* m_ModeButton;
KAction* m_UnCensorButton;
KPopupMenu* m_CountryMenu;
KPopupMenu* m_CountryMenuEU;
KPopupMenu* m_CountryMenuSA;
KPopupMenu* m_CountryMenuAS;
KPopupMenu* m_CountryMenuNA;
KPopupMenu* m_CountryMenuAF;
KPopupMenu* m_CountryMenuNN;
KPopupMenu* m_CountryMenuOC;
KActionMenu* m_ServerButton;
KPopupMenu* m_ServerButtonMenu;
KActionMenu* m_SecurityButton;
KPopupMenu* m_SecurityButtonMenu;
QLabel* m_statusInfo;
QLabel* m_statusTransfer;
QLabel* m_statusSpeed;
StatGraph* m_graphIn;
StatGraph* m_graphOut;
KProcIO* childproc;
KProcIO* filterproc;
KProcIO* netstatproc;
KProcIO* privoxyproc;
TorClient* client;
bool m_servererrornag;
bool m_contactinfonag;
bool m_serverworking;
QListViewItem* m_prevItem;
QTimer *timer;
QTimer *bwtimer;
QTimer *bwLimitTimer;
void (tork::*m_pt2Func)();
KDE::PopupMessage *m_tooltip;
QStringList m_list;
QString m_body;
display_status_t* m_msg;
KProcIO *hashproc;
QString m_hashedpassword;
KConfigSkeletonItem::List previtems;
KConfigSkeleton pcopy;
PrevConfig::PrevConfigList prevlist;
TorkUpdate* updater;
KTempFile* tfTor;
KTempFile* tfPrivoxy;
KWinModule* winModule;
QWidget* prev;
QValueList<QListViewItem*> ordinaryServerList;
QMap<QString,KPopupMenu*> continentMap;
QMap<QString,KPopupMenu*> continentMapList;
QStringList discoveredRouters;
int filterId;
bool m_toolTipShowing;
bool m_persistent;
bool filterWasApplied;
bool geoip_db;
bool waitingForServers;
bool stillStarting;
bool m_DNSTorified;
bool m_showstopperAlreadyDisplayed;
bool m_routerDiscovered;
bool recentNewIdentityRequest;
QDialog* dialog;
MyHidden* myHiddenDialog;
QDialog* serverdialog;
UPnPManager* upnpmanager;
ForwardPortList* forwardPortList;
QString filterError;
QString torCaption;
QString m_program;
SetMaxRate* m_set_max_rate;
};
extern tork *kmain;
#endif // _TORK_H_
|