summaryrefslogtreecommitdiffstats
path: root/kcontrol/filetypes/newtypedlg.cpp
blob: e2a9b28a7269d5b6e7b6de6a2be037ed211d56ff (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

#include <tqlayout.h>
#include <tqlabel.h>
#include <tqwhatsthis.h>
#include <tqcombobox.h>

#include <tdelocale.h>
#include <klineedit.h>

#include "newtypedlg.h"

NewTypeDialog::NewTypeDialog(TQStringList groups,
			     TQWidget *parent, const char *name)
  : KDialogBase(parent, name, true, i18n( "Create New File Type" ), 
    Ok|Cancel, Ok, true)
{
  TQFrame *main = makeMainWidget();
  TQVBoxLayout *topl = new TQVBoxLayout(main, 0, spacingHint());

  TQGridLayout *grid = new TQGridLayout(2, 2);
  grid->setColStretch(1, 1);
  topl->addLayout(grid);

  TQLabel *l = new TQLabel(i18n("Group:"), main);
  grid->addWidget(l, 0, 0);

  groupCombo = new TQComboBox(main);
  //groupCombo->setEditable( true ); M.O.: Currently, the code in filetypesview isn't capable of handling
  //new top level types; so better not let them be added than crash.
  groupCombo->insertStringList(groups);
  grid->addWidget(groupCombo, 0, 1);

  TQWhatsThis::add( groupCombo, i18n("Select the category under which"
    " the new file type should be added.") );

  l = new TQLabel(i18n("Type name:"), main);
  grid->addWidget(l, 1, 0);

  typeEd = new KLineEdit(main);
  grid->addWidget(typeEd, 1, 1);

  typeEd->setFocus();

  // Set a minimum size so that caption is not half-hidden
  setMinimumSize( 300, 50 );
}

TQString NewTypeDialog::group() const 
{ 
  return groupCombo->currentText(); 
}


TQString NewTypeDialog::text() const 
{ 
  return typeEd->text(); 
}