/* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved. * * This 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 software 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 software; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. */ #include #include #include "QueryConnectDialog.h" #include "vncExt.h" QueryConnectDialog::QueryConnectDialog(Display* dpy, const char* address_, const char* user_, int timeout_, QueryResultCallback* cb) : TXDialog(dpy, 300, 100, "VNC Server : Accept Connection?"), addressLbl(dpy, "Host:",this), address(dpy, address_, this), userLbl(dpy, "User:", this), user(dpy, user_, this), timeoutLbl(dpy, "Seconds until automatic reject:", this), timeout(dpy, "0000000000", this), accept(dpy, "Accept", this, this, 60), reject(dpy, "Reject", this, this, 60), callback(cb), timeUntilReject(timeout_), timer(this) { const int pad = 4; int y=pad; int lblWidth = __rfbmax(addressLbl.width(), userLbl.width()); userLbl.move(pad+lblWidth-userLbl.width(), y); user.move(pad+lblWidth, y); addressLbl.move(pad+lblWidth-addressLbl.width(), y+=userLbl.height()); address.move(pad+lblWidth, y); timeoutLbl.move(pad, y+=addressLbl.height()); timeout.move(pad+timeoutLbl.width(), y); accept.move(pad, y+=addressLbl.height()); int maxWidth = __rfbmax(user.width(), address.width()+pad+lblWidth); maxWidth = __rfbmax(maxWidth, accept.width()*3); maxWidth = __rfbmax(maxWidth, timeoutLbl.width()+timeout.width()+pad); reject.move(maxWidth-reject.width(), y); resize(maxWidth + pad, y+reject.height()+pad); setBorderWidth(1); refreshTimeout(); timer.start(1000); } void QueryConnectDialog::deleteWindow(TXWindow*) { unmap(); callback->queryRejected(); } void QueryConnectDialog::buttonActivate(TXButton* b) { unmap(); if (b == &accept) callback->queryApproved(); else if (b == &reject) callback->queryRejected(); } bool QueryConnectDialog::handleTimeout(rfb::Timer* t) { if (timeUntilReject-- == 0) { unmap(); callback->queryTimedOut(); return false; } else { refreshTimeout(); return true; } } void QueryConnectDialog::refreshTimeout() { char buf[16]; sprintf(buf, "%d", timeUntilReject); timeout.setText(buf); } able27/47770'>artonge/backport/stable27/47770 Nextcloud server, a safe home for all your data: https://github.com/nextcloud/serverwww-data
summaryrefslogtreecommitdiffstats
blob: e9751159913e49c2a6064cd2fe8656c98d03fccf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<?php

declare(strict_types=1);

/**
 * @copyright Copyright (c) 2018, John Molakvoæ (skjnldsv@protonmail.com)
 *
 * @author Christoph Wurst <christoph@winzerhof-wurst.at>
 * @author Daniel Kesselberg <mail@danielkesselberg.de>
 * @author John Molakvoæ <skjnldsv@protonmail.com>
 * @author Roeland Jago Douma <roeland@famdouma.nl>
 *
 * @license GNU AGPL version 3 or any later version
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 *
 */
namespace OCA\DAV\Migration;

use Closure;

use OCP\DB\ISchemaWrapper;
use OCP\DB\Types;
use OCP\Migration\IOutput;
use OCP\Migration\SimpleMigrationStep;

class Version1008Date20181030113700 extends SimpleMigrationStep {

	/**
	 * @param IOutput $output
	 * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
	 * @param array $options
	 * @return null|ISchemaWrapper
	 */
	public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) {
		/** @var ISchemaWrapper $schema */
		$schema = $schemaClosure();

		$table = $schema->getTable('cards');
		$table->addColumn('uid', Types::STRING, [
			'notnull' => false,
			'length' => 255
		]);

		return $schema;
	}
}