diff options
Diffstat (limited to 'src/app/RemoteMan')
-rw-r--r-- | src/app/RemoteMan/Makefile.am | 9 | ||||
-rw-r--r-- | src/app/RemoteMan/remoteman.cpp | 385 | ||||
-rw-r--r-- | src/app/RemoteMan/remoteman.h | 71 | ||||
-rw-r--r-- | src/app/RemoteMan/remotemanbase.cpp | 331 | ||||
-rw-r--r-- | src/app/RemoteMan/remotemanbase.h | 83 |
5 files changed, 879 insertions, 0 deletions
diff --git a/src/app/RemoteMan/Makefile.am b/src/app/RemoteMan/Makefile.am new file mode 100644 index 0000000..cff7637 --- /dev/null +++ b/src/app/RemoteMan/Makefile.am @@ -0,0 +1,9 @@ +noinst_LIBRARIES = libRemoteMan.a + +INCLUDES = $(all_includes) + +libRemoteMan_a_METASOURCES = AUTO + +libRemoteMan_a_SOURCES = \ + remoteman.cpp \ + remotemanbase.cpp diff --git a/src/app/RemoteMan/remoteman.cpp b/src/app/RemoteMan/remoteman.cpp new file mode 100644 index 0000000..2374f86 --- /dev/null +++ b/src/app/RemoteMan/remoteman.cpp @@ -0,0 +1,385 @@ +/*************************************************************************** + remoteman.cpp + ------------------- + copyright : (C) 2000 by Shie Erlich & Rafi Yanai + e-mail : krusader@users.sourceforge.net + web site : http://krusader.sourceforge.net + --------------------------------------------------------------------------- + Description + *************************************************************************** + + A + + db dD d8888b. db db .d8888. .d8b. d8888b. d88888b d8888b. + 88 ,8P' 88 `8D 88 88 88' YP d8' `8b 88 `8D 88' 88 `8D + 88,8P 88oobY' 88 88 `8bo. 88ooo88 88 88 88ooooo 88oobY' + 88`8b 88`8b 88 88 `Y8b. 88~~~88 88 88 88~~~~~ 88`8b + 88 `88. 88 `88. 88b d88 db 8D 88 88 88 .8D 88. 88 `88. + YP YD 88 YD ~Y8888P' `8888Y' YP YP Y8888D' Y88888P 88 YD + + S o u r c e F i l e + + *************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ + + + +#include "remoteman.h" +#include "../kicons.h" +#include "../resources.h" +#include "../krusader.h" +#include <tqlineedit.h> +#include <tdelocale.h> +#include <tqpixmap.h> +#include <tqspinbox.h> +#include <tqmultilineedit.h> +#include <tqpushbutton.h> +#include <tqstringlist.h> +#include <tqmessagebox.h> +#include <tqcheckbox.h> +#include <kstandarddirs.h> + +TQString remoteMan::url=TQString(); + +remoteMan::remoteMan() : remoteManBase(0,0,true), currentItem(0) { + // Read the connection list from the configuration file and re-create the tree + config2tree(); + sessions->setCurrentItem(sessions->firstChild()); + // some minor fixes, left out of the designer - do again in next version ! + password->setEchoMode(TQLineEdit::Password); + // ===> should be moved to remoteManBase <===== + connect( hostName, TQ_SIGNAL( textChanged(const TQString&) ), + this, TQ_SLOT( updateConnect(const TQString&) ) ); + connect( sessions, TQ_SIGNAL(doubleClicked(TQListViewItem *)), this, TQ_SLOT(connection())); + connect( sessions, TQ_SIGNAL(returnPressed(TQListViewItem *)), this, TQ_SLOT(connection())); + // execute the main dialog + exec(); +} + +void remoteMan::expandDecos(TQListViewItem* i) { + if (i->text(1)!="SESSION") i->setPixmap(0,LOADICON("folder_open")); +} +void remoteMan::collapseDecos(TQListViewItem* i) { + if (i->text(1)!="SESSION") i->setPixmap(0,LOADICON("folder_open")); +} + +// This is the static memeber, you'd want to call this directly ! +TQString remoteMan::getHost() { + remoteMan *p=new remoteMan(); + delete p; + return url; +} + +// adds a new group submenu +void remoteMan::addGroup() { + TQListViewItem *i=0,*current; + current=sessions->currentItem(); + if (!current) // no item is current, or the list is empty (shouldn't happen) + i=new TQListViewItem(sessions,i18n("New group"),"GROUP"); // insert into the backplane + else + if (current->text(1).left(5)=="GROUP") + i=new TQListViewItem(current,i18n("New group"),"GROUP"); // insert under the current item + else return; // cannot create a new group under an item + // set an open folder pixmap for the group + i->setPixmap(0,LOADICON("folder_open")); + // make the new item current and refresh the view + sessions->setCurrentItem(i); sessions->ensureItemVisible(i); +} + +// add an actual session +void remoteMan::addSession() { + TQListViewItem *i=0,*current; + current=sessions->currentItem(); + // if we are pointing to a session, then the new session will be + // created under the current session's parent group + if (current->text(1)=="SESSION") current=current->parent(); + // create a new item and give it the appropriate pixmap + i=new TQListViewItem(current,i18n("New session"),"SESSION"); + i->setPixmap(0,LOADICON("kr_ftp_new")); + // make the new item current and refresh the view + sessions->setCurrentItem(i); sessions->ensureItemVisible(i); +} + +// called upon a selection change to update the view +void remoteMan::refreshData() { + // first, update the last changes the user made + if (currentItem) { + currentItem->setText(2,hostName->text()); + currentItem->setText(3,portNum->cleanText()); + currentItem->setText(4,userName->text()); + currentItem->setText(5,password->text()); + currentItem->setText(6,remoteDir->text()); + currentItem->setText(7,description->text()); + currentItem->setText(8,protocol->currentText()); + // we have to check if there's another brother-session with + // the same name, if so, we add a <2> to it + TQListViewItem *i; + if (currentItem->parent()) i=currentItem->parent()->firstChild(); + else i=sessions->firstChild(); + while (i) { + if (i->text(0)==currentItem->text(0) && i!=currentItem) { + TQString temp=currentItem->text(0).right(4); + if (temp.left(1)=="<" && temp.right(1)==">") { + int h=temp.mid(1,1).toInt(); + int l=temp.mid(2,1).toInt(); + if ((++l)==10) { ++h; l=0; } + temp=TQString("<%1%2>").arg(h).arg(l); + temp=currentItem->text(0).replace(currentItem->text(0).length()-4,4,temp); + currentItem->setText(0,temp); + } else currentItem->setText(0,currentItem->text(0)+"<02>"); + i=currentItem->parent()->firstChild(); + } else i=i->nextSibling(); + } + } + // here begins the actual function + removeBtn->setEnabled(true); // just incase we turned it off last time + connectBtn->setEnabled(true); + TQListViewItem *current=sessions->currentItem(); + if (!current) return; // if no item is current yet + if (current->text(1).left(5)=="GROUP") { // disable all that don't belong to a group + // first, disable all the fields a user cannot change + hostName->setEnabled(false); + password->setEnabled(false); + portNum->setEnabled(false); + remoteDir->setEnabled(false); + userName->setEnabled(false); + if (current->text(1)=="GROUP!") { + sessionName->setEnabled(false); // even name can't be changed here! + description->setEnabled(false); + removeBtn->setEnabled(false); + connectBtn->setEnabled(false); + } else sessionName->setEnabled(true); + } else { // otherwise, a normal url is under the cursor + if( !current->text(8).isEmpty() ) + protocol->setCurrentText(current->text(8)); + else + protocol->setCurrentItem(0); + hostName->setEnabled(true); + // anonymous connection ?? + userName->setEnabled(!anonymous->isChecked()); + password->setEnabled(!anonymous->isChecked()); + // for now, don't allow port settings for smb:// + portNum->setEnabled( protocol->currentText()=="ftp://" ); + remoteDir->setEnabled(true); + sessionName->setEnabled(true); + description->setEnabled(true); + } + // now, update the session name (or group name) and needed info + sessionName->setText(current->text(0)); + hostName->setText(current->text(2)); + portNum->setValue(current->text(3).toInt()); + if (portNum->value()==0) portNum->setValue(21); + userName->setText(current->text(4)); + password->setText(current->text(5)); + remoteDir->setText(current->text(6)); + description->setText(current->text(7)); + sessions->setSorting(1); sessions->sort(); // resort the tree + currentItem=current; // keep the active item for other jobs + // disable connect button if no host name is defined + if (hostName->text().simplifyWhiteSpace().isEmpty()) + connectBtn->setEnabled(false); +} + +// called when we are changing the session/group name, so that remoteMan +// is able to change it in the corrosponding listview at the same time +void remoteMan::updateName(const TQString &text) { + TQListViewItem *i=sessions->currentItem(); + i->setText(0,text); +} + +void remoteMan::updateConnect(const TQString &) { + // disable connect button if no host name is defined + if (hostName->text().simplifyWhiteSpace().isEmpty()) + connectBtn->setEnabled(false); + else connectBtn->setEnabled(true); +} + +// take an item, and create a "connection", built of the full +// path of folders to the item, seperated by the ` character +TQString item2connection(TQListViewItem *item) { + TQString con=item->text(0); + TQListViewItem *iterator=item->parent(); + while (iterator!=0) { + //////////////////////// explanation: /////////////////////////// + // since the` char is special to us, we use it to seperate items + // in the connection, we cannot allow it to be inside a name, so + // we find it (if it exists) and replace it with a ' character + TQString temp=iterator->text(0); + int i=temp.find('`'); // are there any ` in the name ? + while (i>-1) { // if so, change them until none are left + temp.replace(i,1,TQChar('\'')); + i=temp.find('`'); + } + con=temp+'`'+con; + iterator=iterator->parent(); + } + return con; +} + +// find an item with a specific path - if the path doesn't exist, create it +TQListViewItem* remoteMan::findItem(const TQString &name, TQListViewItem *p) { + TQListViewItem *it; + if (name.isEmpty()) return p; // the end of the recursion has been reached!!! + if (p==0) it=sessions->firstChild(); else it=p->firstChild(); + int loc=name.find('`'); + while (it) { + if (it->text(0)==name.left(loc)) break; + it=it->nextSibling(); + } + if (!it) // item has not been found, create it + if (!p) it=new TQListViewItem(sessions,name.left(loc),"GROUP"); + else it=new TQListViewItem(p,name.left(loc),"GROUP"); + // now, it points to the item we want, so let's go down one level + it=findItem(name.mid(loc+1),it); + return it; +} + +// re-create the tree from a config file +void remoteMan::config2tree() { + // attempt to read the tree from krusader's config file + krConfig->setGroup("RemoteMan"); + TQStringList lst=krConfig->readListEntry("Connections"); + if (lst.count()<1) { // no such list in the config file - create the basics + // add the default groups + TQListViewItem *i; + i=new TQListViewItem(sessions,i18n("Sessions"),"GROUP!"); + // the GROUP text signifies a group (duh), the GROUP! signifies a group + // that the user cannot change + i->setPixmap(0,LOADICON("folder_open")); + sessions->setCurrentItem(i); +//# i=new TQListViewItem(sessions,i18n("Samba sessions (comming soon)"),"GROUP!"); +//# i->setPixmap(0,LOADICON("folder")); + return; + } + // if we got here, we have a connection entry in the config file + // let's work on it... + TQStringList::Iterator it; + TQListViewItem *item=0; + for( it = lst.begin(); it != lst.end(); ++it ) { + TQString t=(*it); // easier to work with + // this part creates the path to the session + int loc=t.findRev('`'); + if (loc>-1) item=findItem(t.left(loc+1),0); + // at this point we have the complete path to the object + // let's keep only the item's name + t=t.mid(loc+1); + // now, we are left with only the session name itself + // so, we create it as a son of the active item + TQStringList newLst=krConfig->readListEntry(*it); // and fill in + bool group=(newLst[1]!="SESSION"); + TQListViewItem *newItem; + if (item==0) // if this item originating from the backplane + newItem=new TQListViewItem(sessions,t,group ? "GROUP" : "SESSION"); + else + newItem=new TQListViewItem(item,t,group ? "GROUP" : "SESSION"); + newItem->setPixmap(0,group ? LOADICON("folder") : LOADICON("kr_ftp_new")); // update a pixmap + newItem->setText(0,t); + // expand the item, if needed + ++it; if ((*it) == "expanded") newItem->setOpen(true); + for (int i=1; i<9; ++i) newItem->setText(i,newLst[i]);// the details + item=0; // clean up pointers + } +} + +// make a single pass on the tree and create a configuration file +void remoteMan::tree2config() { + // first, set the stage + krConfig->setGroup("RemoteMan"); + TQStringList lst; + TQListViewItemIterator it(sessions); + while (it.current()) { // while there are still items in the tree + TQString temp=item2connection((it.current())); + lst.append(temp); // write the connection into the "connection-index" + if (it.current()->isOpen()) + lst.append("expanded"); else lst.append("collapsed"); + TQStringList data; + for (int i=0; i<9; ++i) data.append((it.current())->text(i)); + // write the specific entry into the config file + krConfig->writeEntry(temp,data); + ++it; + } + // now we write the index + krConfig->writeEntry("Connections",lst); + krConfig->sync(); // force an immediate write to the disk +} + +void remoteMan::connection() { + // if clicked on a group... + TQListViewItem *i=sessions->currentItem(); + if (i->text(1)!="SESSION") { + i->setOpen(i->isOpen()); + return; + } + // build a url + if (anonymous->isChecked()) { + userName->setText(TQString()); + password->setText(TQString()); + } else { + userName->setText(userName->text().simplifyWhiteSpace()); + password->setText(password->text().simplifyWhiteSpace()); + } + hostName->setText(hostName->text().simplifyWhiteSpace().lower()); + if (hostName->text().left(6)=="ftp://" || hostName->text().left(6)=="smb://") + hostName->setText(hostName->text().mid(6)); + remoteDir->setText(remoteDir->text().simplifyWhiteSpace()); + if ( !remoteDir->text().isEmpty() && remoteDir->text().left(1)!="/") + remoteDir->setText("/"+remoteDir->text()); + + TQString port=""; + if (protocol->currentText()=="ftp://" && portNum->value()!=21 ) + port=":"+portNum->cleanText(); + + url=protocol->currentText(); + + if( !userName->text().isEmpty() ){ + url = url+userName->text(); + if( !password->text().isEmpty() ); + url = url+":"+password->text(); + url = url+"@"; + } + url=url+ hostName->text()+port+remoteDir->text(); + + // now, let's close cleanly + refreshData(); // make sure all is updated + tree2config(); // write the sessions to a configuration file + remoteManBase::accept(); // tidy up +} + +// remove a connection or a group of connections +void remoteMan::removeSession() { + + TQListViewItem *it=sessions->currentItem(); + if (!it) return; // don't do anything if no item is selected + switch( TQMessageBox::warning( this, i18n("RemoteMan"), + i18n("Are you sure you want to delete this item ???"), + TQMessageBox::Yes, + TQMessageBox::No | TQMessageBox::Default | TQMessageBox::Escape)) { + case TQMessageBox::No : return; + } + // since we're here, the user must have pressed YES, let's delete + delete it; + sessions->triggerUpdate(); +} + +// what we do when the user clicked the close button +void remoteMan::accept() { + refreshData(); // make sure all is updated + tree2config(); // write the sessions to a configuration file + url=TQString(); // this signals getHost() we didn't click CONNECT + remoteManBase::accept(); // tidy up +} + +void remoteMan::reject() { + refreshData(); // make sure all is updated + tree2config(); // write the sessions to a configuration file + url=TQString(); // this signals getHost() we didn't click CONNECT + remoteManBase::reject(); +} + +#include "remoteman.moc" diff --git a/src/app/RemoteMan/remoteman.h b/src/app/RemoteMan/remoteman.h new file mode 100644 index 0000000..795d597 --- /dev/null +++ b/src/app/RemoteMan/remoteman.h @@ -0,0 +1,71 @@ +/*************************************************************************** + remoteman.h + ------------------- + begin : Thu May 4 2000 + copyright : (C) 2000 by Shie Erlich & Rafi Yanai + e-mail : krusader@users.sourceforge.net + web site : http://krusader.sourceforge.net + --------------------------------------------------------------------------- + Description + *************************************************************************** + + A + + db dD d8888b. db db .d8888. .d8b. d8888b. d88888b d8888b. + 88 ,8P' 88 `8D 88 88 88' YP d8' `8b 88 `8D 88' 88 `8D + 88,8P 88oobY' 88 88 `8bo. 88ooo88 88 88 88ooooo 88oobY' + 88`8b 88`8b 88 88 `Y8b. 88~~~88 88 88 88~~~~~ 88`8b + 88 `88. 88 `88. 88b d88 db 8D 88 88 88 .8D 88. 88 `88. + YP YD 88 YD ~Y8888P' `8888Y' YP YP Y8888D' Y88888P 88 YD + + H e a d e r F i l e + + *************************************************************************** + * * + * 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 REMOTEMAN_H +#define REMOTEMAN_H + +#include "remotemanbase.h" +#include <tqlistview.h> + +class remoteMan : public remoteManBase { + TQ_OBJECT + +public: + remoteMan(); + static TQString getHost(); // we call remoteMan mainly with this function + +protected: + void config2tree(); // internal + void tree2config(); // internal + TQListViewItem *findItem(const TQString &name, TQListViewItem *p); + +public slots: + void addGroup(); + void refreshData() ; // called whenver the current session changes + void updateName(const TQString&); // update the session/group name in real-time + void updateConnect(const TQString&); // enable/disable the connect button in real-time + void addSession(); + void connection(); + void removeSession(); + void expandDecos(TQListViewItem*); + void collapseDecos(TQListViewItem*); + +protected slots: + void accept(); + void reject(); + +private: + TQListViewItem *currentItem; + static TQString url; +}; + +#endif diff --git a/src/app/RemoteMan/remotemanbase.cpp b/src/app/RemoteMan/remotemanbase.cpp new file mode 100644 index 0000000..a48f9dc --- /dev/null +++ b/src/app/RemoteMan/remotemanbase.cpp @@ -0,0 +1,331 @@ +/**************************************************************************** +** Form implementation generated from reading ui file 'remotemanbase.ui' +** +** Created: Thu Jun 7 16:24:11 2001 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "remotemanbase.h" + +#include <tdelocale.h> +#include <tqcheckbox.h> +#include <tqcombobox.h> +#include <tqheader.h> +#include <tqlabel.h> +#include <tqlineedit.h> +#include <tqlistview.h> +#include <tqmultilineedit.h> +#include <tqpushbutton.h> +#include <tqspinbox.h> +#include <tqlayout.h> +#include <tqvariant.h> +#include <tqtooltip.h> +#include <tqwhatsthis.h> +#include <kprotocolinfo.h> + + +/* + * Constructs a remoteManBase which is a child of 'parent', with the + * name 'name' and widget flags set to 'f' + * + * The dialog will by default be modeless, unless you set 'modal' to + * true to construct a modal dialog. + */ +remoteManBase::remoteManBase( TQWidget* parent, const char* name, bool modal, WFlags fl ) + : TQDialog( parent, name, modal, fl ) +{ + if ( !name ) + setName( "remoteManBase" ); + resize( 670, 502 ); + setCaption( i18n( "RemoteMan: Connection Manager" ) ); + setSizeGripEnabled( true ); + remoteManBaseLayout = new TQGridLayout( this ); + remoteManBaseLayout->setSpacing( 6 ); + remoteManBaseLayout->setMargin( 11 ); + + Layout23 = new TQVBoxLayout; + Layout23->setSpacing( 6 ); + Layout23->setMargin( 0 ); + + TextLabel1 = new TQLabel( this, "TextLabel1" ); + TextLabel1->setText( i18n( "Session name:" ) ); + Layout23->addWidget( TextLabel1 ); + + sessionName = new TQLineEdit( this, "sessionName" ); + Layout23->addWidget( sessionName ); + + remoteManBaseLayout->addLayout( Layout23, 0, 1 ); + + Layout12 = new TQHBoxLayout; + Layout12->setSpacing( 6 ); + Layout12->setMargin( 0 ); + TQSpacerItem* spacer = new TQSpacerItem( 20, 20, TQSizePolicy::Expanding, TQSizePolicy::Minimum ); + Layout12->addItem( spacer ); + + moreBtn = new TQPushButton( this, "moreBtn" ); + moreBtn->setText( i18n( "&More" ) ); + moreBtn->setAutoDefault( false ); + moreBtn->setDefault( false ); + Layout12->addWidget( moreBtn ); + + closeBtn = new TQPushButton( this, "closeBtn" ); + closeBtn->setText( i18n( "&Close" ) ); + closeBtn->setAutoDefault( false ); + closeBtn->setDefault( false ); + Layout12->addWidget( closeBtn ); + + remoteManBaseLayout->addMultiCellLayout( Layout12, 7, 7, 0, 1 ); + + sessions = new TQListView( this, "sessions" ); + sessions->addColumn( i18n( "Sessions" ) ); + sessions->header()->setClickEnabled( false, sessions->header()->count() - 1 ); + sessions->header()->setResizeEnabled( false, sessions->header()->count() - 1 ); + sessions->setMinimumSize( TQSize( 300, 400 ) ); + sessions->setVScrollBarMode( TQListView::AlwaysOn ); + sessions->setHScrollBarMode( TQListView::Auto ); + sessions->setRootIsDecorated( true ); + + remoteManBaseLayout->addMultiCellWidget( sessions, 0, 6, 0, 0 ); + + Layout9 = new TQVBoxLayout; + Layout9->setSpacing( 6 ); + Layout9->setMargin( 0 ); + + Layout10 = new TQGridLayout; + Layout10->setSpacing( 6 ); + Layout10->setMargin( 0 ); + + TextLabel1_3_3 = new TQLabel( this, "TextLabel1_3_3" ); + TextLabel1_3_3->setText( i18n( "Password:" ) ); + + Layout10->addWidget( TextLabel1_3_3, 0, 1 ); + + password = new TQLineEdit( this, "password" ); + + Layout10->addWidget( password, 1, 1 ); + + TextLabel1_3 = new TQLabel( this, "TextLabel1_3" ); + TextLabel1_3->setText( i18n( "User name:" ) ); + + Layout10->addWidget( TextLabel1_3, 0, 0 ); + + userName = new TQLineEdit( this, "userName" ); + + Layout10->addWidget( userName, 1, 0 ); + Layout9->addLayout( Layout10 ); + + anonymous = new TQCheckBox( this, "anonymous" ); + anonymous->setText( i18n( "Anonymous" ) ); + Layout9->addWidget( anonymous ); + + remoteManBaseLayout->addLayout( Layout9, 2, 1 ); + + Layout26 = new TQVBoxLayout; + Layout26->setSpacing( 6 ); + Layout26->setMargin( 0 ); + + TextLabel1_3_2 = new TQLabel( this, "TextLabel1_3_2" ); + TextLabel1_3_2->setText( i18n( "Remote directory:" ) ); + Layout26->addWidget( TextLabel1_3_2 ); + + remoteDir = new TQLineEdit( this, "remoteDir" ); + Layout26->addWidget( remoteDir ); + + remoteManBaseLayout->addLayout( Layout26, 4, 1 ); + + Layout27 = new TQVBoxLayout; + Layout27->setSpacing( 6 ); + Layout27->setMargin( 0 ); + + TextLabel1_3_2_2 = new TQLabel( this, "TextLabel1_3_2_2" ); + TextLabel1_3_2_2->setText( i18n( "Description:" ) ); + Layout27->addWidget( TextLabel1_3_2_2 ); + + description = new TQMultiLineEdit( this, "description" ); + Layout27->addWidget( description ); + + remoteManBaseLayout->addLayout( Layout27, 5, 1 ); + + layout = new TQGridLayout; + layout->setSpacing( 6 ); + layout->setMargin( 0 ); + + removeBtn = new TQPushButton( this, "removeBtn" ); + removeBtn->setText( i18n( "&Remove" ) ); + removeBtn->setAutoDefault( false ); + removeBtn->setDefault( false ); + + layout->addWidget( removeBtn, 0, 2 ); + + connectBtn = new TQPushButton( this, "connectBtn" ); + connectBtn->setText( i18n( "Co&nnect" ) ); + connectBtn->setAutoDefault( false ); + connectBtn->setDefault( false ); + + layout->addMultiCellWidget( connectBtn, 1, 1, 0, 2 ); + + newGroupBtn = new TQPushButton( this, "newGroupBtn" ); + newGroupBtn->setEnabled( true ); + newGroupBtn->setText( i18n( "New &Group" ) ); + newGroupBtn->setAutoDefault( false ); + newGroupBtn->setDefault( false ); + newGroupBtn->setFlat( false ); + + layout->addWidget( newGroupBtn, 0, 0 ); + + addBtn = new TQPushButton( this, "addBtn" ); + addBtn->setEnabled( true ); + addBtn->setText( i18n( "New Connec&tion" ) ); + addBtn->setAutoDefault( false ); + addBtn->setDefault( false ); + addBtn->setFlat( false ); + + layout->addWidget( addBtn, 0, 1 ); + + remoteManBaseLayout->addLayout( layout, 6, 1 ); + + Layout11 = new TQGridLayout; + Layout11->setSpacing( 6 ); + Layout11->setMargin( 0 ); + + TextLabel1_2 = new TQLabel( this, "TextLabel1_2" ); + TextLabel1_2->setText( i18n( "Host:" ) ); + + Layout11->addMultiCellWidget( TextLabel1_2, 0, 0, 0, 1 ); + + TQStringList protocols = KProtocolInfo::protocols(); + + protocol = new TQComboBox( false, this, "protocol" ); + if( protocols.contains("ftp") ) + protocol->insertItem( i18n( "ftp://" ) ); + if( protocols.contains("smb") ) + protocol->insertItem( i18n( "smb://" ) ); + if( protocols.contains("fish") ) + protocol->insertItem( i18n( "fish://" )); + if( protocols.contains("sftp") ) + protocol->insertItem( i18n( "sftp://" )); + protocol->setSizePolicy( TQSizePolicy( (TQSizePolicy::SizeType)1, (TQSizePolicy::SizeType)0, protocol->sizePolicy().hasHeightForWidth() ) ); + + Layout11->addWidget( protocol, 1, 0 ); + + hostName = new TQLineEdit( this, "hostName" ); + hostName->setSizePolicy( TQSizePolicy( (TQSizePolicy::SizeType)7, (TQSizePolicy::SizeType)0, hostName->sizePolicy().hasHeightForWidth() ) ); + hostName->setMinimumSize( TQSize( 0, 0 ) ); + + Layout11->addWidget( hostName, 1, 1 ); + + portNum = new TQSpinBox( this, "portNum" ); + portNum->setMaxValue( 99999 ); + portNum->setValue( 21 ); + + Layout11->addWidget( portNum, 1, 2 ); + + TextLabel1_2_2 = new TQLabel( this, "TextLabel1_2_2" ); + TextLabel1_2_2->setText( i18n( "Port: " ) ); + + Layout11->addWidget( TextLabel1_2_2, 0, 2 ); + + remoteManBaseLayout->addLayout( Layout11, 1, 1 ); + + TextLabel1_4 = new TQLabel( this, "TextLabel1_4" ); + TQFont TextLabel1_4_font( TextLabel1_4->font() ); + TextLabel1_4_font.setPointSize( 10 ); + TextLabel1_4->setFont( TextLabel1_4_font ); + TextLabel1_4->setText( i18n( "* Warning: Storing your password is not secure !!!" ) ); + TextLabel1_4->setAlignment( int( TQLabel::AlignVCenter | TQLabel::AlignRight ) ); + + remoteManBaseLayout->addWidget( TextLabel1_4, 3, 1 ); + + // signals and slots connections + connect( closeBtn, TQ_SIGNAL( clicked() ), this, TQ_SLOT( accept() ) ); + connect( addBtn, TQ_SIGNAL( clicked() ), this, TQ_SLOT( addSession() ) ); + connect( removeBtn, TQ_SIGNAL( clicked() ), this, TQ_SLOT( removeSession() ) ); + connect( sessions, TQ_SIGNAL( selectionChanged(TQListViewItem*) ), this, TQ_SLOT( refreshData() ) ); + connect( sessions, TQ_SIGNAL( selectionChanged() ), this, TQ_SLOT( refreshData() ) ); + connect( sessions, TQ_SIGNAL( expanded(TQListViewItem*) ), this, TQ_SLOT( refreshData() ) ); + connect( sessions, TQ_SIGNAL( currentChanged(TQListViewItem*) ), this, TQ_SLOT( refreshData() ) ); + connect( sessions, TQ_SIGNAL( mouseButtonClicked(int,TQListViewItem*,const +TQPoint&,int) ), this, TQ_SLOT( refreshData() ) ); + connect( sessions, TQ_SIGNAL( collapsed(TQListViewItem*) ), this, TQ_SLOT( refreshData() ) ); + connect( connectBtn, TQ_SIGNAL( clicked() ), this, TQ_SLOT( connection() ) ); + connect( sessionName, TQ_SIGNAL( textChanged(const TQString&) ), this, TQ_SLOT( updateName(const TQString&) ) ); + connect( newGroupBtn, TQ_SIGNAL( clicked() ), this, TQ_SLOT( addGroup() ) ); + connect( anonymous, TQ_SIGNAL( clicked() ), this, TQ_SLOT( refreshData() ) ); + connect( protocol, TQ_SIGNAL(activated(int)), this, TQ_SLOT(refreshData())); + + // tab order + setTabOrder( sessionName, hostName ); + setTabOrder( hostName, userName ); + setTabOrder( userName, password ); + setTabOrder( password, remoteDir ); + setTabOrder( remoteDir, description ); + setTabOrder( description, connectBtn ); + setTabOrder( connectBtn, addBtn ); + setTabOrder( addBtn, newGroupBtn ); + setTabOrder( newGroupBtn, removeBtn ); + setTabOrder( removeBtn, moreBtn ); + setTabOrder( moreBtn, closeBtn ); + setTabOrder( closeBtn, sessions ); + setTabOrder( sessions, portNum ); +} + +/* + * Destroys the object and frees any allocated resources + */ +remoteManBase::~remoteManBase() +{ + // no need to delete child widgets, TQt does it all for us +} + +/* + * Main event handler. Reimplemented to handle application + * font changes + */ +bool remoteManBase::event( TQEvent* ev ) +{ + bool ret = TQDialog::event( ev ); + if ( ev->type() == TQEvent::ApplicationFontChange ) { + TQFont TextLabel1_4_font( TextLabel1_4->font() ); + TextLabel1_4_font.setPointSize( 10 ); + TextLabel1_4->setFont( TextLabel1_4_font ); + } + return ret; +} + +void remoteManBase::addSession() +{ + tqWarning( "remoteManBase::addSession(): Not implemented yet!" ); +} + +void remoteManBase::connection() +{ + tqWarning( "remoteManBase::connection(): Not implemented yet!" ); +} + +void remoteManBase::moreInfo() +{ + tqWarning( "remoteManBase::moreInfo(): Not implemented yet!" ); +} + +void remoteManBase::addGroup() +{ + tqWarning( "remoteManBase::addGroup(): Not implemented yet!" ); +} + +void remoteManBase::refreshData() +{ + tqWarning( "remoteManBase::refreshData(): Not implemented yet!" ); +} + +void remoteManBase::removeSession() +{ + tqWarning( "remoteManBase::removeSession(): Not implemented yet!" ); +} + +void remoteManBase::updateName(const TQString&) +{ + tqWarning( "remoteManBase::updateName(const TQString&): Not implemented yet!" ); +} + +#include "remotemanbase.moc" diff --git a/src/app/RemoteMan/remotemanbase.h b/src/app/RemoteMan/remotemanbase.h new file mode 100644 index 0000000..b9c9f67 --- /dev/null +++ b/src/app/RemoteMan/remotemanbase.h @@ -0,0 +1,83 @@ +/**************************************************************************** +** Form interface generated from reading ui file 'remotemanbase.ui' +** +** Created: Thu Jun 7 16:23:59 2001 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#ifndef REMOTEMANBASE_H +#define REMOTEMANBASE_H + +#include <tqvariant.h> +#include <tqdialog.h> +class TQVBoxLayout; +class TQHBoxLayout; +class TQGridLayout; +class TQCheckBox; +class TQComboBox; +class TQLabel; +class TQLineEdit; +class TQListView; +class TQListViewItem; +class TQMultiLineEdit; +class TQPushButton; +class TQSpinBox; + +class remoteManBase : public TQDialog +{ + TQ_OBJECT + + +public: + remoteManBase( TQWidget* parent = 0, const char* name = 0, bool modal = false, WFlags fl = 0 ); + ~remoteManBase(); + + TQLabel* TextLabel1; + TQLineEdit* sessionName; + TQPushButton* moreBtn; + TQPushButton* closeBtn; + TQListView* sessions; + TQLabel* TextLabel1_3_3; + TQLineEdit* password; + TQLabel* TextLabel1_3; + TQLineEdit* userName; + TQCheckBox* anonymous; + TQLabel* TextLabel1_3_2; + TQLineEdit* remoteDir; + TQLabel* TextLabel1_3_2_2; + TQMultiLineEdit* description; + TQPushButton* removeBtn; + TQPushButton* connectBtn; + TQPushButton* newGroupBtn; + TQPushButton* addBtn; + TQLabel* TextLabel1_2; + TQComboBox* protocol; + TQLineEdit* hostName; + TQSpinBox* portNum; + TQLabel* TextLabel1_2_2; + TQLabel* TextLabel1_4; + +public slots: + virtual void addSession(); + virtual void connection(); + virtual void moreInfo(); + virtual void addGroup(); + virtual void refreshData(); + virtual void removeSession(); + virtual void updateName(const TQString&); + +protected: + TQGridLayout* remoteManBaseLayout; + TQVBoxLayout* Layout23; + TQHBoxLayout* Layout12; + TQVBoxLayout* Layout9; + TQGridLayout* Layout10; + TQVBoxLayout* Layout26; + TQVBoxLayout* Layout27; + TQGridLayout* layout; + TQGridLayout* Layout11; + bool event( TQEvent* ); +}; + +#endif // REMOTEMANBASE_H |