|
|
|
@ -64,15 +64,15 @@ Smb4KSystemTray::Smb4KSystemTray( TQWidget *parent, const char *name )
|
|
|
|
|
actionCollection()->setHighlightingEnabled( true );
|
|
|
|
|
|
|
|
|
|
// Set up the context menu (skeleton):
|
|
|
|
|
m_shares_menu = new KActionMenu( i18n( "Mounted Shares" ), "hdd_mount",
|
|
|
|
|
m_shares_menu = new TDEActionMenu( i18n( "Mounted Shares" ), "hdd_mount",
|
|
|
|
|
actionCollection(), "st_mounted_shares_action_menu" );
|
|
|
|
|
m_bookmarks_menu = new KActionMenu( i18n( "Bookmarks" ), "bookmark_folder",
|
|
|
|
|
m_bookmarks_menu = new TDEActionMenu( i18n( "Bookmarks" ), "bookmark_folder",
|
|
|
|
|
actionCollection(), "st_bookmark_action_menu" );
|
|
|
|
|
KActionSeparator *sep = new KActionSeparator( TQT_TQOBJECT(this) );
|
|
|
|
|
KAction *manual_mount = new KAction( i18n( "M&ount Manually" ), "connect_creating",
|
|
|
|
|
TDEActionSeparator *sep = new TDEActionSeparator( TQT_TQOBJECT(this) );
|
|
|
|
|
TDEAction *manual_mount = new TDEAction( i18n( "M&ount Manually" ), "connect_creating",
|
|
|
|
|
0, TQT_TQOBJECT(this), TQT_SLOT( slotMountManually() ),
|
|
|
|
|
actionCollection(), "st_mount_manually_action" );
|
|
|
|
|
KAction *configure = KStdAction::preferences( TQT_TQOBJECT(this), TQT_SLOT( slotConfigDialog() ),
|
|
|
|
|
TDEAction *configure = KStdAction::preferences( TQT_TQOBJECT(this), TQT_SLOT( slotConfigDialog() ),
|
|
|
|
|
actionCollection(), "st_configure_action" );
|
|
|
|
|
|
|
|
|
|
m_shares_menu->plug( contextMenu() );
|
|
|
|
@ -86,8 +86,8 @@ Smb4KSystemTray::Smb4KSystemTray( TQWidget *parent, const char *name )
|
|
|
|
|
slotSetupSharesMenu();
|
|
|
|
|
|
|
|
|
|
// Connections:
|
|
|
|
|
connect( actionCollection(), TQT_SIGNAL( actionHighlighted( KAction * ) ),
|
|
|
|
|
this, TQT_SLOT( slotActionHighlighted( KAction * ) ) );
|
|
|
|
|
connect( actionCollection(), TQT_SIGNAL( actionHighlighted( TDEAction * ) ),
|
|
|
|
|
this, TQT_SLOT( slotActionHighlighted( TDEAction * ) ) );
|
|
|
|
|
|
|
|
|
|
connect( Smb4KCore::bookmarkHandler(), TQT_SIGNAL( bookmarksUpdated() ),
|
|
|
|
|
this, TQT_SLOT( slotSetupBookmarksMenu() ) );
|
|
|
|
@ -233,13 +233,13 @@ void Smb4KSystemTray::slotSetupBookmarksMenu()
|
|
|
|
|
if ( !actionCollection()->action( "st_edit_bookmarks_action" ) )
|
|
|
|
|
{
|
|
|
|
|
// OK, build the menu from ground up:
|
|
|
|
|
KAction *edit_bookmarks = new KAction( i18n( "&Edit Bookmarks" ), "bookmark", 0,
|
|
|
|
|
TDEAction *edit_bookmarks = new TDEAction( i18n( "&Edit Bookmarks" ), "bookmark", 0,
|
|
|
|
|
TQT_TQOBJECT(this), TQT_SLOT( slotBookmarkEditor() ), actionCollection(),
|
|
|
|
|
"st_edit_bookmarks_action" );
|
|
|
|
|
edit_bookmarks->setGroup( "BookmarkActions" );
|
|
|
|
|
edit_bookmarks->plug( m_bookmarks_menu->popupMenu() );
|
|
|
|
|
|
|
|
|
|
KActionSeparator *sep = new KActionSeparator( actionCollection(), "st_bookmark_action_separator" );
|
|
|
|
|
TDEActionSeparator *sep = new TDEActionSeparator( actionCollection(), "st_bookmark_action_separator" );
|
|
|
|
|
sep->setGroup( "BookmarkActions" );
|
|
|
|
|
sep->plug( m_bookmarks_menu->popupMenu() );
|
|
|
|
|
}
|
|
|
|
@ -247,9 +247,9 @@ void Smb4KSystemTray::slotSetupBookmarksMenu()
|
|
|
|
|
// Get the list of bookmark actions and delete all entries. We could
|
|
|
|
|
// also try to keep those actions that are not obsolete, but I think
|
|
|
|
|
// this is the cleanest way.
|
|
|
|
|
KActionPtrList list = actionCollection()->actions( "Bookmarks" );
|
|
|
|
|
TDEActionPtrList list = actionCollection()->actions( "Bookmarks" );
|
|
|
|
|
|
|
|
|
|
for ( KActionPtrList::Iterator it = list.begin(); it != list.end(); ++it )
|
|
|
|
|
for ( TDEActionPtrList::Iterator it = list.begin(); it != list.end(); ++it )
|
|
|
|
|
{
|
|
|
|
|
(*it)->unplug( m_bookmarks_menu->popupMenu() );
|
|
|
|
|
actionCollection()->remove( *it );
|
|
|
|
@ -289,7 +289,7 @@ void Smb4KSystemTray::slotSetupBookmarksMenu()
|
|
|
|
|
for ( TQStringList::ConstIterator it = display_strings.begin(); it != display_strings.end(); ++it )
|
|
|
|
|
{
|
|
|
|
|
// Create the bookmark action:
|
|
|
|
|
KAction *a = new KAction( *it, "folder", KShortcut::null(), 0, 0, actionCollection(), "st_"+*it );
|
|
|
|
|
TDEAction *a = new TDEAction( *it, "folder", TDEShortcut::null(), 0, 0, actionCollection(), "st_"+*it );
|
|
|
|
|
a->setGroup( "Bookmarks" );
|
|
|
|
|
connect( a, TQT_SIGNAL( activated() ), TQT_TQOBJECT(this), TQT_SLOT( slotBookmarkActivated() ) );
|
|
|
|
|
|
|
|
|
@ -396,10 +396,10 @@ void Smb4KSystemTray::slotBookmarkActivated()
|
|
|
|
|
void Smb4KSystemTray::slotEnableBookmarks()
|
|
|
|
|
{
|
|
|
|
|
// Get the list of bookmarks:
|
|
|
|
|
KActionPtrList list = actionCollection()->actions( "Bookmarks" );
|
|
|
|
|
TDEActionPtrList list = actionCollection()->actions( "Bookmarks" );
|
|
|
|
|
|
|
|
|
|
// Enable/diable the bookmark actions:
|
|
|
|
|
for ( KActionPtrList::Iterator it = list.begin(); it != list.end(); ++it )
|
|
|
|
|
for ( TDEActionPtrList::Iterator it = list.begin(); it != list.end(); ++it )
|
|
|
|
|
{
|
|
|
|
|
TQString name;
|
|
|
|
|
|
|
|
|
@ -443,13 +443,13 @@ void Smb4KSystemTray::slotSetupSharesMenu()
|
|
|
|
|
if ( !actionCollection()->action( "st_unmount_all_action" ) )
|
|
|
|
|
{
|
|
|
|
|
// OK, build the menu from ground up:
|
|
|
|
|
KAction *unmount_all = new KAction( i18n( "U&nmount All" ), "gear", KShortcut::null(),
|
|
|
|
|
TDEAction *unmount_all = new TDEAction( i18n( "U&nmount All" ), "gear", TDEShortcut::null(),
|
|
|
|
|
TQT_TQOBJECT(this), TQT_SLOT( slotUnmountAllShares() ), actionCollection(),
|
|
|
|
|
"st_unmount_all_action" );
|
|
|
|
|
unmount_all->setGroup( "ShareActions" );
|
|
|
|
|
unmount_all->plug( m_shares_menu->popupMenu(), 0 );
|
|
|
|
|
|
|
|
|
|
KActionSeparator *sep = new KActionSeparator( actionCollection(), "st_shares_action_separator" );
|
|
|
|
|
TDEActionSeparator *sep = new TDEActionSeparator( actionCollection(), "st_shares_action_separator" );
|
|
|
|
|
sep->setGroup( "ShareActions" );
|
|
|
|
|
sep->plug( m_shares_menu->popupMenu(), 1 );
|
|
|
|
|
}
|
|
|
|
@ -458,7 +458,7 @@ void Smb4KSystemTray::slotSetupSharesMenu()
|
|
|
|
|
// not delete all entries in the menu, but look for changes.
|
|
|
|
|
|
|
|
|
|
// Get the list of share actions:
|
|
|
|
|
KActionPtrList actions_list = actionCollection()->actions( "ShareMenus" );
|
|
|
|
|
TDEActionPtrList actions_list = actionCollection()->actions( "ShareMenus" );
|
|
|
|
|
|
|
|
|
|
// Get the list of mounted shares:
|
|
|
|
|
TQValueList<Smb4KShare *> shares_list = Smb4KCore::mounter()->getShares();
|
|
|
|
@ -469,7 +469,7 @@ void Smb4KSystemTray::slotSetupSharesMenu()
|
|
|
|
|
actionCollection()->action( "st_unmount_all_action" )->setEnabled( true );
|
|
|
|
|
|
|
|
|
|
// Delete all obsolete actions:
|
|
|
|
|
for ( KActionPtrList::Iterator it = actions_list.begin(); it != actions_list.end(); ++it )
|
|
|
|
|
for ( TDEActionPtrList::Iterator it = actions_list.begin(); it != actions_list.end(); ++it )
|
|
|
|
|
{
|
|
|
|
|
// Get the canonical path of the share action:
|
|
|
|
|
TQString action_name = (*it)->name();
|
|
|
|
@ -494,7 +494,7 @@ void Smb4KSystemTray::slotSetupSharesMenu()
|
|
|
|
|
{
|
|
|
|
|
// Find the "Force Unmount" action and decide if it needs to be
|
|
|
|
|
// enabled/disabled:
|
|
|
|
|
KAction *force = actionCollection()->action( "st_[force]_"+canonical_path );
|
|
|
|
|
TDEAction *force = actionCollection()->action( "st_[force]_"+canonical_path );
|
|
|
|
|
|
|
|
|
|
if ( force )
|
|
|
|
|
{
|
|
|
|
@ -506,8 +506,8 @@ void Smb4KSystemTray::slotSetupSharesMenu()
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
// First remove all actions that are in the submenu:
|
|
|
|
|
KAction *action = NULL;
|
|
|
|
|
KActionMenu *menu = static_cast<KActionMenu *>( *it );
|
|
|
|
|
TDEAction *action = NULL;
|
|
|
|
|
TDEActionMenu *menu = static_cast<TDEActionMenu *>( *it );
|
|
|
|
|
|
|
|
|
|
if ( menu )
|
|
|
|
|
{
|
|
|
|
@ -569,8 +569,8 @@ void Smb4KSystemTray::slotSetupSharesMenu()
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
// First remove all actions that are in the submenu:
|
|
|
|
|
KAction *action = NULL;
|
|
|
|
|
KActionMenu *menu = static_cast<KActionMenu *>( *it );
|
|
|
|
|
TDEAction *action = NULL;
|
|
|
|
|
TDEActionMenu *menu = static_cast<TDEActionMenu *>( *it );
|
|
|
|
|
|
|
|
|
|
if ( menu )
|
|
|
|
|
{
|
|
|
|
@ -632,8 +632,8 @@ void Smb4KSystemTray::slotSetupSharesMenu()
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
// First remove all actions that are in the submenu:
|
|
|
|
|
KAction *action = NULL;
|
|
|
|
|
KActionMenu *menu = static_cast<KActionMenu *>( *it );
|
|
|
|
|
TDEAction *action = NULL;
|
|
|
|
|
TDEActionMenu *menu = static_cast<TDEActionMenu *>( *it );
|
|
|
|
|
|
|
|
|
|
if ( menu )
|
|
|
|
|
{
|
|
|
|
@ -729,18 +729,18 @@ void Smb4KSystemTray::slotSetupSharesMenu()
|
|
|
|
|
// there:
|
|
|
|
|
for ( TQValueList<Smb4KShare *>::ConstIterator it = shares_list.begin(); it != shares_list.end(); ++it )
|
|
|
|
|
{
|
|
|
|
|
KActionMenu *action_menu = NULL;
|
|
|
|
|
TDEActionMenu *action_menu = NULL;
|
|
|
|
|
|
|
|
|
|
// Reread the list of share action menus:
|
|
|
|
|
KActionPtrList new_actions_list = actionCollection()->actions( "ShareMenus" );
|
|
|
|
|
TDEActionPtrList new_actions_list = actionCollection()->actions( "ShareMenus" );
|
|
|
|
|
|
|
|
|
|
for ( KActionPtrList::ConstIterator i = new_actions_list.begin(); i != new_actions_list.end(); ++i )
|
|
|
|
|
for ( TDEActionPtrList::ConstIterator i = new_actions_list.begin(); i != new_actions_list.end(); ++i )
|
|
|
|
|
{
|
|
|
|
|
TQString item = TQString( "st_[share_menu]_%1" ).arg( TQString((*it)->canonicalPath()) );
|
|
|
|
|
|
|
|
|
|
if ( TQString::compare( (*i)->name(), item ) == 0 )
|
|
|
|
|
{
|
|
|
|
|
action_menu = static_cast<KActionMenu *>( *i );
|
|
|
|
|
action_menu = static_cast<TDEActionMenu *>( *i );
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
@ -752,7 +752,7 @@ void Smb4KSystemTray::slotSetupSharesMenu()
|
|
|
|
|
|
|
|
|
|
if ( !action_menu )
|
|
|
|
|
{
|
|
|
|
|
// Create a new KAction menu:
|
|
|
|
|
// Create a new TDEAction menu:
|
|
|
|
|
TQIconSet set;
|
|
|
|
|
TQPixmap pix;
|
|
|
|
|
KIconLoader loader;
|
|
|
|
@ -780,33 +780,33 @@ void Smb4KSystemTray::slotSetupSharesMenu()
|
|
|
|
|
|
|
|
|
|
set.reset( pix, TQIconSet::Automatic );
|
|
|
|
|
|
|
|
|
|
action_menu = new KActionMenu( Smb4KSettings::showMountPoint() ? (*it)->path() : (*it)->name(),
|
|
|
|
|
action_menu = new TDEActionMenu( Smb4KSettings::showMountPoint() ? (*it)->path() : (*it)->name(),
|
|
|
|
|
set, actionCollection(), "st_[share_menu]_"+(*it)->canonicalPath() );
|
|
|
|
|
action_menu->setGroup( "ShareMenus" );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Define the actions that can be performed on a share from within
|
|
|
|
|
// the system tray widget:
|
|
|
|
|
KAction *umount = new KAction( i18n( "&Unmount" ), "hdd_unmount", KShortcut::null(), TQT_TQOBJECT(this),
|
|
|
|
|
TDEAction *umount = new TDEAction( i18n( "&Unmount" ), "hdd_unmount", TDEShortcut::null(), TQT_TQOBJECT(this),
|
|
|
|
|
TQT_SLOT( slotUnmountShare() ), actionCollection(), "st_[unmount]_"+(*it)->canonicalPath() );
|
|
|
|
|
umount->setGroup( "ShareActions" );
|
|
|
|
|
#ifdef __linux__
|
|
|
|
|
KAction *force_umount = new KAction( i18n( "&Force Unmounting" ), "hdd_unmount", KShortcut::null(), TQT_TQOBJECT(this),
|
|
|
|
|
TDEAction *force_umount = new TDEAction( i18n( "&Force Unmounting" ), "hdd_unmount", TDEShortcut::null(), TQT_TQOBJECT(this),
|
|
|
|
|
TQT_SLOT( slotForceUnmountShare() ), actionCollection(), "st_[force]_"+(*it)->canonicalPath() );
|
|
|
|
|
force_umount->setGroup( "ShareActions" );
|
|
|
|
|
force_umount->setEnabled( Smb4KSettings::useForceUnmount() );
|
|
|
|
|
#endif
|
|
|
|
|
KAction *synchronize = new KAction( i18n( "S&ynchronize" ), "bottom", KShortcut::null(), TQT_TQOBJECT(this),
|
|
|
|
|
TDEAction *synchronize = new TDEAction( i18n( "S&ynchronize" ), "bottom", TDEShortcut::null(), TQT_TQOBJECT(this),
|
|
|
|
|
TQT_SLOT( slotSynchronize() ), actionCollection(), "st_[synchronize]_"+(*it)->canonicalPath() );
|
|
|
|
|
synchronize->setGroup( "ShareActions" );
|
|
|
|
|
synchronize->setEnabled( !Smb4KSettings::rsync().isEmpty() );
|
|
|
|
|
|
|
|
|
|
KAction *konsole = new KAction( i18n( "Open with Konso&le" ), "terminal", KShortcut::null(), TQT_TQOBJECT(this),
|
|
|
|
|
TDEAction *konsole = new TDEAction( i18n( "Open with Konso&le" ), "terminal", TDEShortcut::null(), TQT_TQOBJECT(this),
|
|
|
|
|
TQT_SLOT( slotKonsole() ), actionCollection(), "st_[konsole]_"+(*it)->canonicalPath() );
|
|
|
|
|
konsole->setGroup( "ShareActions" );
|
|
|
|
|
konsole->setEnabled( !Smb4KSettings::konsole().isEmpty() );
|
|
|
|
|
|
|
|
|
|
KAction *konqueror = new KAction( i18n( "Open with &Konqueror" ), "kfm_home", KShortcut::null(), TQT_TQOBJECT(this),
|
|
|
|
|
TDEAction *konqueror = new TDEAction( i18n( "Open with &Konqueror" ), "kfm_home", TDEShortcut::null(), TQT_TQOBJECT(this),
|
|
|
|
|
TQT_SLOT( slotFilemanager() ), actionCollection(), "st_[filemanager]_"+(*it)->canonicalPath() );
|
|
|
|
|
konqueror->setGroup( "ShareActions" );
|
|
|
|
|
|
|
|
|
@ -892,16 +892,16 @@ void Smb4KSystemTray::slotSetupSharesMenu()
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
// Remove all share action menus:
|
|
|
|
|
for ( KActionPtrList::Iterator it = actions_list.begin(); it != actions_list.end(); ++it )
|
|
|
|
|
for ( TDEActionPtrList::Iterator it = actions_list.begin(); it != actions_list.end(); ++it )
|
|
|
|
|
{
|
|
|
|
|
KActionMenu *action_menu = static_cast<KActionMenu *>( *it );
|
|
|
|
|
TDEActionMenu *action_menu = static_cast<TDEActionMenu *>( *it );
|
|
|
|
|
|
|
|
|
|
// Get the canonical path of the share action:
|
|
|
|
|
TQString action_name = action_menu->name();
|
|
|
|
|
TQString canonical_path = action_name.section( "st_[share_menu]_", 1, -1 );
|
|
|
|
|
|
|
|
|
|
// Remove all children of the share action menus:
|
|
|
|
|
KAction *action = NULL;
|
|
|
|
|
TDEAction *action = NULL;
|
|
|
|
|
|
|
|
|
|
// Unmount action
|
|
|
|
|
action = actionCollection()->action( "st_[unmount]_"+canonical_path );
|
|
|
|
@ -1060,7 +1060,7 @@ void Smb4KSystemTray::slotFilemanager()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void Smb4KSystemTray::slotActionHighlighted( KAction *action )
|
|
|
|
|
void Smb4KSystemTray::slotActionHighlighted( TDEAction *action )
|
|
|
|
|
{
|
|
|
|
|
// If the main window is not shown, the last action that
|
|
|
|
|
// is highlighted when the user clicks an action in a
|
|
|
|
|