File: kbslocationdialog.ui.h

package info (click to toggle)
kboincspy 0.9.1-3
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 12,880 kB
  • ctags: 3,964
  • sloc: cpp: 29,018; sh: 9,736; perl: 2,793; makefile: 472; xml: 119
file content (55 lines) | stat: -rw-r--r-- 1,588 bytes parent folder | download | duplicates (3)
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
/****************************************************************************
** ui.h extension file, included from the uic-generated form implementation.
**
** If you want to add, delete, or rename functions or slots, use
** Qt Designer to update this file, preserving your code.
**
** You should not define a constructor or destructor in this file.
** Instead, write your code in functions called init() and destroy().
** These will automatically be called by the form's constructor and
** destructor.
*****************************************************************************/

void KBSLocationDialog::init()
{
  changed = false;
  host->setText(defaultHost());
}

QString KBSLocationDialog::defaultHost()
{
  const KURL fileURL(url->url());
  return  (fileURL.isValid() && !fileURL.host().isEmpty()) ? fileURL.host() : "localhost";
}

void KBSLocationDialog::updateURL(const QString &string)
{
  const QString defaultHost = this->defaultHost();
  if(!changed && host->text() != defaultHost) host->setText(defaultHost);
  
  const KURL fileURL(string);
  ok->setEnabled(!fileURL.isEmpty() && fileURL.isValid() && fileURL.fileName() == "client_state.xml");
}

void KBSLocationDialog::updateHost(const QString &string)
{
  changed = string.stripWhiteSpace() != defaultHost();
}

KBSLocation KBSLocationDialog::location()
{
  KBSLocation out;
  
  KURL fileURL(url->url());
  out.url = KURL(fileURL, ".");
  out.url.adjustPath(+1);
  
  out.host = host->text().stripWhiteSpace();
  
  out.port = (port->currentItem() > 0) ? port->currentText().toUInt(0, 10) : 0;
  
  return out;
}