summaryrefslogtreecommitdiffstats
path: root/kstars/kstars/addlinkdialog.h
blob: 628b47a2d14a535c0996c60ea77860d38ed54e41 (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
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
/***************************************************************************
                          addlinkdialog.h  -  K Desktop Planetarium
                             -------------------
    begin                : Sun Oct 21 2001
    copyright            : (C) 2001 by Jason Harris
    email                : kstars@30doradus.org
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   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.                                   *
 *                                                                         *
 ***************************************************************************/

#ifndef ADDLINKDIALOG_H
#define ADDLINKDIALOG_H

#include <kdialogbase.h>
#include <klineedit.h>
#include <klocale.h>
#include <tqradiobutton.h>

#include "addlinkdialogui.h"

class TQLayout;
class TQString;
class SkyMap;

/**@class Simple dialog for adding a custom URL to a popup menu.
  *@author Jason Harris
  *@version 1.0
  */

class AddLinkDialog : public KDialogBase  {
	Q_OBJECT
  
public:
/**Constructor. */
	AddLinkDialog( TQWidget* parent = 0, const TQString &oname=i18n("object") );

/**Destructor (empty) */
	~AddLinkDialog() {}

/**@return TQString of the entered URL */
	TQString url() const { return ald->URLBox->text(); }

/**@short Set the URL text
	*@param s the new URL text
	*/
	void setURL( const TQString &s ) { ald->URLBox->setText( s ); }
	
/**@return TQString of the entered menu entry text */
	TQString desc() const { return ald->DescBox->text(); }

/**@short Set the Description text
	*@param s the new description text
	*/
	void setDesc( const TQString &s ) { ald->DescBox->setText( s ); }
	
/**@return TRUE if user declared the link is an image */
	bool isImageLink() const { return ald->ImageRadio->isChecked(); }

/**@short Set the link type
	*@param b if true, link is an image link.
	*/
	void setImageLink( bool b ) { ald->ImageRadio->setChecked( b ); }

private slots:
/**Open the entered URL in the web browser 
	*/
	void checkURL( void );

	/**We provide a default menu text string; this function changes the
		*default string if the link type (image/webpage) is changed.  Note
		*that if the user has changed the menu text, this function does nothing.
		*@param id 0=show image string; 1=show webpage string.
		*/
	void changeDefaultDescription( int id );

private:
	TQString ObjectName;
	TQVBoxLayout *vlay;
	AddLinkDialogUI *ald;
};

#endif