예제 #1
0
int deleteWalletPrompt(char* wallet) {
  mMsgBoxPush(4);
  multiPrintXY(3, 2, "Delete the\nSelected Wallet?", TEXT_MODE_TRANSPARENT_BACKGROUND,
               TEXT_COLOR_BLACK);
  if(closeMsgBox(1, 4)) {
    deleteWallet(wallet);
    return 1;
  }
  return 0;
}
예제 #2
0
TDEWalletManager::TDEWalletManager(TQWidget *parent, const char *name, WFlags f)
: TDEMainWindow(parent, name, f), DCOPObject("TDEWalletManager") {
	TDEGlobal::dirs()->addResourceType("tdewallet", "share/apps/tdewallet");
	_tdewalletdLaunch = false;
	TQAccel *accel = new TQAccel(this, "tdewalletmanager");

	TDEApplication::dcopClient()->setQtBridgeEnabled(false);
	_shuttingDown = false;
	TDEConfig cfg("tdewalletrc"); // not sure why this setting isn't in tdewalletmanagerrc...
	TDEConfigGroup walletConfigGroup(&cfg, "Wallet");
	_dcopRef = 0L;
	if (walletConfigGroup.readBoolEntry("Launch Manager", true)) {
		_tray = new KSystemTray(this, "tdewalletmanager tray");
		_tray->setPixmap(loadSystemTrayIcon("wallet_closed"));
		TQToolTip::add(_tray, i18n("TDE Wallet: No wallets open."));
		connect(_tray, TQT_SIGNAL(quitSelected()), TQT_SLOT(shuttingDown()));
		TQStringList wl = TDEWallet::Wallet::walletList();
		bool isOpen = false;
		for (TQStringList::Iterator it = wl.begin(); it != wl.end(); ++it) {
			if (TDEWallet::Wallet::isOpen(*it)) {
				_tray->setPixmap(loadSystemTrayIcon("wallet_open"));
				TQToolTip::remove(_tray);
				TQToolTip::add(_tray, i18n("TDE Wallet: A wallet is open."));
				isOpen = true;
				break;
			}
		}
		if (!isOpen && kapp->isRestored()) {
			delete _tray;
			_tray = 0L;
			TQTimer::singleShot( 0, kapp, TQT_SLOT( quit()));
			return;
		}
	} else {
		_tray = 0L;
	}

	_iconView = new TDEWalletIconView(this, "tdewalletmanager icon view");
	connect(_iconView, TQT_SIGNAL(executed(TQIconViewItem*)), TQT_TQOBJECT(this), TQT_SLOT(openWallet(TQIconViewItem*)));
	connect(_iconView, TQT_SIGNAL(contextMenuRequested(TQIconViewItem*, const TQPoint&)), TQT_TQOBJECT(this), TQT_SLOT(contextMenu(TQIconViewItem*, const TQPoint&)));

	updateWalletDisplay();
	setCentralWidget(_iconView);
	_iconView->setMinimumSize(320, 200);

	_dcopRef = new DCOPRef("kded", "tdewalletd");
	_dcopRef->dcopClient()->setNotifications(true);
	connect(_dcopRef->dcopClient(),
		TQT_SIGNAL(applicationRemoved(const TQCString&)),
		this,
		TQT_SLOT(possiblyRescan(const TQCString&)));
	connect(_dcopRef->dcopClient(),
		TQT_SIGNAL(applicationRegistered(const TQCString&)),
		this,
		TQT_SLOT(possiblyRescan(const TQCString&)));

	connectDCOPSignal(_dcopRef->app(), _dcopRef->obj(), "allWalletsClosed()", "allWalletsClosed()", false);
	connectDCOPSignal(_dcopRef->app(), _dcopRef->obj(), "walletClosed(TQString)", "updateWalletDisplay()", false);
	connectDCOPSignal(_dcopRef->app(), _dcopRef->obj(), "walletOpened(TQString)", "aWalletWasOpened()", false);
	connectDCOPSignal(_dcopRef->app(), _dcopRef->obj(), "walletDeleted(TQString)", "updateWalletDisplay()", false);
	connectDCOPSignal(_dcopRef->app(), _dcopRef->obj(), "walletListDirty()", "updateWalletDisplay()", false);

	// FIXME: slight race - a wallet can open, then we get launched, but the
	//        wallet closes before we are done opening.  We will then stay
	//        open.  Must check that a wallet is still open here.

	new TDEAction(i18n("&New Wallet..."), "tdewalletmanager", 0, TQT_TQOBJECT(this),
			TQT_SLOT(createWallet()), actionCollection(),
			"wallet_create");
	TDEAction *act = new TDEAction(i18n("Configure &Wallet..."), "configure",
			0, TQT_TQOBJECT(this), TQT_SLOT(setupWallet()), actionCollection(),
			"wallet_settings");
	if (_tray) {
		act->plug(_tray->contextMenu());
	}
	act = new TDEAction(i18n("Close &All Wallets"), 0, 0, TQT_TQOBJECT(this),
			TQT_SLOT(closeAllWallets()), actionCollection(),
			"close_all_wallets");
	if (_tray) {
		act->plug(_tray->contextMenu());
	}
	KStdAction::quit(TQT_TQOBJECT(this), TQT_SLOT(shuttingDown()), actionCollection());
	KStdAction::keyBindings(guiFactory(), TQT_SLOT(configureShortcuts()),
actionCollection());

	createGUI("tdewalletmanager.rc");
	accel->connectItem(accel->insertItem(Key_Return), TQT_TQOBJECT(this), TQT_SLOT(openWallet()));
	accel->connectItem(accel->insertItem(Key_Delete), TQT_TQOBJECT(this), TQT_SLOT(deleteWallet()));

	if (_tray) {
		_tray->show();
	} else {
		show();
	}

	kapp->setName("tdewallet"); // hack to fix docs
}